[jboss-cvs] JBoss Messaging SVN: r5596 - in branches/Branch_1_4: tests/src/org/jboss/test/messaging/jms/clustering and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jan 7 23:09:34 EST 2009
Author: gaohoward
Date: 2009-01-07 23:09:34 -0500 (Wed, 07 Jan 2009)
New Revision: 5596
Modified:
branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
Log:
JBMESSAGING-1457
Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2009-01-07 21:58:52 UTC (rev 5595)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2009-01-08 04:09:34 UTC (rev 5596)
@@ -3016,6 +3016,19 @@
localQueue.mergeIn(queue.getChannelID(), failedNodeID.intValue());
log.debug("Merged queue");
+
+ //Delete from storage
+
+ //Note we must do this *after* we have done any merge.
+ //This is because if we did it first, then the merge failed, we'd be left with the old channel deleted
+ //but the messages would have still be in the old channel
+ //meaning they would have disappeared from the users point of view and it would involve manual
+ //database intervention to correct it
+ //See http://jira.jboss.com/jira/browse/JBMESSAGING-1113
+
+ deleteBindingFromStorage(queue);
+
+ log.debug(this + " deleted binding for " + queue.getName());
}
else
{
@@ -3024,19 +3037,6 @@
log.warn("Cannot failover " + queue.getName() + " since it does not exist on this node. " +
"You must deploy your clustered destinations on ALL nodes of the cluster");
}
-
- //Delete from storage
-
- //Note we must do this *after* we have done any merge.
- //This is because if we did it first, then the merge failed, we'd be left with the old channel deleted
- //but the messages would have still be in the old channel
- //meaning they would have disappeared from the users point of view and it would involve manual
- //database intervention to correct it
- //See http://jira.jboss.com/jira/browse/JBMESSAGING-1113
-
- deleteBindingFromStorage(queue);
-
- log.debug(this + " deleted binding for " + queue.getName());
// Note we do not need to send an unbind request across the cluster - this is because
// when the node crashes a view change will hit the other nodes and that will cause
Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2009-01-07 21:58:52 UTC (rev 5595)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2009-01-08 04:09:34 UTC (rev 5596)
@@ -21,6 +21,7 @@
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.management.ObjectName;
+import javax.naming.InitialContext;
import org.jboss.jms.client.FailoverEvent;
import org.jboss.jms.client.JBossConnection;
@@ -2122,6 +2123,7 @@
public void testFailoverWithSingleDistributedTargetWithMessage() throws Exception
{
Connection conn = null;
+ Connection conn1 = null;
try
{
@@ -2170,6 +2172,23 @@
TextMessage rm = (TextMessage)cons.receive(2000);
assertNotNull(rm);
assertEquals("blimey", rm.getText());
+
+ //simulate restarting node 1, do not clean db
+ ServerManagement.start(1, config, overrides, false);
+ ServerManagement.deployQueue("singleDeployedDistributedQueue", 1);
+ conn1 = createConnectionOnServer(cf, 1);
+ ic[1] = new InitialContext(ServerManagement.getJNDIEnvironment(1));
+
+ lameClusteredQueue = (Queue)ic[1].lookup("queue/singleDeployedDistributedQueue");
+
+ Session session1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ conn1.start();
+
+ MessageConsumer cons1 = session1.createConsumer(lameClusteredQueue);
+ TextMessage rm1 = (TextMessage)cons1.receive(2000);
+ assertNotNull(rm1);
+ assertEquals("message-to-lose", rm1.getText());
+
}
finally
{
@@ -2177,6 +2196,10 @@
{
conn.close();
}
+ if (conn1 != null)
+ {
+ conn1.close();
+ }
}
}
More information about the jboss-cvs-commits
mailing list