From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 4 Jun 2019 18:17:45 +0300 From: Vladimir Davydov Subject: Re: [PATCH 1/2] memtx: add yields during space format check Message-ID: <20190604151745.z5relioezjkyxhac@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Serge Petrenko Cc: tarantool-patches@freelists.org List-ID: On Mon, Jun 03, 2019 at 06:51:05PM +0300, Serge Petrenko wrote: > Just like index build, space check in memtx stalls event loop for the > whole check time. Add occasional yields, and an on_replace trigger, > which checks format for tuples inserted while space format check is in > progress. > > Follow-up #3976 > > @TarantoolBol document > Title: memtx now checks space format in background > > There is no event loop stall when memtx engine checks space format > anymore. You may insert tuples into a space, while its new format is > being checked. If the tuples don't match the new format, format change > will be aborted. > --- > src/box/memtx_space.c | 110 ++++++++++++++++++++++++++++++++---------- > 1 file changed, 84 insertions(+), 26 deletions(-) > > diff --git a/src/box/memtx_space.c b/src/box/memtx_space.c > index 1d209033c..a370c038a 100644 > --- a/src/box/memtx_space.c > +++ b/src/box/memtx_space.c > @@ -43,6 +43,16 @@ > #include "column_mask.h" > #include "sequence.h" > > +/* > + * Yield every 1K tuples. > + * In debug mode yield more often for testing purposes. > + */ > +#ifdef NDEBUG > +enum { MEMTX_YIELD_LOOPS = 1000 }; > +#else > +enum { MEMTX_YIELD_LOOPS = 10 }; > +#endif > + > static void > memtx_space_destroy(struct space *space) > { > @@ -814,6 +824,52 @@ memtx_space_add_primary_key(struct space *space) > return 0; > } > > +/* > + * Ongoing index build or format check state used by > + * corrseponding on_replace triggers. > + */ > +struct memtx_op_state { What's 'op'? The name's too generic. I renamed it to memtx_ddl_state. I also renamed MEMTX_YIELD_LOOPS to MEMTX_DDL_YIELD_LOOPS to emphasize that this is about DDL. I pushed both patches to master with this minor changes. Thanks!