helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [15/50] [abbrv] helix git commit: Ignore instances with no instance configuration
Date Thu, 22 Jun 2017 22:57:34 GMT
Ignore instances with no instance configuration

Ignore instances with no instance configuration when fetching the list
of instances that have a specific tag.

The deletion order in ZKHelixAdmin#dropInstance deletes the instance
configuration before deleting the instance itself. If this is
interrupted midway, the instance configuration is deleted but the
instance is present in the list of instances.

When fetching the list of instances with a given tag, this means that
if an instance has its configuration missing, the instance
configuration will be null and the loop will exit with NPE. This patch
adds a null check to avoid aborting the loop.


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

Branch: refs/heads/master
Commit: 812b83f0a69e055dc22a6f4cb4ec1c4ec1ff4572
Parents: 470b514
Author: Jean-Francois Im <jfim@linkedin.com>
Authored: Wed Mar 8 14:21:45 2017 -0800
Committer: Jean-Francois Im <jfim@linkedin.com>
Committed: Wed Mar 8 14:25:21 2017 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/812b83f0/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
index 378777f..351c10e 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
@@ -602,7 +602,7 @@ public class ZKHelixAdmin implements HelixAdmin {
 
     for (String instanceName : instances) {
       InstanceConfig config = accessor.getProperty(keyBuilder.instanceConfig(instanceName));
-      if (config.containsTag(tag)) {
+      if (config != null && config.containsTag(tag)) {
         result.add(instanceName);
       }
     }


Mime
View raw message