Permalink
Browse files

Merge branch 'Branch_JGroups_3_2' of github.com:belaban/JGroups into …

…Branch_JGroups_3_2
  • Loading branch information...
2 parents fcc682b + 0fc0961 commit 58c6ecbd1249c7908d246a77c3de4c2f690e4d96 Bela Ban committed Nov 13, 2012
Showing with 1,350 additions and 308 deletions.
  1. +1 −1 conf/relay1.xml
  2. +1 −1 conf/relay2.xml
  3. +39 −9 conf/scripts/BecomeServerTest/testSendingOfMsgsOnUnconnectedChannel.btm
  4. +26 −0 conf/scripts/ForwardToCoordFailoverTest/testSendingDuringViewChange.btm
  5. +1 −1 conf/scripts/SequencerFailoverTest/testResendingVersusNewMessages.btm
  6. +1 −1 conf/testng/byteman.xml
  7. BIN lib/byteman-bmunit.jar
  8. BIN lib/byteman-install.jar
  9. BIN lib/byteman-submit.jar
  10. BIN lib/byteman.jar
  11. +6 −6 lib/licenses/thirdparty-licenses.xml
  12. BIN lib/{testng.jar → testng-6.8.jar}
  13. +5 −4 pom.xml
  14. +5 −2 src/org/jgroups/JChannel.java
  15. +5 −5 src/org/jgroups/protocols/Discovery.java
  16. +1 −1 src/org/jgroups/protocols/FILE_PING.java
  17. +56 −83 src/org/jgroups/protocols/FORWARD_TO_COORD.java
  18. +4 −4 src/org/jgroups/protocols/SEQUENCER.java
  19. +5 −4 src/org/jgroups/protocols/TP.java
  20. +5 −0 src/org/jgroups/protocols/pbcast/NAKACK2.java
  21. +110 −77 src/org/jgroups/protocols/relay/RELAY2.java
  22. +225 −63 src/org/jgroups/protocols/relay/Relayer.java
  23. +17 −3 src/org/jgroups/protocols/relay/config/RelayConfig.java
  24. +1 −1 src/org/jgroups/stack/DiagnosticsHandler.java
  25. +328 −0 src/org/jgroups/util/ForwardQueue.java
  26. +5 −4 tests/byteman/org/jgroups/tests/byteman/BecomeServerTest.java
  27. +167 −0 tests/byteman/org/jgroups/tests/byteman/ForwardToCoordFailoverTest.java
  28. +31 −0 tests/byteman/org/jgroups/tests/helpers/BecomeServerTestHelper.java
  29. +37 −0 tests/byteman/org/jgroups/tests/helpers/ForwardToCoordFailoverTestHelper.java
  30. +7 −1 tests/byteman/org/jgroups/tests/helpers/SequencerFailoverTestHelper.java
  31. +11 −6 tests/junit-functional/org/jgroups/protocols/FORWARD_TO_COORD_Test.java
  32. +250 −31 tests/junit-functional/org/jgroups/tests/Relay2Test.java
View
@@ -4,7 +4,7 @@
Sample configuration of multiple sites, to be used in RELAY2
****
- **** Note that the schema is still work-in-progress and might change between 3.2 and 3.2, as
+ **** Note that the schema is still work-in-progress and might change between 3.2 and 3.3, as
**** we're trying to simplify it
****
-->
View
@@ -4,7 +4,7 @@
Sample configuration of multipe sites, to be used in RELAY2
****
- **** Note that the schema is still work-in-progress and might change between 3.2 and 3.2, as
+ **** Note that the schema is still work-in-progress and might change between 3.2 and 3.3, as
**** we're trying to simplify it
****
-->
@@ -17,9 +17,20 @@
RULE CreateRendezvous
CLASS BecomeServerTest
METHOD testSendingOfMsgsOnUnconnectedChannel
+AT ENTRY
IF TRUE
DO System.out.println("--> Creating rendezvous");
- createRendezvous("BecomeServerTest", 2, true);
+ createRendezvous("rv", 2, true); ## we use this RV 2 times, so it needs to be rejoinable
+ENDRULE
+
+## Delete the rendezvous when the test is done
+RULE DeleteRendezvous
+CLASS BecomeServerTest
+METHOD testSendingOfMsgsOnUnconnectedChannel
+AT EXIT
+IF TRUE
+ DO System.out.println("--> Deleting rendezvous");
+ deleteRendezvous("rv", 2);
ENDRULE
@@ -28,32 +39,51 @@ RULE MessageSending
CLASS BecomeServerTest
METHOD sendMessage
AT ENTRY
-IF rendezvous("BecomeServerTest") != -1
+IF rendezvous("rv") != -1
DO System.out.println("--> A: sending message");
ENDRULE
+## Signals that A's message has been received by B
+#RULE MessageReception
+#CLASS NAKACK2
+#METHOD up
+#HELPER org.jgroups.tests.helpers.BecomeServerTestHelper
+#AFTER INVOKE BoundedList.add(Message) ALL
+#BIND len=$msg.getLength();
+# is_server=$0.is_server;
+#IF len > 0
+# DO System.out.println("--> " + $0.local_addr + ": received message " + $msg.printHeaders() + ", added to queue, is_server=" + is_server);
+# rendezvous("rv");
+#ENDRULE
+
+
## Signals that A's message has been received by B
RULE MessageReception
CLASS NAKACK2
METHOD up
+HELPER org.jgroups.tests.helpers.BecomeServerTestHelper
AFTER INVOKE BoundedList.add(Message) ALL
-BIND len=$msg.getLength();
-IF len > 0
- DO System.out.println("--> " + $0.local_addr + ": received message " + $msg.printHeaders() + ", added to queue");
- rendezvous("BecomeServerTest");
+BIND queue=$0.become_server_queue;
+ is_server=$0.is_server;
+ local_addr_name=org.jgroups.util.UUID.get($0.local_addr);
+AFTER INVOKE BoundedList.add ALL
+IF !is_server && local_addr_name.equals("B") && messageReceived(queue)
+ DO rendezvous("rv");
ENDRULE
+
+
## Blocks until A has sent the message and B has received (and queued) it
RULE InstallView
CLASS ClientGmsImpl
METHOD installView
AT ENTRY
BIND local_addr_name=org.jgroups.util.UUID.get($0.gms.local_addr);
-IF local_addr_name.equals("B") AND rendezvous("BecomeServerTest") != -1
- DO System.out.println("--> B: installView() entered rendezvous; blocking until message has been received");
- rendezvous("BecomeServerTest");
+IF local_addr_name.equals("B") AND rendezvous("rv") != -1
+ DO System.out.println("--> B: installView() waiting on rendezvous until message has been received");
+ rendezvous("rv");
System.out.println("--> B: installView() was unblocked");
ENDRULE
@@ -0,0 +1,26 @@
+
+## Test case for https://issues.jboss.org/browse/JGRP-1517 (FORWARD_TO_COORD):
+## - When a coord A fails, we resend messages in the forward-queue that we haven't yet received
+## - If, at the same time, new messages are sent, the old messages in the forward-queue might be received
+## *after* the new ones. JGRP-1517 is supposed to fix that. The fix is that sending of new messages on a view
+## change will be blocked until all messages in the forward-queue have been forwarded successfully.
+##
+## The test case intercepts FORWARD_TO_COORD.handleViewChange() and starts a thread which sends new messages.
+## We then check the order of message delivery, which must be FIFO.
+
+RULE SendNewMessages
+CLASS ForwardQueue
+METHOD doFlush
+HELPER org.jgroups.tests.helpers.ForwardToCoordFailoverTestHelper
+AT READ flushing ALL
+BIND local_addr_name=org.jgroups.util.UUID.get($0.local_addr);
+ map:java.util.Map=$0.forward_table;
+ empty=map.isEmpty();
+IF !empty && local_addr_name.equals("C")
+#IF TRUE
+ DO System.out.println("[byteman script] --> sending new messages 6-10");
+ sendMessages($0.up_prot, 6, 10);
+ENDRULE
+
+
+
@@ -18,7 +18,7 @@ BIND local_addr_name=org.jgroups.util.UUID.get($0.local_addr);
empty=map.isEmpty();
flushing=$0.flushing
IF flushing && local_addr_name.equals("C") && !empty
-DO System.out.println("-- sending new messages 2-5");
+DO System.out.println("[byteman] --> sending new messages 2-5");
sendMessages($0, 2, 5);
ENDRULE
View
@@ -3,7 +3,7 @@
parallel="false"
thread-count="1" >
- <test name="byteman" junit="false" time-out="1200000">
+ <test name="byteman" junit="false" time-out="30000">
<groups>
<run>
<include name="byteman"/>
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
@@ -44,25 +44,25 @@
</module>
<module name='byteman'
licenseType='LGPL 2.1'
- version='2.0.3'
+ version='2.1.0'
projectHome='http://www.jboss.org/byteman'>
<jar name='byteman.jar' />
</module>
<module name='byteman-bmunit'
licenseType='LGPL 2.1'
- version='2.0.3 (temp)'
+ version='2.1.0'
projectHome='http://www.jboss.org/byteman'>
<jar name='byteman-bmunit.jar' />
</module>
<module name='byteman-install'
licenseType='LGPL 2.1'
- version='2.0.3'
+ version='2.1.0'
projectHome='http://www.jboss.org/byteman'>
<jar name='byteman-install.jar' />
</module>
<module name='byteman-submit'
licenseType='LGPL 2.1'
- version='2.0.3'
+ version='2.1.0'
projectHome='http://www.jboss.org/byteman'>
<jar name='byteman-submit.jar' />
</module>
@@ -89,10 +89,10 @@
</module>
<module name='testng'
licenseType='apache-2.0'
- version='6.3.1'
+ version='6.8'
projectHome='http://www.testng.org'
description='Used for unit testing'>
- <jar name='testng.jar' />
+ <jar name='testng-6.8.jar' />
</module>
<module name='xalan'
licenseType='apache-2.0'
Binary file not shown.
View
@@ -31,9 +31,10 @@
</licenses>
<scm>
- <connection>cvs -d:pserver:anonymous@javagroups.cvs.sourceforge.net:/cvsroot/javagroups</connection>
- <developerConnection>cvs -d:ext:USER@javagroups.cvs.sf.net/cvsroot/javagroups</developerConnection>
- <url>cvs -d:pserver:anonymous@javagroups.cvs.sourceforge.net:/cvsroot/javagroups</url>
+ <connection>git://github.com/belaban/JGroups.git</connection>
+ <developerConnection>git@github.com:belaban/JGroups.git</developerConnection>
+ <tag>master</tag>
+ <url>https://github.com/belaban/JGroups</url>
</scm>
<issueManagement>
@@ -93,7 +94,7 @@
<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-bmunit</artifactId>
- <version>2.0.0</version>
+ <version>2.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -169,7 +169,9 @@ public JChannel(ProtocolStackConfigurator configurator) throws Exception {
/**
- * Creates a channel from a list of protocols
+ * Creates a channel from a list of protocols. Note that after a {@link org.jgroups.JChannel#close()}, the protocol
+ * list <em>should not</em> be reused, ie. new JChannel(protocols) would reuse the same protocol list, and this
+ * might lead to problems !
* @param protocols The list of protocols, from bottom to top, ie. the first protocol in the list is the transport,
* the last the top protocol
* @throws Exception
@@ -1070,7 +1072,8 @@ private void handleOperation(Map<String, String> map, String operation) throws E
String prot_name=operation.substring(0, index);
Protocol prot=prot_stack.findProtocol(prot_name);
if(prot == null)
- throw new IllegalArgumentException("protocol " + prot_name + " not found");
+ return; // less drastic than throwing an exception...
+
int args_index=operation.indexOf("[");
String method_name;
@@ -271,7 +271,7 @@ public void sendDiscoveryRequest(String cluster_name, Promise promise, ViewId vi
msg.setFlag(Message.OOB);
msg.putHeader(this.id, hdr);
if(log.isTraceEnabled())
- log.trace("[FIND_INITIAL_MBRS] sending discovery request to " + msg.getDest());
+ log.trace(local_addr + ": sending discovery request to " + msg.getDest());
if(!sendDiscoveryRequestsInParallel()) {
down_prot.down(new Event(Event.MSG, msg));
}
@@ -283,7 +283,7 @@ public void run() {
}
catch(Exception ex){
if(log.isErrorEnabled())
- log.error("failed sending discovery request to " + addr + ": " + ex);
+ log.error(local_addr + ": failed sending discovery request to " + addr + ": " + ex);
}
}
});
@@ -376,7 +376,7 @@ public Object up(Event evt) {
else {
if(!group_addr.equals(hdr.cluster_name)) {
if(log.isWarnEnabled())
- log.warn("discarding discovery request for cluster '" + hdr.cluster_name + "' from " +
+ log.warn(local_addr + ": discarding discovery request for cluster '" + hdr.cluster_name + "' from " +
msg.getSrc() + "; our cluster name is '" + group_addr + "'. " +
"Please separate your clusters cleanly.");
return null;
@@ -530,7 +530,7 @@ public Object down(Event evt) {
List<PingData> rsps=find_all_views? findAllViews(promise) : findInitialMembers(promise);
long diff=System.currentTimeMillis() - start;
if(log.isTraceEnabled())
- log.trace("discovery took "+ diff + " ms: responses: " + Util.printPingData(rsps));
+ log.trace(local_addr + ": discovery took "+ diff + " ms: responses: " + Util.printPingData(rsps));
return rsps;
case Event.TMP_VIEW:
@@ -642,7 +642,7 @@ public void run() {
}
if(log.isTraceEnabled())
- log.trace("received GET_MBRS_REQ from " + sender + ", sending response " + rsp_hdr);
+ log.trace(local_addr + ": received GET_MBRS_REQ from " + sender + ", sending response " + rsp_hdr);
down_prot.down(new Event(Event.MSG, rsp_msg));
}
@@ -313,7 +313,7 @@ private File writeToTempFile(File dir, PingData data) {
}
catch(Exception e) {
Util.close(out);
- log.error("Failed to write temporary file: "+file.getAbsolutePath());
+ log.error("Failed to write temporary file: "+file.getAbsolutePath(), e);
deleteFile(file);
return null;
}
Oops, something went wrong.

0 comments on commit 58c6ecb

Please sign in to comment.