From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 138B8469710 for ; Fri, 20 Nov 2020 15:01:07 +0300 (MSK) Received: by mail-lf1-f66.google.com with SMTP id j205so13065228lfj.6 for ; Fri, 20 Nov 2020 04:01:06 -0800 (PST) Date: Fri, 20 Nov 2020 15:01:03 +0300 From: Cyrill Gorcunov Message-ID: <20201120120103.GD875895@grain> References: <20201119194100.840495-1-gorcunov@gmail.com> <20201119194100.840495-5-gorcunov@gmail.com> <1e448048-ac86-2c58-ed0a-2cc2f6a5df11@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1e448048-ac86-2c58-ed0a-2cc2f6a5df11@tarantool.org> Subject: Re: [Tarantool-patches] [RFC 4/4] qsync: allow to specify replication_synchro_quorum as a formula List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko Cc: tml , Vladislav Shpilevoy On Fri, Nov 20, 2020 at 01:50:50PM +0300, Serge Petrenko wrote: > > @@ -4216,6 +4217,7 @@ unregister_replica(struct trigger *trigger, void * /* event */) > > struct replica *replica = replica_by_uuid(&old_uuid); > > assert(replica != NULL); > > replica_clear_id(replica); > > + replication_on_cluster_update(); > > return 0; > > } > > We usually perform all the work related to replica register/unregister > directly in replica_set_id > and replica_clear_id. > > Besides, these are the places where replicaset.registered_count is updated, > so it'd be nice to call replication_on_cluster_update from there. Sure. > > --- a/src/box/box.cc > > +++ b/src/box/box.cc > > @@ -634,14 +634,6 @@ box_check_replication_synchro_quorum(void) > > */ > > int value = replication_synchro_quorum; > > quorum = eval_replication_synchro_quorum(value); > > > Pass replicaset.registered_count instead of replication_synchro_quorum here. Wait, this is bootstrap, replicaset.registered_count is 0 at this moment, no? > > } > > +/** > > + * Evaluate the new synchro quorum number when replica > > + * get registered/unregistered and the quorum depends on > > + * their amount via formula in config. > > + */ > > +void > > +replication_on_cluster_update(void) > > +{ > > + if (!replication_synchro_quorum_eval) > > + return; > > + > > + /* > > + * Account only registered replicas when evaluating > > + * quorum number from a fromula present in config. > > + */ > > + int value = replicaset.registered_count - replicaset.anon_count; > > > registered_count stands for 'normal' replica count, so no need to subtract > anon_count from it. Yeah, thanks! > > + > > + say_info("replication: evaluated quorum is %d", quorum); > > > quorum -> replication_synchro_quorum ok