[Spread-cvs] commit: r442 - trunk/daemon
jonathan at spread.org
jonathan at spread.org
Fri Jan 6 20:10:41 EST 2012
Author: jonathan
Date: 2012-01-06 20:10:41 -0500 (Fri, 06 Jan 2012)
New Revision: 442
Modified:
trunk/daemon/Changelog
trunk/daemon/protocol.c
Log:
Document Token Hurry algorithm to determine if token should be held. Also fix bug where request to send is sometimes delayed by the hurry timeout when it shouldn't be.
Modified: trunk/daemon/Changelog
===================================================================
--- trunk/daemon/Changelog 2012-01-07 00:43:24 UTC (rev 441)
+++ trunk/daemon/Changelog 2012-01-07 01:10:41 UTC (rev 442)
@@ -1,3 +1,10 @@
+Fri Jan 6 19:58:12 2012 Jonathan Stanton <jonathan at spreadconcepts.com>
+
+ * protocol.c (Handle_hurry): Fix token hurry bug where one daemon
+ wanted to send, but the token entered hold state until hurry
+ timeout expired. Prevents 2 second latency delay to send in certain
+ circumstances.
+
Fri Jan 6 01:01:01 2012 Jonathan Stanton <jonathan at spreadconcepts.com>
* include/sp.h, scatter.h (dummy_scat_element): Fix scatter type
Modified: trunk/daemon/protocol.c
===================================================================
--- trunk/daemon/protocol.c 2012-01-07 00:43:24 UTC (rev 441)
+++ trunk/daemon/protocol.c 2012-01-07 01:10:41 UTC (rev 442)
@@ -485,7 +485,7 @@
if( (Memb_state() != EVS ) && (Token->seq > MAX_WRAP_SEQUENCE_VALUE ) )
{
Alarm( PRINT, "Prot_handle_token: Token Sequence number (%ld) approaching 2^31 so trigger membership to reset it.\n", Token->seq);
-
+ /* return swallows token and will break ring and trigger membership */
return;
}
@@ -1329,6 +1329,26 @@
}
}
+/* The Token is in "hold" state at a leader or non-leader daemon
+ * if the following conditions hold:
+ *
+ * 1) A normal token is circling:
+ * "Memb_state() == OP or GATHER with Alive token"
+ * These are the only states when a token that allows message sends is circling
+ * 2) All messages are stable at all daemons (i.e. every daemon knows that all messages are stable):
+ * "ARU == Highest_Seq"
+ * Otherwise we need to cycle the token so all daemons will learn about the messages and the ARU of
+ * other daemons so they can laearn about stability of all messages.
+ * 3) Only one copy of a token with a particular ARQ value has been sent around the ring:
+ * "Get_retrans(Last_token->type) <= 1"
+ * This is true when the token is sent on in the Prot_handle_token() function after being recreated or
+ * if it is sent the first time Prot_token_hurry() is called because of a timeout after Prot_handle_token has created a new token.
+ * 4) The token are circulated at least once without doing any work (no new messages or updates to counters)
+ * AND no daemon has requested the token in order to send new messages (sent a Hurry request)
+ * "Token_counter > 1"
+ * This measures the lack of interest by any daemon in introducing new work and is only used in Spread
+ * to detect this lack of interest - i.e. it has no other role.
+ */
static int Is_token_hold()
{
if( ( Memb_state() == OP ||
@@ -1355,6 +1375,11 @@
if( Conf_id_in_conf( Memb_active_ptr(), pack_ptr->proc_id ) != -1 )
{
Alarm( PROTOCOL, "Handle_hurry: sending token now\n");
+ /* Reset token_counter so token protocol knows someone wants to send
+ * and token should not go into hold state until everyone gets a chance
+ * to send.
+ */
+ Token_counter = 0;
Prot_token_hurry();
}
}
More information about the Spread-cvs
mailing list