Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] replication: freeze join vclock before read view
@ 2019-10-26  0:17 Ilya Kosarev
  0 siblings, 0 replies; only message in thread
From: Ilya Kosarev @ 2019-10-26  0:17 UTC (permalink / raw)
  To: tarantool-patches; +Cc: v.shpilevoy

join_vclock test could fail on huge load due to vclock advance
comparing to an actual WAL. Now we are freezing vclock before read view
freeze & WAL sync. It is also better to get max index and index count
in single request in join_vclock test. With fixes mentioned above it is
not fragile anymore.

Closes #4160
---
https://github.com/tarantool/tarantool/tree/i.kosarev/gh-4160-fix-join-vclock
https://github.com/tarantool/tarantool/issues/4160

 src/box/relay.cc                      | 4 ++--
 test/replication/join_vclock.result   | 5 +----
 test/replication/join_vclock.test.lua | 3 +--
 test/replication/suite.ini            | 1 -
 4 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/box/relay.cc b/src/box/relay.cc
index 74588cba7..ee23dd2aa 100644
--- a/src/box/relay.cc
+++ b/src/box/relay.cc
@@ -298,6 +298,8 @@ relay_initial_join(int fd, uint64_t sync, struct vclock *vclock)
 		relay_delete(relay);
 	});
 
+	vclock_copy(vclock, &replicaset.vclock);
+
 	/* Freeze a read view in engines. */
 	struct engine_join_ctx ctx;
 	engine_prepare_join_xc(&ctx);
@@ -312,8 +314,6 @@ relay_initial_join(int fd, uint64_t sync, struct vclock *vclock)
 	if (wal_sync() != 0)
 		diag_raise();
 
-	vclock_copy(vclock, &replicaset.vclock);
-
 	/* Respond to the JOIN request with the current vclock. */
 	struct xrow_header row;
 	xrow_encode_vclock_xc(&row, vclock);
diff --git a/test/replication/join_vclock.result b/test/replication/join_vclock.result
index a9781073d..d6d9af783 100644
--- a/test/replication/join_vclock.result
+++ b/test/replication/join_vclock.result
@@ -67,10 +67,7 @@ test_run:cmd("switch replica1")
 ---
 - true
 ...
-cnt = box.space.test.index[0]:count()
----
-...
-box.space.test.index.primary:max()[1] == cnt - 1
+box.space.test.index.primary:max()[1] == box.space.test.index.primary:count() - 1
 ---
 - true
 ...
diff --git a/test/replication/join_vclock.test.lua b/test/replication/join_vclock.test.lua
index 0b60dffc2..a813ba31f 100644
--- a/test/replication/join_vclock.test.lua
+++ b/test/replication/join_vclock.test.lua
@@ -26,8 +26,7 @@ ch:get()
 
 errinj.set("ERRINJ_RELAY_FINAL_SLEEP", false)
 test_run:cmd("switch replica1")
-cnt = box.space.test.index[0]:count()
-box.space.test.index.primary:max()[1] == cnt - 1
+box.space.test.index.primary:max()[1] == box.space.test.index.primary:count() - 1
 test_run:cmd("switch default")
 
 replica_set.drop_all(test_run)
diff --git a/test/replication/suite.ini b/test/replication/suite.ini
index 384dac677..ed1de3140 100644
--- a/test/replication/suite.ini
+++ b/test/replication/suite.ini
@@ -12,7 +12,6 @@ long_run = prune.test.lua
 is_parallel = True
 pretest_clean = True
 fragile = errinj.test.lua            ; gh-3870
-          join_vclock.test.lua       ; gh-4160
           long_row_timeout.test.lua  ; gh-4351
           skip_conflict_row.test.lua ; gh-4457
           sync.test.lua              ; gh-3835 gh-3877
-- 
2.17.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-26  0:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-26  0:17 [Tarantool-patches] [PATCH] replication: freeze join vclock before read view Ilya Kosarev

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