From: blackh <gra...@li...> - 2003-07-14 11:42:44
|
blackh Mon Jul 14 04:42:43 2003 EDT Modified files: /grapevine/raisen/grapevine discovery.xml transaction-routing.xml Log: Fix bug in transaction routing: had 'ack' instead of 'nack'! No wonder it wasn't working. Index: grapevine/raisen/grapevine/transaction-routing.xml diff -u grapevine/raisen/grapevine/transaction-routing.xml:1.37 grapevine/raisen/grapevine/transaction-routing.xml:1.38 --- grapevine/raisen/grapevine/transaction-routing.xml:1.37 Fri Jun 13 23:15:38 2003 +++ grapevine/raisen/grapevine/transaction-routing.xml Mon Jul 14 04:42:43 2003 @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<!-- $Id: transaction-routing.xml,v 1.37 2003/06/14 06:15:38 blackh Exp $ --> +<!-- $Id: transaction-routing.xml,v 1.38 2003/07/14 11:42:43 blackh Exp $ --> <!-- To route a transaction to another node, set the transaction# @@ -67,7 +67,7 @@ ]> <grapevine> - <domain name="grapevine.transaction-routing" author1="Stephen Blackheath" rev="$Revision: 1.37 $"> + <domain name="grapevine.transaction-routing" author1="Stephen Blackheath" rev="$Revision: 1.38 $"> <facts> <flag verbose="false" debug="false"/> @@ -75,9 +75,33 @@ <rules> +<preprocess.if test="language >= '1.1'"> + <!-- If we receive a message that contains 'route', we first check to see + what the I/O backlog looks like. --> + route_message-100: + msg = <msg.from interface="[fromInterface]" location="[fromLocation]" remoteIPAddr="[remoteIPAddr]"> + <route id="[id]" destination="[destination]"/> + </msg.from>, + + backlog=backlogMillis(), + backlog >= 8000, + + <!-- If the I/O backlog is more than 8 seconds, then we reject the new message. + This prevents the grapevine daemon from getting bogged down if its CPU is + not fast enough to cope with the traffic it is receiving. --> + retract msg, + remember new <msg.to location="[fromLocation]" interface="[fromInterface]" within="0"> + <nack id="[id]"/> + </msg.to>, + { + <flag debug="true"/>, + println("transaction-routing: " ## id ## " rejected due to overloading. Backlog=" ## backlog), + } || true; +</preprocess.if> + <!-- If we receive a message that contains 'route', then we route the message to its intended destination. --> - route_message-100: + route_message-105: msg = <msg.from interface="[interface]" location="[fromLocation]" remoteIPAddr="[remoteIPAddr]"> <route id="[id]" destination="[destination]"/> </msg.from>, @@ -168,7 +192,7 @@ println("transaction-routing: " ## id ## " routing loop - send NACK"), <!-- ### --> <!-- Otherwise send a nack to indicate a routing loop. --> remember new <msg.to location="[fromLocation]" interface="[fromInterface]" within="0"> - <ack id="[id]"/> + <nack id="[id]"/> </msg.to> } } || @@ -536,7 +560,7 @@ remember new <got-ack id="[id]" interface="[interface]" routee="[location]"/>; <!-- If we receive a NACK, then this means we got a routing loop. - So, propagate again immediately. This will make it try a different destinations. --> + So, propagate again immediately. This will make it try a different destination. --> receive_nack: trans=<obj.transaction id="[id]" band="[band]"/>, msg=<msg.from location="[location]"> |