diff options
| author | Keith Wall <kwall@apache.org> | 2014-05-14 07:51:35 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2014-05-14 07:51:35 +0000 |
| commit | 3b8cb11a904b9c1f4a808c29fd37121a4e3e7c43 (patch) | |
| tree | d54a56ac91ef1fadb53506b864af5d140b073bbe /qpid/java/bdbstore | |
| parent | 297b63fd0fdde764dc1c9aa7da7d9d7a0a5d1283 (diff) | |
| download | qpid-python-3b8cb11a904b9c1f4a808c29fd37121a4e3e7c43.tar.gz | |
QPID-5715: BDB HA's remote replication nodes were using wrong value for lastKnownReplicationId property
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1594509 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore')
2 files changed, 28 insertions, 4 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java index d2ed22c14c..4aff32fe13 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java @@ -642,7 +642,7 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode<BDBHAVirtu { remoteNode.setRole(nodeState.getNodeState().name()); remoteNode.setJoinTime(nodeState.getJoinTime()); - remoteNode.setLastTransactionId(nodeState.getKnownMasterTxnEndVLSN()); + remoteNode.setLastTransactionId(nodeState.getCurrentTxnEndVLSN()); } } } diff --git a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java index d39146a6dd..06e01aadc9 100644 --- a/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java +++ b/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostNodeRestTest.java @@ -136,6 +136,14 @@ public class BDBHAVirtualHostNodeRestTest extends QpidRestTestCase 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 BDBHAVirtualHostNodeRestTest extends QpidRestTestCase 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 BDBHAVirtualHostNodeRestTest extends QpidRestTestCase 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); + } } |
