shuan1026 opened a new pull request, #11827: URL: https://github.com/apache/ozone/pull/11827
## What changes were proposed in this pull request? `ContainerBalancer.start()` runs after a leader change or safe-mode exit when `shouldRun` is persisted. The task sleeps for `hdds.scm.wait.time.after.safemode.exit` before `balance()`. That `Thread.sleep` is inside `ContainerBalancerTask.run`'s `try`, and the only handler is `catch (Exception)`. An interrupt during the delay (`ozone admin containerbalancer stop`, SCM step-down, or SCM shutdown) is logged ERROR. The same interrupt during the `Thread.sleep` calls in `balance()` is a normal stop: INFO, interrupt flag restored, then return. This patch catches `InterruptedException` before the generic handler and does the same for the delayed start. The message is "Container Balancer was interrupted during the delayed start." `stop()` and `stopBalancer()` already record the stop reason before interrupting, so this path does not call `recordStopReason`. Other exceptions still log at ERROR with stop reason `ERROR`. `TestContainerBalancer#testDelayedStartOnSCMStatusChange` already stops the balancer while that sleep is in progress. It now asserts the INFO line is present and "Container Balancer is stopped abnormally" is absent. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17522 ## How was this patch tested? - `TestContainerBalancer#testDelayedStartOnSCMStatusChange` in `hadoop-hdds/server-scm`. The new assertions fail on the ERROR line before the production change and pass after it. - ci: https://github.com/shuan1026/ozone/actions/runs/40734744312 -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
