[PATCH] replication: print master uuid when (re)bootstrapping

Vladimir Davydov vdavydov.dev at gmail.com
Fri Jul 27 19:13:05 MSK 2018


Currently only the remote address is printed. Let's also print the UUID,
because replicas are identified by UUID everywhere in tarantool, not by
the address. An example of the output is below:

  I> can't follow eb81a67e-99ee-40bb-8601-99b03fa20124 at [::1]:58083: required {1: 8} available {1: 12}
  C> replica is too old, initiating rebootstrap
  I> bootstrapping replica from eb81a67e-99ee-40bb-8601-99b03fa20124 at [::1]:58083

  I> can't follow eb81a67e-99ee-40bb-8601-99b03fa20124 at [::1]:58083: required {1: 17, 2: 1} available {1: 20}
  I> can't rebootstrap from eb81a67e-99ee-40bb-8601-99b03fa20124 at [::1]:58083: replica has local rows: local {1: 17, 2: 1} remote {1: 23}
  I> recovery start

Suggested by @kostja.

Follow-up ea69a0cd12d8 ("replication: rebootstrap instance on startup
if it fell behind").
---
https://github.com/tarantool/tarantool/commits/dv/print-replica-uuid-to-log
https://www.freelists.org/post/tarantool-patches/PATCH-v3-0711-replication-rebootstrap-instance-on-startup-if-it-fell-behind,3

 src/box/box.cc         |  3 ++-
 src/box/replication.cc | 10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index ae4959d6..ee12d573 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -1703,7 +1703,8 @@ bootstrap_from_master(struct replica *master)
 	applier_resume_to_state(applier, APPLIER_READY, TIMEOUT_INFINITY);
 	assert(applier->state == APPLIER_READY);
 
-	say_info("bootstrapping replica from %s",
+	say_info("bootstrapping replica from %s at %s",
+		 tt_uuid_str(&master->uuid),
 		 sio_strfaddr(&applier->addr, applier->addr_len));
 
 	/*
diff --git a/src/box/replication.cc b/src/box/replication.cc
index 48956d2e..26bbbe32 100644
--- a/src/box/replication.cc
+++ b/src/box/replication.cc
@@ -659,14 +659,15 @@ replicaset_needs_rejoin(struct replica **master)
 			return false;
 		}
 
+		const char *uuid_str = tt_uuid_str(&replica->uuid);
 		const char *addr_str = sio_strfaddr(&applier->addr,
 						applier->addr_len);
 		char *local_vclock_str = vclock_to_string(&replicaset.vclock);
 		char *remote_vclock_str = vclock_to_string(&ballot->vclock);
 		char *gc_vclock_str = vclock_to_string(&ballot->gc_vclock);
 
-		say_info("can't follow %s: required %s available %s",
-			 addr_str, local_vclock_str, gc_vclock_str);
+		say_info("can't follow %s at %s: required %s available %s",
+			 uuid_str, addr_str, local_vclock_str, gc_vclock_str);
 
 		if (vclock_compare(&replicaset.vclock, &ballot->vclock) > 0) {
 			/*
@@ -674,9 +675,10 @@ replicaset_needs_rejoin(struct replica **master)
 			 * the master. Don't rebootstrap as we don't want
 			 * to lose any data.
 			 */
-			say_info("can't rebootstrap from %s: "
+			say_info("can't rebootstrap from %s at %s: "
 				 "replica has local rows: local %s remote %s",
-				 addr_str, local_vclock_str, remote_vclock_str);
+				 uuid_str, addr_str, local_vclock_str,
+				 remote_vclock_str);
 			goto next;
 		}
 
-- 
2.11.0




More information about the Tarantool-patches mailing list