diff options
author | Alan Conway <aconway@apache.org> | 2013-12-10 14:11:36 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2013-12-10 14:11:36 +0000 |
commit | c52b4b966e4127aa2c965a4d29560b13cefcdc20 (patch) | |
tree | 5cf018888147d382e6777649b0f396c1086e7aa7 /qpid/cpp/src/qpid/ha/Primary.cpp | |
parent | 077619a135faf171ba85baf1c8acb250c93f2657 (diff) | |
download | qpid-python-c52b4b966e4127aa2c965a4d29560b13cefcdc20.tar.gz |
QPID-5404: HA broker message duplication when deleting a queue with an alt-exchange
The old code ran auto-delete on the backup on disconnect. This reroutes
messages onto the alt queue with incorrect replication IDs from the original
queue, and then replicates duplicate rerouted messages from the primary. The
solution is to process auto deletes on the new primary and let them replicate to
the backups.
- Move all auto-delete logic into QueueReplicator
- Primary process auto-delete on QueueReplicator as part of promotion.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1549844 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/ha/Primary.cpp')
-rw-r--r-- | qpid/cpp/src/qpid/ha/Primary.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/ha/Primary.cpp b/qpid/cpp/src/qpid/ha/Primary.cpp index 0c1858ceb1..0c0fe983bb 100644 --- a/qpid/cpp/src/qpid/ha/Primary.cpp +++ b/qpid/cpp/src/qpid/ha/Primary.cpp @@ -94,7 +94,16 @@ Primary::Primary(HaBroker& hb, const BrokerInfo::Set& expect) : logPrefix("Primary: "), active(false), replicationTest(hb.getSettings().replicateDefault.get()) { + // Note that at this point, we are still rejecting client connections. + // So we are safe from client interference while we set up the primary. + hb.getMembership().setStatus(RECOVERING); + + // Process all QueueReplicators, handles auto-delete queues. + QueueReplicator::Vector qrs; + QueueReplicator::copy(hb.getBroker().getExchanges(), qrs); + std::for_each(qrs.begin(), qrs.end(), boost::bind(&QueueReplicator::promoted, _1)); + broker::QueueRegistry& queues = hb.getBroker().getQueues(); queues.eachQueue(boost::bind(&Primary::initializeQueue, this, _1)); if (expect.empty()) { |