From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Olga Arkhangelskaia <krishtal.olja@gmail.com> Cc: tarantool-patches@freelists.org Subject: Re: [tarantool-patches] [PATCH v2 2/3] box: add replication_sync_timeout Date: Thu, 30 Aug 2018 19:11:36 +0300 [thread overview] Message-ID: <20180830161136.xhvok7vgkei6hxip@esperanza> (raw) In-Reply-To: <20180830141114.4531-2-krishtal.olja@gmail.com> On Thu, Aug 30, 2018 at 05:11:13PM +0300, Olga Arkhangelskaia wrote: > diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua > index f803d8987..213904458 100644 > --- a/src/box/lua/load_cfg.lua > +++ b/src/box/lua/load_cfg.lua > @@ -200,6 +202,7 @@ local dynamic_cfg = { > replication_connect_timeout = private.cfg_set_replication_connect_timeout, > replication_connect_quorum = private.cfg_set_replication_connect_quorum, > replication_sync_lag = private.cfg_set_replication_sync_lag, > + replication_sync_timeout = private.cfg_set_replication_sync_timeout, ^^^ Nit: three extra spaces. > instance_uuid = function() > if box.cfg.instance_uuid ~= box.info.uuid then > box.error(box.error.CFG, 'instance_uuid', > diff --git a/src/box/replication.cc b/src/box/replication.cc > index 861ce34ea..be58b0225 100644 > --- a/src/box/replication.cc > +++ b/src/box/replication.cc > @@ -49,7 +49,7 @@ double replication_timeout = 1.0; /* seconds */ > double replication_connect_timeout = 30.0; /* seconds */ > int replication_connect_quorum = REPLICATION_CONNECT_QUORUM_ALL; > double replication_sync_lag = 10.0; /* seconds */ > - > +double replication_sync_timeout = 300.0; /* seconds */ > struct replicaset replicaset; Nit: an empty line was here for a reason - it separated configuration options from replicaset definition. Please leave it. > > static int > @@ -673,12 +673,20 @@ replicaset_sync(void) > > /* > * Wait until all connected replicas synchronize up to > - * replication_sync_lag > + * replication_sync_lag or return on replication_sync_timeout > */ > + double start_time = ev_monotonic_now(loop()); > + double deadline = start_time + replication_sync_timeout; > while (replicaset.applier.synced < quorum && > replicaset.applier.connected + > - replicaset.applier.loading >= quorum) > - fiber_cond_wait(&replicaset.applier.cond); > + replicaset.applier.loading >= quorum) { > + if (fiber_cond_wait_deadline(&replicaset.applier.cond, > + deadline) != 0) { > + say_crit("replication_sync_timeout fired, entering orphan mode"); This message is not needed, because "entering orphan mode" is printed right below in this case. > + break; > + } > + > + } > > if (replicaset.applier.synced < quorum) { > /*
next prev parent reply other threads:[~2018-08-30 16:11 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-08-30 14:11 [tarantool-patches] [PATCH 1/3] box: make replication_sync_lag option dynamic Olga Arkhangelskaia 2018-08-30 14:11 ` [tarantool-patches] [PATCH v2 2/3] box: add replication_sync_timeout Olga Arkhangelskaia 2018-08-30 16:11 ` Vladimir Davydov [this message] 2018-08-30 14:11 ` [tarantool-patches] [PATCH v6 3/3] box: adds replication sync after cfg. update Olga Arkhangelskaia 2018-08-30 16:41 ` Vladimir Davydov
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=20180830161136.xhvok7vgkei6hxip@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=krishtal.olja@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH v2 2/3] box: add replication_sync_timeout' \ /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