From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 531D945C304 for ; Fri, 18 Dec 2020 11:14:21 +0300 (MSK) Received: by mail-lf1-f45.google.com with SMTP id s26so3215843lfc.8 for ; Fri, 18 Dec 2020 00:14:21 -0800 (PST) Date: Fri, 18 Dec 2020 11:14:16 +0300 From: Cyrill Gorcunov Message-ID: <20201218081416.GG14556@grain> References: <20201214113935.1040421-1-gorcunov@gmail.com> <20201214113935.1040421-4-gorcunov@gmail.com> <2b00fba4-63bd-559f-c273-a02cf3fed6f3@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b00fba4-63bd-559f-c273-a02cf3fed6f3@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v4 3/3] test: add replication/gh-5446-qsync-eval-quorum.test.lua List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: Mons Anderson , tml 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')