From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Leonid Vasiliev <lvasiliev@tarantool.org>,
Serge Petrenko <sergepetrenko@tarantool.org>,
gorcunov@gmail.com, sergos@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 2/2] box: introduce a cfg handle to become syncro leader
Date: Mon, 20 Jul 2020 23:13:09 +0200 [thread overview]
Message-ID: <0db23a8c-1507-d61e-7826-fabb3fd46515@tarantool.org> (raw)
In-Reply-To: <71f0e22e-b622-22c7-812d-d118d31cb2bc@tarantool.org>
Hi! Thanks for the review!
>> diff --git a/src/box/box.cc b/src/box/box.cc
>> index ca24b98ca..087710383 100644
>> --- a/src/box/box.cc
>> +++ b/src/box/box.cc
>> @@ -78,6 +78,7 @@
>> #include "sequence.h"
>> #include "sql_stmt_cache.h"
>> #include "msgpack.h"
>> +#include "trivia/util.h"
>> static char status[64] = "unknown";
>> @@ -945,6 +946,84 @@ box_set_replication_anon(void)
>> }
>> +void
>> +box_set_replication_synchro_leader(void)
>> +{
>> + bool is_leader = cfg_geti("replication_synchro_leader");
>> + /*
>> + * For now no actions required when an instance stops
>> + * being a leader. We should probably wait until txn_limbo
>> + * becomes empty.
>> + */
>> + if (!is_leader)
>> + return;
>> + uint32_t former_leader_id = txn_limbo.instance_id;
>> + if (former_leader_id == REPLICA_ID_NIL ||
>> + former_leader_id == instance_id) {
>> + return;
>> + }
>> +
>> + /* Wait until pending confirmations/rollbacks reach us. */
>> + double timeout = 2 * txn_limbo_confirm_timeout(&txn_limbo);
>> + double start_tm = fiber_time();
>> + while (!txn_limbo_is_empty(&txn_limbo)) {
>> + if (fiber_time() - start_tm > timeout)
>
> From the d988d7fb92fe1dda4b64218fb06813e93eb56ed1 commit comment:
> "
> ...use fiber_clock() instead of fiber_time() for timeouts
>
> fiber_time() reports real time, which shouldn't be used for calculating
> timeouts as it is affected by system time changes. Add fiber_clock()
> based on ev_monotonic_now(), export it to Lua, and use it instead.
> ".
Indeed. I've sent a patch fixing it.
prev parent reply other threads:[~2020-07-20 21:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 21:55 [Tarantool-patches] [PATCH 0/2] introduce actions on leader election Serge Petrenko
2020-07-04 21:55 ` [Tarantool-patches] [PATCH 1/2] util: move cmp_i64 from xlog.c to util.h Serge Petrenko
2020-07-04 21:55 ` [Tarantool-patches] [PATCH 2/2] box: introduce a cfg handle to become syncro leader Serge Petrenko
2020-07-04 23:03 ` Vladislav Shpilevoy
2020-07-04 23:18 ` Vladislav Shpilevoy
2020-07-05 11:09 ` Serge Petrenko
2020-07-09 22:03 ` Leonid Vasiliev
2020-07-20 21:13 ` Vladislav Shpilevoy [this message]
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=0db23a8c-1507-d61e-7826-fabb3fd46515@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=gorcunov@gmail.com \
--cc=lvasiliev@tarantool.org \
--cc=sergepetrenko@tarantool.org \
--cc=sergos@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 2/2] box: introduce a cfg handle to become syncro leader' \
/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