-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sometimes, instance could enter the queue initialization while still not running (for example, left in the orphan mode). This resulted in "lazy start". But Tarantool does not call `box.cfg {}` after leaving orphan mode, so queue could stuck in the `INIT` state. Now we wait in the background for instances, that are not running. It is similar to lazy init for read-only instances. Note that this fix works only for Tarantool versions >= 2.10.0. This is because of used watchers. Closes #226
- Loading branch information
Showing
3 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env tarantool | ||
|
||
local test = require('tap').test('') | ||
local queue = require('queue') | ||
local tnt = require('t.tnt') | ||
|
||
rawset(_G, 'queue', require('queue')) | ||
|
||
local qc = require('queue.compat') | ||
if not qc.check_version({2, 10, 0}) then | ||
require('log').info('Tests skipped, tarantool version < 2.10.0') | ||
return | ||
end | ||
|
||
test:plan(1) | ||
|
||
test:test('Check orphan mode not stalling queue', function(test) | ||
test:plan(4) | ||
local engine = os.getenv('ENGINE') or 'memtx' | ||
tnt.cluster.cfg{} | ||
|
||
box.cfg{ | ||
replication = { | ||
'replicator:[email protected]:3398', | ||
'replicator:[email protected]:3399' | ||
}, | ||
listen = '127.0.0.1:3395', | ||
replication_connect_quorum = 4, | ||
bootstrap_strategy = 'legacy' | ||
} | ||
|
||
test:isnt(queue.state(), 'RUNNING', 'check queue state') | ||
test:is(box.info.ro, true, 'check read only') | ||
test:is(box.info.ro_reason, 'orphan', 'check ro reason') | ||
|
||
box.cfg{replication_connect_quorum = 1} | ||
|
||
local attempts = 0 | ||
while true do | ||
if queue.state() == 'RUNNING' then | ||
test:is(queue.state(), 'RUNNING', 'check queue state after orphan') | ||
return | ||
end | ||
attempts = attempts + 1 | ||
if attempts == 10 then | ||
break | ||
end | ||
require('fiber').sleep(0.1) | ||
end | ||
test:is(queue.state(), 'RUNNING', 'check queue state after orphan') | ||
end) | ||
|
||
rawset(_G, 'queue', nil) | ||
tnt.finish() | ||
os.exit(test:check() and 0 or 1) | ||
-- vim: set ft=lua : |