Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH 1/1] swim: push-pull dissemination
@ 2019-07-04 22:23 Vladislav Shpilevoy
  2019-07-05  8:21 ` [tarantool-patches] " Konstantin Osipov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Shpilevoy @ 2019-07-04 22:23 UTC (permalink / raw)
  To: tarantool-patches; +Cc: kostja

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] swim: push-pull dissemination
  2019-07-04 22:23 [tarantool-patches] [PATCH 1/1] swim: push-pull dissemination Vladislav Shpilevoy
@ 2019-07-05  8:21 ` Konstantin Osipov
  2019-07-05 22:44   ` Vladislav Shpilevoy
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Osipov @ 2019-07-05  8:21 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/07/05 10:17]:
> 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.
> 

OK to push.

Now all messages are symmetric, is this right?


-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tarantool-patches] Re: [PATCH 1/1] swim: push-pull dissemination
  2019-07-05  8:21 ` [tarantool-patches] " Konstantin Osipov
@ 2019-07-05 22:44   ` Vladislav Shpilevoy
  0 siblings, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy @ 2019-07-05 22:44 UTC (permalink / raw)
  To: Konstantin Osipov; +Cc: tarantool-patches

Pushed to the master.

On 05/07/2019 10:21, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/07/05 10:17]:
>> 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.
>>
> 
> OK to push.
> 
> Now all messages are symmetric, is this right?
> 
> 

Yes, they all are the same now. Even indirect ones.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-05 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-04 22:23 [tarantool-patches] [PATCH 1/1] swim: push-pull dissemination Vladislav Shpilevoy
2019-07-05  8:21 ` [tarantool-patches] " Konstantin Osipov
2019-07-05 22:44   ` Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox