summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-07-19 20:18:39 +0000
committerAlan Conway <aconway@apache.org>2012-07-19 20:18:39 +0000
commit86ec92715e981988e4ff4ce9e6905fac6088d210 (patch)
treea644c5414400ad9dcf065473d3c74aa0a5fc2550
parent81dd2137190a781894a9f76dab6210eda8536bba (diff)
downloadqpid-python-86ec92715e981988e4ff4ce9e6905fac6088d210.tar.gz
QPID-4158: HA transition to CATCHUP status too early.
Previously we set status to CATCHUP when the BrokerReplicators bridge was initialized. This is too early, it's possible for an aborted attempt to connect to another backup to get as far as bridge init. This patch waits till we receive the first actual message from the primary before updating status to CATCHUP. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1363520 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/ha/BrokerReplicator.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/qpid/cpp/src/qpid/ha/BrokerReplicator.cpp b/qpid/cpp/src/qpid/ha/BrokerReplicator.cpp
index 1415b8179a..9214bc2f87 100644
--- a/qpid/cpp/src/qpid/ha/BrokerReplicator.cpp
+++ b/qpid/cpp/src/qpid/ha/BrokerReplicator.cpp
@@ -225,22 +225,6 @@ void BrokerReplicator::initializeBridge(Bridge& bridge, SessionHandler& sessionH
<< " status:" << printable(haBroker.getStatus()));
initialized = true;
- switch (haBroker.getStatus()) {
- case JOINING:
- haBroker.setStatus(CATCHUP);
- break;
- case CATCHUP:
- break;
- case READY:
- break;
- case RECOVERING:
- case ACTIVE:
- assert(0); // Primary does not reconnect.
- return;
- case STANDALONE:
- return;
- }
-
framing::AMQP_ServerProxy peer(sessionHandler.out);
const qmf::org::apache::qpid::broker::ArgsLinkBridge& args(bridge.getArgs());
@@ -267,6 +251,10 @@ void BrokerReplicator::initializeBridge(Bridge& bridge, SessionHandler& sessionH
}
void BrokerReplicator::route(Deliverable& msg) {
+ // We transition from JOINING->CATCHUP on the first message received from the primary.
+ // Until now we couldn't be sure if we had a good connection to the primary.
+ if (haBroker.getStatus() == JOINING) haBroker.setStatus(CATCHUP);
+
const framing::FieldTable* headers = msg.getMessage().getApplicationHeaders();
const MessageProperties* messageProperties = msg.getMessage().getProperties<MessageProperties>();
Variant::List list;