Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] Add wait_vclock_ignore0 compare function
@ 2020-07-12 15:04 Sergey Kaplun
  2020-07-13  8:03 ` [Tarantool-patches] Omit this patch Sergey Kaplun
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Kaplun @ 2020-07-12 15:04 UTC (permalink / raw)
  To: tarantool-patches; +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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Tarantool-patches] Omit this patch.
  2020-07-12 15:04 [Tarantool-patches] [PATCH] Add wait_vclock_ignore0 compare function Sergey Kaplun
@ 2020-07-13  8:03 ` Sergey Kaplun
  0 siblings, 0 replies; 2+ messages in thread
From: Sergey Kaplun @ 2020-07-13  8:03 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Vladislav Shpilevoy, Alexander Turenko


I came up with a workaround - this patch is not neccessary.
Fill free to ignore.

On 12.07.20, Sergey Kaplun wrote:
> 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.
> 
...


-- 
Best regards,
Sergey Kaplun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-13  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12 15:04 [Tarantool-patches] [PATCH] Add wait_vclock_ignore0 compare function Sergey Kaplun
2020-07-13  8:03 ` [Tarantool-patches] Omit this patch Sergey Kaplun

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