Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v2 08/11] replication: rebootstrap instance on startup if it fell behind
Date: Thu, 14 Jun 2018 11:58:37 +0300	[thread overview]
Message-ID: <20180614085837.do36dza7aizlm4on@esperanza> (raw)
In-Reply-To: <20180613205527.GE10632@chai>

On Wed, Jun 13, 2018 at 11:55:27PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [18/06/08 20:38]:
> > If a replica fell too much behind its peers in the cluster and xlog
> > files needed for it to get up to speed have been removed, it won't be
> > able to proceed without rebootstrap. This patch makes the recovery
> > procedure detect such cases and initiate rebootstrap procedure if
> > necessary.
> > 
> > Note, rebootstrap is currently only supported by memtx engine. If there
> > are vinyl spaces on the replica, rebootstrap will fail. This is fixed by
> > the following patches.
> 
> A nitpick, but this makes the whole point of factoring out local
> recovery less valid.
> 
> 
> If local_recovery() can fall back to bootstrap_from_master(), then
> the name is misleading.
> 
> Please make sure the control flow and decision making stays in box_cfg().

I rather disagree. Rejoin can be though of as an optional step of the
local recovery process. Although we do overwrite local data, we don't
purge it - it is still in the local directory and can be recovered upon
request. I can, of course, move bootstrap_from_master to box_cfg, but
frankly I think it would make the code look worse.

> 
> >  
> > +bool
> > +replicaset_needs_rejoin(struct replica **master)
> > +{
> > +	replicaset_foreach(replica) {
> > +		if (replica->applier != NULL &&
> > +		    vclock_compare(&replica->applier->gc_vclock,
> > +				   &replicaset.vclock) > 0) {
> > +			*master = replica;
> > +			return true;
> > +		}
> > +	}
> > +	*master = NULL;
> > +	return false;
> > +}
> 
> Intuitively this function should return true only if none of the
> masters can provide it with necessary logs, not *any* of the
> masters.

Well, yes, but if an instance fell behind a master, it won't retry to
subscribe to it, even after it has synced up with a master that has all
xlogs available. I thought about fixing it in the future while leaving
it plain and simple for now - rejoin if at least one master reports the
replica is stale...

  reply	other threads:[~2018-06-14  8:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-08 17:34 [PATCH v2 00/11] Replica rejoin Vladimir Davydov
2018-06-08 17:34 ` [PATCH v2 01/11] box: retrieve instance uuid before starting local recovery Vladimir Davydov
2018-06-08 17:51   ` Konstantin Osipov
2018-06-08 17:34 ` [PATCH v2 02/11] box: refactor hot standby recovery Vladimir Davydov
2018-06-08 17:34 ` [PATCH v2 03/11] box: retrieve end vclock before starting local recovery Vladimir Davydov
2018-06-14 12:58   ` Konstantin Osipov
2018-06-08 17:34 ` [PATCH v2 04/11] box: open the port " Vladimir Davydov
2018-06-13 20:43   ` Konstantin Osipov
2018-06-14  8:31     ` Vladimir Davydov
2018-06-14 12:59       ` Konstantin Osipov
2018-06-15 15:48         ` [PATCH 0/3] Speed up recovery in case rebootstrap is not needed Vladimir Davydov
2018-06-15 15:48           ` [PATCH 1/3] xlog: erase eof marker when reopening existing file for writing Vladimir Davydov
2018-06-27 17:09             ` Konstantin Osipov
2018-06-15 15:48           ` [PATCH 2/3] wal: rollback vclock on write failure Vladimir Davydov
2018-06-27 17:22             ` Konstantin Osipov
2018-06-15 15:48           ` [PATCH 3/3] wal: create empty xlog on shutdown Vladimir Davydov
2018-06-27 17:29             ` Konstantin Osipov
2018-06-08 17:34 ` [PATCH v2 05/11] box: connect to remote peers before starting local recovery Vladimir Davydov
2018-06-13 20:45   ` Konstantin Osipov
2018-06-14  8:34     ` Vladimir Davydov
2018-06-14 12:59       ` Konstantin Osipov
2018-06-08 17:34 ` [PATCH v2 06/11] box: factor out local recovery function Vladimir Davydov
2018-06-13 20:50   ` Konstantin Osipov
2018-06-08 17:34 ` [PATCH v2 07/11] applier: inquire oldest vclock on connect Vladimir Davydov
2018-06-13 20:51   ` Konstantin Osipov
2018-06-14  8:40     ` Vladimir Davydov
2018-06-08 17:34 ` [PATCH v2 08/11] replication: rebootstrap instance on startup if it fell behind Vladimir Davydov
2018-06-13 20:55   ` Konstantin Osipov
2018-06-14  8:58     ` Vladimir Davydov [this message]
2018-06-08 17:34 ` [PATCH v2 09/11] vinyl: simplify vylog recovery from backup Vladimir Davydov
2018-06-08 17:34 ` [PATCH v2 10/11] vinyl: pass flags to vy_recovery_new Vladimir Davydov
2018-06-13 20:56   ` Konstantin Osipov
2018-06-08 17:34 ` [PATCH v2 11/11] vinyl: implement rebootstrap support Vladimir Davydov
2018-06-10 12:02   ` 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=20180614085837.do36dza7aizlm4on@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 08/11] replication: rebootstrap instance on startup if it fell behind' \
    /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