[Tarantool-patches] [PATCH v4 10/12] election: support manual elections in clear_synchro_queue()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Apr 18 19:07:38 MSK 2021


>>> +        /*
>>> +         * Make this instance a candidate and run until some leader, not
>>> +         * necessarily this instance, emerges.
>>> +         */
>>> +        raft_start_candidate(box_raft());
>>> +        /*
>>> +         * Trigger new elections without waiting for an old leader to
>>> +         * disappear.
>>> +         */
>>> +        raft_new_term(box_raft());
>>> +        box_raft_wait_leader_found();
>> Shouldn't we wait for election_timeout?
> 
> I think not. Let's wait for however long it takes to elect a leader.
> Several terms may pass before the leader is finally elected.
> 
> I mean, IMO it would be simpler for the user to do:
> 
> ```
> box.ctl.promote()
>    -- term1, split vote
>    -- term2, split vote
>    -- term3, leader found
> -- success
> ```
> rather than
> ```
> box.ctl.promote()
> -- error, split vote
> 
> box.ctl.promote()
> -- error, split vote
> 
> box.ctl.promote()
> -- success
> ```

The first option looks simpler, but it is infinite, this is the problem.
In case of not enough voters alive box.ctl.promote() would hang until there
are enough voters. But yeah, split vote is also an issue.

Maybe we could leave it like this for now, then make split vote detection,
and then wait for a timeout. It should not break backward compatibility.


More information about the Tarantool-patches mailing list