[Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_SYNC_TIMEOUT

sergeyb at tarantool.org sergeyb at tarantool.org
Mon Jul 6 13:32:09 MSK 2020


From: Sergey Bronnikov <sergeyb at tarantool.org>

Some tests for synchronous replication requires creation of a special state
when replication_synchro_timeout is not exceeded. Greater timeout value will
make tests longer and increase probability of flakiness. When constant
ERRINJ_SYNC_TIMEOUT is set to true operation will stay in a state nor confirmed
nor rolled back.

Part of #5055
---
 src/box/replication.cc | 4 ++++
 src/lib/core/errinj.h  | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/box/replication.cc b/src/box/replication.cc
index ef0e2411d..675a76a7e 100644
--- a/src/box/replication.cc
+++ b/src/box/replication.cc
@@ -38,6 +38,7 @@
 
 #include "box.h"
 #include "gc.h"
+#include "errinj.h"
 #include "error.h"
 #include "relay.h"
 #include "vclock.h" /* VCLOCK_MAX */
@@ -866,6 +867,9 @@ replicaset_sync(void)
 	       replicaset.applier.loading >= quorum) {
 		if (fiber_cond_wait_deadline(&replicaset.applier.cond,
 					     deadline) != 0)
+			ERROR_INJECT(ERRINJ_SYNC_TIMEOUT, {
+				continue;
+			});
 			break;
 	}
 
diff --git a/src/lib/core/errinj.h b/src/lib/core/errinj.h
index 76b453003..43f6da6c2 100644
--- a/src/lib/core/errinj.h
+++ b/src/lib/core/errinj.h
@@ -147,6 +147,7 @@ struct errinj {
 	_(ERRINJ_AUTO_UPGRADE, ERRINJ_BOOL, {.bparam = false})\
 	_(ERRINJ_COIO_WRITE_CHUNK, ERRINJ_BOOL, {.bparam = false}) \
 	_(ERRINJ_APPLIER_SLOW_ACK, ERRINJ_BOOL, {.bparam = false}) \
+	_(ERRINJ_SYNC_TIMEOUT, ERRINJ_BOOL, {.bparam = false}) \
 
 ENUM0(errinj_id, ERRINJ_LIST);
 extern struct errinj errinjs[];
-- 
2.26.2



More information about the Tarantool-patches mailing list