diff options
| author | Alan Conway <aconway@apache.org> | 2013-02-07 19:26:02 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2013-02-07 19:26:02 +0000 |
| commit | 4b414873f34a3e9d556161ef29a433beb8a8f2ba (patch) | |
| tree | b59c37d130913362898aa49073e8a1d0311b28df /cpp | |
| parent | 8af19ee5f0acf860a632b4d63935108597be3bfe (diff) | |
| download | qpid-python-4b414873f34a3e9d556161ef29a433beb8a8f2ba.tar.gz | |
QPID-4555: HA Check for backup ready when new backup joins.
This test was missing so if there were no backed-up queues the backup would
never be marked ready. It was workig because of a separte bug:
auto-delete/exclusive queues were being replicated incorrectly so there were
always replicated queues (temp queues created by qpid-ha)
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1443677 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
| -rw-r--r-- | cpp/src/qpid/ha/Backup.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/ha/Primary.cpp | 9 | ||||
| -rwxr-xr-x | cpp/src/tests/ha_tests.py | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/cpp/src/qpid/ha/Backup.cpp b/cpp/src/qpid/ha/Backup.cpp index f133ecd5c6..2affc12bf6 100644 --- a/cpp/src/qpid/ha/Backup.cpp +++ b/cpp/src/qpid/ha/Backup.cpp @@ -89,6 +89,7 @@ void Backup::setBrokerUrl(const Url& brokers) { void Backup::stop(Mutex::ScopedLock&) { if (stopped) return; + stopped = true; QPID_LOG(debug, logPrefix << "Leaving backup role."); if (link) link->close(); if (replicator.get()) { diff --git a/cpp/src/qpid/ha/Primary.cpp b/cpp/src/qpid/ha/Primary.cpp index 12535399e3..67108fa5f9 100644 --- a/cpp/src/qpid/ha/Primary.cpp +++ b/cpp/src/qpid/ha/Primary.cpp @@ -245,14 +245,17 @@ void Primary::opened(broker::Connection& connection) { backup->setCatchupQueues(haBroker.getBroker().getQueues(), false); } backups[info.getSystemId()] = backup; + i = backups.find(info.getSystemId()); } else { QPID_LOG(info, logPrefix << "Known backup connected: " << info); i->second->setConnection(&connection); - checkReady(i, l); } - if (info.getStatus() == JOINING) info.setStatus(CATCHUP); - membership.add(info); + if (info.getStatus() == JOINING) { + info.setStatus(CATCHUP); + membership.add(info); + } + if (i != backups.end()) checkReady(i, l); } else QPID_LOG(debug, logPrefix << "Accepted client connection " diff --git a/cpp/src/tests/ha_tests.py b/cpp/src/tests/ha_tests.py index e517ce4527..3261e34085 100755 --- a/cpp/src/tests/ha_tests.py +++ b/cpp/src/tests/ha_tests.py @@ -464,8 +464,10 @@ class ReplicationTests(HaBrokerTest): def test_replicate_default(self): """Make sure we don't replicate if ha-replicate is unspecified or none""" cluster1 = HaCluster(self, 2, ha_replicate=None) + cluster1[1].wait_status("ready") c1 = cluster1[0].connect().session().sender("q;{create:always}") cluster2 = HaCluster(self, 2, ha_replicate="none") + cluster2[1].wait_status("ready") cluster2[0].connect().session().sender("q;{create:always}") time.sleep(.1) # Give replication a chance. try: |
