Tarantool development patches archive
 help / color / mirror / Atom feed
From: Georgy Kirichenko <georgy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Georgy Kirichenko <georgy@tarantool.org>
Subject: [tarantool-patches] [PATCH 4/5] Emit NOP if an applier skips row
Date: Fri,  4 Jan 2019 13:34:14 +0300	[thread overview]
Message-ID: <4f7b4d6b6625186eada32818305f93cdec4ae8d0.1546593619.git.georgy@tarantool.org> (raw)
In-Reply-To: <cover.1546593619.git.georgy@tarantool.org>

Fill lsn gaps with NOPs if applier configured to skip conflicting
rows.

Needed for: #980
---
 src/box/applier.cc | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/box/applier.cc b/src/box/applier.cc
index fbceadb2b..b05d72c73 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -527,23 +527,26 @@ applier_subscribe(struct applier *applier)
 						     row.replica_id);
 			vclock_follow_xrow(&replicaset.applier.vclock, &row);
 			int res = xstream_write(applier->subscribe_stream, &row);
-			if (res != 0) {
-				struct error *e = diag_last_error(diag_get());
+			struct error *e = diag_last_error(diag_get());
+			if (res != 0 && e->type == &type_ClientError &&
+			    box_error_code(e) == ER_TUPLE_FOUND &&
+			    replication_skip_conflict) {
 				/**
 				 * Silently skip ER_TUPLE_FOUND error if such
 				 * option is set in config.
 				 */
-				if (e->type == &type_ClientError &&
-				    box_error_code(e) == ER_TUPLE_FOUND &&
-				    replication_skip_conflict)
-					diag_clear(diag_get());
-				else {
-					/* Rollback lsn to have a chance for a retry. */
-					vclock_set(&replicaset.applier.vclock,
-						   row.replica_id, old_lsn);
-					latch_unlock(latch);
-					diag_raise();
-				}
+				diag_clear(diag_get());
+				row.type = IPROTO_NOP;
+				row.bodycnt = 0;
+				res = xstream_write(applier->subscribe_stream,
+						    &row);
+			}
+			if (res != 0) {
+				/* Rollback lsn to have a chance for a retry. */
+				vclock_set(&replicaset.applier.vclock,
+					   row.replica_id, old_lsn);
+				latch_unlock(latch);
+				diag_raise();
 			}
 		}
 		latch_unlock(latch);
-- 
2.20.1

  parent reply	other threads:[~2019-01-04 10:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-04 10:34 [tarantool-patches] [PATCH 0/5] Strong sequentially LSN in journal Georgy Kirichenko
2019-01-04 10:34 ` [tarantool-patches] [PATCH 1/5] Do not promote wal vclock for failed writes Georgy Kirichenko
2019-01-04 10:34 ` [tarantool-patches] [PATCH 2/5] Update replicaset vclock from wal Georgy Kirichenko
2019-01-04 10:34 ` [tarantool-patches] [PATCH 3/5] Enforce applier out of order protection Georgy Kirichenko
2019-01-04 10:34 ` Georgy Kirichenko [this message]
2019-01-04 10:34 ` [tarantool-patches] [PATCH 5/5] Disallow lsn gaps while vclock following Georgy Kirichenko
2019-01-11 13:31 ` [tarantool-patches] Re: [PATCH 0/5] Strong sequentially LSN in journal Georgy Kirichenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f7b4d6b6625186eada32818305f93cdec4ae8d0.1546593619.git.georgy@tarantool.org \
    --to=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 4/5] Emit NOP if an applier skips row' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox