From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 21 Aug 2018 18:42:52 +0300 From: Konstantin Osipov Subject: Re: [PATCH v2 5/7] Introduce _vinyl_deferred_delete system space Message-ID: <20180821154252.GE28159@chai> References: <2af0dbcdd1daeffac95fa7d23a86efeec3990dd7.1534847663.git.vdavydov.dev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2af0dbcdd1daeffac95fa7d23a86efeec3990dd7.1534847663.git.vdavydov.dev@gmail.com> To: Vladimir Davydov Cc: tarantool-patches@freelists.org List-ID: * 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. > + { > + const char *engine = "blackhole"; > + const char *name = "_vinyl_deferred_delete"; > + struct space_opts opts = space_opts_default; > + opts.group_id = GROUP_LOCAL; > + struct space_def *def; > + def = space_def_new_xc(BOX_VINYL_DEFERRED_DELETE_ID, ADMIN, 0, > + name, strlen(name), engine, > + strlen(engine), &opts, NULL, 0); > + auto def_guard = make_scoped_guard([=] { > + space_def_delete(def); > + }); > + RLIST_HEAD(key_list); > + struct space *space = space_new_xc(def, &key_list); > + space_cache_replace(space); > + init_system_space(space); > + trigger_run_xc(&on_alter_space, space); > + } > } > Otherwise OK to push. -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov