From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tml <tarantool-patches@dev.tarantool.org>,
Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v19 2/3] qsync: order access to the limbo terms
Date: Tue, 5 Oct 2021 16:25:21 +0300 [thread overview]
Message-ID: <19aec308-075f-c9f0-44a7-959c9d4a8193@tarantool.org> (raw)
In-Reply-To: <YVt34PgdDPcQLkpI@grain>
05.10.2021 00:53, Cyrill Gorcunov пишет:
> On Fri, Oct 01, 2021 at 03:37:18PM +0300, Serge Petrenko wrote:
>> Shouldn't we guard limbo->owner as well?
>> Otherwise you may start writing confirm for an old leader once promote for a
>> new one is already in progress.
>>
>> I don't remember us discussing this before, so, maybe I'm just confused.
> Seems I still don't follow. Look, currently limbo::owner_id is assigned
> from the one place:
>
> txn_limbo_process_core
> txn_limbo_process_begin(limbo)
> txn_limbo_read_demote | txn_limbo_read_promote
> ...
> limbo->owner_id = replica_id;
>
> The txn_limbo_process_core is called from console (via box.ctl.promote|demote
> commands) or via applier. When it comes from console then we still take the
> lock before write into the journal
>
> static void
> box_issue_promote(uint32_t prev_leader_id, int64_t promote_lsn)
> {
> struct raft *raft = box_raft();
> assert(raft->volatile_term == raft->term);
> assert(promote_lsn >= 0);
> struct synchro_request req = {
> .type = IPROTO_RAFT_PROMOTE,
> .replica_id = prev_leader_id,
> .origin_id = instance_id,
> .lsn = promote_lsn,
> .term = raft->term,
> };
> --> txn_limbo_process_begin(&txn_limbo);
> --> txn_limbo_write_promote(&txn_limbo, req.lsn, req.term);
> txn_limbo_process_core(&txn_limbo, &req);
> assert(txn_limbo_is_empty(&txn_limbo));
> txn_limbo_process_commit(&txn_limbo);
> }
>
> thus console commands and applier are serialized. Or I miss something
> obvious?
Here's what can happen. You're the old leader, and you've received a
promote from someone else already, it's being written now.
Now some replica sends you an ack. You enter txn_limbo_ack
(it doesn't check the latch). txn_limbo_ack() may result in writing a
CONFIRM.
The PROMOTE is already in progress, so you'll end up writing CONFIRM for
a wrong leader id (your own) after PROMOTE is written.
--
Serge Petrenko
next prev parent reply other threads:[~2021-10-05 13:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 9:44 [Tarantool-patches] [PATCH v19 0/3] qsync: implement packet filtering (part 1) Cyrill Gorcunov via Tarantool-patches
2021-09-30 9:44 ` [Tarantool-patches] [PATCH v19 1/3] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches
2021-09-30 9:44 ` [Tarantool-patches] [PATCH v19 2/3] qsync: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches
2021-10-01 12:14 ` Serge Petrenko via Tarantool-patches
2021-10-01 12:31 ` Cyrill Gorcunov via Tarantool-patches
2021-10-01 12:37 ` Serge Petrenko via Tarantool-patches
2021-10-04 21:53 ` Cyrill Gorcunov via Tarantool-patches
2021-10-05 13:25 ` Serge Petrenko via Tarantool-patches [this message]
2021-10-05 21:52 ` Cyrill Gorcunov via Tarantool-patches
2021-09-30 9:44 ` [Tarantool-patches] [PATCH v19 3/3] test: add gh-6036-qsync-order test Cyrill Gorcunov via Tarantool-patches
2021-10-01 12:30 ` Serge Petrenko via Tarantool-patches
2021-10-04 21:16 ` Cyrill Gorcunov via Tarantool-patches
2021-10-05 13:55 ` Serge Petrenko via Tarantool-patches
2021-10-05 22:26 ` Cyrill Gorcunov via Tarantool-patches
2021-10-05 22:32 ` Cyrill Gorcunov via Tarantool-patches
2021-10-06 7:06 ` Cyrill Gorcunov 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=19aec308-075f-c9f0-44a7-959c9d4a8193@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 v19 2/3] qsync: order access to the limbo terms' \
/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