summaryrefslogtreecommitdiff
path: root/cpp/src
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
commitf3ee4928d6e867a35034b0d8279a3da3353dffd4 (patch)
tree8c492b6380537a01e81466a81ea44dc793779133 /cpp/src
parenta3efa990d231cb39d4e532b6f4d03159827b3dda (diff)
downloadqpid-python-f3ee4928d6e867a35034b0d8279a3da3353dffd4.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/qpid@1363520 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/ha/BrokerReplicator.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/cpp/src/qpid/ha/BrokerReplicator.cpp b/cpp/src/qpid/ha/BrokerReplicator.cpp
index 1415b8179a..9214bc2f87 100644
--- a/cpp/src/qpid/ha/BrokerReplicator.cpp
+++ b/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;