Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 1/3] box: ignore read-only mode for replica local spaces
Date: Tue, 10 Jul 2018 16:43:25 +0300	[thread overview]
Message-ID: <f4504bd30a74b6d7ced13007d642b3acb3a1119b.1531229587.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1531229587.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1531229587.git.vdavydov.dev@gmail.com>

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

  reply	other threads:[~2018-07-10 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 13:43 [PATCH 0/3] Follow-up on " Vladimir Davydov
2018-07-10 13:43 ` Vladimir Davydov [this message]
2018-07-10 13:43 ` [PATCH 2/3] test: check that is_local flag has no effect on temporary spaces Vladimir Davydov
2018-07-10 13:43 ` [PATCH 3/3] vinyl: implement support of replica local spaces Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4504bd30a74b6d7ced13007d642b3acb3a1119b.1531229587.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 1/3] box: ignore read-only mode for replica local spaces' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox