From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (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 E420D43040F for ; Wed, 26 Aug 2020 10:52:59 +0300 (MSK) From: Serge Petrenko Date: Wed, 26 Aug 2020 10:52:36 +0300 Message-Id: <4fb599846ea343540312cd833f4dfe2d00771eb2.1598427905.git.sergepetrenko@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [RAFT 04/10] [tosquash] raft: introduce IPROTO_RAFT_VCLOCK List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, gorcunov@gmail.com, sergos@tarantool.org Cc: tarantool-patches@dev.tarantool.org From: Vladislav Shpilevoy IPROTO_RAFT keys are stored in their own isolated dictionary, so no need to reuse other keys. Better implement the raft's own keyset with IPROTO_RAFT_* keys. --- src/box/iproto_constants.h | 1 + src/box/xrow.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/box/iproto_constants.h b/src/box/iproto_constants.h index 4217ce2e0..3ec397d3c 100644 --- a/src/box/iproto_constants.h +++ b/src/box/iproto_constants.h @@ -264,6 +264,7 @@ enum iproto_raft_keys { IPROTO_RAFT_TERM = 0, IPROTO_RAFT_VOTE = 1, IPROTO_RAFT_STATE = 2, + IPROTO_RAFT_VCLOCK = 3, }; /** diff --git a/src/box/xrow.c b/src/box/xrow.c index ed3f77a15..836de3575 100644 --- a/src/box/xrow.c +++ b/src/box/xrow.c @@ -972,7 +972,7 @@ xrow_encode_raft(struct xrow_header *row, struct region *region, size += (r->state != 0) * (mp_sizeof_uint(IPROTO_RAFT_STATE) + mp_sizeof_uint(r->state)); if (r->vclock != NULL) { - size += mp_sizeof_uint(IPROTO_VCLOCK) + + size += mp_sizeof_uint(IPROTO_RAFT_VCLOCK) + mp_sizeof_vclock_ignore0(r->vclock); } @@ -999,7 +999,7 @@ xrow_encode_raft(struct xrow_header *row, struct region *region, buf = mp_encode_uint(buf, r->state); } if (r->vclock != NULL) { - buf = mp_encode_uint(buf, IPROTO_VCLOCK); + buf = mp_encode_uint(buf, IPROTO_RAFT_VCLOCK); buf = mp_encode_vclock_ignore0(buf, r->vclock); } @@ -1029,7 +1029,7 @@ xrow_decode_raft(const struct xrow_header *row, struct raft_request *r) case IPROTO_RAFT_STATE: r->state = mp_decode_uint(&pos); break; - case IPROTO_VCLOCK: + case IPROTO_RAFT_VCLOCK: if (r->vclock != NULL) mp_decode_vclock_ignore0(&pos, r->vclock); else -- 2.20.1 (Apple Git-117)