chihsuan opened a new pull request, #10733: URL: https://github.com/apache/ozone/pull/10733
## What changes were proposed in this pull request? **Problem.** When a `java.lang.Error` (for example `OutOfMemoryError`) escapes a delete-block transaction in `DeleteBlocksCommandHandler`, it is swallowed today and the datanode keeps running in a possibly unreliable state. A pool-task `Error` is wrapped in `ExecutionException` and only logged as "task failed." in `handleTasksResults()`, and a bare `Error` on the delete worker thread is absorbed by the `catch (Throwable)` in `DeleteCmdWorker.run()`. **Fix.** Let a fatal `Error` propagate and terminate the datanode, following the same philosophy as the `DatanodeStateMachine` daemon-thread uncaught exception handler: - `handleTasksResults()` unwraps an `Error` carried by `ExecutionException` and rethrows the original instance, so it is never reclassified as a per-transaction failure and no partial ACK is built for the command. - `DeleteCmdWorker.run()` catches `Error` ahead of the existing `catch (Throwable)` and calls `ExitUtils.terminate(1, ...)`, so the worker stops consuming delete commands and the datanode shuts down. The HDDS-13451 behavior for `Exception` is unchanged: the transaction is reported with `success=false` and the datanode keeps running. A fatal command is marked failed with no deletion ACK and is never marked executed; after restart, SCM resends the command and the existing duplicate-transaction handling keeps the retry safe. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-13472 ## How was this patch tested? - Added unit tests in `TestDeleteBlocksCommandHandler`: - a wrapped `Error` is rethrown from `handleTasksResults()` and stops processing of the remaining futures, - an `Error` on the retry path of `executeCmdWithRetry()` propagates the same way, - an end-to-end worker test (with `ExitUtils.disableSystemExit()`) verifies the termination path is invoked, the fatal command is marked FAILED with no deletion ACK, and the next queued command is not processed. - Existing exception regression test (`testDeleteBlocksCommandHandlerExceptionShouldNotInterrupt`) still passes. - `mvn -pl :hdds-container-service test -Dtest=TestDeleteBlocksCommandHandler`: 54 tests pass. - Module checkstyle passes. Generated-by: Claude Code (Fable 5) -- 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]
