From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 22 Aug 2018 20:04:59 +0300 From: Vladimir Davydov Subject: Re: [PATCH v2 5/7] Introduce _vinyl_deferred_delete system space Message-ID: <20180822170459.o5mqviz2e3n43q37@esperanza> References: <2af0dbcdd1daeffac95fa7d23a86efeec3990dd7.1534847663.git.vdavydov.dev@gmail.com> <20180821154252.GE28159@chai> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180821154252.GE28159@chai> To: Konstantin Osipov Cc: tarantool-patches@freelists.org List-ID: On Tue, Aug 21, 2018 at 06:42:52PM +0300, Konstantin Osipov wrote: > * Vladimir Davydov [18/08/21 15:19]: > > + /* > > + * _vinyl_deferred_delete - blackhole that is needed > > + * for writing deferred DELETE statements generated by > > + * vinyl compaction tasks to WAL. > > + */ > > Please expand this comment to explain why we can't create this > space purely from Lua or upgrade script: > > There is an intricate ordering dependency between creating of this > system space, recovery, and engine initialization, when we set an > on_replace trigger on the space. To resolve this dependency, we > create a space stub at schema_init(), then set a trigger in > engine_init(), which is called next, and then "alter" the space to > its final form in recovery(), which is called next. Done: diff --git a/src/box/schema.cc b/src/box/schema.cc index 32669c69..dd5896c5 100644 --- a/src/box/schema.cc +++ b/src/box/schema.cc @@ -357,6 +357,15 @@ schema_init() * _vinyl_deferred_delete - blackhole that is needed * for writing deferred DELETE statements generated by * vinyl compaction tasks to WAL. + * + * There is an intricate ordering dependency between + * recovery of this system space and initialization of + * the vinyl engine, when we set an on_replace trigger + * on the space. To resolve this dependency, we create + * a space stub in schema_init(), then set a trigger in + * engine_begin_initial_recovery(), which is called next, + * then recover WAL rows, executing the trigger for each + * of them. */ { const char *engine = "blackhole";