Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Serge Petrenko <sergepetrenko@tarantool.org>, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] box: introduce on_election triggers
Date: Mon, 26 Jul 2021 22:27:10 +0200	[thread overview]
Message-ID: <27aaa450-7c0c-1e5e-e912-db5bae282e16@tarantool.org> (raw)
In-Reply-To: <20210722072002.13145-1-sergepetrenko@tarantool.org>

Hi! Thanks for the patch!

See 3 comments below.

> diff --git a/src/box/raft.c b/src/box/raft.c
> index 7f787c0c5..c9c3ba818 100644
> --- a/src/box/raft.c
> +++ b/src/box/raft.c
> @@ -52,6 +52,8 @@ enum election_mode box_election_mode = ELECTION_MODE_INVALID;
>   */
>  static struct trigger box_raft_on_update;
>  
> +struct rlist box_raft_on_state = RLIST_HEAD_INITIALIZER(box_raft_on_state);

1. I propose to call it 'box_raft_on_update'. We usually use 'on_<action>'
naming pattern.

> +
>  /**
>   * Worker fiber does all the asynchronous work, which may need yields and can be
>   * long. These are WAL writes, network broadcasts. That allows not to block the
> @@ -274,6 +276,7 @@ box_raft_broadcast(struct raft *raft, const struct raft_msg *msg)
>  	assert(raft == box_raft());
>  	struct raft_request req;
>  	box_raft_msg_to_request(msg, &req);
> +	trigger_run(&box_raft_on_state, NULL);

2. Maybe call it after the state is pushed to the relays? So as it
would be sent earlier in case the triggers are going to yield.

>  	replicaset_foreach(replica)
>  		relay_push_raft(replica->relay, &req);
>  }
> diff --git a/test/replication/gh-5819-election-triggers.result b/test/replication/gh-5819-election-triggers.result
> new file mode 100644
> index 000000000..546aac8a2
> --- /dev/null
> +++ b/test/replication/gh-5819-election-triggers.result

3. Hm, I think we are supposed to use gh-#### file naming only for
bugfixes.
https://github.com/tarantool/tarantool/wiki/Code-review-procedure#testing

This is a feature, hence can have a normal name, or be in an existing
test file which is also not bound to a single ticket.

  reply	other threads:[~2021-07-26 20:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  7:20 Serge Petrenko via Tarantool-patches
2021-07-26 20:27 ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-07-28 10:03   ` Sergey Petrenko via Tarantool-patches
2021-07-29 21:45     ` Vladislav Shpilevoy via Tarantool-patches
2021-08-06  9:49       ` Vitaliia Ioffe via Tarantool-patches

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=27aaa450-7c0c-1e5e-e912-db5bae282e16@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] box: introduce on_election triggers' \
    /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