From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Ilya Kosarev <i.kosarev@tarantool.org>,
tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 2/4] replication: fix appliers pruning
Date: Sun, 24 Nov 2019 16:54:03 +0100 [thread overview]
Message-ID: <8b2b2757-8926-1fbc-3f2b-1a1afea6fa52@tarantool.org> (raw)
In-Reply-To: <66ff4c73f329f83b616eeadbf5ea6f26994ecb4a.1574545667.git.i.kosarev@tarantool.org>
Thanks for the patch!
On 23/11/2019 22:53, Ilya Kosarev wrote:
> During pruning of replicaset appliers some anon replicas might connect
> from replicaset_follow called in another fiber. Therefore we need to
> prune appliers of anon replicas first.
>
> Closes #4643
> ---
> src/box/replication.cc | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/src/box/replication.cc b/src/box/replication.cc
> index 509187cd3..3ccfa8b33 100644
> --- a/src/box/replication.cc
> +++ b/src/box/replication.cc
> @@ -516,23 +516,23 @@ replicaset_update(struct applier **appliers, int count)
> */
>
> /* Prune old appliers */
> - replicaset_foreach(replica) {
> - if (replica->applier == NULL)
> - continue;
> + rlist_foreach_entry_safe(replica, &replicaset.anon, in_anon, next) {
'safe' rlist iteration won't help, if a next anon replica
will connect during yield in applier_stop(). Safe iteration can
cope with deletion only of the current element.
You can try
while (rlist_empty(...)) {
replica = rlist_first(...);
...
}
The same about the cycle below.
And I am not really sure, that you need two
cycles now. Just keep it one, but iterate like
I showed above.
> applier = replica->applier;
> replica_clear_applier(replica);
> - replica->applier_sync_state = APPLIER_DISCONNECTED;
> + replica_delete(replica);
> applier_stop(applier);
> applier_delete(applier);
> }
> - rlist_foreach_entry_safe(replica, &replicaset.anon, in_anon, next) {
> + rlist_create(&replicaset.anon);
> + replicaset_foreach(replica) {
> + if (replica->applier == NULL)
> + continue;
> applier = replica->applier;
> replica_clear_applier(replica);
> - replica_delete(replica);
> + replica->applier_sync_state = APPLIER_DISCONNECTED;
> applier_stop(applier);
> applier_delete(applier);
> }
> - rlist_create(&replicaset.anon);
>
> /* Save new appliers */
> replicaset.applier.total = count;
>
next prev parent reply other threads:[~2019-11-24 15:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-23 21:53 [Tarantool-patches] [PATCH v2 0/4] fix box_set_replication issues & stabilize quorum test Ilya Kosarev
2019-11-23 21:53 ` [Tarantool-patches] [PATCH v2 1/4] test: update test-run Ilya Kosarev
2019-11-23 21:53 ` [Tarantool-patches] [PATCH v2 2/4] replication: fix appliers pruning Ilya Kosarev
2019-11-24 15:54 ` Vladislav Shpilevoy [this message]
2019-11-23 21:53 ` [Tarantool-patches] [PATCH v2 3/4] replication: make anon replicas iteration safe Ilya Kosarev
2019-11-23 21:53 ` [Tarantool-patches] [PATCH v2 4/4] test: stabilize quorum test conditions Ilya Kosarev
2019-11-24 15:54 ` Vladislav Shpilevoy
2019-11-24 15:53 ` [Tarantool-patches] [PATCH v2 0/4] fix box_set_replication issues & stabilize quorum test Vladislav Shpilevoy
2019-11-25 11:50 ` Ilya Kosarev
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=8b2b2757-8926-1fbc-3f2b-1a1afea6fa52@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=i.kosarev@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v2 2/4] replication: fix appliers pruning' \
/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