summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-02-13 16:19:02 +0000
committerAlan Conway <aconway@apache.org>2012-02-13 16:19:02 +0000
commit5f9feb8192404dae5c73ce9fbdf41a78826576a6 (patch)
tree18b4d05ec2207fdae5c005bc3aa6879828538cb4
parent2af6b56cc92ae88bf587fb32393edb67e66a02a1 (diff)
downloadqpid-python-qpid-3603-2.tar.gz
QPID-3603: Make link maintenance interval configurable.qpid-3603-2
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-2@1243586 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/Broker.cpp9
-rw-r--r--qpid/cpp/src/qpid/broker/Broker.h1
-rw-r--r--qpid/cpp/src/qpid/broker/Link.cpp7
-rwxr-xr-xqpid/cpp/src/tests/ha_tests.py4
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 f264eff99c..28d28b87d2 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)