From: Serge Petrenko <sergepetrenko@tarantool.org> To: v.shpilevoy@tarantool.org, gorcunov@gmail.com, sergos@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [RAFT 04/10] [tosquash] raft: introduce IPROTO_RAFT_VCLOCK Date: Wed, 26 Aug 2020 10:52:36 +0300 [thread overview] Message-ID: <4fb599846ea343540312cd833f4dfe2d00771eb2.1598427905.git.sergepetrenko@tarantool.org> (raw) In-Reply-To: <cover.1598427905.git.sergepetrenko@tarantool.org> From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> 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)
next prev parent reply other threads:[~2020-08-26 7:52 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-26 7:52 [Tarantool-patches] [RAFT 00/10] raft implementation Serge Petrenko 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 01/10] raft: introduce persistent raft state Serge Petrenko 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 02/10] raft: relay status updates to followers Serge Petrenko 2020-08-27 20:36 ` Vladislav Shpilevoy 2020-08-28 10:10 ` Sergey Petrenko 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 03/10] [tosquash] raft: return raft_request to xrow Serge Petrenko 2020-08-26 7:52 ` Serge Petrenko [this message] 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 05/10] [tosquash] xrow: refactor raft request codec Serge Petrenko 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 06/10] [tosquash] raft: don't fill raft_request manually Serge Petrenko 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 07/10] [tosquash] raft: rename curr_leader to leader Serge Petrenko 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 08/10] [tosquash] raft: rename raft_process to raft_process_recovery Serge Petrenko 2020-08-26 7:52 ` [Tarantool-patches] [RAFT 09/10] [tosquash] applier: handler error at raft row appliance Serge Petrenko 2020-08-26 7:53 ` [Tarantool-patches] [RAFT 10/10] [tosquash] relay: move raft broadcast details into relay Serge Petrenko
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4fb599846ea343540312cd833f4dfe2d00771eb2.1598427905.git.sergepetrenko@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=sergos@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [RAFT 04/10] [tosquash] raft: introduce IPROTO_RAFT_VCLOCK' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox