helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject helix git commit: Add extra logs for isLeader in ZKHelixManager
Date Wed, 14 Nov 2018 00:49:50 GMT
Repository: helix
Updated Branches:
  refs/heads/master 59536d39c -> 00e50db3a


Add extra logs for isLeader in ZKHelixManager

Espresso has one controller think itself is not leader for the cluster for 7 days. We dont
have any logs for it. Adding logs to detect all the possible of non-leader situation.


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

Branch: refs/heads/master
Commit: 00e50db3a476b13fc718c75cf74f76e479ec6a5b
Parents: 59536d3
Author: Junkai Xue <jxue@linkedin.com>
Authored: Thu Nov 1 11:18:25 2018 -0700
Committer: Junkai Xue <jxue@linkedin.com>
Committed: Tue Nov 13 16:49:42 2018 -0800

----------------------------------------------------------------------
 .../org/apache/helix/manager/zk/ZKHelixManager.java | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/00e50db3/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 c4275df..ba3c16f 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
@@ -797,12 +797,18 @@ public class ZKHelixManager implements HelixManager, IZkStateListener
{
 
   @Override
   public boolean isLeader() {
+    String warnLogPrefix = String
+        .format("Instance %s is not leader of cluster %s due to", _instanceName, _clusterName);
     if (_instanceType != InstanceType.CONTROLLER
         && _instanceType != InstanceType.CONTROLLER_PARTICIPANT) {
+      LOG.warn(String
+          .format("%s instance type %s does not match to CONTROLLER/CONTROLLER_PARTICIPANT",
+              warnLogPrefix, _instanceType.name()));
       return false;
     }
 
     if (!isConnected()) {
+      LOG.warn(String.format("%s HelixManager is not connected", warnLogPrefix));
       return false;
     }
 
@@ -811,13 +817,19 @@ public class ZKHelixManager implements HelixManager, IZkStateListener
{
       if (leader != null) {
         String leaderName = leader.getInstanceName();
         String sessionId = leader.getSessionId();
-        if (leaderName != null && leaderName.equals(_instanceName) && sessionId
!= null
-            && sessionId.equals(_sessionId)) {
+        if (leaderName != null && leaderName.equals(_instanceName) && sessionId
!= null && sessionId
+            .equals(_sessionId)) {
           return true;
         }
+        LOG.warn(String
+            .format("%s current session %s does not match leader session %s", warnLogPrefix,
+                _sessionId, sessionId));
       }
+      LOG.warn(String.format("%s leader ZNode is null", warnLogPrefix));
+
     } catch (Exception e) {
       // log
+      LOG.warn(String.format("%s exception happen when session check", warnLogPrefix), e);
     }
     return false;
   }


Mime
View raw message