You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/07/29 08:15:48 UTC
incubator-ignite git commit: ignite-752-2: supported connection check
frequency even for cases when failure timeout is ignored;
performance optimizations
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-752-2 a12775621 -> 55f0eb569
ignite-752-2: supported connection check frequency even for cases when failure timeout is ignored; performance optimizations
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/55f0eb56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/55f0eb56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/55f0eb56
Branch: refs/heads/ignite-752-2
Commit: 55f0eb56967d2cc9bdf62c3fb665521a59ddaf33
Parents: a127756
Author: Denis Magda <dm...@gridgain.com>
Authored: Wed Jul 29 09:15:29 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Wed Jul 29 09:15:29 2015 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 42 +++++++++++---------
1 file changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/55f0eb56/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 547347c..b2be5b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -1787,6 +1787,9 @@ class ServerImpl extends TcpDiscoveryImpl {
/** Connection check frequency. */
private long connCheckFreq;
+ /** Connection check threshold. */
+ private long connCheckThreshold;
+
/**
*/
protected RingMessageWorker() {
@@ -1799,19 +1802,22 @@ class ServerImpl extends TcpDiscoveryImpl {
* Initializes connection check frequency. Used only when failure detection timeout is enabled.
*/
private void initConnectionCheckFrequency() {
- if (spi.failureDetectionTimeoutEnabled()) {
- for (int i = 3; i > 0; i--) {
- connCheckFreq = spi.failureDetectionTimeout() / i;
-
- if (connCheckFreq > 0)
- break;
- }
+ if (spi.failureDetectionTimeoutEnabled())
+ connCheckThreshold = spi.failureDetectionTimeout();
+ else
+ connCheckThreshold = Math.min(spi.getSocketTimeout(), spi.getHeartbeatFrequency());
- assert connCheckFreq > 0;
+ for (int i = 3; i > 0; i--) {
+ connCheckFreq = connCheckThreshold / i;
- if (log.isDebugEnabled())
- log.debug("Connection check frequency is calculated: " + connCheckFreq);
+ if (connCheckFreq > 10)
+ break;
}
+
+ assert connCheckFreq > 0;
+
+ if (log.isDebugEnabled())
+ log.debug("Connection check frequency is calculated: " + connCheckFreq);
}
/**
@@ -2306,9 +2312,9 @@ class ServerImpl extends TcpDiscoveryImpl {
// If node existed on connection initialization we should check
// whether it has not gone yet.
- if (nextNodeExists && pingNode(next))
- U.error(log, "Failed to send message to next node [msg=" + msg +
- ", next=" + next + ']', err);
+ if (nextNodeExists)
+ log.warning("Failed to send message to next node [msg=" + msg + ", next=" + next +
+ ", errMsg=" + (err != null ? err.getMessage() : "N/A") + ']');
else if (log.isDebugEnabled())
log.debug("Failed to send message to next node [msg=" + msg + ", next=" + next +
", errMsg=" + (err != null ? err.getMessage() : "N/A") + ']');
@@ -4025,7 +4031,7 @@ class ServerImpl extends TcpDiscoveryImpl {
/**
* Check the last time a heartbeat message received. If the time is bigger than {@code hbCheckTimeout} than
- * {@link TcpDiscoveryStatusCheckMessage} is sent accros the ring.
+ * {@link TcpDiscoveryStatusCheckMessage} is sent across the ring.
*/
private void checkHeartbeatsReceiving() {
if (lastTimeStatusMsgSent < locNode.lastUpdateTime())
@@ -4045,11 +4051,9 @@ class ServerImpl extends TcpDiscoveryImpl {
* Check connection aliveness status.
*/
private void checkConnection() {
- if (!spi.failureDetectionTimeoutEnabled())
- return;
-
- if (!failureThresholdReached && U.currentTimeMillis() - locNode.lastDataReceivedTime()
- >= spi.failureDetectionTimeout() && ring.hasRemoteNodes() && spiStateCopy() == CONNECTED) {
+ if (spi.failureDetectionTimeoutEnabled() && !failureThresholdReached &&
+ U.currentTimeMillis() - locNode.lastDataReceivedTime() >= connCheckThreshold &&
+ ring.hasRemoteNodes() && spiStateCopy() == CONNECTED) {
log.info("Local node seems to be disconnected from topology (failure detection timeout " +
"is reached): [failureDetectionTimeout=" + spi.failureDetectionTimeout() +