[Tarantool-patches] [PATCH 4/4] election: activate raft split vote handling

Serge Petrenko sergepetrenko at tarantool.org
Tue Jan 18 16:21:52 MSK 2022



15.01.2022 03:48, Vladislav Shpilevoy пишет:
> Raft needs to know cluster size in order to detect and handle
> split vote. The patch uses registered server count as cluster
> size.
>
> It is not documented nor has a changelog file because this is an
> optimization. Can't be observed except in logs or with a watch.
>
> Closes #5285

Thanks for working on this!
Please, find one comment below.

> ---
>   src/box/raft.c                                |  4 +-
>   .../election_split_vote_test.lua              | 92 +++++++++++++++++++
>   2 files changed, 95 insertions(+), 1 deletion(-)
>   create mode 100644 test/replication-luatest/election_split_vote_test.lua
>
> diff --git a/src/box/raft.c b/src/box/raft.c
> index 1e360dc88..1908b71b6 100644
> --- a/src/box/raft.c
> +++ b/src/box/raft.c
> @@ -229,7 +229,9 @@ box_raft_update_election_quorum(void)
>   	 *   be lost.
>   	 */
>   	int quorum = MIN(replication_synchro_quorum, max);
> -	raft_cfg_election_quorum(box_raft(), quorum);
> +	struct raft *raft = box_raft();
> +	raft_cfg_election_quorum(raft, quorum);
> +	raft_cfg_cluster_size(raft, replicaset.registered_count);

Better use `max` instead of `replicaset.registered_count` here.
I don't think something could go wrong with setting cluster size to zero
initially, but let's better avoid that.

>   }
>   
>   void
...

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list