[Tarantool-patches] [PATCH vshard 1/1] storage: allow replica to boot before master

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Aug 6 01:15:46 MSK 2020


Thanks for the review!

>         diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua
>         index c6a78fe..ed577f9 100644
>         --- a/vshard/storage/init.lua
>         +++ b/vshard/storage/init.lua
>         @@ -2435,8 +2446,11 @@ local function storage_cfg(cfg, this_replica_uuid, is_reload)
>              local uri = luri.parse(this_replica.uri)
>              schema_upgrade(is_master, uri.login, uri.password)
> 
>         -    local old_trigger = box.space._bucket:on_replace()[1]
>         -    box.space._bucket:on_replace(bucket_generation_increment, old_trigger)
>         +    if is_master then
>         +        local old_trigger = M.bucket_on_replace
>         +        box.space._bucket:on_replace(bucket_generation_increment, old_trigger)
>         +        M.bucket_on_replace = bucket_generation_increment
>         +    end
> 
> 
> It seems that the trigger is never removed. If a replica was a master some time ago, it still has the trigger.
> Is it safe?

Yes, it is. The trigger only increments a counter in M. And the counter is
not used for anything out of the node. It should be just locally monotonic.
So it is ok to increment it even on replica. After all this is how it
worked before.

But again, after this comment I had second thoughts, and decided to remove the
trigger when switched to replica to be consistent. See v2 in a new mail thread.


More information about the Tarantool-patches mailing list