From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Serge Petrenko <sergepetrenko@tarantool.org>, tarantool-patches@dev.tarantool.org, gorcunov@gmail.com Subject: Re: [Tarantool-patches] [PATCH 2/2] election: during bootstrap prefer candidates Date: Sun, 18 Jul 2021 19:00:41 +0200 [thread overview] Message-ID: <365e2e2d-4be6-4447-36a1-2a6a8ee4ab21@tarantool.org> (raw) In-Reply-To: <911781cb-0aac-de47-3e08-e888b646a429@tarantool.org> Thanks for the review! >> diff --git a/src/box/box.cc b/src/box/box.cc >> index ef3efe3e0..3105b04b6 100644 >> --- a/src/box/box.cc >> +++ b/src/box/box.cc >> @@ -3519,7 +3519,30 @@ box_cfg_xc(void) >> * should take the control over the situation and start a new >> * term immediately. >> */ >> - raft_new_term(box_raft()); >> + struct raft *raft = box_raft(); >> + if (box_election_mode == ELECTION_MODE_MANUAL) { >> + raft_start_candidate(raft); >> + raft_new_term(raft); >> + int rc = box_raft_wait_leader_found(); >> + /* >> + * No need to check if the mode is still manual - it >> + * couldn't change because box.cfg is protected with a >> + * fiber lock. >> + */ >> + assert(box_election_mode == ELECTION_MODE_MANUAL); >> + raft_stop_candidate(raft, false); >> + /* >> + * It should not fail, because on bootstrap the node is >> + * a single registered instance. It can't not win the >> + * elections while being a lone participant. But still >> + * check the result so as not to a ignore potential >> + * problems. >> + */ >> + if (rc != 0) >> + diag_raise(); >> + } else { >> + raft_new_term(raft); >> + } > > Could you please extract this fix into a separate commit? Done. See v2. > Speaking of your problems with raft_try_candidate. I also can't think > of a good enough alternative. > > For promote it would be nice to do: > > do { > raft_try_candidate_for_1_term(); > } while (leader is not known); > > and simply > raft_try_candidate_for_1_term(); > for bootstrap. > > But raft_try_candidate_for_1_term() looks hard to implement. Yes, I had something like that in mind too. I tried to implement it in v2.
next prev parent reply other threads:[~2021-07-18 17:01 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-15 23:49 [Tarantool-patches] [PATCH 0/2] Bootstrap voter Vladislav Shpilevoy via Tarantool-patches 2021-07-15 23:49 ` [Tarantool-patches] [PATCH 1/2] replication: introduce ballot.can_be_leader Vladislav Shpilevoy via Tarantool-patches 2021-07-16 10:59 ` Serge Petrenko via Tarantool-patches 2021-07-18 17:00 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-19 9:11 ` Sergey Petrenko via Tarantool-patches 2021-07-16 14:29 ` Konstantin Osipov via Tarantool-patches 2021-07-18 17:00 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-19 9:12 ` Konstantin Osipov via Tarantool-patches 2021-07-19 22:06 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-20 8:49 ` Konstantin Osipov via Tarantool-patches 2021-07-20 20:02 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-20 20:18 ` Konstantin Osipov via Tarantool-patches 2021-07-20 21:16 ` Cyrill Gorcunov via Tarantool-patches 2021-07-20 23:20 ` Konstantin Osipov via Tarantool-patches 2021-07-21 18:51 ` Cyrill Gorcunov via Tarantool-patches 2021-07-21 21:43 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-15 23:49 ` [Tarantool-patches] [PATCH 2/2] election: during bootstrap prefer candidates Vladislav Shpilevoy via Tarantool-patches 2021-07-16 11:30 ` Serge Petrenko via Tarantool-patches 2021-07-18 17:00 ` Vladislav Shpilevoy via Tarantool-patches [this message] 2021-07-16 14:27 ` [Tarantool-patches] [PATCH 0/2] Bootstrap voter Konstantin Osipov via Tarantool-patches 2021-07-18 17:00 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-19 9:13 ` Konstantin Osipov via Tarantool-patches 2021-07-19 22:04 ` Vladislav Shpilevoy via Tarantool-patches
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=365e2e2d-4be6-4447-36a1-2a6a8ee4ab21@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=sergepetrenko@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/2] election: during bootstrap prefer candidates' \ /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