diff options
author | Alan Conway <aconway@apache.org> | 2012-07-31 16:11:44 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-07-31 16:11:44 +0000 |
commit | 01bcc91ada7b79f16a65995c620d436c21f827be (patch) | |
tree | 83f44565d5e59d4f80a9446a5854778d98cbd3e4 /qpid/cpp/src/qpid/ha/Primary.cpp | |
parent | 221cd0fcbe49acbda7e2d434e759f186afc3afff (diff) | |
download | qpid-python-01bcc91ada7b79f16a65995c620d436c21f827be.tar.gz |
QPID-4176: HA Error handling
Additional error handling and logging for ConnectionObserver, Primary and
ReplicatingSubscription.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1367649 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 | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/qpid/cpp/src/qpid/ha/Primary.cpp b/qpid/cpp/src/qpid/ha/Primary.cpp index e7aa4858be..69c94bfc7d 100644 --- a/qpid/cpp/src/qpid/ha/Primary.cpp +++ b/qpid/cpp/src/qpid/ha/Primary.cpp @@ -141,26 +141,32 @@ void Primary::checkReady(BackupMap::iterator i, Mutex::ScopedLock& l) { } void Primary::timeoutExpectedBackups() { - sys::Mutex::ScopedLock l(lock); - if (active) return; // Already activated - // Remove records for any expectedBackups that are not yet connected - // Allow backups that are connected to continue becoming ready. - for (BackupSet::iterator i = expectedBackups.begin(); i != expectedBackups.end();) - { - boost::shared_ptr<RemoteBackup> rb = *i; - if (!rb->isConnected()) { - BrokerInfo info = rb->getBrokerInfo(); - QPID_LOG(error, logPrefix << "Expected backup timed out: " << info); - expectedBackups.erase(i++); - backups.erase(info.getSystemId()); - rb->cancel(); - // Downgrade the broker to CATCHUP - info.setStatus(CATCHUP); - haBroker.addBroker(info); + try { + sys::Mutex::ScopedLock l(lock); + if (active) return; // Already activated + // Remove records for any expectedBackups that are not yet connected + // Allow backups that are connected to continue becoming ready. + for (BackupSet::iterator i = expectedBackups.begin(); i != expectedBackups.end();) + { + boost::shared_ptr<RemoteBackup> rb = *i; + if (!rb->isConnected()) { + BrokerInfo info = rb->getBrokerInfo(); + QPID_LOG(error, logPrefix << "Expected backup timed out: " << info); + expectedBackups.erase(i++); + backups.erase(info.getSystemId()); + rb->cancel(); + // Downgrade the broker to CATCHUP + info.setStatus(CATCHUP); + haBroker.addBroker(info); + } + else ++i; } - else ++i; + checkReady(l); + } + catch(const std::exception& e) { + QPID_LOG(error, logPrefix << "Error timing out backups: " << e.what()); + // No-where for this exception to go. } - checkReady(l); } void Primary::readyReplica(const ReplicatingSubscription& rs) { |