You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "shounakmk219 (via GitHub)" <gi...@apache.org> on 2023/07/04 06:18:00 UTC

[GitHub] [pinot] shounakmk219 commented on a diff in pull request #10969: Instance drop operation validation check API

shounakmk219 commented on code in PR #10969:
URL: https://github.com/apache/pinot/pull/10969#discussion_r1251535522


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3148,6 +3137,31 @@ public PinotResourceManagerResponse dropInstance(String instanceName) {
     return PinotResourceManagerResponse.success("Instance " + instanceName + " dropped");
   }
 
+  /**
+   * Utility to perform a safety check of the operation to drop an instance.
+   * If the resource is not safe to drop the utility lists all the possible reasons.
+   * @param instanceName Pinot instance name
+   * @return List of reasons why the operation is unsafe. Empty list if the operation is safe.
+   */
+  public List<String> instanceDropSafetyCheck(String instanceName) {
+    List<String> issues = new ArrayList<>();
+    // Check if the instance is live
+    if (_helixDataAccessor.getProperty(_keyBuilder.liveInstance(instanceName)) != null) {
+      issues.add(String.format("Instance %s is still live", instanceName));

Review Comment:
   Updated the response structure



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

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org