[PATCH 1/3] box: ignore read-only mode for replica local spaces

Vladimir Davydov vdavydov.dev at gmail.com
Tue Jul 10 16:43:25 MSK 2018


Replica local spaces can't cause replication conflicts so we don't
really need to respect box.cfg.read_only for them (they are similar
to temporary spaces in this regard).

Follow-up #3443
---
 src/box/box.cc                         | 4 +++-
 test/replication/local_spaces.result   | 3 +++
 test/replication/local_spaces.test.lua | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index 15b84374..fba00a6f 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -976,7 +976,9 @@ box_process1(struct request *request, box_tuple_t **result)
 	struct space *space = space_cache_find(request->space_id);
 	if (space == NULL)
 		return -1;
-	if (!space_is_temporary(space) && box_check_writable() != 0)
+	if (!space_is_temporary(space) &&
+	    space_group_id(space) != GROUP_LOCAL &&
+	    box_check_writable() != 0)
 		return -1;
 	return process_rw(request, space, result);
 }
diff --git a/test/replication/local_spaces.result b/test/replication/local_spaces.result
index bbae2204..1ee04803 100644
--- a/test/replication/local_spaces.result
+++ b/test/replication/local_spaces.result
@@ -100,6 +100,9 @@ box.space.test2:select()
 ---
 - []
 ...
+box.cfg{read_only = true} -- local spaces ignore read_only
+---
+...
 for i = 1, 3 do box.space.test2:insert{i, i} end
 ---
 ...
diff --git a/test/replication/local_spaces.test.lua b/test/replication/local_spaces.test.lua
index 97443c03..40cb6f97 100644
--- a/test/replication/local_spaces.test.lua
+++ b/test/replication/local_spaces.test.lua
@@ -40,6 +40,7 @@ box.space.test1.is_local
 box.space.test2.is_local
 box.space.test1:select()
 box.space.test2:select()
+box.cfg{read_only = true} -- local spaces ignore read_only
 for i = 1, 3 do box.space.test2:insert{i, i} end
 
 test_run:cmd("switch default")
-- 
2.11.0




More information about the Tarantool-patches mailing list