[tarantool-patches] [PATCH] ddl: No replication for temp and local spaces

Vladimir Davydov vdavydov.dev at gmail.com
Fri Jun 21 18:05:11 MSK 2019


On Thu, Jun 20, 2019 at 04:33:26PM +0300, Stanislav Zudin wrote:
> From b596d7d9cda4649a3c0ebb27d4887a57422ac458 Mon Sep 17 00:00:00 2001
> From: Stanislav Zudin <szudin at tarantool.org>
> Date: Wed, 19 Jun 2019 12:28:02 +0300
> Subject: [PATCH] ddl: No replication for temp and local spaces
> 
> Do not spread the space:truncate() to replicas if the
> affected space is local or temporary.
> 
> Closes #4263
> ---
> Branch: https://github.com/tarantool/tarantool/tree/stanztt/gh-4263-no-replica-tmplocal-space
> Issue: https://github.com/tarantool/tarantool/issues/4263
> 
>  src/box/alter.cc                       | 10 ++++
>  test/replication/local_spaces.result   | 78 ++++++++++++++++++++++++++
>  test/replication/local_spaces.test.lua | 36 ++++++++++++
>  3 files changed, 124 insertions(+)
> 
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index a37a68ce4..e8a49cf98 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -2278,6 +2278,16 @@ on_replace_dd_truncate(struct trigger * /* trigger
> */, void *event)
>  	auto scoped_guard =
>  		make_scoped_guard([=] { alter_space_delete(alter); });
> 
> +	/*
> +	 * Modify the WAL header to prohibit
> +	 * replication of local & temporary
> +	 * spaces truncation.
> +	 */
> +	if (space_is_temporary(old_space) ||
> +	    space_group_id(old_space) == GROUP_LOCAL) {
> +		stmt->row->group_id = GROUP_LOCAL;
> +	}
> +
>  	/*
>  	 * Recreate all indexes of the truncated space.
>  	 */
> diff --git a/test/replication/local_spaces.result
> b/test/replication/local_spaces.result
> index ed1b76da8..97e9a9814 100644
> --- a/test/replication/local_spaces.result
> +++ b/test/replication/local_spaces.result
> @@ -71,6 +71,22 @@ s3.temporary
>  ---
>  - true
>  ...
> +-- gh-4263 The truncation of the local & temporary space
> +-- should not spread among the replicas
> +s4 = box.schema.space.create('test4', {is_local = true, temporary = true})

You should test 'is_local' and 'tmemporary' separately now, as you
changed the condition in on_replace_dd_truncate. Please fix.



More information about the Tarantool-patches mailing list