From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 47BBC469719 for ; Wed, 28 Oct 2020 21:13:59 +0300 (MSK) Received: by mail-lj1-f172.google.com with SMTP id x6so233824ljd.3 for ; Wed, 28 Oct 2020 11:13:59 -0700 (PDT) From: Cyrill Gorcunov Date: Wed, 28 Oct 2020 21:13:52 +0300 Message-Id: <20201028181352.260915-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] raft: make sure the voking mask is wide enough List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Cc: Vladislav Shpilevoy 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 --- I didn't make any branch here since it is trivial, fetch it from the mbox please if decide to apply. 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) * 8 >= VCLOCK_MAX, + "RAFT: vote_mask is too short"); }