From 2375b3a3b03f9382b964f842d804d7bb565c4a4b Mon Sep 17 00:00:00 2001
From: Georgy Moshkin <gmoshkin@picodata.io>
Date: Wed, 30 Aug 2023 19:16:49 +0300
Subject: [PATCH] core: rename temporary spaces to data-temporary

Everywhere where we refer to temporary spaces we now say data-temporary.
This is because temporary spaces were never truly temporary because
their definitions would still be persisted and replicated and they
couldn't be created on read-only replicas. In a following commit we will
introduce a new fully temporary type of spaces, which will be just
called 'temporary', so this commit signifies this terminology change.

NO_DOC=renaming
NO_CHANGELOG=renaming
NO_TEST=renaming
---
 src/box/alter.cc                              | 27 ++++++++++---------
 src/box/box.cc                                | 19 ++++++-------
 src/box/engine.h                              |  4 +--
 src/box/lua/space.cc                          |  2 +-
 src/box/memtx_allocator.h                     |  6 ++---
 src/box/memtx_space.c                         |  6 +++--
 src/box/read_view.c                           |  5 ++--
 src/box/read_view.h                           |  4 +--
 src/box/space.c                               |  2 +-
 src/box/space.h                               |  6 ++---
 src/box/space_def.c                           |  5 ++--
 src/box/space_def.h                           |  4 +--
 src/box/tuple.h                               |  2 +-
 src/box/tuple_constraint_fkey.c               |  7 ++---
 src/box/tuple_format.h                        |  4 +--
 src/box/txn.c                                 | 10 +++----
 src/box/vinyl.c                               |  5 ++--
 src/box/wal.c                                 |  2 +-
 src/lib/core/tt_sort.c                        |  2 +-
 .../gh_5616_temp_space_truncate_ro_test.lua   |  6 ++---
 test/box/alter.result                         |  2 +-
 test/box/alter.test.lua                       |  2 +-
 test/box/before_replace.result                |  2 +-
 test/box/before_replace.test.lua              |  2 +-
 test/box/errinj.result                        |  4 +--
 test/box/errinj.test.lua                      |  4 +--
 test/box/on_replace.result                    |  2 +-
 test/box/on_replace.test.lua                  |  2 +-
 test/box/temp_spaces.result                   | 12 ++++-----
 test/box/temp_spaces.test.lua                 | 10 +++----
 ..._8936_foreign_key_wrong_reference_test.lua | 21 ++++++++-------
 test/replication/local_spaces.result          |  6 ++---
 test/replication/local_spaces.test.lua        |  6 ++---
 test/sql/misc.result                          |  2 +-
 test/sql/misc.test.lua                        |  2 +-
 test/unit/memtx_allocator.cc                  | 22 +++++++--------
 test/vinyl/gh.result                          |  4 +--
 test/vinyl/gh.test.lua                        |  2 +-
 38 files changed, 123 insertions(+), 112 deletions(-)

diff --git a/src/box/alter.cc b/src/box/alter.cc
index 0ea6f4fa3e..d306db518d 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -2031,8 +2031,8 @@ space_check_truncate(struct space *space)
 
 /**
  * Check whether @a old_space holders prohibit alter to @a new_space_def.
- * For example if the space becomes temporary, there can be foreign keys
- * from non-temporary space, so this alter must not be allowed.
+ * For example if the space becomes data-temporary, there can be foreign keys
+ * from non-data-temporary space, so this alter must not be allowed.
  * Return 0 if allowed, or -1 if not allowed (diag is set).
  */
 static int
@@ -2044,9 +2044,11 @@ space_check_alter(struct space *old_space, struct space_def *new_space_def)
 	 * required below.
 	 */
 	assert(old_space->def->opts.group_id == new_space_def->opts.group_id);
-	/* Only alter from non-temporary to temporary can cause problems. */
-	if (space_is_temporary(old_space) ||
-	    !space_opts_is_temporary(&new_space_def->opts))
+	/* Only alter from non-data-temporary to data-temporary can cause
+	 * problems.
+	 */
+	if (space_is_data_temporary(old_space) ||
+	    !space_opts_is_data_temporary(&new_space_def->opts))
 		return 0;
 	/* Check for foreign keys that refers to this space. */
 	struct space_cache_holder *h;
@@ -2060,15 +2062,16 @@ space_check_alter(struct space *old_space, struct space_def *new_space_def)
 				     space_cache_holder);
 		struct space *other_space = constr->space;
 		/*
-		 * If the referring space is temporary too then the alter
+		 * If the referring space is data-temporary too then the alter
 		 * can't break foreign key consistency after restart.
 		 */
-		if (space_opts_is_temporary(&other_space->def->opts))
+		if (space_opts_is_data_temporary(&other_space->def->opts))
 			continue;
 		diag_set(ClientError, ER_ALTER_SPACE,
 			 space_name(old_space),
-			 tt_sprintf("foreign key '%s' from non-temporary space"
-				    " '%s' can't refer to temporary space",
+			 tt_sprintf("foreign key '%s' from non-data-temporary"
+				    " space '%s' can't refer to data-temporary"
+				    " space",
 				    constr->def.name, space_name(other_space)));
 		return -1;
 	}
@@ -2759,9 +2762,9 @@ on_replace_dd_truncate(struct trigger * /* trigger */, void *event)
 	 * box_process1() bypasses the read-only check for the _truncate system
 	 * space because there the space that is going to be truncated isn't yet
 	 * known. Perform the check here if this statement was issued by this
-	 * replica and the space isn't temporary or local.
+	 * replica and the space isn't data-temporary or local.
 	 */
-	bool is_temp = space_is_temporary(old_space) ||
+	bool is_temp = space_is_data_temporary(old_space) ||
 		       space_is_local(old_space);
 	if (!is_temp && stmt->row->replica_id == 0 &&
 	    box_check_writable() != 0)
@@ -2798,7 +2801,7 @@ on_replace_dd_truncate(struct trigger * /* trigger */, void *event)
 
 	/*
 	 * Modify the WAL header to prohibit
-	 * replication of local & temporary
+	 * replication of local & data-temporary
 	 * spaces truncation.
 	 */
 	if (is_temp) {
diff --git a/src/box/box.cc b/src/box/box.cc
index fe945c4d1e..6108174ec5 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -3571,23 +3571,24 @@ box_process1(struct request *request, box_tuple_t **result)
 	if (space == NULL)
 		return -1;
 	/*
-	 * Allow to write to temporary and local spaces in the read-only mode.
-	 * To handle space truncation, we postpone the read-only check for the
-	 * _truncate system space till the on_replace trigger is called, when
-	 * we know which space is truncated.
+	 * Allow to write to data-temporary and local spaces in the read-only
+	 * mode. To handle space truncation, we postpone the read-only check for
+	 * the _truncate system space till the on_replace trigger is called,
+	 * when we know which space is truncated.
 	 */
 	if (space_id(space) != BOX_TRUNCATE_ID &&
-	    !space_is_temporary(space) &&
+	    !space_is_data_temporary(space) &&
 	    !space_is_local(space) &&
 	    box_check_writable() != 0)
 		return -1;
 	if (space_is_memtx(space)) {
 		/*
 		 * Due to on_init_schema triggers set on system spaces,
-		 * we can insert data during recovery to local and temporary
-		 * spaces. However, until recovery is finished, we can't
-		 * check key uniqueness (since indexes are still not yet built).
-		 * So reject any attempts to write into these spaces.
+		 * we can insert data during recovery to local and
+		 * data-temporary spaces. However, until recovery is finished,
+		 * we can't check key uniqueness (since indexes are still not
+		 * yet built). So reject any attempts to write into these
+		 * spaces.
 		 */
 		if (memtx_space_is_recovering(space)) {
 			diag_set(ClientError, ER_UNSUPPORTED, "Snapshot recovery",
diff --git a/src/box/engine.h b/src/box/engine.h
index bd7d102526..bf528fec82 100644
--- a/src/box/engine.h
+++ b/src/box/engine.h
@@ -245,8 +245,8 @@ struct engine_vtab {
 	void (*reset_stat)(struct engine *);
 	/**
 	 * Check definition of a new space for engine-specific
-	 * limitations. E.g. not all engines support temporary
-	 * tables.
+	 * limitations. E.g. not all engines support data-temporary
+	 * spaces.
 	 */
 	int (*check_space_def)(struct space_def *);
 };
diff --git a/src/box/lua/space.cc b/src/box/lua/space.cc
index 19249fd480..15bd2e2878 100644
--- a/src/box/lua/space.cc
+++ b/src/box/lua/space.cc
@@ -423,7 +423,7 @@ lbox_fillspace(struct lua_State *L, struct space *space, int i)
 
 	/* space.temporary */
 	lua_pushstring(L, "temporary");
-	lua_pushboolean(L, space_is_temporary(space));
+	lua_pushboolean(L, space_is_data_temporary(space));
 	lua_settable(L, i);
 
 	/* space.type */
diff --git a/src/box/memtx_allocator.h b/src/box/memtx_allocator.h
index 44b1e8cc3b..d3e29c9774 100644
--- a/src/box/memtx_allocator.h
+++ b/src/box/memtx_allocator.h
@@ -139,9 +139,9 @@ memtx_tuple_rv_version(struct memtx_tuple_rv *rv)
  * for each type maintain an independent list.
  */
 enum memtx_tuple_rv_type {
-	/** Tuples from non-temporary spaces. */
+	/** Tuples from non-data-temporary spaces. */
 	memtx_tuple_rv_default,
-	/** Tuples from temporary spaces. */
+	/** Tuples from data-temporary spaces. */
 	memtx_tuple_rv_temporary,
 	memtx_tuple_rv_type_MAX,
 };
@@ -257,7 +257,7 @@ class MemtxAllocator {
 		}
 		ReadView *rv = (ReadView *)xcalloc(1, sizeof(*rv));
 		for (int type = 0; type < memtx_tuple_rv_type_MAX; type++) {
-			if (!opts->enable_temporary_spaces &&
+			if (!opts->enable_data_temporary_spaces &&
 			    type == memtx_tuple_rv_temporary)
 				continue;
 			rv->rv[type] = memtx_tuple_rv_new(read_view_version,
diff --git a/src/box/memtx_space.c b/src/box/memtx_space.c
index e36d5bf6e6..04476eeca8 100644
--- a/src/box/memtx_space.c
+++ b/src/box/memtx_space.c
@@ -1362,9 +1362,11 @@ memtx_space_prepare_alter(struct space *old_space, struct space *new_space)
 	struct memtx_space *new_memtx_space = (struct memtx_space *)new_space;
 
 	if (old_memtx_space->bsize != 0 &&
-	    space_is_temporary(old_space) != space_is_temporary(new_space)) {
+	    space_is_data_temporary(old_space) !=
+	    space_is_data_temporary(new_space)) {
 		diag_set(ClientError, ER_ALTER_SPACE, old_space->def->name,
-			 "can not switch temporary flag on a non-empty space");
+			 "can not change data-temporariness on a non-empty "
+			 "space");
 		return -1;
 	}
 
diff --git a/src/box/read_view.c b/src/box/read_view.c
index cf1be6e9e6..bd0b0ee493 100644
--- a/src/box/read_view.c
+++ b/src/box/read_view.c
@@ -67,7 +67,7 @@ read_view_opts_create(struct read_view_opts *opts)
 	opts->filter_arg = NULL;
 	opts->enable_field_names = false;
 	opts->enable_space_upgrade = false;
-	opts->enable_temporary_spaces = false;
+	opts->enable_data_temporary_spaces = false;
 	opts->disable_decompression = false;
 }
 
@@ -157,7 +157,8 @@ read_view_add_space_cb(struct space *space, void *arg_raw)
 	struct read_view *rv = arg->rv;
 	const struct read_view_opts *opts = arg->opts;
 	if ((space->engine->flags & ENGINE_SUPPORTS_READ_VIEW) == 0 ||
-	    (space_is_temporary(space) && !opts->enable_temporary_spaces) ||
+	    (space_is_data_temporary(space) &&
+	     !opts->enable_data_temporary_spaces) ||
 	    !opts->filter_space(space, opts->filter_arg))
 		return 0;
 	struct space_read_view *space_rv = space_read_view_new(space, opts);
diff --git a/src/box/read_view.h b/src/box/read_view.h
index 056d5ca0f4..4853d6c02a 100644
--- a/src/box/read_view.h
+++ b/src/box/read_view.h
@@ -163,10 +163,10 @@ struct read_view_opts {
 	 */
 	bool enable_space_upgrade;
 	/**
-	 * Temporary spaces aren't included into this read view unless this
+	 * Data-temporary spaces aren't included into this read view unless this
 	 * flag is set.
 	 */
-	bool enable_temporary_spaces;
+	bool enable_data_temporary_spaces;
 	/**
 	 * Memtx-specific. Disables decompression of tuples fetched from
 	 * the read view. Setting this flag makes the raw read view methods
diff --git a/src/box/space.c b/src/box/space.c
index c15a3001e4..9edc0c747b 100644
--- a/src/box/space.c
+++ b/src/box/space.c
@@ -476,7 +476,7 @@ space_new(struct space_def *def, struct rlist *key_list)
 struct space *
 space_new_ephemeral(struct space_def *def, struct rlist *key_list)
 {
-	assert(space_opts_is_temporary(&def->opts));
+	assert(space_opts_is_data_temporary(&def->opts));
 	assert(def->opts.is_ephemeral);
 	struct space *space = space_new(def, key_list);
 	if (space == NULL)
diff --git a/src/box/space.h b/src/box/space.h
index 43197ffc89..df0b4870f5 100644
--- a/src/box/space.h
+++ b/src/box/space.h
@@ -346,11 +346,11 @@ space_name(const struct space *space)
 	return space->def->name;
 }
 
-/** Return true if space is temporary. */
+/** Return true if space is data-temporary. */
 static inline bool
-space_is_temporary(const struct space *space)
+space_is_data_temporary(const struct space *space)
 {
-	return space_opts_is_temporary(&space->def->opts);
+	return space_opts_is_data_temporary(&space->def->opts);
 }
 
 /** Return true if space is synchronous. */
diff --git a/src/box/space_def.c b/src/box/space_def.c
index 9206694659..d7f215aee6 100644
--- a/src/box/space_def.c
+++ b/src/box/space_def.c
@@ -113,7 +113,7 @@ space_tuple_format_new(struct tuple_format_vtab *vtab, void *engine,
 	return tuple_format_new(vtab, engine, keys, key_count,
 				def->fields, def->field_count,
 				def->exact_field_count, def->dict,
-				space_opts_is_temporary(&def->opts),
+				space_opts_is_data_temporary(&def->opts),
 				def->opts.is_ephemeral,
 				def->opts.constraint_def,
 				def->opts.constraint_count, def->format_data,
@@ -297,8 +297,7 @@ space_opts_parse_temporary(const char **data, void *vopts,
 			 "only one of 'type' or 'temporary' may be specified");
 		return -1;
 	}
-	bool is_temporary = mp_decode_bool(data);
-	opts->type = is_temporary ?
+	opts->type = mp_decode_bool(data) ?
 		SPACE_TYPE_DATA_TEMPORARY : SPACE_TYPE_NORMAL;
 	return 0;
 }
diff --git a/src/box/space_def.h b/src/box/space_def.h
index 8ed4619ae7..31f1ebe0f0 100644
--- a/src/box/space_def.h
+++ b/src/box/space_def.h
@@ -129,10 +129,10 @@ space_opts_create(struct space_opts *opts)
 }
 
 /**
- * Check if the space is temporary.
+ * Check if the space is data-temporary.
  */
 static inline bool
-space_opts_is_temporary(const struct space_opts *opts)
+space_opts_is_data_temporary(const struct space_opts *opts)
 {
 	assert(opts->type != SPACE_TYPE_DEFAULT);
 	return opts->type != SPACE_TYPE_NORMAL;
diff --git a/src/box/tuple.h b/src/box/tuple.h
index 0c1783e730..9c9429cb49 100644
--- a/src/box/tuple.h
+++ b/src/box/tuple.h
@@ -399,7 +399,7 @@ enum tuple_flag {
 	 */
 	TUPLE_IS_DIRTY = 1,
 	/**
-	 * The tuple belongs to a temporary space so it can be freed
+	 * The tuple belongs to a data-temporary space so it can be freed
 	 * immediately while a snapshot is in progress.
 	 */
 	TUPLE_IS_TEMPORARY = 2,
diff --git a/src/box/tuple_constraint_fkey.c b/src/box/tuple_constraint_fkey.c
index 8d7f0d7d28..a1a1209de3 100644
--- a/src/box/tuple_constraint_fkey.c
+++ b/src/box/tuple_constraint_fkey.c
@@ -629,11 +629,12 @@ tuple_constraint_fkey_check_spaces(struct tuple_constraint *constr,
 				   struct space *space,
 				   struct space *foreign_space)
 {
-	if (space_is_temporary(foreign_space) && !space_is_temporary(space)) {
+	if (space_is_data_temporary(foreign_space) &&
+	    !space_is_data_temporary(space)) {
 		diag_set(ClientError, ER_CREATE_FOREIGN_KEY,
 			 constr->def.name, constr->space->def->name,
-			 "foreign key from non-temporary space"
-			 " can't refer to temporary space");
+			 "foreign key from non-data-temporary space"
+			 " can't refer to data-temporary space");
 		return -1;
 	}
 	if (space_is_local(foreign_space) && !space_is_local(space)) {
diff --git a/src/box/tuple_format.h b/src/box/tuple_format.h
index 94ecc5bc40..bd23b65655 100644
--- a/src/box/tuple_format.h
+++ b/src/box/tuple_format.h
@@ -245,7 +245,7 @@ struct tuple_format {
 	/** Reference counter */
 	int refs;
 	/**
-	 * Tuples of this format belong to a temporary space and
+	 * Tuples of this format belong to a data-temporary space and
 	 * hence can be freed immediately while checkpointing is
 	 * in progress.
 	 */
@@ -417,7 +417,7 @@ tuple_format_unref(struct tuple_format *format)
  * @param space_fields Array of fields, defined in a space format.
  * @param space_field_count Length of @a space_fields.
  * @param exact_field_count Exact field count for format.
- * @param is_temporary Set if format belongs to temporary space.
+ * @param is_temporary Set if format belongs to data-temporary space.
  * @param is_reusable Set if format may be reused.
  * @param constraint_def - Array of constraint definitions.
  * @param constraint_count - Number of constraints above.
diff --git a/src/box/txn.c b/src/box/txn.c
index a1b7d485b6..8fa1955f06 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -606,10 +606,10 @@ txn_commit_stmt(struct txn *txn, struct request *request)
 
 	/*
 	 * Create WAL record for the write requests in
-	 * non-temporary spaces. stmt->space can be NULL for
+	 * non-data-temporary spaces. stmt->space can be NULL for
 	 * IRPOTO_NOP or IPROTO_RAFT_CONFIRM.
 	 */
-	if (stmt->space == NULL || !space_is_temporary(stmt->space)) {
+	if (stmt->space == NULL || !space_is_data_temporary(stmt->space)) {
 		if (txn_add_redo(txn, stmt, request) != 0)
 			goto fail;
 		assert(stmt->row != NULL);
@@ -1307,10 +1307,10 @@ txn_check_space_linearizability(const struct txn *txn,
 	 * require checking whether **any** node in the replicaset has
 	 * committed something, which's impossible as soon as at least one node
 	 * becomes unavailable.
-	 * The only exception are local and temporary spaces, which only store
-	 * updates present on this particular node.
+	 * The only exception are local and data-temporary spaces, which only
+	 * store updates present on this particular node.
 	 */
-	if (!space_is_sync(space) && !space_is_temporary(space) &&
+	if (!space_is_sync(space) && !space_is_data_temporary(space) &&
 	    !space_is_local(space)) {
 		diag_set(ClientError, ER_UNSUPPORTED,
 			 tt_sprintf("space \"%s\"", space_name(space)),
diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index 03a3e275cf..6a5c1b1980 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -587,9 +587,10 @@ vinyl_engine_check_space_def(struct space_def *def)
 			return -1;
 		}
 	}
-	if (space_opts_is_temporary(&def->opts)) {
+	if (space_opts_is_data_temporary(&def->opts)) {
 		diag_set(ClientError, ER_ALTER_SPACE,
-			 def->name, "engine does not support temporary flag");
+			 def->name,
+			 "engine does not support data-temporary spaces");
 		return -1;
 	}
 	return 0;
diff --git a/src/box/wal.c b/src/box/wal.c
index 815d74da70..7b0ddb478f 100644
--- a/src/box/wal.c
+++ b/src/box/wal.c
@@ -969,7 +969,7 @@ wal_assign_lsn(struct vclock *vclock_diff, struct vclock *base,
 			 * instance id. This is also true for
 			 * anonymous replicas, since they are
 			 * only capable of writing to local and
-			 * temporary spaces.
+			 * data-temporary spaces.
 			 */
 			if ((*row)->group_id != GROUP_LOCAL)
 				(*row)->replica_id = instance_id;
diff --git a/src/lib/core/tt_sort.c b/src/lib/core/tt_sort.c
index 474dc94423..89d2d459d1 100644
--- a/src/lib/core/tt_sort.c
+++ b/src/lib/core/tt_sort.c
@@ -179,7 +179,7 @@ sort_bucket(va_list ap)
 		  worker->bucket_size, sort->elem_size,
 		  sort->cmp, sort->cmp_arg);
 
-	/* Move sorted data back from temporary space. */
+	/* Move sorted data back from data-temporary space. */
 	memcpy(sort->data + worker->bucket_begin * sort->elem_size,
 	       sort->buffer + worker->bucket_begin * sort->elem_size,
 	       worker->bucket_size * sort->elem_size);
diff --git a/test/box-luatest/gh_5616_temp_space_truncate_ro_test.lua b/test/box-luatest/gh_5616_temp_space_truncate_ro_test.lua
index 0dd944760f..e384e27543 100644
--- a/test/box-luatest/gh_5616_temp_space_truncate_ro_test.lua
+++ b/test/box-luatest/gh_5616_temp_space_truncate_ro_test.lua
@@ -21,7 +21,7 @@ g_single.after_each(function(cg)
     end)
 end)
 
--- Checks that a temporary space can be truncated in the read-only mode.
+-- Checks that a data-temporary space can be truncated in the read-only mode.
 g_single.test_temp_space_truncate_ro = function(cg)
     cg.server:exec(function()
         local s = box.schema.create_space('test', {temporary = true})
@@ -89,8 +89,8 @@ g_replication.after_each(function(cg)
     cg.replica:wait_for_vclock_of(cg.master)
 end)
 
--- Checks that a truncate operation for a temporary space isn't replicated to
--- a read-only replica.
+-- Checks that a truncate operation for a data-temporary space isn't replicated
+-- to a read-only replica.
 g_replication.test_temp_space_truncate_ro = function(cg)
     cg.master:exec(function()
         local s = box.schema.create_space('test', {temporary = true})
diff --git a/test/box/alter.result b/test/box/alter.result
index 17549523fb..96a322d062 100644
--- a/test/box/alter.result
+++ b/test/box/alter.result
@@ -1410,7 +1410,7 @@ s:alter({format = {{{1, 2, 3, 4}}}})
 - error: 'Illegal parameters, format[1]: name (string) is expected'
 ...
 --
--- Alter temporary.
+-- Alter data-temporary.
 --
 s:alter({temporary = true})
 ---
diff --git a/test/box/alter.test.lua b/test/box/alter.test.lua
index 2b1923358f..9eb3f19f40 100644
--- a/test/box/alter.test.lua
+++ b/test/box/alter.test.lua
@@ -560,7 +560,7 @@ s:alter({format = true})
 s:alter({format = {{{1, 2, 3, 4}}}})
 
 --
--- Alter temporary.
+-- Alter data-temporary.
 --
 s:alter({temporary = true})
 assert(s.temporary)
diff --git a/test/box/before_replace.result b/test/box/before_replace.result
index 34c94dcb7e..be73f6c506 100644
--- a/test/box/before_replace.result
+++ b/test/box/before_replace.result
@@ -834,7 +834,7 @@ s:drop()
 ---
 ...
 --
--- gh-4266 triggers on temporary space fail
+-- gh-4266 triggers on data-temporary space fail
 --
 s = box.schema.space.create('test', {temporary = true})
 ---
diff --git a/test/box/before_replace.test.lua b/test/box/before_replace.test.lua
index a29a0f1e9e..9f32f4a974 100644
--- a/test/box/before_replace.test.lua
+++ b/test/box/before_replace.test.lua
@@ -293,7 +293,7 @@ save_type
 s:drop()
 
 --
--- gh-4266 triggers on temporary space fail
+-- gh-4266 triggers on data-temporary space fail
 --
 s = box.schema.space.create('test', {temporary = true})
 
diff --git a/test/box/errinj.result b/test/box/errinj.result
index 105b11dfe2..6c2dd1ea27 100644
--- a/test/box/errinj.result
+++ b/test/box/errinj.result
@@ -1401,7 +1401,7 @@ _ = box.space.test:create_index('pk')
 for i = 1, 100 do box.space.test:insert{i} end
 ---
 ...
--- Create a temporary space.
+-- Create a data-temporary space.
 count = 500
 ---
 ...
@@ -1428,7 +1428,7 @@ box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', true)
 _ = fiber.create(function() box.snapshot() c:put(true) end)
 ---
 ...
--- Overwrite data stored in the temporary space while snapshot
+-- Overwrite data stored in the data-temporary space while snapshot
 -- is in progress to make sure that tuples stored in it are freed
 -- immediately.
 for i = 1, count do box.space.tmp:delete{i} end
diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua
index 438f3dcbee..78047408d6 100644
--- a/test/box/errinj.test.lua
+++ b/test/box/errinj.test.lua
@@ -468,7 +468,7 @@ _ = box.schema.space.create('test')
 _ = box.space.test:create_index('pk')
 for i = 1, 100 do box.space.test:insert{i} end
 
--- Create a temporary space.
+-- Create a data-temporary space.
 count = 500
 pad = string.rep('x', 100 * 1024)
 _ = box.schema.space.create('tmp', {temporary = true})
@@ -480,7 +480,7 @@ c = fiber.channel(1)
 box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', true)
 _ = fiber.create(function() box.snapshot() c:put(true) end)
 
--- Overwrite data stored in the temporary space while snapshot
+-- Overwrite data stored in the data-temporary space while snapshot
 -- is in progress to make sure that tuples stored in it are freed
 -- immediately.
 for i = 1, count do box.space.tmp:delete{i} end
diff --git a/test/box/on_replace.result b/test/box/on_replace.result
index 35a8422397..04f7dc541a 100644
--- a/test/box/on_replace.result
+++ b/test/box/on_replace.result
@@ -749,7 +749,7 @@ s:drop()
 ---
 ...
 --
--- gh-4266 triggers on temporary space fail
+-- gh-4266 triggers on data-temporary space fail
 --
 s = box.schema.space.create('test', {temporary = true})
 ---
diff --git a/test/box/on_replace.test.lua b/test/box/on_replace.test.lua
index 79c828dadb..e0da1869c3 100644
--- a/test/box/on_replace.test.lua
+++ b/test/box/on_replace.test.lua
@@ -299,7 +299,7 @@ save_type
 s:drop()
 
 --
--- gh-4266 triggers on temporary space fail
+-- gh-4266 triggers on data-temporary space fail
 --
 s = box.schema.space.create('test', {temporary = true})
 
diff --git a/test/box/temp_spaces.result b/test/box/temp_spaces.result
index eb4bdb3423..28cb1ded15 100644
--- a/test/box/temp_spaces.result
+++ b/test/box/temp_spaces.result
@@ -1,8 +1,8 @@
--- temporary spaces
+-- data-temporary spaces
 _space = box.space._space
 ---
 ...
--- not a temporary
+-- not a data-temporary
 FLAGS = 6
 ---
 ...
@@ -16,7 +16,7 @@ s.temporary
 s:drop()
 ---
 ...
--- not a temporary, too
+-- not a data-temporary, too
 s = box.schema.space.create('t', { temporary = false })
 ---
 ...
@@ -27,7 +27,7 @@ s.temporary
 s:drop()
 ---
 ...
--- not a temporary, too
+-- not a data-temporary, too
 s = box.schema.space.create('t', { temporary = nil })
 ---
 ...
@@ -65,14 +65,14 @@ s.temporary
 ...
 _ = _space:update(s.id, {{'=', FLAGS, {temporary = false}}})
 ---
-- error: 'Can''t modify space ''t'': can not switch temporary flag on a non-empty
+- error: 'Can''t modify space ''t'': can not change data-temporariness on a non-empty
     space'
 ...
 s.temporary
 ---
 - true
 ...
--- check that temporary space can be modified in read-only mode (gh-1378)
+-- check that data-temporary space can be modified in read-only mode (gh-1378)
 box.cfg{read_only=true}
 ---
 ...
diff --git a/test/box/temp_spaces.test.lua b/test/box/temp_spaces.test.lua
index 4d9f680bd7..0f8d4346ef 100644
--- a/test/box/temp_spaces.test.lua
+++ b/test/box/temp_spaces.test.lua
@@ -1,17 +1,17 @@
--- temporary spaces
+-- data-temporary spaces
 _space = box.space._space
--- not a temporary
+-- not a data-temporary
 FLAGS = 6
 s = box.schema.space.create('t', { temporary = true })
 s.temporary
 s:drop()
 
--- not a temporary, too
+-- not a data-temporary, too
 s = box.schema.space.create('t', { temporary = false })
 s.temporary
 s:drop()
 
--- not a temporary, too
+-- not a data-temporary, too
 s = box.schema.space.create('t', { temporary = nil })
 s.temporary
 s:drop()
@@ -28,7 +28,7 @@ s.temporary
 _ = _space:update(s.id, {{'=', FLAGS, {temporary = false}}})
 s.temporary
 
--- check that temporary space can be modified in read-only mode (gh-1378)
+-- check that data-temporary space can be modified in read-only mode (gh-1378)
 box.cfg{read_only=true}
 box.cfg.read_only
 s:insert{2, 3, 4}
diff --git a/test/engine-luatest/gh_8936_foreign_key_wrong_reference_test.lua b/test/engine-luatest/gh_8936_foreign_key_wrong_reference_test.lua
index 1f2a8bfc20..de23bf5f63 100644
--- a/test/engine-luatest/gh_8936_foreign_key_wrong_reference_test.lua
+++ b/test/engine-luatest/gh_8936_foreign_key_wrong_reference_test.lua
@@ -1,5 +1,5 @@
 -- https://github.com/tarantool/tarantool/issues/8936
--- Test foreign keys to temporary and local spaces.
+-- Test foreign keys to data-temporary and local spaces.
 local server = require('luatest.server')
 local t = require('luatest')
 
@@ -37,7 +37,7 @@ g.after_each(function(cg)
     end)
 end)
 
--- Foreign key must not refer to temporary space from normal space.
+-- Foreign key must not refer to data-temporary space from normal space.
 g.test_field_foreign_key_temporary = function(cg)
     local engine = cg.params.engine
     local country_is_temporary = cg.params.country_variant
@@ -46,7 +46,8 @@ g.test_field_foreign_key_temporary = function(cg)
     t.skip_if(engine == 'vinyl')
 
     cg.server:exec(function(engine, country_is_temporary, city_is_temporary)
-        -- foreign key must not point for non-temporary to temporary space.
+        -- foreign key must not point for non-data-temporary to data-temporary
+        -- space.
         local must_be_prohibited =
             country_is_temporary and not city_is_temporary
 
@@ -72,8 +73,8 @@ g.test_field_foreign_key_temporary = function(cg)
         if must_be_prohibited then
             t.assert_error_msg_content_equals(
                 "Failed to create foreign key 'country' in space 'city': " ..
-                "foreign key from non-temporary space " ..
-                "can't refer to temporary space",
+                "foreign key from non-data-temporary space " ..
+                "can't refer to data-temporary space",
                 box.schema.create_space, 'city', city_opts
             )
             return nil
@@ -87,8 +88,8 @@ g.test_field_foreign_key_temporary = function(cg)
         if country_is_temporary and city_is_temporary then
             t.assert_error_msg_content_equals(
                 "Failed to create foreign key 'country' in space 'city': " ..
-                "foreign key from non-temporary space " ..
-                "can't refer to temporary space",
+                "foreign key from non-data-temporary space " ..
+                "can't refer to data-temporary space",
                 city.alter, city, {temporary = false}
             )
             country:alter{temporary = false}
@@ -97,7 +98,8 @@ g.test_field_foreign_key_temporary = function(cg)
         if not country_is_temporary and not city_is_temporary then
             t.assert_error_msg_content_equals(
                 "Can't modify space 'country': foreign key 'country' from " ..
-                "non-temporary space 'city' can't refer to temporary space",
+                "non-data-temporary space 'city' can't refer to " ..
+                "data-temporary space",
                 country.alter, country, {temporary = true}
             )
             city:alter{temporary = true}
@@ -142,7 +144,8 @@ g.test_field_foreign_key_local = function(cg)
     local city_is_local = cg.params.city_variant
 
     cg.server:exec(function(engine, country_is_local, city_is_local)
-        -- foreign key must not point for non-temporary to temporary space.
+        -- foreign key must not point for non-data-temporary to data-temporary
+        -- space.
         local must_be_prohibited =
             country_is_local and not city_is_local
 
diff --git a/test/replication/local_spaces.result b/test/replication/local_spaces.result
index 4855d8a889..0f07cc28a3 100644
--- a/test/replication/local_spaces.result
+++ b/test/replication/local_spaces.result
@@ -55,8 +55,8 @@ box.space._space:insert{9000, 1, 'test', engine, 0, {group_id = 2}, {}} -- error
 ---
 - error: Replication group '2' does not exist
 ...
--- Temporary local spaces should behave in the same fashion as
--- plain temporary spaces, i.e. neither replicated nor persisted.
+-- Data-temporary local spaces should behave in the same fashion as
+-- plain data-temporary spaces, i.e. neither replicated nor persisted.
 s3 = box.schema.space.create('test3', {is_local = true, temporary = true})
 ---
 ...
@@ -71,7 +71,7 @@ s3.temporary
 ---
 - true
 ...
--- gh-4263 The truncation of the local & temporary space
+-- gh-4263 The truncation of the local & data-temporary space
 -- should not spread among the replicas
 s4 = box.schema.space.create('test4', {is_local = true})
 ---
diff --git a/test/replication/local_spaces.test.lua b/test/replication/local_spaces.test.lua
index c5e2240302..6c98bf436f 100644
--- a/test/replication/local_spaces.test.lua
+++ b/test/replication/local_spaces.test.lua
@@ -26,14 +26,14 @@ box.space._space:update(s2.id, {{'=', 6, {group_id = 0}}}) -- error
 -- 0 (global) and 1 (local)
 box.space._space:insert{9000, 1, 'test', engine, 0, {group_id = 2}, {}} -- error
 
--- Temporary local spaces should behave in the same fashion as
--- plain temporary spaces, i.e. neither replicated nor persisted.
+-- Data-temporary local spaces should behave in the same fashion as
+-- plain data-temporary spaces, i.e. neither replicated nor persisted.
 s3 = box.schema.space.create('test3', {is_local = true, temporary = true})
 _ = s3:create_index('pk')
 s3.is_local
 s3.temporary
 
--- gh-4263 The truncation of the local & temporary space
+-- gh-4263 The truncation of the local & data-temporary space
 -- should not spread among the replicas
 s4 = box.schema.space.create('test4', {is_local = true})
 _ = s4:create_index('pk')
diff --git a/test/sql/misc.result b/test/sql/misc.result
index adfb1a443b..c46bee4e24 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -136,7 +136,7 @@ box.execute('SELECT X\'4D6564766564\'')
   - [!!binary TWVkdmVk]
 ...
 --
--- gh-4139: assertion when reading a temporary space.
+-- gh-4139: assertion when reading a data-temporary space.
 --
 format = {{name = 'id', type = 'integer'}}
 ---
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 7ed0b86c39..43098fac66 100644
--- a/test/sql/misc.test.lua
+++ b/test/sql/misc.test.lua
@@ -31,7 +31,7 @@ box.execute('SELECT \'abc\';')
 box.execute('SELECT X\'4D6564766564\'')
 
 --
--- gh-4139: assertion when reading a temporary space.
+-- gh-4139: assertion when reading a data-temporary space.
 --
 format = {{name = 'id', type = 'integer'}}
 s = box.schema.space.create('s',{format=format, temporary=true})
diff --git a/test/unit/memtx_allocator.cc b/test/unit/memtx_allocator.cc
index 2cd830d21b..c5e1943035 100644
--- a/test/unit/memtx_allocator.cc
+++ b/test/unit/memtx_allocator.cc
@@ -318,7 +318,7 @@ test_temp_tuple_gc()
 	struct tuple *tuple12 = alloc_tuple();
 	struct tuple *tuple13 = alloc_tuple();
 	struct tuple *tuple14 = alloc_tuple();
-	opts.enable_temporary_spaces = false;
+	opts.enable_data_temporary_spaces = false;
 	memtx_allocators_read_view rv1 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 8, "count after rv1 opened");
 	free_tuple(temp_tuple11);
@@ -329,7 +329,7 @@ test_temp_tuple_gc()
 	struct tuple *tuple22 = alloc_tuple();
 	struct tuple *tuple23 = alloc_tuple();
 	struct tuple *tuple24 = alloc_tuple();
-	opts.enable_temporary_spaces = true;
+	opts.enable_data_temporary_spaces = true;
 	memtx_allocators_read_view rv2 = memtx_allocators_open_read_view(&opts);
 	/* temp_tuple11 is freed */
 	is(alloc_tuple_count(), 13, "count after rv2 opened");
@@ -341,7 +341,7 @@ test_temp_tuple_gc()
 	struct tuple *temp_tuple34 = alloc_temp_tuple();
 	struct tuple *tuple33 = alloc_tuple();
 	struct tuple *tuple34 = alloc_tuple();
-	opts.enable_temporary_spaces = false;
+	opts.enable_data_temporary_spaces = false;
 	memtx_allocators_read_view rv3 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 17, "count after rv3 opened");
 	free_tuple(temp_tuple13);
@@ -352,7 +352,7 @@ test_temp_tuple_gc()
 	free_tuple(tuple33);
 	struct tuple *temp_tuple44 = alloc_temp_tuple();
 	struct tuple *tuple44 = alloc_tuple();
-	opts.enable_temporary_spaces = true;
+	opts.enable_data_temporary_spaces = true;
 	memtx_allocators_read_view rv4 = memtx_allocators_open_read_view(&opts);
 	/* temp_tuple33 is freed */
 	is(alloc_tuple_count(), 18, "count after rv4 opened");
@@ -402,14 +402,14 @@ test_reuse_read_view()
 	is(alloc_tuple_count(), 0, "count before alloc");
 	struct tuple *tuple1 = alloc_tuple();
 	struct tuple *temp_tuple1 = alloc_temp_tuple();
-	opts.enable_temporary_spaces = false;
+	opts.enable_data_temporary_spaces = false;
 	memtx_allocators_read_view rv1 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 2, "count after rv1 opened");
 	free_tuple(tuple1);
 	free_tuple(temp_tuple1);
 	struct tuple *tuple2 = alloc_tuple();
 	struct tuple *temp_tuple2 = alloc_temp_tuple();
-	opts.enable_temporary_spaces = true;
+	opts.enable_data_temporary_spaces = true;
 	memtx_allocators_read_view rv2 = memtx_allocators_open_read_view(&opts);
 	/* temp_tuple1 is freed */
 	is(alloc_tuple_count(), 3, "count after rv2 opened");
@@ -417,21 +417,21 @@ test_reuse_read_view()
 	free_tuple(temp_tuple2);
 	struct tuple *tuple3 = alloc_tuple();
 	struct tuple *temp_tuple3 = alloc_temp_tuple();
-	opts.enable_temporary_spaces = true;
+	opts.enable_data_temporary_spaces = true;
 	memtx_allocators_read_view rv3 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 5, "count after rv3 opened");
 	free_tuple(tuple3);
 	free_tuple(temp_tuple3);
 	struct tuple *tuple4 = alloc_tuple();
 	struct tuple *temp_tuple4 = alloc_temp_tuple();
-	opts.enable_temporary_spaces = false;
+	opts.enable_data_temporary_spaces = false;
 	memtx_allocators_read_view rv4 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 7, "count after rv4 opened");
 	free_tuple(tuple4);
 	free_tuple(temp_tuple4);
 	struct tuple *tuple5 = alloc_tuple();
 	struct tuple *temp_tuple5 = alloc_temp_tuple();
-	opts.enable_temporary_spaces = false;
+	opts.enable_data_temporary_spaces = false;
 	memtx_allocators_read_view rv5 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 9, "count after rv5 opened");
 	free_tuple(tuple5);
@@ -439,7 +439,7 @@ test_reuse_read_view()
 	thread_sleep(0.2);
 	struct tuple *tuple6 = alloc_tuple();
 	struct tuple *temp_tuple6 = alloc_temp_tuple();
-	opts.enable_temporary_spaces = true;
+	opts.enable_data_temporary_spaces = true;
 	memtx_allocators_read_view rv6 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 11, "count after rv6 opened");
 	free_tuple(tuple6);
@@ -447,7 +447,7 @@ test_reuse_read_view()
 	thread_sleep(0.2);
 	struct tuple *tuple7 = alloc_tuple();
 	struct tuple *temp_tuple7 = alloc_temp_tuple();
-	opts.enable_temporary_spaces = false;
+	opts.enable_data_temporary_spaces = false;
 	memtx_allocators_read_view rv7 = memtx_allocators_open_read_view(&opts);
 	is(alloc_tuple_count(), 13, "count after rv7 opened");
 	free_tuple(tuple7);
diff --git a/test/vinyl/gh.result b/test/vinyl/gh.result
index 1cad352789..fa75dfd316 100644
--- a/test/vinyl/gh.result
+++ b/test/vinyl/gh.result
@@ -72,10 +72,10 @@ s:insert{'a'}
 s:drop()
 ---
 ...
--- gh-436: No error when creating temporary vinyl space
+-- gh-436: No error when creating data-temporary vinyl space
 s = box.schema.space.create('tester',{engine='vinyl', temporary=true})
 ---
-- error: 'Can''t modify space ''tester'': engine does not support temporary flag'
+- error: 'Can''t modify space ''tester'': engine does not support data-temporary spaces'
 ...
 -- gh-432: ignored limit
 s = box.schema.space.create('tester',{engine='vinyl'})
diff --git a/test/vinyl/gh.test.lua b/test/vinyl/gh.test.lua
index 3a9014e073..9c7d7205c6 100644
--- a/test/vinyl/gh.test.lua
+++ b/test/vinyl/gh.test.lua
@@ -29,7 +29,7 @@ s:insert{'a'}
 s:drop()
 
 
--- gh-436: No error when creating temporary vinyl space
+-- gh-436: No error when creating data-temporary vinyl space
 s = box.schema.space.create('tester',{engine='vinyl', temporary=true})
 
 
-- 
GitLab