From: Serge Petrenko <sergepetrenko@tarantool.org> To: Cyrill Gorcunov <gorcunov@gmail.com> Cc: tml <tarantool-patches@dev.tarantool.org>, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [RFC 4/4] qsync: allow to specify replication_synchro_quorum as a formula Date: Fri, 20 Nov 2020 15:41:12 +0300 [thread overview] Message-ID: <63c1afba-1001-289d-57bc-9dc35679ffc7@tarantool.org> (raw) In-Reply-To: <20201120120103.GD875895@grain> 20.11.2020 15:01, Cyrill Gorcunov пишет: > 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? Hm, I didn't think of this. Yes, this is either bootstrap or reconfiguration. Well, if we have a max(1, value) guard nothing bad should happen even if we pass 0 on bootstrap. The formula will be reevaluated each time a replica is registered anyway. Even when the node registers itself. Anyway, passing replication_synchro_quorum as parameter to evaluate quorum is even more random. > >>> } >>> +/** >>> + * 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 -- Serge Petrenko
next prev parent reply other threads:[~2020-11-20 12:41 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-19 19:40 [Tarantool-patches] [RFC 0/4] qsync: evaluate replication_synchro_quorum dynamically Cyrill Gorcunov 2020-11-19 19:40 ` [Tarantool-patches] [RFC 1/4] cfg: add cfg_isnumber helper Cyrill Gorcunov 2020-11-20 9:53 ` Serge Petrenko 2020-11-19 19:40 ` [Tarantool-patches] [RFC 2/4] qsync: move synchro quorum update to separate routine Cyrill Gorcunov 2020-11-20 10:06 ` Serge Petrenko 2020-11-20 11:01 ` Cyrill Gorcunov 2020-11-20 11:39 ` Serge Petrenko 2020-11-20 11:47 ` Cyrill Gorcunov 2020-11-19 19:40 ` [Tarantool-patches] [RFC 3/4] cfg: prepare symbolic evaluation of replication_synchro_quorum Cyrill Gorcunov 2020-11-20 10:32 ` Serge Petrenko 2020-11-20 11:34 ` Cyrill Gorcunov 2020-11-20 11:56 ` Serge Petrenko 2020-11-20 12:14 ` Cyrill Gorcunov 2020-11-26 14:38 ` Mons Anderson 2020-11-26 14:44 ` Cyrill Gorcunov 2020-11-26 16:01 ` Mons Anderson 2020-11-19 19:41 ` [Tarantool-patches] [RFC 4/4] qsync: allow to specify replication_synchro_quorum as a formula Cyrill Gorcunov 2020-11-20 10:50 ` Serge Petrenko 2020-11-20 12:01 ` Cyrill Gorcunov 2020-11-20 12:41 ` Serge Petrenko [this message] 2020-11-20 15:00 ` Cyrill Gorcunov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=63c1afba-1001-289d-57bc-9dc35679ffc7@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [RFC 4/4] qsync: allow to specify replication_synchro_quorum as a formula' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox