-
Notifications
You must be signed in to change notification settings - Fork 54
fix custom driver registration after reboot #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix custom driver registration after reboot
Previously, if a custom driver is registered after calling box.cfg() it causes a problem when the instance will be restarted. The cause of the problem is an attempt to recreate a tube of custom type (which is not registered yet). This bug is now fixed. Fixes #137
- Loading branch information
commit 65b16837a2a09be6201d39ec43050a972cc1856a
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,42 @@ | ||
#!/usr/bin/env tarantool | ||
|
||
local os = require('os') | ||
local queue = require('queue') | ||
local tap = require('tap') | ||
local tnt = require('t.tnt') | ||
|
||
local test = tap.test('custom driver registration after reload') | ||
test:plan(1) | ||
|
||
tnt.cfg() | ||
|
||
--- Accept gh-137, we need to check custom driver registration | ||
-- after restart. Instead of tarantool reboot, we will additionally | ||
-- call queue.start() to simulate the reload of the module. This | ||
-- is not a clean enough, because queue module doesn't provide the | ||
-- hot restart. | ||
-- | ||
-- All tricks in this test are done by professionals, don't try | ||
-- to repeat it yourself!!! | ||
local function check_driver_registration_after_reload() | ||
local fifo = require('queue.abstract.driver.fifo') | ||
queue.register_driver('fifo_cust', fifo) | ||
|
||
local tube = queue.create_tube('tube_cust', 'fifo_cust') | ||
tube:put('1') | ||
local task_id = tube:take()[1] | ||
|
||
-- Simulate the module reload. | ||
queue.driver.fifo_cust = nil | ||
queue.start() | ||
|
||
-- Check the task has been released after reload. | ||
queue.register_driver('fifo_cust', fifo) | ||
local task_status = queue.tube.tube_cust:peek(task_id)[2] | ||
test:is(task_status, 'r', 'check driver registration after reload') | ||
end | ||
|
||
check_driver_registration_after_reload() | ||
|
||
tnt.finish() | ||
os.exit(test:check() and 0 or 1) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.