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



##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
##########
@@ -573,35 +596,31 @@ 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 added to the cluster
+      String instanceConfigPath = 
PropertyPathBuilder.instanceConfig(clusterName, instanceName);
+      throw new HelixException(String.format(
+          _zkClient.exists(instanceConfigPath) ? 
ResetPartitionFailureReason.INSTANCE_NOTALIVE
+              .getMessage(instanceName, resourceName, partitionNames)
+              : ResetPartitionFailureReason.INSTANCE_NONEXISTENT
+                  .getMessage(instanceName, resourceName, partitionNames), 
instanceName,
+          clusterName));

Review comment:
       Some messages require 2 args an others need one arg. Please correct me 
if I am wrong but I think it is hard to return a fully formated string if we do 
not add extra logic here. 




----------------------------------------------------------------
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