Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun <skaplun@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	Alexander Turenko <alexander.turenko@tarantool.org>
Subject: [Tarantool-patches] [PATCH] Add wait_vclock_ignore0 compare function
Date: Sun, 12 Jul 2020 18:04:18 +0300	[thread overview]
Message-ID: <20200712150418.3565-1-skaplun@tarantool.org> (raw)

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

             reply	other threads:[~2020-07-12 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-12 15:04 Sergey Kaplun [this message]
2020-07-13  8:03 ` [Tarantool-patches] Omit this patch Sergey Kaplun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200712150418.3565-1-skaplun@tarantool.org \
    --to=skaplun@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] Add wait_vclock_ignore0 compare function' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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