Skip to content

Commit cfaeac3

Browse files
avtikhontntmac02.tarantool.i
authored andcommitted
Add check in wait_lsn for nil value
Found issue in testing: [006] --- replication/election_qsync.result Fri Oct 16 00:12:02 2020 [006] +++ replication/election_qsync.reject Sat Oct 17 19:08:11 2020 [006] @@ -89,6 +89,8 @@ [006] -- Wait replication to the other instance. [006] test_run:wait_lsn('default', 'replica') [006] | --- [006] + | - error: '...sitories/tarantool/test/var/006_replication/test_run.lua:68: attempt [006] + | to compare nil with number' [006] | ... Found that wait_lsn() routine from test_run.lua script failed on comparing returned result from get_lsn() routine with real integer. It happened because get_lsn() returned 'nil' on the freshly bootstrapped instance. To avoid of it in wait_lsn() routine added check that get_lsn() routine returned not 'nil' value. Complete explanation of the issue and reproducer provided in [1]. This patch does not fix the found issue in tests, but changes the way it works with the issue. Instead of breaking the test run, for now it will wait for the lsn value different from nil in loop till available timeout. Needed for #226 Co-authored-by: Alexander Turenko <[email protected]> [1]: #269 (comment)
1 parent 95f2e88 commit cfaeac3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test_run.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ local function wait_lsn(self, waiter, master)
6565
local sid = self:get_server_id(master)
6666
local lsn = self:get_lsn(master, sid)
6767

68-
while self:get_lsn(waiter, sid) < lsn do
68+
repeat
6969
fiber.sleep(0.001)
70-
end
70+
local waiter_lsn = self:get_lsn(waiter, sid)
71+
until waiter_lsn ~= nil and waiter_lsn >= lsn
7172
end
7273

7374
local function get_vclock(self, node)

0 commit comments

Comments
 (0)