From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id C3E7F2BDC2 for ; Thu, 18 Apr 2019 13:43:37 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LaFdhWc3zzSX for ; Thu, 18 Apr 2019 13:43:37 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 7DA542BDB2 for ; Thu, 18 Apr 2019 13:43:37 -0400 (EDT) Subject: [tarantool-patches] [PATCH 5.5/6] swim: rename TTL to TTD From: Vladislav Shpilevoy References: Message-ID: <5752e49a-c8e0-edb9-fab9-9157a9526e39@tarantool.org> Date: Thu, 18 Apr 2019 20:43:35 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: kostja@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)