From d56371aa256d871fde33992819de440c1ff0a450 Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tsisyk.com>
Date: Thu, 17 Jul 2014 17:53:47 +0400
Subject: [PATCH] Fix #245: title 'primary' is meaningless in master-master
 mode

---
 src/box/box.cc                |  4 ++--
 src/box/replica.cc            |  4 +++-
 test/box/info.result          |  2 +-
 test/lib/tarantool_server.py  |  2 +-
 test/replication/suite.ini    |  2 +-
 test/replication/swap.test.py | 12 ++++++------
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index 6e01eb8402..ee934b615e 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -233,8 +233,8 @@ box_leave_local_standby_mode(void *data __attribute__((unused)))
 	if (recovery_has_remote(recovery_state))
 		recovery_follow_remote(recovery_state);
 
-	title("primary", NULL);
-	say_info("I am primary");
+	title("running", NULL);
+	say_info("ready to accept requests");
 }
 
 /**
diff --git a/src/box/replica.cc b/src/box/replica.cc
index b4699a317c..bb9a997587 100644
--- a/src/box/replica.cc
+++ b/src/box/replica.cc
@@ -189,7 +189,9 @@ replica_bootstrap(struct recovery_state *r)
 static void
 remote_set_status(struct remote *remote, const char *status)
 {
-	title("replica", "%s/%s", uri_to_string(&remote->uri), status);
+	(void) remote;
+	(void) status;
+	/* title("replica", "%s/%s", uri_to_string(&remote->uri), status); */
 }
 
 static void
diff --git a/test/box/info.result b/test/box/info.result
index 42cbbf4313..a015c6c0f6 100644
--- a/test/box/info.result
+++ b/test/box/info.result
@@ -38,7 +38,7 @@ box.info.recovery_last_update
 ...
 box.info.status
 ---
-- primary
+- running
 ...
 string.len(box.info.build.target) > 0
 ---
diff --git a/test/lib/tarantool_server.py b/test/lib/tarantool_server.py
index 605140d790..332d37cbfd 100644
--- a/test/lib/tarantool_server.py
+++ b/test/lib/tarantool_server.py
@@ -525,7 +525,7 @@ class TarantoolServer(Server):
             try:
                 temp = AdminConnection('localhost', self.admin.port)
                 ans = yaml.load(temp.execute('box.info.status'))[0]
-                if ans in ('primary', 'hot_standby', 'orphan') or ans.startswith('replica'):
+                if ans in ('running', 'hot_standby', 'orphan'):
                     return True
                 else:
                     raise Exception("Strange output for `box.info.status`: %s" % (ans))
diff --git a/test/replication/suite.ini b/test/replication/suite.ini
index ab9af45495..c0a179cce9 100644
--- a/test/replication/suite.ini
+++ b/test/replication/suite.ini
@@ -2,4 +2,4 @@
 core = tarantool
 script =  master.lua
 description = tarantool/box, replication
-disabled = consistent.test.lua
+disabled = consistent.test.lua status.test.py
diff --git a/test/replication/swap.test.py b/test/replication/swap.test.py
index 451bf93a2c..9ab5290684 100644
--- a/test/replication/swap.test.py
+++ b/test/replication/swap.test.py
@@ -39,12 +39,12 @@ replica.sql.py_con.authenticate(LOGIN, PASSWORD)
 master.admin("s = box.schema.create_space('tweedledum', {id = 0})")
 master.admin("s:create_index('primary', {type = 'hash'})")
 
-## gh-343: replica.cc must not add login and password to proc title
-status = replica.get_param("status")
-host_port = "%s:%s" % (HOST, master.sql.port)
-m = re.search(r'replica/(.*)/.*', status)
-if not m or m.group(1) != host_port:
-    print 'invalid box.info.status', status, 'expected host:port', host_port
+### gh-343: replica.cc must not add login and password to proc title
+#status = replica.get_param("status")
+#host_port = "%s:%s" % (HOST, master.sql.port)
+#m = re.search(r'replica/(.*)/.*', status)
+#if not m or m.group(1) != host_port:
+#    print 'invalid box.info.status', status, 'expected host:port', host_port
 
 master_id = master.get_param('node')['id']
 replica_id = replica.get_param('node')['id']
-- 
GitLab