d-wang-commit opened a new pull request, #18873:
URL: https://github.com/apache/iotdb/pull/18873
## Description
### Centralize disk recovery in CommonConfig
Disk recovery was implemented in
`DataNodeInternalRPCServiceImpl.sampleDiskLoad()`, while node status and reason
updates were managed by `CommonConfig`. Move the guarded recovery into
`CommonConfig.recoverFromDiskFull()` and share state assignment and transition
logging in a private `updateNodeStatus()` method.
Recovery still applies only to ReadOnly/DiskFull. It also checks the
stopping flag under the same monitor used by status updates and
`setStopping()`. This closes the shutdown interval between setting the stopping
flag and assigning the Stopping reason, during which a healthy disk sample
could previously restore Running.
### Tests
- UT: add `CommonConfigTest.testDiskRecoveryDoesNotUndoLaterStatusChange`
and
`DataNodeInternalRPCServiceImplDiskTest.testStoppingFlagPreventsDiskRecovery`.
Existing tests also check disk thresholds and preservation of Manual,
UnrecoverableError and Stopping reasons. Both test classes passed: 18 tests, no
failures or errors.
- Build: the full reactor package build with `with-zh-locale` and tests
skipped passed.
- IT: no integration tests added or run; no live-cluster validation
performed.
### Side effects and risks
Disk recovery now intentionally leaves the node read-only once shutdown has
started. The stopping setter acquires the existing configuration monitor,
serializing it with disk recovery and status updates. The critical section is
limited to the state transition and its existing logging. No configuration,
storage-format or RPC changes are introduced; read-only reason priorities
remain unchanged.
<hr>
This PR has:
- [x] been self-reviewed.
- [x] concurrent read
- [x] concurrent write
- [x] concurrent read and write
- [x] added Javadocs for the new non-trivial methods.
- [x] added unit tests for the new recovery entry point and the shutdown
interval.
<!-- Check the items by putting "x" in the brackets for the done things. Not
all of these items
apply to every PR. Remove the items which are not done or not relevant to
the PR. None of the items
from the checklist above are strictly necessary, but it would be very
helpful if you at least
self-review the PR. -->
<hr>
##### Key changed/added classes (or packages if there are too many classes)
in this PR
- `CommonConfig`: owns synchronized disk recovery and serializes it with the
stopping flag.
- `DataNodeInternalRPCServiceImpl`: delegates healthy-disk recovery to
`CommonConfig`.
- `CommonConfigTest`, `DataNodeInternalRPCServiceImplDiskTest`: cover later
status changes and recovery during shutdown.
--
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]