summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/ha/Primary.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-06-18 18:08:09 +0000
committerAlan Conway <aconway@apache.org>2012-06-18 18:08:09 +0000
commit349691966a7fc366cd5b907f40dd56a994ca5a96 (patch)
tree164f9e8111c0c01e33fcc1dd9db754cc249a82e1 /cpp/src/qpid/ha/Primary.cpp
parent09a79fda3f455e49474649c836fa6f87e2f7a525 (diff)
downloadqpid-python-349691966a7fc366cd5b907f40dd56a994ca5a96.tar.gz
QPID-3603: Minor cleanup and test improvements in HA code.
- Enabled 10 queue failover test - Minor cleanup in types.h - Rewording, adding comments. - Detect and reject invalid replication values. - Cleaned up some unnecessary #includes git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1351434 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/ha/Primary.cpp')
-rw-r--r--cpp/src/qpid/ha/Primary.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/cpp/src/qpid/ha/Primary.cpp b/cpp/src/qpid/ha/Primary.cpp
index 05dfb539be..a874559655 100644
--- a/cpp/src/qpid/ha/Primary.cpp
+++ b/cpp/src/qpid/ha/Primary.cpp
@@ -21,6 +21,7 @@
#include "Backup.h"
#include "HaBroker.h"
#include "Primary.h"
+#include "ReplicationTest.h"
#include "ReplicatingSubscription.h"
#include "RemoteBackup.h"
#include "ConnectionObserver.h"
@@ -72,6 +73,9 @@ Primary::Primary(HaBroker& hb, const BrokerInfo::Set& expect) :
QPID_LOG(debug, logPrefix << "Expected backups: none");
}
else {
+ // NOTE: RemoteBackups must be created before we set the ConfigurationObserver
+ // orr ConnectionObserver so that there is no client activity while
+ // the QueueGuards are created.
QPID_LOG(debug, logPrefix << "Expected backups: " << expect);
for (BrokerInfo::Set::const_iterator i = expect.begin(); i != expect.end(); ++i) {
bool guard = true; // Create queue guards immediately for expected backups.
@@ -126,6 +130,8 @@ void Primary::readyReplica(const ReplicatingSubscription& rs) {
}
void Primary::queueCreate(const QueuePtr& q) {
+ // Throw if there is an invalid replication level in the queue settings.
+ haBroker.getReplicationTest().replicateLevel(q->getSettings());
Mutex::ScopedLock l(lock);
for (BackupMap::iterator i = backups.begin(); i != backups.end(); ++i) {
i->second->queueCreate(q);
@@ -147,7 +153,7 @@ void Primary::opened(broker::Connection& connection) {
BackupMap::iterator i = backups.find(info.getSystemId());
if (i == backups.end()) {
QPID_LOG(debug, logPrefix << "New backup connected: " << info);
- bool guard = false; // Lazy-create queue guards, pre-creating them here could cause deadlock.
+ bool guard = false; // Lazy-create guards for new backups. Creating them here could deadlock.
backups[info.getSystemId()].reset(
new RemoteBackup(info, haBroker.getBroker(), haBroker.getReplicationTest(), guard));
}