From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, Cyrill Gorcunov <gorcunov@gmail.com> Cc: tml <tarantool-patches@dev.tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v27 2/3] qsync: order access to the limbo terms Date: Fri, 14 Jan 2022 13:20:27 +0300 [thread overview] Message-ID: <4e7c8864-8692-9701-388c-5fbd94db9998@tarantool.org> (raw) In-Reply-To: <1e296ade-8121-4ba3-7762-5695729544c3@tarantool.org> 14.01.2022 02:32, Vladislav Shpilevoy пишет: > > On 13.01.2022 11:13, Serge Petrenko wrote: >> >> 13.01.2022 00:30, Vladislav Shpilevoy пишет: >>> Hi! >>> >>> On 12.01.2022 15:01, Serge Petrenko wrote: >>>> 11.01.2022 23:39, Cyrill Gorcunov пишет: >>>>> On Mon, Jan 10, 2022 at 05:28:43PM +0300, Serge Petrenko wrote: >>>>>> Hi! Thanks for the patch! >>>>>> box_issue_promote() and box_issue_demote() need fine-grained locking >>>>>> anyway. >>>>>> Otherwise it’s possible that promote() is already issued, but not yet >>>>>> written to WAL, and some >>>>>> outdated request is applied by applier at that exact moment. >>>>> True. And in previous series Vlad has asked to not move in code which is >>>>> not covered by tests. So I think this is a task for the next part. Currently >>>>> we cover only the race between appliers. >>>> Let's ask Vlad, then. >>>> >>>> I feel like we should fix this now, not waiting for a full fine-grained locking >>>> patch. >>>> >>>> First of all, this is a known bug (and fine-grained locking was meant to >>>> cover everything we don't know of, just in case). >>> I am not sure I understand what you both are talking about here. Sergey, do >>> you mean 'fine-grained locking' as big critical sections covering a lot of >>> code at once or as many small critical sections? >> I mean "locking every limbo function", like Cyrill tried to do that in the >> previous patch version. > Давай по-русски, тут какое-то недопонимание. > > В старых версиях Кирилл пытался лочить слишком мелко. Протестировать такое было > тяжеловато. Потому та версия не зашла - тестов было 0. В общем после обсуждения в чате я понял твою идею. В предпоследней версии (26) уже не было таких мелких локов. Там лочились функции лимба целиком. > >>> I am confused because of this sentence. "Cover everything we don't know" is >>> rather opposite to fine-grained locking. I voted for big locks because >>> apparently it was too hard to implement smaller more precise locks. >>> >>>> Besides, simply locking issue_promote/issue_demote should be >>>> much easier than implementing the fine-grained locking patch. >>> Yes. I remember the proposal was to lock entire promote/demote and other >>> qsync/raft functions from beginning to end. Because it should be relatively >>> easy. I didn't look at the code in this patch though, can't comment it. >> This particular patch only locks applier_apply_synchro_request(), txn_limbo_process() >> and txn_limbo_is_replica_outdated(), so that applier cannot apply a request from an >> already stale term. >> >> My proposal is to lock box_issue_promote() and box_issue_demote() >> (not whole promote/demote) to get rid of another race: when promote is written >> to WAL, but not yed processed. > Почему не лочить целиком promote/demote? Может если локи были бы шире, то не > нужно было бы и на триггеры портировать все как в новом тикете? Как ты и написал в чате, залочить их прямо целиком не получится. Там есть место, где мы ждём применения CONFIRM/ROLLBACK/etc. Лочить какой-то большой кусок промоута (но не весь промоут) я пока смысла не вижу. Может получиться что там опять какой-то дедлок будет или ещё что-то, и мы будем кучу времени с этим разбираться (непонятно ради чего). В общем, Кирилл, я предлагаю в этом патче добавить лок на весь box_issue_promote()/demote(). Выглядит так, что это не добавит проблем, зато это точно закроет багос с тем, что после отправленного на запись PROMOTE апплаер может применить реквест из уже устаревшего терма. Нужно будет и тест на это сделать, но он выглядит довольно просто: сделать на ноде 1 промоут, на ноде 2 сделать error.injection.set(ERRINJ_WAL_WRITE_COUNTDOWN, 2) (или как там надо чтобы терм записался, а промот завис) box.ctl.promote() на ноде 1 что-нибудь вставить в синхронный спейс на ноде 2 убрать ерриндж и проверить что вставка в спейс не прошла. С тестом на демоут чуть сложнее будет, потому что он только на мастере может работать. > >> What you're talking about is what I call "fine grained locking", and it turned >> out rather hard to implement, so Cyrill abandoned this idea for now. > fine grained значит "мелко-зернистый". То есть локи были бы на мелкие куски кода, > как сначала Кирилл пытался сделать. Я как раз за наоборот топлю - блокировать > сразу большие куски, а не "мелко". Ага, теперь понятно. -- Serge Petrenko
next prev parent reply other threads:[~2022-01-14 10:20 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-30 20:23 [Tarantool-patches] [PATCH v27 0/3] qsync: implement packet filtering (part 1) Cyrill Gorcunov via Tarantool-patches 2021-12-30 20:23 ` [Tarantool-patches] [PATCH v27 1/3] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches 2021-12-30 20:23 ` [Tarantool-patches] [PATCH v27 2/3] qsync: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches 2022-01-10 14:28 ` Serge Petrenko via Tarantool-patches 2022-01-11 20:39 ` Cyrill Gorcunov via Tarantool-patches 2022-01-12 14:01 ` Serge Petrenko via Tarantool-patches 2022-01-12 21:30 ` Vladislav Shpilevoy via Tarantool-patches 2022-01-13 10:13 ` Serge Petrenko via Tarantool-patches 2022-01-13 23:32 ` Vladislav Shpilevoy via Tarantool-patches 2022-01-14 10:20 ` Serge Petrenko via Tarantool-patches [this message] 2022-01-14 10:33 ` Cyrill Gorcunov via Tarantool-patches 2021-12-30 20:23 ` [Tarantool-patches] [PATCH v27 3/3] test: add gh-6036-qsync-order test Cyrill Gorcunov via Tarantool-patches 2022-01-10 14:29 ` Serge Petrenko via Tarantool-patches 2022-01-11 20:41 ` 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=4e7c8864-8692-9701-388c-5fbd94db9998@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 v27 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