xyuanlu commented on a change in pull request #1007:
URL: https://github.com/apache/helix/pull/1007#discussion_r425566381



##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
##########
@@ -573,35 +573,41 @@ public void resetPartition(String clusterName, String 
instanceName, String resou
     // check the instance is alive
     LiveInstance liveInstance = 
accessor.getProperty(keyBuilder.liveInstance(instanceName));
     if (liveInstance == null) {
-      throw new HelixException(
-          "Can't reset state for " + resourceName + "/" + partitionNames + " 
on " + instanceName
-              + ", because " + instanceName + " is not alive");
+      // check if the instance has never exist in the cluster
+      String instancePath = PropertyPathBuilder.instance(clusterName, 
instanceName);
+      String errMessage;
+      if (!_zkClient.exists(instancePath)) {
+        errMessage = String.format(
+            "Can't reset state for %s.%s on %s, because %s has never existed" 
+ " in cluster %s",
+            resourceName, partitionNames, instanceName, instanceName, 
clusterName);
+      } else {
+        errMessage = String.format("Can't reset state for %s.%s on %s, because 
%s does not live in"
+                + " cluster %s anymore", resourceName, partitionNames, 
instanceName, instanceName,

Review comment:
       Please correct me if I am wrong. In my understanding, if the instance 
has ever lived in the cluster, we would be able to find it under /instance Path 
but not under the /liveInstance ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to