From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Cyrill Gorcunov <gorcunov@gmail.com>, tml <tarantool-patches@dev.tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v23 2/3] qsync: order access to the limbo terms Date: Fri, 22 Oct 2021 00:06:05 +0200 [thread overview] Message-ID: <0c3afef7-dbc9-b429-9c7f-ae9fdcf0c634@tarantool.org> (raw) In-Reply-To: <20211014215622.49732-3-gorcunov@gmail.com> Hi! Thanks for the patch! See 4 comments below. > diff --git a/src/box/box.cc b/src/box/box.cc > index e082e1a3d..6a9be745a 100644 > --- a/src/box/box.cc > +++ b/src/box/box.cc > @@ -1686,8 +1684,11 @@ box_issue_promote(uint32_t prev_leader_id, int64_t promote_lsn) > .lsn = promote_lsn, > .term = raft->term, > }; > - txn_limbo_process(&txn_limbo, &req); > + 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); 1. What was wrong with txn_limbo_begin/commit/rollback? I mean `txn_limbo` prefix, without `_process_` suffix. From this hunk we can see that you call `process_begin` but then you call txn_limbo_write_promote - it is not 'process'. Using 'process' because of that looks inconsistent. Also if you would drop it from begin/commit/rollback names, then you could leave txn_limbo_process as is, without this _core suffix. > @@ -1708,8 +1707,12 @@ box_issue_demote(uint32_t prev_leader_id, int64_t promote_lsn) > .lsn = promote_lsn, > .term = box_raft()->term, > }; > - txn_limbo_process(&txn_limbo, &req); > + txn_limbo_process_begin(&txn_limbo); > + txn_limbo_write_demote(&txn_limbo, promote_lsn, > + box_raft()->term); 2. This expression fits into one line (< 80 symbols) just fine. Maybe lets write it as one line? > + txn_limbo_process_core(&txn_limbo, &req); > assert(txn_limbo_is_empty(&txn_limbo)); > + txn_limbo_process_commit(&txn_limbo); > } > diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c > index 70447caaf..9b643072a 100644 > --- a/src/box/txn_limbo.c > +++ b/src/box/txn_limbo.c > @@ -542,10 +543,30 @@ txn_limbo_read_demote(struct txn_limbo *limbo, int64_t lsn) > } > > void > -txn_limbo_ack(struct txn_limbo *limbo, uint32_t replica_id, int64_t lsn) > +txn_limbo_ack(struct txn_limbo *limbo, uint32_t owner_id, > + uint32_t replica_id, int64_t lsn) > { > + /* > + * ACKs are collected only by the transactions originator > + * (which is the single master in 100% so far). Other instances > + * wait for master's CONFIRM message instead. > + * > + * Due to cooperative multitasking there might be limbo owner > + * migration in-fly (while writing data to journal), so for > + * simplicity sake the test for owner is done here instead > + * of putting this check to the callers. > + */ 3. This does not improve simplicity anyhow TBH, rather vice versa. This code looks very suspicious, counter-intuitive. But lets wait for more tests. See comments to the last commit. 4. Why doesn't txn_limbo_ack() keeps the lock for the time of txn_limbo_write_confirm() and txn_limbo_read_confirm()? I think that probably all the limbo functions, literally all of them, must get the latch. From the beginning to the end. And only after careful testing we could try to drop some of the locks, or at least reduce their critical sections. box.ctl functions related to the limbo/raft too. But do not insist on that. This is just how I would do it maybe.
next prev parent reply other threads:[~2021-10-21 22:06 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-14 21:56 [Tarantool-patches] [PATCH v23 0/3] qsync: implement packet filtering (part 1) Cyrill Gorcunov via Tarantool-patches 2021-10-14 21:56 ` [Tarantool-patches] [PATCH v23 1/3] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches 2021-10-14 21:56 ` [Tarantool-patches] [PATCH v23 2/3] qsync: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches 2021-10-21 22:06 ` Vladislav Shpilevoy via Tarantool-patches [this message] 2021-10-14 21:56 ` [Tarantool-patches] [PATCH v23 3/3] test: add gh-6036-qsync-order test Cyrill Gorcunov via Tarantool-patches 2021-10-19 15:09 ` Serge Petrenko via Tarantool-patches 2021-10-19 22:26 ` Cyrill Gorcunov via Tarantool-patches 2021-10-20 6:35 ` Serge Petrenko via Tarantool-patches 2021-10-21 22:06 ` Vladislav Shpilevoy via Tarantool-patches 2021-10-22 6:36 ` Serge Petrenko via Tarantool-patches 2021-10-21 22:06 ` Vladislav Shpilevoy via Tarantool-patches 2021-10-22 22:03 ` Cyrill Gorcunov via Tarantool-patches 2021-10-24 15:39 ` Vladislav Shpilevoy via Tarantool-patches 2021-10-24 16:01 ` 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=0c3afef7-dbc9-b429-9c7f-ae9fdcf0c634@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v23 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