ArafatKhan2198 opened a new pull request, #12203:
URL: https://github.com/apache/ozone/pull/12203
## What changes were proposed in this pull request?
**What was going wrong**
Recon rebuilds its namespace summary (NSSummary) with
`NSSummaryTask.reprocess`. It first sets a shared rebuild state to RUNNING. It
sets the state back to IDLE or FAILED only when the rebuild succeeds or throws
an `Exception`.
A `java.lang.Error` is not an `Exception`. For example, `OutOfMemoryError:
unable to create native thread` can be thrown when the rebuild starts its
thread pool. If that happens, the state stays RUNNING. Every later rebuild then
sees RUNNING, logs "NSSummary tree rebuild is already in progress, skipping
duplicate request." and returns failure without doing anything. Nothing outside
tests resets the state, so only a Recon restart recovers.
Recon itself does not crash, because the task controller absorbs the Error
and the default launch scripts do not exit on `OutOfMemoryError`. Rebuilds keep
failing. The controller keeps its task failure flag set, so new OM update
batches are dropped and Recon's OM-derived data stops updating until restart.
Errors thrown inside a rebuild sub-task are not affected. They arrive
wrapped in an `ExecutionException`, which already sets FAILED.
**What happens now**
`reprocess` also catches `Error`, sets the state to FAILED and rethrows it.
The controller sees the same failure as before, but the next rebuild finds
FAILED instead of RUNNING and runs normally.
```java
} catch (Error e) {
// Do not leave the state RUNNING, or every later rebuild is skipped as
already in progress.
REBUILD_STATE.set(RebuildState.FAILED);
throw e;
}
```
The Error is rethrown rather than turned into a failed result, so nothing
changes for callers except that the state is now correct.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17046
## How was this patch tested?
- New `TestNSSummaryUnifiedControl#testRebuildAfterError`:
`clearNSSummaryTable` throws `OutOfMemoryError("unable to create native
thread")` once. `reprocess` must rethrow it and leave the state FAILED. The
next `reprocess` must succeed and end in IDLE. Without the fix it fails with
`expected: FAILED but was: RUNNING`.
--
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]