Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Georgy Kirichenko <georgy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] [PATCH 2/2] On ctl event trigger
Date: Thu, 30 Aug 2018 16:21:28 +0300	[thread overview]
Message-ID: <20180830132128.gn32tdsunxl5wzbq@esperanza> (raw)
In-Reply-To: <20180830123807.w2p4fiwcld2v3yun@esperanza>

On Thu, Aug 30, 2018 at 03:38:07PM +0300, Vladimir Davydov wrote:
> On Tue, Aug 28, 2018 at 07:19:13PM +0300, Georgy Kirichenko wrote:
> > Introduce a ctl event trigger fired in cases of a bootstrap/recovery status
> > changes, a space create/alter/drop action, an applier state change and
> > shutdown. Trigger could be set with box.ctl_event even before the first
> > box.cfg invocation to control recovery and bootstrap behavior.
> > 
> > Event constants accessible via box.ctl_event.const()
> > There are events:
> >   - RECOVERY
> >   - SPACE
> >   - SHUTDOWN
> >   - APPLIER
> > 
> > A recovery event might have a status:
> >    * RECOVERY_SNAPSHOT_START
> >    * RECOVERY_SNAPSHOT_DONE
> >    * RECOVERY_HOT_STANDBY_START
> >    * RECOVERY_HOT_STANDBY_DONE
> >    * RECOVERY_XLOGS_DONE
> >    * RECOVERY_BOOTSTRAP_START
> >    * RECOVERY_BOOTSTRAP_DONE
> >    * RECOVERY_INITIAL_JOIN_START
> >    * RECOVERY_INITIAL_JOIN_DONE
> >    * RECOVERY_FINAL_JOIN_DONE
> > 
> > A space event consists of space identifier and action:
> >    * SPACE_CREATE
> >    * SPACE_ALTER
> >    * SPACE_DELETE
> > 
> > An applier event contains peer uuid and state:
> >    * APPLIER_OFF
> >    * APPLIER_CONNECT
> >    * APPLIER_CONNECTED
> >    * APPLIER_AUTH
> >    * APPLIER_READY
> >    * APPLIER_INITIAL_JOIN
> >    * APPLIER_FINAL_JOIN
> >    * APPLIER_JOINED
> >    * APPLIER_SYNC
> >    * APPLIER_FOLLOW
> >    * APPLIER_STOPPED
> >    * APPLIER_DISCONNECTED
> >    * APPLIER_LOADING
> 
> I can't review this patch properly, because ctl_event.[hc] are missing,
> but I've a few notes about the API.
> 
> First, I don't understand why you need two kinds of constants. I mean
> SPACE and SPACE_CREATE, or RECOVERY and RECOVERY_SNAPSHOT_START. IMO
> there should be just one set of constants.
> 
> Second, IMO the event trigger should be installed with box.ctl.on_event
> (not box.ctl_event.on_ctl_event), and constants should be defined in
> box.ctl.event (not box.ctl_event.const()).
> 
> Third, let's start with fewer events, only ones that we need to right
> now (e.g. for replication conflict resolution with before_replace).
> We can add other events later, when we need to.

Another thought. I think that mixing space, applier, and global events
in the same trigger isn't a good idea. I'd prefer box.ctl.on_event (or
whatever it's going to be called) to be called only on global events,
such as recovery completion or shutdown. Probably, it shouldn't be
passed any context apart from the event type, because I can't think why
it would ever need it (if it needs anything it can always get it from
box.info).

For applier events, I'd prefer to have a separate trigger, which would
only be called whenever an applier state changes. It should be passed
applier id in the arguments - everything else it can retrieve from
box.info.

Space events look rather superfluous to me, because we already can track
creation of system objects with box space.on_replace. True, we can't
install it before recovery is complete, but we could introduce a global
event called on completion of recovery of all system spaces instead.
We could use it to install before_replace trigger for conflict
resolution.

Anyway, this topic cries for a discussion/brainstorming IMO.

  parent reply	other threads:[~2018-08-30 13:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 16:19 [tarantool-patches] [PATCH 0/2] Box control " Georgy Kirichenko
2018-08-28 16:19 ` [tarantool-patches] [PATCH 1/2] Update lua space cache just after creation Georgy Kirichenko
2018-08-30 12:06   ` Vladimir Davydov
2018-08-31  4:57     ` [tarantool-patches] " Georgy Kirichenko
2018-08-30 12:31   ` Konstantin Osipov
2018-08-31  4:53     ` Georgy Kirichenko
2018-08-28 16:19 ` [tarantool-patches] [PATCH 2/2] On ctl event trigger Georgy Kirichenko
2018-08-30 12:07   ` Vladimir Davydov
2018-08-30 12:10   ` Vladimir Davydov
2018-08-30 12:38   ` Vladimir Davydov
2018-08-30 13:04     ` Georgy Kirichenko
2018-08-30 13:21     ` Vladimir Davydov [this message]
2018-08-30 14:45       ` [tarantool-patches] " Konstantin Osipov
2018-08-30 14:40     ` Konstantin Osipov
2018-08-30 12:50   ` Konstantin Osipov

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=20180830132128.gn32tdsunxl5wzbq@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 2/2] On ctl event trigger' \
    /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