From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 02/10] swim: make swim_new_round() void
Date: Wed, 15 May 2019 22:36:39 +0300 [thread overview]
Message-ID: <745abc0d14765897d4af8ba52a5a78ad229fb568.1557948687.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1557948686.git.v.shpilevoy@tarantool.org>
Firstly, I thought that there is an error - swim_begin_step()
does not reschedules round timer, when new_round() fails. But
then new_round() appeared never failing. This commit makes it
void to eliminate confusion.
Probably it is a legacy since the shuffled members array was
allocated and freed in new_round().
Part of #3234
---
src/lib/swim/swim.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index 725ebf222..a9a0a39b3 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -844,7 +844,7 @@ swim_shuffle_members(struct swim *swim)
* Shuffle members, build randomly ordered queue of addressees. In
* other words, do all round preparation work.
*/
-static int
+static void
swim_new_round(struct swim *swim)
{
int size = mh_size(swim->members);
@@ -852,7 +852,7 @@ swim_new_round(struct swim *swim)
assert(swim->self != NULL);
say_verbose("SWIM %d: skip a round - no members",
swim_fd(swim));
- return 0;
+ return;
}
/* -1 for self. */
say_verbose("SWIM %d: start a new round with %d members", swim_fd(swim),
@@ -866,7 +866,6 @@ swim_new_round(struct swim *swim)
in_round_queue);
}
}
- return 0;
}
/**
@@ -1078,12 +1077,10 @@ swim_begin_step(struct ev_loop *loop, struct ev_timer *t, int events)
(void) events;
(void) loop;
struct swim *swim = (struct swim *) t->data;
- if (! rlist_empty(&swim->round_queue)) {
+ if (! rlist_empty(&swim->round_queue))
say_verbose("SWIM %d: continue the round", swim_fd(swim));
- } else if (swim_new_round(swim) != 0) {
- diag_log();
- return;
- }
+ else
+ swim_new_round(swim);
/*
* Possibly empty, if no members but self are specified.
*/
@@ -1994,11 +1991,7 @@ swim_quit(struct swim *swim)
swim_ev_timer_stop(loop(), &swim->wait_ack_tick);
swim_scheduler_stop_input(&swim->scheduler);
/* Start the last round - quiting. */
- if (swim_new_round(swim) != 0) {
- diag_log();
- swim_delete(swim);
- return;
- }
+ swim_new_round(swim);
struct swim_task *task = &swim->round_step_task;
swim_task_destroy(task);
swim_task_create(task, swim_quit_step_complete, swim_task_delete_cb,
--
2.20.1 (Apple Git-117)
next prev parent reply other threads:[~2019-05-15 19:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 19:36 [tarantool-patches] [PATCH 00/10] swim Lua API Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 01/10] swim: fix an assertion on attempt to chage timeouts Vladislav Shpilevoy
2019-05-16 7:28 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 10/10] swim: cache members in Lua member table Vladislav Shpilevoy
2019-05-16 7:31 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` Vladislav Shpilevoy [this message]
2019-05-16 7:31 ` [tarantool-patches] Re: [PATCH 02/10] swim: make swim_new_round() void Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 03/10] swim: validate URI in swim_probe_member() Vladislav Shpilevoy
2019-05-16 7:31 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 04/10] swim: introduce Lua interface Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 05/10] swim: Lua bindings to manipulate member table Vladislav Shpilevoy
2019-05-16 7:32 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 06/10] swim: Lua bindings to access individual members Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 07/10] swim: pairs() function to iterate over member table Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 08/10] swim: allow to use cdata struct tt_uuid in Lua API Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 09/10] swim: cache decoded payload in the Lua module Vladislav Shpilevoy
2019-05-16 7:36 ` [tarantool-patches] " Konstantin Osipov
2019-05-16 11:58 ` Vladislav Shpilevoy
2019-05-16 22:46 ` Vladislav Shpilevoy
2019-05-21 16:57 ` [tarantool-patches] Re: [PATCH 00/10] swim Lua API Vladislav Shpilevoy
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=745abc0d14765897d4af8ba52a5a78ad229fb568.1557948687.git.v.shpilevoy@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH 02/10] swim: make swim_new_round() void' \
/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