You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2014/05/14 09:51:36 UTC

svn commit: r1594509 - in /qpid/trunk/qpid/java/bdbstore: src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java

Author: kwall
Date: Wed May 14 07:51:35 2014
New Revision: 1594509

URL: http://svn.apache.org/r1594509
Log:
QPID-5715: BDB HA's remote replication nodes were using wrong value for lastKnownReplicationId property

Modified:
    qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
    qpid/trunk/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java

Modified: qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java?rev=1594509&r1=1594508&r2=1594509&view=diff
==============================================================================
--- qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java (original)
+++ qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java Wed May 14 07:51:35 2014
@@ -642,7 +642,7 @@ public class BDBHAVirtualHostNodeImpl ex
                 {
                     remoteNode.setRole(nodeState.getNodeState().name());
                     remoteNode.setJoinTime(nodeState.getJoinTime());
-                    remoteNode.setLastTransactionId(nodeState.getKnownMasterTxnEndVLSN());
+                    remoteNode.setLastTransactionId(nodeState.getCurrentTxnEndVLSN());
                 }
             }
         }

Modified: qpid/trunk/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java?rev=1594509&r1=1594508&r2=1594509&view=diff
==============================================================================
--- qpid/trunk/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java (original)
+++ qpid/trunk/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java Wed May 14 07:51:35 2014
@@ -136,6 +136,14 @@ public class BDBHAVirtualHostNodeRestTes
         assertEquals("Unexpected group name", _hostName, nodeData.get(BDBHAVirtualHostNode.GROUP_NAME));
         assertEquals("Unexpected role", expectedRole, nodeData.get(BDBHAVirtualHostNode.ROLE));
 
+        Integer lastKnownTransactionId = (Integer) nodeData.get(BDBHAVirtualHostNode.LAST_KNOWN_REPLICATION_TRANSACTION_ID);
+        assertNotNull("Unexpected lastKnownReplicationId", lastKnownTransactionId);
+        assertTrue("Unexpected lastKnownReplicationId " + lastKnownTransactionId, lastKnownTransactionId > 0);
+
+        Long joinTime = (Long) nodeData.get(BDBHAVirtualHostNode.JOIN_TIME);
+        assertNotNull("Unexpected joinTime", joinTime);
+        assertTrue("Unexpected joinTime " + joinTime, joinTime > 0);
+
         if (isMaster)
         {
             waitForAttributeChanged("virtualhost/" + masterNode + "/" + _hostName + "?depth=0", VirtualHost.STATE, State.ACTIVE.name());
@@ -155,12 +163,13 @@ public class BDBHAVirtualHostNodeRestTes
             for (String remote : remotes)
             {
                 String remoteUrl = "replicationnode/" + clusterNodeName + "/" + remote;
-                waitForAttributeChanged(remoteUrl, BDBHARemoteReplicationNode.ROLE, remote.equals(masterNode) ? "MASTER" : "REPLICA");
+                Map<String, Object> nodeData = waitForAttributeChanged(remoteUrl, BDBHARemoteReplicationNode.ROLE, remote.equals(masterNode) ? "MASTER" : "REPLICA");
+                assertRemoteNodeData(remote, nodeData);
             }
         }
     }
 
-    private void waitForAttributeChanged(String url, String attributeName, Object newValue) throws Exception
+    private Map<String, Object> waitForAttributeChanged(String url, String attributeName, Object newValue) throws Exception
     {
         List<Map<String, Object>> nodeAttributes = getRestTestHelper().getJsonAsList(url);
         long limit = System.currentTimeMillis() + 5000;
@@ -169,6 +178,21 @@ public class BDBHAVirtualHostNodeRestTes
             Thread.sleep(100l);
             nodeAttributes = getRestTestHelper().getJsonAsList(url);
         }
-        assertEquals("Unexpected attribute " + attributeName, newValue, nodeAttributes.get(0).get(attributeName));
+        Map<String, Object> nodeData = nodeAttributes.get(0);
+        assertEquals("Unexpected attribute " + attributeName, newValue, nodeData.get(attributeName));
+        return nodeData;
     }
+
+    private void assertRemoteNodeData(String name, Map<String, Object> nodeData)
+    {
+        assertEquals("Remote node " + name + " has unexpected name", name, nodeData.get(BDBHAVirtualHostNode.NAME));
+
+        Integer lastKnownTransactionId = (Integer) nodeData.get(BDBHAVirtualHostNode.LAST_KNOWN_REPLICATION_TRANSACTION_ID);
+        assertNotNull("Node " + name + " has unexpected lastKnownReplicationId", lastKnownTransactionId);
+        assertTrue("Node " + name + " has unexpected lastKnownReplicationId " + lastKnownTransactionId, lastKnownTransactionId > 0);
+
+        Long joinTime = (Long) nodeData.get(BDBHAVirtualHostNode.JOIN_TIME);
+        assertNotNull("Node " + name + " has unexpected joinTime", joinTime);
+        assertTrue("Node " + name + " has unexpected joinTime " + joinTime, joinTime > 0);
+     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org