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 5.5/6] swim: rename TTL to TTD
Date: Thu, 18 Apr 2019 20:43:35 +0300	[thread overview]
Message-ID: <5752e49a-c8e0-edb9-fab9-9157a9526e39@tarantool.org> (raw)
In-Reply-To: <cover.1555021137.git.v.shpilevoy@tarantool.org>

TTL is time-to-live and it slightly confuses when is said about a
member's attribute. Status_ttl looks like after this value gets
0 the status is deleted or is no longer valid.

TTD is more precise definition for these counters and is expanded
as time-to-disseminate.
---
 src/lib/swim/swim.c       | 41 ++++++++++++++++++++-------------------
 src/lib/swim/swim_proto.h |  2 +-
 test/unit/swim.c          |  4 ++--
 test/unit/swim.result     |  4 ++--
 4 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index 2dac6eedd..3e64e4c91 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -284,30 +284,31 @@ struct swim_member {
 	 * member state each time any member attribute changes.
 	 *
 	 * According to SWIM, an event should be sent to all
-	 * members at least once - for that a TTL (time-to-live)
-	 * counter is maintained for each independent event type.
+	 * members at least once - for that a TTD
+	 * (time-to-disseminate) counter is maintained for each
+	 * independent event type.
 	 *
-	 * When a member state changes, the TTL is reset to the
+	 * When a member state changes, the TTD is reset to the
 	 * cluster size. It is then decremented after each send.
 	 * This guarantees that each member state change is sent
 	 * to each SWIM member at least once. If a new event of
 	 * the same type is generated before a round is finished,
 	 * the current event object is updated in place with reset
-	 * of the TTL.
+	 * of the TTD.
 	 *
-	 * To conclude, TTL works in two ways: to see which
+	 * To conclude, TTD works in two ways: to see which
 	 * specific member attribute needs dissemination and to
 	 * track how many cluster members still need to learn
 	 * about the change from this instance.
 	 */
 	/**
-	 * General TTL reset each time when any visible member
+	 * General TTD reset each time when any visible member
 	 * attribute is updated. It is always bigger or equal than
-	 * any other TTLs. In addition it helps to keep a dead
-	 * member not dropped until the TTL gets zero so as to
+	 * any other TTDs. In addition it helps to keep a dead
+	 * member not dropped until the TTD gets zero so as to
 	 * allow other members to learn the dead status.
 	 */
-	int status_ttl;
+	int status_ttd;
 	/**
 	 * All created events are put into a queue sorted by event
 	 * time.
@@ -419,7 +420,7 @@ struct swim {
 	 * Queue of all members which have dissemination
 	 * information. A member is added to the queue whenever
 	 * any of its attributes changes, and stays in the queue
-	 * as long as the event TTL is non-zero.
+	 * as long as the event TTD is non-zero.
 	 */
 	struct rlist dissemination_queue;
 };
@@ -444,9 +445,9 @@ swim_wait_ack(struct swim *swim, struct swim_member *member)
 
 /**
  * On literally any update of a member it is added to a queue of
- * members to disseminate updates. Regardless of other TTLs, each
- * update also resets status TTL. Status TTL is always greater
- * than any other event-related TTL, so it's sufficient to look at
+ * members to disseminate updates. Regardless of other TTDs, each
+ * update also resets status TTD. Status TTD is always greater
+ * than any other event-related TTD, so it's sufficient to look at
  * it alone to see that a member needs information dissemination.
  * The status change itself occupies only 2 bytes in a packet, so
  * it is cheap to send it on any update, while does reduce
@@ -459,7 +460,7 @@ swim_register_event(struct swim *swim, struct swim_member *member)
 		rlist_add_tail_entry(&swim->dissemination_queue, member,
 				     in_dissemination_queue);
 	}
-	member->status_ttl = mh_size(swim->members);
+	member->status_ttd = mh_size(swim->members);
 	swim_cached_round_msg_invalidate(swim);
 }
 
@@ -872,8 +873,8 @@ swim_encode_round_msg(struct swim *swim)
 }
 
 /**
- * Decrement TTLs of all events. It is done after each round step.
- * Note, since we decrement TTL of all events, even those which
+ * Decrement TTDs of all events. It is done after each round step.
+ * Note, since we decrement TTD of all events, even those which
  * have not been actually encoded and sent, if there are more
  * events than can fit into a packet, the tail of the queue begins
  * reeking and rotting. The most recently added members could even
@@ -884,13 +885,13 @@ swim_encode_round_msg(struct swim *swim)
  * deal with.
  */
 static void
-swim_decrease_event_ttl(struct swim *swim)
+swim_decrease_event_ttd(struct swim *swim)
 {
 	struct swim_member *member, *tmp;
 	rlist_foreach_entry_safe(member, &swim->dissemination_queue,
 				 in_dissemination_queue,
 				 tmp) {
-		if (--member->status_ttl == 0) {
+		if (--member->status_ttd == 0) {
 			rlist_del_entry(member, in_dissemination_queue);
 			swim_cached_round_msg_invalidate(swim);
 			if (member->status == MEMBER_LEFT)
@@ -959,7 +960,7 @@ swim_complete_step(struct swim_task *task,
 			 * sections.
 			 */
 			swim_wait_ack(swim, m);
-			swim_decrease_event_ttl(swim);
+			swim_decrease_event_ttd(swim);
 		}
 	}
 }
@@ -1029,7 +1030,7 @@ swim_check_acks(struct ev_loop *loop, struct ev_timer *t, int events)
 			break;
 		case MEMBER_DEAD:
 			if (m->unacknowledged_pings >= NO_ACKS_TO_GC &&
-			    swim->gc_mode == SWIM_GC_ON && m->status_ttl == 0) {
+			    swim->gc_mode == SWIM_GC_ON && m->status_ttd == 0) {
 				swim_delete_member(swim, m);
 				continue;
 			}
diff --git a/src/lib/swim/swim_proto.h b/src/lib/swim/swim_proto.h
index ab4057185..e1c70db43 100644
--- a/src/lib/swim/swim_proto.h
+++ b/src/lib/swim/swim_proto.h
@@ -268,7 +268,7 @@ swim_anti_entropy_header_bin_create(struct swim_anti_entropy_header_bin *header,
  * and add more attributes. Or just encode new attributes after
  * the passport. For example, anti-entropy can add a payload when
  * it is up to date; dissemination adds a payload when it is up to
- * date and TTL is > 0.
+ * date and TTD is > 0.
  */
 struct PACKED swim_passport_bin {
 	/** mp_encode_map(5) */
diff --git a/test/unit/swim.c b/test/unit/swim.c
index f3cf6cd06..6f3871606 100644
--- a/test/unit/swim.c
+++ b/test/unit/swim.c
@@ -254,10 +254,10 @@ swim_test_basic_failure_detection(void)
 
 	swim_run_for(1);
 	is(swim_cluster_member_status(cluster, 0, 1), MEMBER_DEAD, "after 2 "\
-	   "more unacks the member still is not deleted - dissemination TTL "\
+	   "more unacks the member still is not deleted - dissemination TTD "\
 	   "keeps it");
 	is(swim_cluster_wait_status(cluster, 0, 1, swim_member_status_MAX, 2),
-	   0, "but it is dropped after 2 rounds when TTL gets 0");
+	   0, "but it is dropped after 2 rounds when TTD gets 0");
 
 	/*
 	 * After IO unblock pending messages will be processed all
diff --git a/test/unit/swim.result b/test/unit/swim.result
index d315f181f..a90a86dd0 100644
--- a/test/unit/swim.result
+++ b/test/unit/swim.result
@@ -68,8 +68,8 @@ ok 5 - subtests
     ok 1 - node is added as alive
     ok 2 - member still is not dead after 2 noacks
     ok 3 - but it is dead after one more
-    ok 4 - after 2 more unacks the member still is not deleted - dissemination TTL keeps it
-    ok 5 - but it is dropped after 2 rounds when TTL gets 0
+    ok 4 - after 2 more unacks the member still is not deleted - dissemination TTD keeps it
+    ok 5 - but it is dropped after 2 rounds when TTD gets 0
     ok 6 - fullmesh is restored
     ok 7 - a member is added back on an ACK
 ok 6 - subtests
-- 
2.17.2 (Apple Git-113)

  parent reply	other threads:[~2019-04-18 17:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 22:22 [tarantool-patches] [PATCH 0/6] swim payload Vladislav Shpilevoy
2019-04-11 22:22 ` [tarantool-patches] [PATCH 1/6] swim: factor out MP_BIN decoding from swim_decode_uuid Vladislav Shpilevoy
2019-04-11 23:09   ` [tarantool-patches] " Konstantin Osipov
2019-04-12 19:23     ` Vladislav Shpilevoy
2019-04-11 22:22 ` [tarantool-patches] [PATCH 2/6] swim: replace event_bin and member_bin with the passport Vladislav Shpilevoy
2019-04-11 23:10   ` [tarantool-patches] " Konstantin Osipov
2019-04-12 19:23     ` Vladislav Shpilevoy
2019-04-11 22:22 ` [tarantool-patches] [PATCH 3/6] swim: factor out 'update' part of swim_member_upsert() Vladislav Shpilevoy
2019-04-11 23:11   ` [tarantool-patches] " Konstantin Osipov
2019-04-12 19:23     ` Vladislav Shpilevoy
2019-04-11 22:22 ` [tarantool-patches] [PATCH 4/6] test: generalize SWIM fake descriptor filters Vladislav Shpilevoy
2019-04-11 23:11   ` [tarantool-patches] " Konstantin Osipov
2019-04-12 19:23     ` Vladislav Shpilevoy
2019-04-11 22:22 ` [tarantool-patches] [PATCH 5/6] test: introduce new SWIM packet filter by component names Vladislav Shpilevoy
2019-04-11 23:11   ` [tarantool-patches] " Konstantin Osipov
2019-04-12 19:23     ` Vladislav Shpilevoy
2019-04-11 22:22 ` [tarantool-patches] [PATCH 6/6] swim: introduce payload Vladislav Shpilevoy
2019-04-18 15:12   ` [tarantool-patches] " Konstantin Osipov
2019-04-18 17:43     ` Vladislav Shpilevoy
2019-04-18 18:03       ` Konstantin Osipov
2019-04-18 20:40         ` Vladislav Shpilevoy
2019-04-18 17:43 ` Vladislav Shpilevoy [this message]
2019-04-18 17:48   ` [tarantool-patches] Re: [PATCH 5.5/6] swim: rename TTL to TTD Konstantin Osipov
2019-04-18 20:40     ` Vladislav Shpilevoy
2019-04-18 18:16 ` [tarantool-patches] [PATCH 7/6] swim: drop incarnation_inc parameter from update() routines Vladislav Shpilevoy
2019-04-18 18:20   ` [tarantool-patches] " Konstantin Osipov
2019-04-18 20:40     ` 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=5752e49a-c8e0-edb9-fab9-9157a9526e39@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 5.5/6] swim: rename TTL to TTD' \
    /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