summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qpid/ha/Primary.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-07-10 20:03:38 +0000
committerAlan Conway <aconway@apache.org>2012-07-10 20:03:38 +0000
commit52d262d135090ccd1d9c8a35db659f88b7a3e748 (patch)
treef80a21b9fef647ee8c778df25a487a9bfbc8ca72 /qpid/cpp/src/qpid/ha/Primary.h
parentb3d7201e4b8989ff32ce37b30886e4c77af98141 (diff)
downloadqpid-python-52d262d135090ccd1d9c8a35db659f88b7a3e748.tar.gz
QPID-4126: HA primary times out expected backups.
After a failure, the newly-promoted primary broker guards messages for each of the backups that were connected at the time of the failure. It waits for them to reconnect to the new primary before becoming active. This patch introduces a time-out so that if an expected backup fails to fail-over within the time limit, the primary will cancel the guards for that backup and carry on. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1359872 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/ha/Primary.h')
-rw-r--r--qpid/cpp/src/qpid/ha/Primary.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/ha/Primary.h b/qpid/cpp/src/qpid/ha/Primary.h
index 3de579a88d..26883f4416 100644
--- a/qpid/cpp/src/qpid/ha/Primary.h
+++ b/qpid/cpp/src/qpid/ha/Primary.h
@@ -26,6 +26,7 @@
#include "BrokerInfo.h"
#include "qpid/sys/Mutex.h"
#include <boost/shared_ptr.hpp>
+#include <boost/intrusive_ptr.hpp>
#include <map>
#include <string>
@@ -38,6 +39,10 @@ class ConnectionObserver;
class ConfigurationObserver;
}
+namespace sys {
+class TimerTask;
+}
+
namespace ha {
class HaBroker;
class ReplicatingSubscription;
@@ -74,6 +79,9 @@ class Primary
boost::shared_ptr<QueueGuard> getGuard(const QueuePtr& q, const BrokerInfo&);
+ // Called in timer thread when the deadline for expected backups expires.
+ void timeoutExpectedBackups();
+
private:
typedef std::map<types::Uuid, boost::shared_ptr<RemoteBackup> > BackupMap;
typedef std::set<boost::shared_ptr<RemoteBackup> > BackupSet;
@@ -89,7 +97,7 @@ class Primary
* Set of expected backups that must be ready before we declare ourselves
* active
*/
- BackupSet initialBackups;
+ BackupSet expectedBackups;
/**
* Map of all the remote backups we know about: any expected backups plus
* all actual backups that have connected. We do not remove entries when a
@@ -98,6 +106,7 @@ class Primary
BackupMap backups;
boost::shared_ptr<broker::ConnectionObserver> connectionObserver;
boost::shared_ptr<broker::ConfigurationObserver> configurationObserver;
+ boost::intrusive_ptr<sys::TimerTask> timerTask;
static Primary* instance;
};