[Tarantool-patches] [PATCH v4 12/16] box: fix an assertion failure after a spurious wakeup in promote
Sergey Petrenko
sergepetrenko at tarantool.org
Fri Jul 23 10:45:22 MSK 2021
22.07.2021 01:29, Vladislav Shpilevoy пишет:
> I appreciate the work you did here!
>
> See 2 comments below.
>
>> diff --git a/test/replication/gh-3055-promote-wakeup-crash.result b/test/replication/gh-3055-promote-wakeup-crash.result
>> new file mode 100644
>> index 000000000..e508611e5
>> --- /dev/null
>> +++ b/test/replication/gh-3055-promote-wakeup-crash.result
>> @@ -0,0 +1,43 @@
>> +-- test-run result file version 2
>> +test_run = require('test_run').new()
>> + | ---
>> + | ...
>> +--
>> +-- gh-3055 follow-up: box.ctl.promote() could crash on an assertion after a
>> +-- spurious wakeup.
>> +--
>> +_ = box.space._cluster:insert{2, require('uuid').str()}
>> + | ---
>> + | ...
>> +box.cfg{election_mode='manual',\
>> + replication_synchro_quorum=2,\
>> + election_timeout=1000}
> 1. Shouldn't you save and restore the old option values in the end
> of the test?
Not anymore. As far as I know the default instance is restarted
between each test run now.
So we only need to reset persistent things now, like
grants, roles, promotes/demotes, spaces and so on.
>> + | ---
>> + | ...
>> +
>> +fiber = require('fiber')
>> + | ---
>> + | ...
>> +f = fiber.create(function() box.ctl.promote() end)
>> + | ---
>> + | ...
>> +f:set_joinable(true)
> 2. But you never use :join(). Perhaps you might want to call it
> after :cancel(). To ensure the fiber really ended.
Yep, my bad. Thanks for noticing!
=====================================
diff --git a/test/replication/gh-3055-promote-wakeup-crash.result
b/test/replication/gh-3055-promote-wakeup-crash.result
index e508611e5..f915bf359 100644
--- a/test/replication/gh-3055-promote-wakeup-crash.result
+++ b/test/replication/gh-3055-promote-wakeup-crash.result
@@ -35,6 +35,11 @@ fiber.yield()
f:cancel()
| ---
| ...
+f:join()
+ | ---
+ | - false
+ | - fiber is cancelled
+ | ...
box.cfg{election_mode='off'}
| ---
| ...
diff --git a/test/replication/gh-3055-promote-wakeup-crash.test.lua
b/test/replication/gh-3055-promote-wakeup-crash.test.lua
index 2ac901b08..acf0c05b0 100644
--- a/test/replication/gh-3055-promote-wakeup-crash.test.lua
+++ b/test/replication/gh-3055-promote-wakeup-crash.test.lua
@@ -16,5 +16,6 @@ fiber.yield()
-- Cleanup.
f:cancel()
+f:join()
box.cfg{election_mode='off'}
test_run:cleanup_cluster()
=====================================
>> + | ---
>> + | ...
>> +f:wakeup()
>> + | ---
>> + | ...
>> +fiber.yield()
>> + | ---
>> + | ...
>> +
>> +-- Cleanup.
>> +f:cancel()
>> + | ---
>> + | ...
>> +box.cfg{election_mode='off'}
>> + | ---
>> + | ...
>> +test_run:cleanup_cluster()
>> + | ---
>> + | ...
More information about the Tarantool-patches
mailing list