From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp10.mail.ru (smtp10.mail.ru [94.100.181.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4B21D4696C4 for ; Wed, 26 Feb 2020 13:00:38 +0300 (MSK) From: sergepetrenko Date: Wed, 26 Feb 2020 13:00:09 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v4 4/4] replication: do not relay rows coming from a remote instance back to it List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kirichenkoga@gmail.com, kostja.osipov@gmail.com, v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org Cc: tarantool-patches@dev.tarantool.org From: Serge Petrenko 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)