Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Serge Petrenko <sergepetrenko@tarantool.org>, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] raft: make sure the leader stays ro till it clears the limbo
Date: Thu, 26 Nov 2020 22:01:06 +0100	[thread overview]
Message-ID: <e09d6a82-ae01-c9ae-e30e-4357ac3f778b@tarantool.org> (raw)
In-Reply-To: <20201124131820.32981-1-sergepetrenko@tarantool.org>

Hi! Thanks for the patch!

On 24.11.2020 14:18, Serge Petrenko wrote:
> When running a cluster with leader election, its useful to wait till the
> instance is writeable to determine that it has become a leader. However,
> sometimes the instance fails to write data right after transitioning to
> leader because its limbo still contains pending transactions from the
> old leader. Make sure the instance deals with pending transactions first
> and becomes writeable only once the limbo is empty.

I just realized one thing. We can add a function txn_limbo_is_ro(),
like we did with raft_is_ro(), account it in box_update_ro_summary(),
and call box_update_ro_summary() when we see that the limbo is emptied,
or when its ownership changes to a different instance.

Probably would be simpler, and also we could make it work with manual
election! So users could call box.ctl.wait_rw() even without using raft!

To show concrete error if somebody still tries to write, we could
patch box_check_writable() to show the reason why the instance is not
writable. We will do it anyway for raft, to tell the users the real
leader in case they are trying to write on a replica. In scope of
https://github.com/tarantool/tarantool/issues/5568.

Your version of the patch also looks good.

What do you think?

  parent reply	other threads:[~2020-11-26 21:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 13:18 Serge Petrenko
2020-11-24 14:14 ` Cyrill Gorcunov
2020-11-25  8:48   ` Serge Petrenko
2020-11-26 21:01 ` Vladislav Shpilevoy [this message]
2020-11-27 13:00   ` Serge Petrenko
2020-11-27 22:10     ` Vladislav Shpilevoy
2020-11-30  9:40       ` Serge Petrenko

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=e09d6a82-ae01-c9ae-e30e-4357ac3f778b@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] raft: make sure the leader stays ro till it clears the limbo' \
    /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