jiajunwang commented on a change in pull request #1740:
URL: https://github.com/apache/helix/pull/1740#discussion_r633828575



##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
##########
@@ -497,6 +499,67 @@ public boolean isInMaintenanceMode(String clusterName) {
         .exists(keyBuilder.maintenance().getPath(), AccessOption.PERSISTENT);
   }
 
+  @Override
+  public void enableClusterPauseMode(String clusterName, boolean 
cancelPendingST, String reason) {
+    logger.info("Enable cluster pause mode for cluster: {}. Cancel pending ST: 
{}. Reason: {}.",
+        clusterName, cancelPendingST, reason);
+
+    PauseSignal pauseSignal = new PauseSignal("pause");
+    pauseSignal.setPauseCluster(Boolean.toString(true));
+    pauseSignal.setCancelPendingST(cancelPendingST);
+    pauseSignal.setFromHost(NetworkUtil.getLocalhostName());
+    pauseSignal.setTriggerTime(Instant.now().toString());
+    if (reason != null && !reason.isEmpty()) {
+      pauseSignal.setReason(reason);
+    }
+
+    BaseDataAccessor<ZNRecord> baseDataAccessor = new 
ZkBaseDataAccessor<>(_zkClient);
+    HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, 
baseDataAccessor);
+
+    if (baseDataAccessor.exists(accessor.keyBuilder().pause().getPath(), 
AccessOption.PERSISTENT)) {
+      throw new HelixPauseExitsException(clusterName + " pause signal already 
exits");

Review comment:
       So do you agree that we should fail the operation even if the cluster is 
only in the Maintenance mode?




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