From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1245B4429E1 for ; Fri, 19 Jun 2020 20:28:33 +0300 (MSK) References: <45e563d5-9f23-581d-2453-a5b5b06abf22@tarantool.org> From: Serge Petrenko Message-ID: <19c81031-454c-b8a0-0434-e311d604677b@tarantool.org> Date: Fri, 19 Jun 2020 20:28:32 +0300 MIME-Version: 1.0 In-Reply-To: <45e563d5-9f23-581d-2453-a5b5b06abf22@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [Tarantool-patches] [PATCH 1/4] xrow: fix comment typo List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org 19.06.2020 01:15, Vladislav Shpilevoy пишет: > Thanks for the patch! Hi! Thanks for the review! > > Consider these changes (you maybe should keep the old names, > mine are probably worse): > > ==================== > diff --git a/src/box/xrow.c b/src/box/xrow.c > index 7a79a18dd..5055cba46 100644 > --- a/src/box/xrow.c > +++ b/src/box/xrow.c > @@ -879,8 +879,8 @@ xrow_encode_dml(const struct request *request, struct region *region, > } > > int > -xrow_encode_confirm_rollback(struct xrow_header *row, uint32_t replica_id, > - int64_t lsn) > +xrow_encode_synchro_finish(struct xrow_header *row, uint32_t replica_id, > + int64_t lsn, int type) > { > size_t len = mp_sizeof_map(2) + mp_sizeof_uint(IPROTO_REPLICA_ID) + > mp_sizeof_uint(replica_id) + mp_sizeof_uint(IPROTO_LSN) + > @@ -903,6 +903,7 @@ xrow_encode_confirm_rollback(struct xrow_header *row, uint32_t replica_id, > row->body[0].iov_base = buf; > row->body[0].iov_len = len; > row->bodycnt = 1; > + row->type = type; > > return 0; > } > @@ -910,26 +911,19 @@ xrow_encode_confirm_rollback(struct xrow_header *row, uint32_t replica_id, > int > xrow_encode_confirm(struct xrow_header *row, uint32_t replica_id, int64_t lsn) > { > - int res = xrow_encode_confirm_rollback(row, replica_id, lsn); > - if (res == 0) { > - row->type = IPROTO_CONFIRM; > - } > - return res; > + return xrow_encode_synchro_finish(row, replica_id, lsn, IPROTO_CONFIRM); > } > > int > xrow_encode_rollback(struct xrow_header *row, uint32_t replica_id, int64_t lsn) > { > - int res = xrow_encode_confirm_rollback(row, replica_id, lsn); > - if (res == 0) { > - row->type = IPROTO_ROLLBACK; > - } > - return res; > + return xrow_encode_synchro_finish(row, replica_id, lsn, > + IPROTO_ROLLBACK); > } > > int > -xrow_decode_confirm_rollback(struct xrow_header *row, uint32_t *replica_id, > - int64_t *lsn) > +xrow_decode_synchro_finish(struct xrow_header *row, uint32_t *replica_id, > + int64_t *lsn) > { > if (row->bodycnt == 0) { > diag_set(ClientError, ER_INVALID_MSGPACK, "request body"); > @@ -976,14 +970,17 @@ xrow_decode_confirm_rollback(struct xrow_header *row, uint32_t *replica_id, > return 0; > } > > -int xrow_decode_confirm(struct xrow_header *row, uint32_t *replica_id, int64_t *lsn) > +int > +xrow_decode_confirm(struct xrow_header *row, uint32_t *replica_id, int64_t *lsn) > { > - return xrow_decode_confirm_rollback(row, replica_id, lsn); > + return xrow_decode_synchro_finish(row, replica_id, lsn); > } > > -int xrow_decode_rollback(struct xrow_header *row, uint32_t *replica_id, int64_t *lsn) > +int > +xrow_decode_rollback(struct xrow_header *row, uint32_t *replica_id, > + int64_t *lsn) > { > - return xrow_decode_confirm_rollback(row, replica_id, lsn); > + return xrow_decode_synchro_finish(row, replica_id, lsn); > } > > int I applied your diff while keeping the old names and squashed the commit into the one introducing CONFIRM entry. (This answer is both for patches 1 and 2, since you answered here) -- Serge Petrenko