From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Petrenko <sergepetrenko@tarantool.org>, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 07/12] box: introduce `box.ctl.demote`
Date: Sun, 1 Aug 2021 18:19:39 +0200 [thread overview]
Message-ID: <e69b95b9-37de-9bae-eace-8b9927f5bfd1@tarantool.org> (raw)
In-Reply-To: <b3a7cfcb-1a61-8657-7e36-56d5e1a49458@tarantool.org>
Hi! Thanks for the patch!
I think we are on the finish line here, see 4 small
comments below. After them and after you fix the failing
vinyl test, the patchset will probably be finished!
There are only 2 things which bother me. They are not bugs
and we can work on them in the next quarter.
1) Assume you have election_mode = 'manual'. And you are a
leader. You call box.ctl.demote() and stop being a leader.
But the limbo is still yours. If now you switch election_mode to
'off', you need to call box.ctl.demote() again to free the
limbo.
2) In the last commit I see we make too much actions to ensure
we are a writable leader. Perhaps in the future we should not
report box.info.election.state == 'leader' until promote is
written and should not say the instance is writable.
I don't have a plan for either of these ideas yet.
> diff --git a/src/box/box.cc b/src/box/box.cc
> index 41f665e38..a34e05e94 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -1679,20 +1679,44 @@ box_issue_promote(uint32_t prev_leader_id, int64_t promote_lsn)
> assert(txn_limbo_is_empty(&txn_limbo));
> }
>
> +/* A guard to block multiple simultaneous box_promote() invocations. */
1. For out of function comments we usually use /** as an opening.
> +static bool in_box_promote = false;
2. Could you please use `is_` prefix here? `is_in_box_promote`.
> +
> +int
> +box_promote_qsync(void)
> +{
> + assert(!in_box_promote);
> + assert(is_box_configured);
> + struct raft *raft = box_raft();
> + in_box_promote = true;
> + auto promote_guard = make_scoped_guard([&] {
> + in_box_promote = false;
> + });
> + if (raft->state != RAFT_STATE_LEADER)
> + return 0;
3. This condition is not reachable, according to what I see in
box_raft_worker_f().
> + assert(box_election_mode == ELECTION_MODE_MANUAL ||
> + box_election_mode == ELECTION_MODE_CANDIDATE);
> + if (txn_limbo_replica_term(&txn_limbo, instance_id) == raft->term)
> + return 0;
> + int64_t wait_lsn = box_wait_limbo_acked(TIMEOUT_INFINITY);
> + if (wait_lsn < 0)
> + return -1;
4. Perhaps this better be panic? Because infinity timeout should
not ever be reached. And then the function becomes void, because
would not be able to fail anymore.
> + box_issue_promote(txn_limbo.owner_id, wait_lsn);
> + return 0;
> +}
> commit 7980cb3096f2616a2851f8d97db8091f0d82879c
> Author: Serge Petrenko <sergepetrenko@tarantool.org>
> Date: Mon Jun 28 11:52:44 2021 +0300
>
> box: allow calling promote on a candidate
>
> Part of #6034
>
> diff --git a/test/replication/gh-6034-election-candidate-promote.result b/test/replication/gh-6034-election-candidate-promote.result
> new file mode 100644
> index 000000000..2b4bc0213
> --- /dev/null
> +++ b/test/replication/gh-6034-election-candidate-promote.result
5. The test name format `gh-####-...` is obligatory only for bug tests.
This patch seems to be adding a feature.
next prev parent reply other threads:[~2021-08-01 16:19 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 22:12 [Tarantool-patches] [PATCH v3 00/12] forbid implicit limbo ownership transition Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 01/12] replication: always send raft state to subscribers Serge Petrenko via Tarantool-patches
2021-07-04 12:12 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-09 9:43 ` Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 02/12] txn_limbo: fix promote term filtering Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 03/12] raft: refactor raft_new_term() Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 04/12] box: make promote always bump the term Serge Petrenko via Tarantool-patches
2021-07-04 12:14 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14 18:26 ` Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 05/12] replication: forbid implicit limbo owner transition Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 06/12] box: allow calling promote on a candidate Serge Petrenko via Tarantool-patches
2021-07-04 12:14 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14 18:26 ` Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 07/12] box: introduce `box.ctl.demote` Serge Petrenko via Tarantool-patches
2021-07-04 12:27 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14 18:28 ` Serge Petrenko via Tarantool-patches
2021-07-21 23:28 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-23 7:44 ` Sergey Petrenko via Tarantool-patches
2021-07-26 23:50 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-29 20:56 ` Sergey Petrenko via Tarantool-patches
2021-08-01 16:19 ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-08-03 7:56 ` Serge Petrenko via Tarantool-patches
2021-08-03 23:25 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-04 13:08 ` Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 08/12] txn_limbo: persist the latest effective promote in snapshot Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 09/12] replication: encode version in JOIN request Serge Petrenko via Tarantool-patches
2021-07-04 12:27 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14 18:28 ` Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 10/12] replication: add META stage to JOIN Serge Petrenko via Tarantool-patches
2021-07-04 12:28 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14 18:28 ` Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 11/12] replication: send latest effective promote in initial join Serge Petrenko via Tarantool-patches
2021-07-04 12:28 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14 18:28 ` Serge Petrenko via Tarantool-patches
2021-06-28 22:12 ` [Tarantool-patches] [PATCH v3 12/12] replication: send current Raft term in join response Serge Petrenko via Tarantool-patches
2021-07-04 12:29 ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14 18:28 ` Serge Petrenko via Tarantool-patches
2021-08-04 22:41 ` [Tarantool-patches] [PATCH v3 00/12] forbid implicit limbo ownership transition Vladislav Shpilevoy via Tarantool-patches
2021-08-06 7:54 ` Vitaliia Ioffe via Tarantool-patches
2021-08-06 8:31 ` Kirill Yukhin via Tarantool-patches
2021-08-08 10:46 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-09 7:14 ` Kirill Yukhin 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=e69b95b9-37de-9bae-eace-8b9927f5bfd1@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 v3 07/12] box: introduce `box.ctl.demote`' \
/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