From 012aba39d0204e3cd57dcf83e99d6d5bf9a0e74f Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 18 Sep 2013 21:13:27 +0000 Subject: NO-JIRA: HA Primary should not log messages for unreplicated queues and exchanges. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1524570 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/ha/Primary.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/ha/Primary.cpp b/qpid/cpp/src/qpid/ha/Primary.cpp index 606e6452d3..e7fdc5035f 100644 --- a/qpid/cpp/src/qpid/ha/Primary.cpp +++ b/qpid/cpp/src/qpid/ha/Primary.cpp @@ -245,10 +245,10 @@ void Primary::removeReplica(const ReplicatingSubscription& rs) { void Primary::queueCreate(const QueuePtr& q) { // Set replication argument. ReplicateLevel level = replicationTest.useLevel(*q); - QPID_LOG(debug, logPrefix << "Created queue " << q->getName() - << " replication: " << printable(level)); q->addArgument(QPID_REPLICATE, printable(level).str()); if (level) { + QPID_LOG(debug, logPrefix << "Created queue " << q->getName() + << " replication: " << printable(level)); initializeQueue(q); // Give each queue a unique id. Used by backups to avoid confusion of // same-named queues. @@ -264,24 +264,26 @@ void Primary::queueCreate(const QueuePtr& q) { // NOTE: Called with queue registry lock held. void Primary::queueDestroy(const QueuePtr& q) { - QPID_LOG(debug, logPrefix << "Destroyed queue " << q->getName()); - { - Mutex::ScopedLock l(lock); - for (BackupMap::iterator i = backups.begin(); i != backups.end(); ++i) - i->second->queueDestroy(q); + if (replicationTest.useLevel(*q)) { + QPID_LOG(debug, logPrefix << "Destroyed queue " << q->getName()); + { + Mutex::ScopedLock l(lock); + for (BackupMap::iterator i = backups.begin(); i != backups.end(); ++i) + i->second->queueDestroy(q); + } + checkReady(); // Outside lock } - checkReady(); // Outside lock } // NOTE: Called with exchange registry lock held. void Primary::exchangeCreate(const ExchangePtr& ex) { ReplicateLevel level = replicationTest.useLevel(*ex); - QPID_LOG(debug, logPrefix << "Created exchange " << ex->getName() - << " replication: " << printable(level)); FieldTable args = ex->getArgs(); args.setString(QPID_REPLICATE, printable(level).str()); // Set replication arg. if (level) { - // Give each exchange a unique id to avoid confusion of same-named exchanges. + QPID_LOG(debug, logPrefix << "Created exchange " << ex->getName() + << " replication: " << printable(level)); + // Give each exchange a unique id to avoid confusion of same-named exchanges. args.set(QPID_HA_UUID, FieldTable::ValuePtr(new UuidValue(&Uuid(true)[0]))); } ex->setArgs(args); @@ -289,8 +291,10 @@ void Primary::exchangeCreate(const ExchangePtr& ex) { // NOTE: Called with exchange registry lock held. void Primary::exchangeDestroy(const ExchangePtr& ex) { - QPID_LOG(debug, logPrefix << "Destroyed exchange " << ex->getName()); - // Do nothing + if (replicationTest.useLevel(*ex)) { + QPID_LOG(debug, logPrefix << "Destroyed exchange " << ex->getName()); + // Do nothing + } } // New backup connected -- cgit v1.2.1