Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tml <tarantool-patches@dev.tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v3] raft: make sure the voking mask is wide enough
Date: Fri, 30 Oct 2020 11:39:48 +0300	[thread overview]
Message-ID: <570630ad-1fcb-b50b-3d55-d75a8e80be77@tarantool.org> (raw)
In-Reply-To: <20201030083033.GC198833@grain>


30.10.2020 11:30, Cyrill Gorcunov пишет:
> The vote_mask is declared as uint32_t which is highly coupled
> with VCLOCK_MAX, lets add a compile time test to be sure.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
> v2:
>   Use CHAR_BIT instead of hardcoded bits number
>
>   src/box/raft.c |    6 ++++++
>   1 file changed, 6 insertions(+)
>
> Index: tarantool.git/src/box/raft.c
> ===================================================================
> --- tarantool.git.orig/src/box/raft.c
> +++ tarantool.git/src/box/raft.c
> @@ -1061,4 +1061,10 @@ raft_init(void)
>   {
>   	ev_timer_init(&raft.timer, raft_sm_schedule_new_election_cb, 0, 0);
>   	rlist_create(&raft.on_update);
> +
> +	/*
> +	 * Make sure there is enough bits to track all replicas.
> +	 */
> +	static_assert(sizeof(raft.vote_mask) * CHAR_BIT >= VCLOCK_MAX,
> +		      "RAFT: vote_mask is too short");
>   }
Thanks for the fix! LGTM.

-- 
Serge Petrenko

  reply	other threads:[~2020-10-30  8:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28 18:13 [Tarantool-patches] " Cyrill Gorcunov
2020-10-28 18:56 ` [Tarantool-patches] [PATCH v2] raft: make sure the voting " Cyrill Gorcunov
2020-10-30  7:33   ` Serge Petrenko
2020-10-30  8:30     ` [Tarantool-patches] [PATCH v3] raft: make sure the voking " Cyrill Gorcunov
2020-10-30  8:39       ` Serge Petrenko [this message]
2020-11-02 22:04 ` [Tarantool-patches] " Vladislav Shpilevoy
2020-11-02 22:17   ` Cyrill Gorcunov
2020-11-02 22:28 ` Vladislav Shpilevoy

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=570630ad-1fcb-b50b-3d55-d75a8e80be77@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3] raft: make sure the voking mask is wide enough' \
    /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