You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by lx...@apache.org on 2016/12/19 17:54:12 UTC

[2/9] helix git commit: [HELIX-642] Disable the participant instance once it disconnected due to unstable ZK

[HELIX-642] Disable the participant instance once it disconnected due to unstable ZK

When ZK is not stable, the instance connection will be disconnected. Before disconnect from ZK, disable the instance.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/1db24388
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/1db24388
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/1db24388

Branch: refs/heads/helix-0.6.x
Commit: 1db243887d54feee787a2ddb66bce9e34fab9afe
Parents: a9267e5
Author: Junkai Xue <jx...@linkedin.com>
Authored: Thu Dec 15 16:46:11 2016 -0800
Committer: Junkai Xue <jx...@linkedin.com>
Committed: Thu Dec 15 16:46:11 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/helix/manager/zk/ZKHelixManager.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/1db24388/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
index 16b0882..6f4a874 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixManager.java
@@ -826,6 +826,13 @@ public class ZKHelixManager implements HelixManager, IZkStateListener {
         LOG.error("instanceName: " + _instanceName + " is flapping. disconnect it. "
             + " maxDisconnectThreshold: " + _maxDisconnectThreshold + " disconnects in "
             + _flappingTimeWindowMs + "ms.");
+
+        // Only disable the instance when it's instance type is PARTICIPANT
+        if (_instanceType.equals(InstanceType.PARTICIPANT)) {
+          LOG.warn("instanceName: " + _instanceName
+              + " is flapping. Since it is a participant, disable it.");
+          getClusterManagmentTool().enableInstance(_clusterName, _instanceName, false);
+        }
         disconnect();
       }
       break;