[Tarantool-patches] [PATCH 2/3] recovery: make it transactional
Cyrill Gorcunov
gorcunov at gmail.com
Fri Apr 2 18:11:26 MSK 2021
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);
> +}
More information about the Tarantool-patches
mailing list