From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH 2/3] recovery: make it transactional Date: Fri, 2 Apr 2021 18:11:26 +0300 [thread overview] Message-ID: <YGc0HiULbM4qIzmp@grain> (raw) In-Reply-To: <e8c083836362fec0166d61737a6df316234a3f8a.1617315744.git.v.shpilevoy@tarantool.org> On Fri, Apr 02, 2021 at 12:23:43AM +0200, Vladislav Shpilevoy wrote: > + > +/** > + * Yield once in a while, but not too often, mostly to allow signal handling to > + * take place. > + */ > +static void > +wal_stream_try_yield(struct wal_stream *stream) > +{ > + bool needs_yield = (stream->rows % WAL_ROWS_PER_YIELD == 0); Maybe worth to move this calculation below? > + if (wal_stream_has_tx(stream)) { > + /* > + * Save the yield. Otherwise it would happen only on rows which > + * are a multiple of WAL_ROWS_PER_YIELD and are last in their > + * transaction, which is probably a very rare coincidence. > + */ > + stream->has_yield = true; > + return; > + } Here --> So it won't take place if not needed. Not a big deal though up to you. > + if (stream->has_yield) > + stream->has_yield = false; > + else if (!needs_yield) > + return; > + fiber_sleep(0); > +}
next prev parent reply other threads:[~2021-04-02 15:11 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-01 22:23 [Tarantool-patches] [PATCH 0/3] Transactional recovery Vladislav Shpilevoy via Tarantool-patches 2021-04-01 22:23 ` [Tarantool-patches] [PATCH 1/3] vinyl: handle multi-statement recovery txns Vladislav Shpilevoy via Tarantool-patches 2021-04-02 9:24 ` Serge Petrenko via Tarantool-patches 2021-04-01 22:23 ` [Tarantool-patches] [PATCH 2/3] recovery: make it transactional Vladislav Shpilevoy via Tarantool-patches 2021-04-02 11:47 ` Serge Petrenko via Tarantool-patches 2021-04-03 13:18 ` Vladislav Shpilevoy via Tarantool-patches 2021-04-05 8:36 ` Serge Petrenko via Tarantool-patches 2021-04-02 15:11 ` Cyrill Gorcunov via Tarantool-patches [this message] 2021-04-01 22:23 ` [Tarantool-patches] [PATCH 3/3] box: remove is_local_recovery variable Vladislav Shpilevoy via Tarantool-patches 2021-04-02 11:47 ` Serge Petrenko via Tarantool-patches 2021-04-03 13:18 ` Vladislav Shpilevoy via Tarantool-patches 2021-04-05 8:17 ` Serge Petrenko via Tarantool-patches 2021-04-02 9:42 ` [Tarantool-patches] [PATCH 0/3] Transactional recovery Konstantin Osipov via Tarantool-patches 2021-04-05 16: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=YGc0HiULbM4qIzmp@grain \ --to=tarantool-patches@dev.tarantool.org \ --cc=gorcunov@gmail.com \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/3] recovery: make it transactional' \ /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