From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4DD80445320 for ; Thu, 6 Aug 2020 01:15:48 +0300 (MSK) References: <0963ccd10f91b249116916d5c1c91f5eef11e438.1596575031.git.v.shpilevoy@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Thu, 6 Aug 2020 00:15:46 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH vshard 1/1] storage: allow replica to boot before master List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yaroslav Dynnikov Cc: tml 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.