d-wang-commit opened a new pull request, #19048:
URL: https://github.com/apache/iotdb/pull/19048
## Description
### Fix shutdown status regression
A DataNode can report ReadOnly(Stopping) with a heartbeat timestamp newer
than a shutdown report already processed by ConfigNode. The current transition
rules accept this heartbeat and replace the in-memory and persisted Stopped
status with ReadOnly(Stopping).
Reject this transition in ConfigNode unless force is true. A stopping
heartbeat represents shutdown progress and does not establish that the node has
restarted. Keep the requested statistics timestamp, clear the rejected reason,
and retain the stopped node's load score. Running recovery, other ReadOnly
reasons, Removing protection, and forced updates retain their existing behavior.
### Tests
- UT: Added four regression tests in NodeCacheTest and
LoadCachePersistedNodeStatusTest. They cover a newer stopping heartbeat,
repeated statistics refreshes, restoration from persisted Stopped status,
recovery with other ReadOnly reasons, and forced updates.
- Focused validation: 49 tests passed across NodeCacheTest,
LoadCachePersistedNodeStatusTest, and LoadCacheNodeStatusTest after compiling
the current state-management sources and tests with javac and running
JUnitCore. Before the fix, the two new shutdown regression cases failed.
- Formatting: ConfigNode Spotless passed.
- IT: No integration tests added or modified.
IoTDBPartitionDurableIT.testStoppedDataNode was not rerun. Validation is
limited to the focused UT run; full Maven validation is not complete.
### Side effects and risks
Non-forced ReadOnly(Stopping) updates can no longer revive a Stopped node.
Other ReadOnly reasons and explicit force updates remain accepted under the
existing transition rules. The change adds no RPC or persistence-format
changes, background work, or new stored state. It does not add retention of a
previous ReadOnly reason across shutdown.
<hr>
This PR has:
- [x] been self-reviewed.
- [x] added comments explaining the "why" and the intent of the code
wherever would not be obvious
for an unfamiliar reader.
- [x] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold
for code coverage.
<hr>
##### Key changed/added classes (or packages if there are too many classes)
in this PR
- NodeStatistics: reject non-forced Stopped-to-ReadOnly(Stopping)
transitions in ConfigNode.
- NodeCacheTest: verify that a newer stopping heartbeat cannot revive a
stopped node.
- LoadCachePersistedNodeStatusTest: cover persistence, cache restoration,
other ReadOnly reasons, and forced updates.
--
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]