From 9f77b4a4365fa23d2dc624c7b5062ce52b9d6fb4 Mon Sep 17 00:00:00 2001
From: Vladimir Davydov <vdavydov@tarantool.org>
Date: Thu, 18 Aug 2022 18:29:53 +0300
Subject: [PATCH] Store space names in database read view

We need to know space names to export a database read view to Lua.

Needed for https://github.com/tarantool/tarantool-ee/issues/139

NO_DOC=internal
NO_TEST=ee
NO_CHANGELOG=internal
---
 src/box/read_view.c | 2 ++
 src/box/read_view.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/box/read_view.c b/src/box/read_view.c
index c9abf4ae82..56358fba90 100644
--- a/src/box/read_view.c
+++ b/src/box/read_view.c
@@ -64,9 +64,11 @@ space_read_view_new(struct space *space, const struct read_view_opts *opts)
 				(space->index_id_max + 1);
 	struct grp_alloc all = grp_alloc_initializer();
 	grp_alloc_reserve_data(&all, sizeof(*space_rv));
+	grp_alloc_reserve_str0(&all, space_name(space));
 	grp_alloc_reserve_data(&all, index_map_size);
 	grp_alloc_use(&all, xmalloc(grp_alloc_size(&all)));
 	space_rv = grp_alloc_create_data(&all, sizeof(*space_rv));
+	space_rv->name = grp_alloc_create_str0(&all, space_name(space));
 	space_rv->index_map = grp_alloc_create_data(&all, index_map_size);
 	assert(grp_alloc_size(&all) == 0);
 
diff --git a/src/box/read_view.h b/src/box/read_view.h
index 821a1f6025..d6aa859f5f 100644
--- a/src/box/read_view.h
+++ b/src/box/read_view.h
@@ -25,6 +25,8 @@ struct space_read_view {
 	struct rlist link;
 	/** Space id. */
 	uint32_t id;
+	/** Space name. */
+	char *name;
 	/** Replication group id. See space_opts::group_id. */
 	uint32_t group_id;
 	/**
-- 
GitLab