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/Multicaster.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'cpp/src/qpid/cluster/Multicaster.h') diff --git a/cpp/src/qpid/cluster/Multicaster.h b/cpp/src/qpid/cluster/Multicaster.h index 2db84a9ce0..f70bd5ca31 100644 --- a/cpp/src/qpid/cluster/Multicaster.h +++ b/cpp/src/qpid/cluster/Multicaster.h @@ -41,16 +41,18 @@ class Cpg; /** * Multicast to the cluster. Shared, thread safe object. - * - * Runs in two modes; * - * initializing: Hold connection mcast events. Multicast cluster - * events directly in the calling thread. This mode is used before - * joining the cluster where the poller may not yet be active and we - * want to hold any connection traffic till we join. + * holding mode: Hold connection events for later multicast. Cluster + * events are never held. Used during PRE_INIT/INIT state when we + * want to hold any connection traffic till we are read in the + * cluster. + * + * bypass mode: Multicast cluster events directly in the calling + * thread. This mode is used by cluster in PRE_INIT state the poller + * is not yet be active. * - * ready: normal operation. Queues all mcasts on a pollable queue, - * multicasts connection and cluster events. + * Multicaster is created in bypass+holding mode, they are disabled by + * start and setReady respectively. */ class Multicaster { @@ -65,7 +67,9 @@ class Multicaster void mcastBuffer(const char*, size_t, const ConnectionId&); void mcast(const Event& e); - /** Switch to ready mode. */ + /** Start the pollable queue, turn off bypass mode. */ + void start(); + /** Switch to ready mode, release held messages. */ void setReady(); private: @@ -81,6 +85,7 @@ class Multicaster bool ready; PlainEventQueue holdingQueue; std::vector ioVector; + bool bypass; }; }} // namespace qpid::cluster -- cgit v1.2.1