Gargi-jais11 commented on code in PR #8488: URL: https://github.com/apache/ozone/pull/8488#discussion_r2115158193
########## hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java: ########## @@ -600,6 +603,51 @@ public VolumeChoosingPolicy getVolumeChoosingPolicy() { return volumeChoosingPolicy; } + /** + * Stops the DiskBalancerService if it is running. + */ + public void stopDiskBalancer() { + paused.set(shouldRun); + setShouldRun(false); + LOG.info("DiskBalancerService stopped."); + } + + /** + * Resume the DiskBalancerService if it was running previously. + */ + public void resumeDiskBalancer() { + if (paused.getAndSet(false)) { + setShouldRun(true); + LOG.info("DiskBalancerService resumed."); + } + } + + /** + * @return true, if DiskBalancerService was running before pause. + */ + public boolean isPaused() { + return paused.get(); + } + + /** + * Handle state changes for DiskBalancerService. + */ + public void nodeStateChange(HddsProtos.NodeOperationalState state) { + if (state == HddsProtos.NodeOperationalState.DECOMMISSIONING || + state == HddsProtos.NodeOperationalState.ENTERING_MAINTENANCE) { + LOG.info("Node state changed to {}. Stopping DiskBalancerService.", state); Review Comment: ok -- 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: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org