You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are tests (at least mine one from PR #222), which lean on stability of bucket_id -> replicaset mapping: this mapping should be the same from run to run. See:
pairs() iteration over replicasets table in vshard is stable (the same from run to run).
In this conditions vshard just traverse over replicaset in the same order and created the same ranges of bucket ids on the same replicasets.
The point about stability of pairs() is a bit vague. It seems, it works on tarantool, however there is no such guarantee. It would not work on recent LuaJIT and may become broken in tarantool if we'll pulldown some LuaJIT patches (I guess, it is relevant to this one; Update: @Buristan corrects me that pairs() non-deterministic behavior is actually introduced in LuaJIT/LuaJIT@ff34b48).
There are two ways to make the code safe:
Write the test without assumption about where particular bucket resides.
I don't like that the test (and all such tests) would become less straightforward and will be more abstract, so harder to understand.
To illustrate: what if I'll need two keys, which gives different bucket ids, which should reside on different replicasets? Sure, it is possible to generate them, but it requires extra code and will make things cumbersome. We'll make the idea of the test less obvious for a reader.
Don't call vshard.router.bootstrap(), disable rebalancer and create buckets manually using vshard.storage.bucket_force_create().
It may be tricky, because we use 'vshard-router' cartridge role, which bootstraps vshard router on its own.
(Thanks @Gerold103 and @olegrok for answering questions and far-beyound-working-time discussions, so finally I ended up with conslusion that the testing code is not well written and filed this issue.)
The text was updated successfully, but these errors were encountered:
There are tests (at least mine one from PR #222), which lean on stability of bucket_id -> replicaset mapping: this mapping should be the same from run to run. See:
crud/test/integration/select_test.lua
Lines 1593 to 1614 in 5e8c91e
The test uses it several lines below:
crud/test/integration/select_test.lua
Lines 1632 to 1639 in 5e8c91e
It works, when several assumptions are true:
pairs()
iteration over replicasets table in vshard is stable (the same from run to run).In this conditions vshard just traverse over replicaset in the same order and created the same ranges of bucket ids on the same replicasets.
The point about stability of
pairs()
is a bit vague. It seems, it works on tarantool, however there is no such guarantee. It would not work on recent LuaJIT and may become broken in tarantool if we'll pulldown some LuaJIT patches (I guess, it is relevant to this one; Update: @Buristan corrects me thatpairs()
non-deterministic behavior is actually introduced in LuaJIT/LuaJIT@ff34b48).There are two ways to make the code safe:
I don't like that the test (and all such tests) would become less straightforward and will be more abstract, so harder to understand.
To illustrate: what if I'll need two keys, which gives different bucket ids, which should reside on different replicasets? Sure, it is possible to generate them, but it requires extra code and will make things cumbersome. We'll make the idea of the test less obvious for a reader.
vshard.router.bootstrap()
, disable rebalancer and create buckets manually usingvshard.storage.bucket_force_create()
.It may be tricky, because we use 'vshard-router' cartridge role, which bootstraps vshard router on its own.
But, maybe, implement the ability to replace vshard's router bootstrap code with your own one for the 'vshard-storage' role? (Filed Allow to redefine vshard router boostrapping code in the vshard-router role cartridge#1606.)
(Thanks @Gerold103 and @olegrok for answering questions and far-beyound-working-time discussions, so finally I ended up with conslusion that the testing code is not well written and filed this issue.)
The text was updated successfully, but these errors were encountered: