[PATCH v2 5/7] Introduce _vinyl_deferred_delete system space

Konstantin Osipov kostja at tarantool.org
Tue Aug 21 18:42:52 MSK 2018


* Vladimir Davydov <vdavydov.dev at gmail.com> [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



More information about the Tarantool-patches mailing list