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

Serge Petrenko sergepetrenko at tarantool.org
Mon Apr 19 12:32:24 MSK 2021



18.04.2021 19:07, Vladislav Shpilevoy пишет:
>>>> +        /*
>>>> +         * 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.

Besides, now the user may cancel the fiber issuing the promote.

>
> 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.

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list