[Tarantool-patches] [PATCH v4 4/4] replication: do not relay rows coming from a remote instance back to it

sergepetrenko sergepetrenko at tarantool.org
Wed Feb 26 13:00:09 MSK 2020


From: Serge Petrenko <sergepetrenko at tarantool.org>

We have a mechanism for restoring rows originating from an instance that
suffered a sudden power loss: remote masters resend the isntance's rows
received before a certain point in time, defined by remote master vclock
at the moment of subscribe.
However, this is useful only on initial replication configuraiton, when
an instance has just recovered, so that it can receive what it has
relayed but haven't synced to disk.
In other cases, when an instance is operating normally and master-master
replication is configured, the mechanism described above may lead to
instance re-applying instance's own rows, coming from a master it has just
subscribed to.
To fix the problem do not relay rows coming from a remote instance, if
the instance has already recovered.

Closes #4739
---
 src/box/applier.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/box/applier.cc b/src/box/applier.cc
index 911353425..1a07d71a9 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -866,8 +866,9 @@ applier_subscribe(struct applier *applier)
 	struct vclock vclock;
 	vclock_create(&vclock);
 	vclock_copy(&vclock, &replicaset.vclock);
+	unsigned int id_mask = box_is_orphan() ? 0 : 1 << instance_id;
 	xrow_encode_subscribe_xc(&row, &REPLICASET_UUID, &INSTANCE_UUID,
-				 &vclock, replication_anon, 0);
+				 &vclock, replication_anon, id_mask);
 	coio_write_xrow(coio, &row);
 
 	/* Read SUBSCRIBE response */
-- 
2.20.1 (Apple Git-117)



More information about the Tarantool-patches mailing list