diff options
author | Alan Conway <aconway@apache.org> | 2012-10-09 19:52:24 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-10-09 19:52:24 +0000 |
commit | a769439c2e8bc10e33292e87008204a0d6c20059 (patch) | |
tree | f09fc24ca604c87b9343dd084f098cff00c65d8a /cpp/src/qpid/ha/RemoteBackup.cpp | |
parent | a12252bbafc72607e11aad13a8cb1e86ffc5d30f (diff) | |
download | qpid-python-a769439c2e8bc10e33292e87008204a0d6c20059.tar.gz |
QPID-4360: Fix test bug: Non-ready HA broker can be incorrectly promoted to primary.
Test test_delete_missing_response was failing with "cluster active, cannot promote".
- Fixed test bug: "fake" primary triggered "cannot promote".
- Backup: always create QueueReplicator if not already existing.
- Terminology change: "initial" queues -> "catch-up" queues.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1396244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/ha/RemoteBackup.cpp')
-rw-r--r-- | cpp/src/qpid/ha/RemoteBackup.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/cpp/src/qpid/ha/RemoteBackup.cpp b/cpp/src/qpid/ha/RemoteBackup.cpp index 3421380940..ce4e545c80 100644 --- a/cpp/src/qpid/ha/RemoteBackup.cpp +++ b/cpp/src/qpid/ha/RemoteBackup.cpp @@ -37,10 +37,10 @@ RemoteBackup::RemoteBackup(const BrokerInfo& info, ReplicationTest rt, bool con) brokerInfo(info), replicationTest(rt), connected(con), reportedReady(false) {} -void RemoteBackup::setInitialQueues(broker::QueueRegistry& queues, bool createGuards) +void RemoteBackup::setCatchupQueues(broker::QueueRegistry& queues, bool createGuards) { - QPID_LOG(debug, logPrefix << "Setting initial queues" << (createGuards ? " and guards" : "")); - queues.eachQueue(boost::bind(&RemoteBackup::initialQueue, this, _1, createGuards)); + QPID_LOG(debug, logPrefix << "Setting catch-up queues" << (createGuards ? " and guards" : "")); + queues.eachQueue(boost::bind(&RemoteBackup::catchupQueue, this, _1, createGuards)); } RemoteBackup::~RemoteBackup() { cancel(); } @@ -52,12 +52,14 @@ void RemoteBackup::cancel() { } bool RemoteBackup::isReady() { - return connected && initialQueues.empty(); + return connected && catchupQueues.empty(); } -void RemoteBackup::initialQueue(const QueuePtr& q, bool createGuard) { +void RemoteBackup::catchupQueue(const QueuePtr& q, bool createGuard) { if (replicationTest.isReplicated(ALL, *q)) { - initialQueues.insert(q); + QPID_LOG(debug, logPrefix << "Catch-up queue" + << (createGuard ? " and guard" : "") << ": " << q->getName()); + catchupQueues.insert(q); if (createGuard) guards[q].reset(new QueueGuard(*q, brokerInfo)); } } @@ -88,13 +90,13 @@ std::ostream& operator<<(std::ostream& o, const QueueSetPrinter& qp) { } void RemoteBackup::ready(const QueuePtr& q) { - initialQueues.erase(q); + catchupQueues.erase(q); QPID_LOG(debug, logPrefix << "Queue ready: " << q->getName() - << QueueSetPrinter(", waiting for: ", initialQueues)); + << QueueSetPrinter(", waiting for: ", catchupQueues)); if (isReady()) QPID_LOG(debug, logPrefix << "All queues ready"); } -// Called via ConfigurationObserver::queueCreate and from initialQueue +// Called via ConfigurationObserver::queueCreate and from catchupQueue void RemoteBackup::queueCreate(const QueuePtr& q) { if (replicationTest.isReplicated(ALL, *q)) guards[q].reset(new QueueGuard(*q, brokerInfo)); @@ -102,7 +104,7 @@ void RemoteBackup::queueCreate(const QueuePtr& q) { // Called via ConfigurationObserver void RemoteBackup::queueDestroy(const QueuePtr& q) { - initialQueues.erase(q); + catchupQueues.erase(q); GuardMap::iterator i = guards.find(q); if (i != guards.end()) { i->second->cancel(); |