From 1ee14919b116885a8cf59eb22f8d56acb535a6ba Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 14 Feb 2012 16:12:06 +0000 Subject: QPID-3603: Make link maintenance interval configurable. HA code needs faster reconnects than federation. This is a temporary solution till we have a more robust and rapid reconnect mechanism in place. git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603-6@1244106 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/Broker.cpp | 9 +++++++-- qpid/cpp/src/qpid/broker/Broker.h | 1 + qpid/cpp/src/qpid/broker/Link.cpp | 7 +++++-- qpid/cpp/src/tests/ha_tests.py | 4 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/qpid/cpp/src/qpid/broker/Broker.cpp b/qpid/cpp/src/qpid/broker/Broker.cpp index 2a890a4217..221c31583b 100644 --- a/qpid/cpp/src/qpid/broker/Broker.cpp +++ b/qpid/cpp/src/qpid/broker/Broker.cpp @@ -127,7 +127,8 @@ Broker::Options::Options(const std::string& name) : queueFlowResumeRatio(70), queueThresholdEventRatio(80), defaultMsgGroup("qpid.no-group"), - timestampRcvMsgs(false) // set the 0.10 timestamp delivery property + timestampRcvMsgs(false), // set the 0.10 timestamp delivery property + linkMaintenanceInterval(2) { int c = sys::SystemInfo::concurrency(); workerThreads=c+1; @@ -149,6 +150,8 @@ Broker::Options::Options(const std::string& name) : ("mgmt-enable,m", optValue(enableMgmt,"yes|no"), "Enable Management") ("mgmt-qmf2", optValue(qmf2Support,"yes|no"), "Enable broadcast of management information over QMF v2") ("mgmt-qmf1", optValue(qmf1Support,"yes|no"), "Enable broadcast of management information over QMF v1") + // FIXME aconway 2012-02-13: consistent treatment of values in SECONDS + // allow sub-second intervals. ("mgmt-pub-interval", optValue(mgmtPubInterval, "SECONDS"), "Management Publish Interval") ("queue-purge-interval", optValue(queueCleanInterval, "SECONDS"), "Interval between attempts to purge any expired messages from queues") @@ -164,7 +167,9 @@ Broker::Options::Options(const std::string& name) : ("default-flow-resume-threshold", optValue(queueFlowResumeRatio, "PERCENT"), "Percent of queue's maximum capacity at which flow control is de-activated.") ("default-event-threshold-ratio", optValue(queueThresholdEventRatio, "%age of limit"), "The ratio of any specified queue limit at which an event will be raised") ("default-message-group", optValue(defaultMsgGroup, "GROUP-IDENTIFER"), "Group identifier to assign to messages delivered to a message group queue that do not contain an identifier.") - ("enable-timestamp", optValue(timestampRcvMsgs, "yes|no"), "Add current time to each received message."); + ("enable-timestamp", optValue(timestampRcvMsgs, "yes|no"), "Add current time to each received message.") + ("link-maintenace-interval", optValue(linkMaintenanceInterval, "SECONDS")) + ; } const std::string empty; diff --git a/qpid/cpp/src/qpid/broker/Broker.h b/qpid/cpp/src/qpid/broker/Broker.h index fbe653bf5d..b6eab894f3 100644 --- a/qpid/cpp/src/qpid/broker/Broker.h +++ b/qpid/cpp/src/qpid/broker/Broker.h @@ -124,6 +124,7 @@ public: uint16_t queueThresholdEventRatio; std::string defaultMsgGroup; bool timestampRcvMsgs; + double linkMaintenanceInterval; // FIXME aconway 2012-02-13: consistent parsing of SECONDS values. private: std::string getHome(); diff --git a/qpid/cpp/src/qpid/broker/Link.cpp b/qpid/cpp/src/qpid/broker/Link.cpp index e896b3238b..e3b2b1f29c 100644 --- a/qpid/cpp/src/qpid/broker/Link.cpp +++ b/qpid/cpp/src/qpid/broker/Link.cpp @@ -50,10 +50,13 @@ namespace _qmf = ::qmf::org::apache::qpid::broker; struct LinkTimerTask : public sys::TimerTask { LinkTimerTask(Link& l, sys::Timer& t) - : TimerTask(/*FIXME*/100*sys::TIME_MSEC, "Link retry timer"), link(l), timer(t) {} + : TimerTask(int64_t(l.getBroker()->getOptions().linkMaintenanceInterval* + sys::TIME_SEC), + "Link retry timer"), + link(l), timer(t) {} void fire() { - link.maintenanceVisit(); // FIXME aconway 2012-01-31: + link.maintenanceVisit(); setupNextFire(); timer.add(this); } diff --git a/qpid/cpp/src/tests/ha_tests.py b/qpid/cpp/src/tests/ha_tests.py index 950a092018..97de0d1f77 100755 --- a/qpid/cpp/src/tests/ha_tests.py +++ b/qpid/cpp/src/tests/ha_tests.py @@ -31,8 +31,8 @@ class HaBroker(Broker): def __init__(self, test, args=[], broker_url=None, **kwargs): assert BrokerTest.ha_lib, "Cannot locate HA plug-in" args=["--load-module", BrokerTest.ha_lib, - "--log-enable=debug+:ha::", # FIXME aconway 2012-01-31: - "--log-enable=debug+:Link", + # FIXME aconway 2012-02-13: workaround slow link failover. + "--link-maintenace-interval=0.1", "--ha-enable=yes"] if broker_url: args += [ "--ha-broker-url", broker_url ] Broker.__init__(self, test, args, **kwargs) -- cgit v1.2.1