From ef9268528d3147173dfb0d2ef707ee3e4fc4f210 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 12 Mar 2010 20:11:31 +0000 Subject: New cluster member pushes store when joining an active cluster. Previously a broker with a clean store would not be able to join an active cluster because the shtudown-id did not match. This commit ensures that when a broker joins an active cluster, it always pushes its store regardless of status. Clean/dirty status is only compared when forming an initial cluster. This change required splitting initialization into two phases: PRE_INIT: occurs in the Cluster ctor during early-initialize. This phase determines whether or not to push the store. INIT: occurs after Cluster::initialize and does the remaining initialization chores. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@922412 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/InitialStatusMap.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cpp/src/qpid/cluster/InitialStatusMap.h') diff --git a/cpp/src/qpid/cluster/InitialStatusMap.h b/cpp/src/qpid/cluster/InitialStatusMap.h index eedc99b0b2..a5a600365e 100644 --- a/cpp/src/qpid/cluster/InitialStatusMap.h +++ b/cpp/src/qpid/cluster/InitialStatusMap.h @@ -51,12 +51,18 @@ class InitialStatusMap /** Process received status */ void received(const MemberId&, const Status& is); - /**@return true if the map is complete. */ + /**@return true if the map has an entry for all current cluster members. */ bool isComplete() const; + + size_t getActualSize() const { return map.size(); } + size_t getRequiredSize() const { return size; } + /**@return true if the map was completed by the last config change or received. */ bool transitionToComplete(); /**@pre isComplete(). @return this node's elders */ MemberSet getElders() const; + /**@pre isComplete(). @return True if there are active members of the cluster. */ + bool isActive(); /**@pre isComplete(). @return True if we need to request an update. */ bool isUpdateNeeded(); /**@pre isComplete(). @return Cluster-wide cluster ID. */ @@ -71,8 +77,9 @@ class InitialStatusMap private: typedef std::map > Map; static bool notInitialized(const Map::value_type&); - static bool isActive(const Map::value_type&); + static bool isActiveEntry(const Map::value_type&); static bool hasStore(const Map::value_type&); + Map map; MemberSet firstConfig; MemberId self; -- cgit v1.2.1