andyhuangdev commented on code in PR #11086:
URL: https://github.com/apache/ozone/pull/11086#discussion_r3841665751
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -634,7 +634,12 @@ public CompletableFuture<TermIndex>
notifyInstallSnapshotFromLeader(
return CompletableFuture.supplyAsync(
() -> {
try {
- return ozoneManager.installSnapshotFromLeader(leaderNodeId);
+ TermIndex termIndex =
ozoneManager.installSnapshotFromLeader(leaderNodeId);
+ if (termIndex == null) {
+ throw new CompletionException(
+ new IOException("Failed to install snapshot from OM leader "
+ leaderNodeId));
+ }
+ return termIndex;
Review Comment:
@szetszwo
Thanks for the guidance. Updated in e6e998a.
The state machine no longer treats every null TermIndex as an exception. A
null result retains its existing non-exceptional semantics.
Actual checkpoint installation failures are now propagated as IOException.
For a DB replacement failure, OM first restores the previous state and restarts
the required services, then throws the saved exception with the original cause.
I also updated the tests to cover:
- null results completing normally;
- IOException completing the Ratis future exceptionally; and
- DB replacement failure being propagated after the original OM state is
restored.
Validation:
- TestOzoneManagerStateMachine: 49 tests passed
- TestOMRatisSnapshots#testInstallSnapshotFailedBackupRestoresDbDir passed
- checkstyle passed
--
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]