From e279e65e22234214e558a2d72373c5994771eb80 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Thu, 3 Sep 2015 21:22:28 +0300
Subject: [PATCH] replication: remove redundancy in error messages

---
 src/box/relay.cc   |  2 +-
 src/box/replica.cc | 22 +++++++---------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/box/relay.cc b/src/box/relay.cc
index ee2fbc008e..0f28540b56 100644
--- a/src/box/relay.cc
+++ b/src/box/relay.cc
@@ -89,6 +89,7 @@ replication_join_f(va_list ap)
 	/* Send snapshot */
 	engine_join(relay);
 
+	say_info("snapshot sent");
 }
 
 void
@@ -115,7 +116,6 @@ replication_join(int fd, struct xrow_header *packet,
 	struct xrow_header row;
 	xrow_encode_vclock(&row, vclockset_last(&r->snap_dir.index));
 	relay_send(&relay, &row);
-	say_info("snapshot sent");
 }
 
 static void
diff --git a/src/box/replica.cc b/src/box/replica.cc
index 8ced5ca715..33623f4113 100644
--- a/src/box/replica.cc
+++ b/src/box/replica.cc
@@ -114,10 +114,8 @@ replica_connect(struct replica *replica, struct ev_io *coio,
 	assert(coio->fd >= 0);
 	coio_readn(coio, greeting, sizeof(greeting));
 
-	if (!replica->warning_said) {
-		say_info("connected to %s", sio_strfaddr(&replica->addr,
-			 replica->addr_len));
-	}
+	say_info("connected to %s",
+		 sio_strfaddr(&replica->addr, replica->addr_len));
 
 	/* Don't display previous error messages in box.info.replication */
 	diag_clear(&fiber()->diag);
@@ -150,10 +148,8 @@ static void
 replica_process_join(struct replica *replica, struct recovery_state *r,
 		    struct ev_io *coio, struct iobuf *iobuf)
 {
-	if (!replica->warning_said) {
-		say_info("bootstrapping a replica from %s",
-			 sio_strfaddr(&replica->addr, replica->addr_len));
-	}
+	say_info("downloading a snapshot from %s",
+		 sio_strfaddr(&replica->addr, replica->addr_len));
 
 	/* Send JOIN request */
 	struct xrow_header row;
@@ -198,11 +194,6 @@ static void
 replica_process_subscribe(struct replica *replica, struct recovery_state *r,
 			 struct ev_io *coio, struct iobuf *iobuf)
 {
-	if (!replica->warning_said) {
-		say_info("subscribing to updates from %s",
-			 sio_strfaddr(&replica->addr, replica->addr_len));
-	}
-
 	/* Send SUBSCRIBE request */
 	struct xrow_header row;
 	xrow_encode_subscribe(&row, &cluster_id, &r->server_uuid, &r->vclock);
@@ -351,7 +342,8 @@ replica_start(struct replica *replica, struct recovery_state *r)
 	assert(replica->reader == NULL);
 
 	const char *uri = uri_format(&replica->uri);
-	say_info("starting replication from %s", uri);
+	if (replica->io.fd < 0)
+		say_crit("starting replication from %s", uri);
 	snprintf(name, sizeof(name), "replica/%s", uri);
 
 	struct fiber *f = fiber_new(name, pull_from_replica);
@@ -371,7 +363,7 @@ replica_stop(struct replica *replica)
 	if (f == NULL)
 		return;
 	const char *uri = uri_format(&replica->uri);
-	say_info("shutting down replica %s", uri);
+	say_crit("shutting down replica %s", uri);
 	fiber_cancel(f);
 	/**
 	 * If the replica died from an exception, don't throw it
-- 
GitLab