From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 8F36F42EF5C for ; Fri, 19 Jun 2020 01:15:11 +0300 (MSK) References: From: Vladislav Shpilevoy Message-ID: <45e563d5-9f23-581d-2453-a5b5b06abf22@tarantool.org> Date: Fri, 19 Jun 2020 00:15:10 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org Thanks for the patch! 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