[Tarantool-patches] [PATCH v4 3/3] test: add replication/gh-5446-qsync-eval-quorum.test.lua
Cyrill Gorcunov
gorcunov at gmail.com
Fri Dec 18 11:14:16 MSK 2020
On Fri, Dec 18, 2020 at 12:18:00AM +0100, Vladislav Shpilevoy wrote:
> > +-- Create a sync space we will operate on
> > +_ = box.schema.space.create('sync', {is_sync = true, engine = engine})
> > + | ---
> > + | ...
> > +s = box.space.sync
> > + | ---
> > + | ...
> > +s:format({{name = 'id', type = 'unsigned'}, {name = 'value', type = 'unsigned'}})
>
> 1. Why do you need the format? Why do you even need 2 fields?
>
> > + | ---
> > + | ...
> > +_ = s:create_index('primary', {parts = {'id'}})
>
> 2. In primary index you can omit 'parts' - it will use the first
> field automatically.
Took both notes from some existing example. Would the following be better?
---
diff --git a/test/replication/gh-5446-qsync-eval-quorum.test.lua b/test/replication/gh-5446-qsync-eval-quorum.test.lua
index 2ecfa8c3e..9f731a488 100644
--- a/test/replication/gh-5446-qsync-eval-quorum.test.lua
+++ b/test/replication/gh-5446-qsync-eval-quorum.test.lua
@@ -17,10 +17,8 @@ test_run:grep_log("default", match) ~= nil
-- Create a sync space we will operate on
_ = box.schema.space.create('sync', {is_sync = true, engine = engine})
-s = box.space.sync
-s:format({{name = 'id', type = 'unsigned'}, {name = 'value', type = 'unsigned'}})
-_ = s:create_index('primary', {parts = {'id'}})
-s:insert{1, 1}
+_ = box.space.sync:create_index('pk')
+box.space.sync:insert{1}
test_run:cmd('create server replica1 with rpl_master=default,\
script="replication/replica-quorum-1.lua"')
@@ -69,17 +67,17 @@ test_run:grep_log("default", match) ~= nil
-- 5 replicas left, the commit should pass
test_run:cmd('stop server replica1')
test_run:cmd('delete server replica1')
-s:insert{2, 2}
+box.space.sync:insert{2}
-- 4 replicas left,the commit should pass
test_run:cmd('stop server replica2')
test_run:cmd('delete server replica2')
-s:insert{3, 3}
+box.space.sync:insert{3}
-- 3 replicas left, the commit should pass
test_run:cmd('stop server replica3')
test_run:cmd('delete server replica3')
-s:insert{4, 4}
+box.space.sync:insert{4}
-- 2 replicas left, the commit should NOT pass
--
@@ -88,11 +86,11 @@ s:insert{4, 4}
-- not pass since replicas are stopped.
box.cfg { replication_synchro_timeout = 0.5 }
test_run:cmd('stop server replica4')
-s:insert{5, 5}
+box.space.sync:insert{5}
-- restore it back and retry
test_run:cmd('start server replica4 with wait=True, wait_load=True')
box.cfg { replication_synchro_timeout = 1000 }
-s:insert{5, 5}
+box.space.sync:insert{5}
test_run:cmd('stop server replica4')
test_run:cmd('delete server replica4')
More information about the Tarantool-patches
mailing list