Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 1/1] swim: push-pull dissemination
Date: Fri,  5 Jul 2019 00:23:38 +0200	[thread overview]
Message-ID: <0b77920f623b1ed8beb47112f5607e2f2e74651c.1562278974.git.v.shpilevoy@tarantool.org> (raw)

SWIM in the original paper says, that dissemination time of an
event is O(log(N)), where N is size of the cluster. It is true,
when both ping and ack messages carry dissemination and
anti-entropy. Before this patch it wasn't so - only regular
pings were carrying something.

After this patch the SWIM module has true exponential
dissemination speed.

Closes #4253
---
Branch: https://github.com/tarantool/tarantool/tree/gerold103/gh-4253-swim-true-log
Issue: https://github.com/tarantool/tarantool/issues/4253

 src/lib/swim/swim.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index eda255e6f..7d07a353d 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -1136,15 +1136,13 @@ swim_encode_dissemination(struct swim *swim, struct swim_packet *packet)
 
 /** Encode SWIM components into a UDP packet. */
 static void
-swim_encode_round_msg(struct swim *swim)
+swim_encode_msg(struct swim *swim, struct swim_packet *packet,
+		enum swim_fd_msg_type fd_type)
 {
-	struct swim_packet *packet = &swim->round_step_task.packet;
-	swim_packet_create(packet);
 	char *header = swim_packet_alloc(packet, 1);
 	int map_size = 0;
 	map_size += swim_encode_src_uuid(swim, packet);
-	map_size += swim_encode_failure_detection(swim, packet,
-						  SWIM_FD_MSG_PING);
+	map_size += swim_encode_failure_detection(swim, packet, fd_type);
 	ERROR_INJECT(ERRINJ_SWIM_FD_ONLY, {
 		mp_encode_map(header, map_size);
 		return;
@@ -1221,7 +1219,9 @@ swim_begin_step(struct ev_loop *loop, struct ev_timer *t, int events)
 		swim_ev_timer_stop(loop, t);
 		return;
 	}
-	swim_encode_round_msg(swim);
+	struct swim_packet *packet = &swim->round_step_task.packet;
+	swim_packet_create(packet);
+	swim_encode_msg(swim, packet, SWIM_FD_MSG_PING);
 	struct swim_member *m =
 		rlist_first_entry(&swim->round_queue, struct swim_member,
 				  in_round_queue);
@@ -1280,11 +1280,7 @@ swim_send_fd_msg(struct swim *swim, struct swim_task *task,
 	swim_packet_create(&task->packet);
 	if (proxy != NULL)
 		swim_task_set_proxy(task, proxy);
-	char *header = swim_packet_alloc(&task->packet, 1);
-	int map_size = swim_encode_src_uuid(swim, &task->packet);
-	map_size += swim_encode_failure_detection(swim, &task->packet, type);
-	assert(map_size == 2);
-	mp_encode_map(header, map_size);
+	swim_encode_msg(swim, &task->packet, type);
 	say_verbose("SWIM %d: schedule %s to %s", swim_fd(swim),
 		    swim_fd_msg_type_strs[type], swim_inaddr_str(dst));
 	swim_task_send(task, dst, &swim->scheduler);
-- 
2.20.1 (Apple Git-117)

             reply	other threads:[~2019-07-04 22:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 22:23 Vladislav Shpilevoy [this message]
2019-07-05  8:21 ` [tarantool-patches] " Konstantin Osipov
2019-07-05 22:44   ` 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=0b77920f623b1ed8beb47112f5607e2f2e74651c.1562278974.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/1] swim: push-pull dissemination' \
    /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