From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E92F9445320 for ; Sun, 12 Jul 2020 18:04:41 +0300 (MSK) From: Sergey Kaplun Date: Sun, 12 Jul 2020 18:04:18 +0300 Message-Id: <20200712150418.3565-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH] Add wait_vclock_ignore0 compare function List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: Vladislav Shpilevoy , Alexander Turenko Function wait_vclock is unsuitable for waiting vclock, when there are inserts in local spaces. Function wait_vclock_ignore0 waits for corresponding vclock ignoring zero component. Needed for #3363 --- Branch: https://github.com/tarantool/test-run/tree/skaplun/wait-vclock-ignore0 test_run.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test_run.lua b/test_run.lua index 9a25246..8a44789 100644 --- a/test_run.lua +++ b/test_run.lua @@ -94,6 +94,28 @@ local function wait_vclock(self, node, to_vclock) end end +local function wait_vclock_ignore0(self, node, to_vclock) + while true do + local vclock = self:get_vclock(node) + local ok = true + for server_id, to_lsn in pairs(to_vclock) do + if server_id ~= 0 then + local lsn = vclock[server_id] + if lsn == nil or lsn < to_lsn then + ok = false + break + end + end + end + if ok then + return + end + log.info("wait vclock: %s to %s", yaml.encode(vclock), + yaml.encode(to_vclock)) + fiber.sleep(0.001) + end +end + local create_cluster_cmd1 = 'create server %s with script="%s/%s.lua"' local create_cluster_cmd1_return_listen_uri = @@ -440,6 +462,7 @@ local inspector_methods = { -- vclock get_vclock = get_vclock, wait_vclock = wait_vclock, + wait_vclock_ignore0 = wait_vclock_ignore0, switch = switch, -- replication create_cluster = create_cluster, -- 2.24.1