[Tarantool-patches] [PATCH 2/3] replication: test clear_synchro_queue function
sergeyb at tarantool.org
sergeyb at tarantool.org
Thu Jul 9 20:16:45 MSK 2020
From: Sergey Bronnikov <sergeyb at tarantool.org>
Part of #5055
Part of #4849
---
test/replication/qsync_basic.result | 85 +++++++++++++++++++++++++++
test/replication/qsync_basic.test.lua | 31 ++++++++++
2 files changed, 116 insertions(+)
diff --git a/test/replication/qsync_basic.result b/test/replication/qsync_basic.result
index ab4be0c7e..464df75a7 100644
--- a/test/replication/qsync_basic.result
+++ b/test/replication/qsync_basic.result
@@ -32,6 +32,14 @@ s2.is_sync
| - false
| ...
+--
+-- gh-4849: clear synchro queue with unconfigured box
+--
+box.ctl.clear_synchro_queue()
+ | ---
+ | - -1
+ | ...
+
-- Net.box takes sync into account.
box.schema.user.grant('guest', 'super')
| ---
@@ -553,6 +561,82 @@ box.space.sync:select{7}
| - - [7]
| ...
+--
+-- gh-4849: clear synchro queue on a replica
+--
+test_run:switch('default')
+ | ---
+ | - true
+ | ...
+box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout = 2}
+ | ---
+ | ...
+f1 = fiber.create(box.space.sync.replace, box.space.sync, {9})
+ | ---
+ | ...
+f1:status()
+ | ---
+ | - suspended
+ | ...
+test_run:switch('replica')
+ | ---
+ | - true
+ | ...
+box.ctl.clear_synchro_queue()
+ | ---
+ | - 0
+ | ...
+box.space.sync:select{9}
+ | ---
+ | - []
+ | ...
+test_run:switch('default')
+ | ---
+ | - true
+ | ...
+box.space.sync:select{9}
+ | ---
+ | - []
+ | ...
+f1:status()
+ | ---
+ | - dead
+ | ...
+
+--
+-- gh-4849: clear synchro queue on a master
+--
+test_run:switch('default')
+ | ---
+ | - true
+ | ...
+box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout = 2}
+ | ---
+ | ...
+f1 = fiber.create(box.space.sync.replace, box.space.sync, {10})
+ | ---
+ | ...
+f1:status()
+ | ---
+ | - suspended
+ | ...
+box.ctl.clear_synchro_queue()
+ | ---
+ | - -2
+ | ...
+box.space.sync:select{10}
+ | ---
+ | - - [10]
+ | ...
+test_run:switch('replica')
+ | ---
+ | - true
+ | ...
+box.space.sync:select{10}
+ | ---
+ | - - [10]
+ | ...
+
-- Cleanup.
test_run:cmd('switch default')
| ---
@@ -576,6 +660,7 @@ test_run:cmd('delete server replica')
| ...
box.space.test:drop()
| ---
+ | - error: A rollback for a synchronous transaction is received
| ...
box.space.sync:drop()
| ---
diff --git a/test/replication/qsync_basic.test.lua b/test/replication/qsync_basic.test.lua
index d2df7a4fb..084ad4abb 100644
--- a/test/replication/qsync_basic.test.lua
+++ b/test/replication/qsync_basic.test.lua
@@ -13,6 +13,11 @@ s1:select{}
s2 = box.schema.create_space('test2')
s2.is_sync
+--
+-- gh-4849: clear synchro queue with unconfigured box
+--
+box.ctl.clear_synchro_queue()
+
-- Net.box takes sync into account.
box.schema.user.grant('guest', 'super')
netbox = require('net.box')
@@ -222,6 +227,32 @@ assert(newlsn >= oldlsn + 2)
test_run:switch('replica')
box.space.sync:select{7}
+--
+-- gh-4849: clear synchro queue on a replica
+--
+test_run:switch('default')
+box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout = 2}
+f1 = fiber.create(box.space.sync.replace, box.space.sync, {9})
+f1:status()
+test_run:switch('replica')
+box.ctl.clear_synchro_queue()
+box.space.sync:select{9}
+test_run:switch('default')
+box.space.sync:select{9}
+f1:status()
+
+--
+-- gh-4849: clear synchro queue on a master
+--
+test_run:switch('default')
+box.cfg{replication_synchro_quorum = 3, replication_synchro_timeout = 2}
+f1 = fiber.create(box.space.sync.replace, box.space.sync, {10})
+f1:status()
+box.ctl.clear_synchro_queue()
+box.space.sync:select{10}
+test_run:switch('replica')
+box.space.sync:select{10}
+
-- Cleanup.
test_run:cmd('switch default')
--
2.26.2
More information about the Tarantool-patches
mailing list