Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
	Konstantin Osipov <kostja@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 1/2] swim: introduce broadcast tasks
Date: Thu, 11 Apr 2019 16:46:30 +0300	[thread overview]
Message-ID: <698d6420-071c-39b2-e9ae-bad0377ea1a6@tarantool.org> (raw)
In-Reply-To: <20190411125753.GA2123@chai>



On 11/04/2019 15:57, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/04/10 21:01]:
>> When a cluster is just created, no one knows anyone. Broadcast
>> helps to establish some initial relationships between members.
>>
>> This commit introduces only an interface to create broadcast
>> tasks from SWIM code. The next commit uses this interface to
>> implement ping broadcast.
> 
>> +/**
>> + * Broadcast task. Besides usual task fields, stores a list of
>> + * interfaces available for broadcast packets. The task works
>> + * multiple times, each time sending a packet to one interface.
>> + * After completion it is self-deleted.
>> + */
>> +struct swim_bcast_task {
> 
>     Please explain in the comment why you need a task - you may
>     only broadcast when a socket is writable, so use a generic way to 
>     interact with the transport. Please mention why you create a
>     single task, not multiple - no particular reason, just to
>     create fewer tasks and do less error checking for failed
>     resources.

My way has nothing to do with less error checking. I still check
for no interfaces, for getifaddrs() error, for IO errors. The only
reason - I wanted not to create many tasks, to save some memory.

>     Please mention in a comment to swim_broadcast that
>     we send a broadcast message to all interfaces which are
>     support IP protocol and broadcast messages. 

I did it in the next commit. Here we do not have swim_broadcast()
yet.


I've update the comment and pushed to the master:

===================================================================
diff --git a/src/lib/swim/swim_io.h b/src/lib/swim/swim_io.h
index 30acd491f..5d0cb0d47 100644
--- a/src/lib/swim/swim_io.h
+++ b/src/lib/swim/swim_io.h
@@ -250,8 +250,16 @@ swim_task_destroy(struct swim_task *task)
 /**
  * Broadcast task. Besides usual task fields, stores a list of
  * interfaces available for broadcast packets. The task works
- * multiple times, each time sending a packet to one interface.
- * After completion it is self-deleted.
+ * asynchronously just like its ancestor, because even broadcast
+ * packets can not be sent without explicit permission from libev
+ * in a form of EV_WRITE event.
+ *
+ * Despite usually having multiple network interfaces supporting
+ * broadcast, there is only one task to send a packet to all of
+ * them. The same task works multiple times, each time sending a
+ * packet to one interface. After completion it is self-deleted.
+ * There are no any concrete reason behind that except stint on
+ * memory for multiple tasks.
  */
 struct swim_bcast_task {
 	/** Base structure. */
===================================================================

> 
> 
> Otherwise the patch is OK to push.
> 
> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> http://tarantool.io - www.twitter.com/kostja_osipov
> 

  reply	other threads:[~2019-04-11 13:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 17:45 [tarantool-patches] [PATCH 0/2] swim broadcast Vladislav Shpilevoy
2019-04-10 17:45 ` [tarantool-patches] [PATCH 1/2] swim: introduce broadcast tasks Vladislav Shpilevoy
2019-04-11 12:57   ` [tarantool-patches] " Konstantin Osipov
2019-04-11 13:46     ` Vladislav Shpilevoy [this message]
2019-04-10 17:45 ` [tarantool-patches] [PATCH 2/2] swim: expose ping broadcast API Vladislav Shpilevoy
2019-04-11 13:00   ` [tarantool-patches] " Konstantin Osipov
2019-04-11 13:00     ` Konstantin Osipov
2019-04-11 13:47     ` Vladislav Shpilevoy
2019-04-10 18:11 ` [tarantool-patches] Re: [PATCH 0/2] swim broadcast Konstantin Osipov
2019-04-10 18:13   ` Vladislav Shpilevoy
2019-04-10 22:13     ` 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=698d6420-071c-39b2-e9ae-bad0377ea1a6@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH 1/2] swim: introduce broadcast tasks' \
    /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