From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Cyrill Gorcunov <gorcunov@gmail.com>, tml <tarantool-patches@dev.tarantool.org> Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v20 2/3] qsync: order access to the limbo terms Date: Fri, 8 Oct 2021 05:33:38 +0300 [thread overview] Message-ID: <77769068-c0e9-6ab4-2df9-1f5b13829e15@tarantool.org> (raw) In-Reply-To: <20211006201522.335898-3-gorcunov@gmail.com> 06.10.2021 23:15, Cyrill Gorcunov пишет: > Limbo terms tracking is shared between appliers and when > one of appliers is waiting for write to complete inside > journal_write() routine, an other may need to access read > term value to figure out if promote request is valid to > apply. Due to cooperative multitasking access to the terms > is not consistent so we need to be sure that other fibers > read up to date terms (ie written to the WAL). > > Thanks for working on this! LGTM with one minor comment. ... > diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c > index 70447caaf..301fc1a8f 100644 > --- a/src/box/txn_limbo.c > +++ b/src/box/txn_limbo.c ... > @@ -724,11 +738,14 @@ txn_limbo_wait_empty(struct txn_limbo *limbo, double timeout) > } > > void > -txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) > +txn_limbo_process_core(struct txn_limbo *limbo, > + const struct synchro_request *req) > { > + assert(latch_is_locked(&limbo->promote_latch)); > + > uint64_t term = req->term; > uint32_t origin = req->origin_id; > - if (txn_limbo_replica_term(limbo, origin) < term) { > + if (vclock_get(&limbo->promote_term_map, origin) < (int64_t)term) { > vclock_follow(&limbo->promote_term_map, origin, term); > if (term > limbo->promote_greatest_term) > limbo->promote_greatest_term = term; > @@ -786,11 +803,33 @@ txn_limbo_process(struct txn_limbo *limbo, const struct synchro_request *req) > return; > } > > +void > +txn_limbo_process(struct txn_limbo *limbo, > + const struct synchro_request *req) > +{ > + txn_limbo_process_begin(limbo); > + txn_limbo_process_core(limbo, req); > + txn_limbo_process_commit(limbo); > +} > + > void > txn_limbo_on_parameters_change(struct txn_limbo *limbo) > { > if (rlist_empty(&limbo->queue)) > return; > + /* > + * In case if we're not current leader (ie not owning the > + * limbo) then we should not confirm anything, otherwise > + * we could reduce quorum number and start writing CONFIRM > + * while leader node carries own maybe bigger quorum value. > + */ > + if (!txn_limbo_is_owner(limbo, instance_id)) { > + say_warn("qsync: trying to change replication_synchro_quorum " > + "on node %u while owner is %u, ignore.", > + instance_id, limbo->owner_id); > + return; > + } Hm, I don't think we need a warning here. It'd be printed every time quorum is updated due to formula recalculations. > + > struct txn_limbo_entry *e; > int64_t confirm_lsn = -1; > rlist_foreach_entry(e, &limbo->queue, in_queue) { > ... -- Serge Petrenko
next prev parent reply other threads:[~2021-10-08 2:33 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-06 20:15 [Tarantool-patches] [PATCH v20 0/3] qsync: implement packet filtering (part 1) Cyrill Gorcunov via Tarantool-patches 2021-10-06 20:15 ` [Tarantool-patches] [PATCH v20 1/3] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches 2021-10-06 20:15 ` [Tarantool-patches] [PATCH v20 2/3] qsync: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches 2021-10-08 2:33 ` Serge Petrenko via Tarantool-patches [this message] 2021-10-06 20:15 ` [Tarantool-patches] [PATCH v20 3/3] test: add gh-6036-qsync-order test Cyrill Gorcunov via Tarantool-patches 2021-10-08 2:57 ` Serge Petrenko 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=77769068-c0e9-6ab4-2df9-1f5b13829e15@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 v20 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