From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Serge Petrenko <sergepetrenko@tarantool.org>
Cc: tarantool-patches@freelists.org, kostja@tarantool.org
Subject: Re: [PATCH v3 1/2] memtx: add yields during index build
Date: Wed, 29 May 2019 18:58:32 +0300 [thread overview]
Message-ID: <20190529155832.tmbbxknlyt72j7ym@esperanza> (raw)
In-Reply-To: <398dbcffaa3254d81e8b77a93a541ce26fa8f50d.1559056498.git.sergepetrenko@tarantool.org>
On Tue, May 28, 2019 at 06:33:24PM +0300, Serge Petrenko wrote:
> diff --git a/src/box/memtx_space.c b/src/box/memtx_space.c
> index 5ddb4f7ee..7a3e6b74a 100644
> --- a/src/box/memtx_space.c
> +++ b/src/box/memtx_space.c
> @@ -933,8 +1005,38 @@ memtx_space_build_index(struct space *src_space, struct index *new_index,
> */
> if (new_index->def->iid == 0)
> tuple_ref(tuple);
> + if (++count % YIELD_LOOPS == 0) {
> + /*
> + * Remember the latest inserted tuple to
> + * avoid processing yet to be added tuples
> + * in on_replace triggers.
> + */
> + state.cursor = tuple;
I think that state.cursor should be referenced counted - otherwise it
might get freed right under us.
> + fiber_sleep(0);
> + /*
> + * The on_replace trigger may have failed
> + * during the yield.
> + */
> + if (state.rc != 0) {
> + rc = -1;
> + diag_move(&state.diag, diag_get());
> + break;
> + }
> + }
> + /*
> + * Sleep after at least 1 tuple is inserted to test
> + * on_replace triggers for index build.
> + * Sleep only once.
> + */
> + struct errinj *inj = errinj(ERRINJ_BUILD_INDEX_DELAY, ERRINJ_DOUBLE);
> + if (inj != NULL && inj->dparam > 0 && count == 1) {
> + state.cursor = tuple;
> + fiber_sleep(inj->dparam);
> + }
The error injection should be added in the next patch, the one that adds
tests. Please re-split.
Other than that, looks good to me.
next prev parent reply other threads:[~2019-05-29 15:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 15:33 [PATCH v3 0/2] " Serge Petrenko
2019-05-28 15:33 ` [PATCH v3 1/2] " Serge Petrenko
2019-05-29 15:58 ` Vladimir Davydov [this message]
2019-05-28 15:33 ` [PATCH v3 2/2] test: move background index build test to engine suite from vinyl Serge Petrenko
2019-05-28 15:39 ` [tarantool-patches] " Serge Petrenko
2019-05-29 16:03 ` Vladimir Davydov
2019-05-29 11:01 ` [PATCH v3 0/2] memtx: add yields during index build Konstantin Osipov
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=20190529155832.tmbbxknlyt72j7ym@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=kostja@tarantool.org \
--cc=sergepetrenko@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH v3 1/2] memtx: add yields during index build' \
/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