d-wang-commit opened a new pull request, #18594:
URL: https://github.com/apache/iotdb/pull/18594
Classify ReadOnly trigger points with priority-ordered reasons (Stopping >
Manual > UnrecoverableError > DiskFull > unclassified), propagate the reason
through heartbeats as a separate statusReason field, and show it as a dedicated
StatusReason column in SHOW CLUSTER / SHOW CONFIGNODES / SHOW DATANODES and the
information_schema.NODES view instead of the merged Status(reason) string.
UnrecoverableError reasons carry the truncated exception message with a
class-name fallback.
## Description
Classifies ReadOnly trigger points with reasons and displays the reason in
a dedicated column instead of merging
it into the Status string.
### **Reason state machine (`CommonConfig`)**
- ReadOnly entries carry stable tokens with priority `Stopping > Manual >
UnrecoverableError > DiskFull`, plus a
legacy unclassified (null) reason at the lowest priority.
- Same-status writes never downgrade the reason (a DiskFull alarm cannot
overwrite a Manual ReadOnly); a
same-priority `UnrecoverableError` keeps the first reason. Status and
reason are written atomically.
### **Trigger point classification**
- Disk-full sampling / folder exhaustion → `DiskFull`
- `SET SYSTEM TO READONLY` (local or cluster-wide) → `Manual`
- Shutdown flush phase → `Stopping`
- Storage / WAL / checkpoint unrecoverable errors → `UnrecoverableError,
<timestamp>, <message>`; the message is
truncated to 256 chars with `...` and falls back to the exception class
name when empty
### **Reason propagation & display**
- DataNode heartbeats carry `statusReason` alongside `status`, read from
one snapshot to avoid torn pairs.
- `SHOW CLUSTER` / `SHOW CLUSTER DETAILS` / `SHOW CONFIGNODES` / `SHOW
DATANODES` insert a `StatusReason` column
right after `Status` only when at least one node has a reason; nodes
without one show NULL, and the `Status`
column keeps the plain status (no more merged `ReadOnly(DiskFull)`
strings).
- `information_schema.NODES` gains a `status_reason` column.
- New thrift fields are optional: responses from an old ConfigNode (field
unset) keep the legacy column layout.
### Tests
- **UT**: `CommonConfigTest` (priority chain,
first-UnrecoverableError-wins, unclassified-reason semantics, truncation /
class-name fallback, same-status reason preservation);
`DataNodeInternalRPCServiceImplDiskTest` (auto-recovery only for an exact
ReadOnly+DiskFull state);
`DataNodeInternalRPCServiceImplSetSystemStatusTest` (Manual classification);
`Show*TaskTest` (dynamic column layouts incl. old-ConfigNode fallback);
`NodeCacheTest` (reason propagation; a failure-detector `Unknown` never carries
a reason);
`FolderManagerTest`; `DataNodeShutdownHookTest`.
- **IT**: `IoTDBSetSystemStatusTableIT` (end-to-end Manual reason through
SHOW DATANODES, plain status in the NODES view); `IoTDBDatabaseIT` (NODES
schema).
### Negative effects
- SHOW statements gain one extra column only when a reason exists; clients
parsing by column name are unaffected.
- Each reason is bounded to 256 chars and only travels in heartbeats /
SHOW responses, so the payload overhead is negligible.
<hr>
This PR has:
- [ ] been self-reviewed.
- [ ] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods.
- [ ] added or updated version, __license__, or notice information
- [ ] added comments explaining the "why" and the intent of the code
wherever would not be obvious
for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold
for code coverage.
- [ ] added integration tests.
- [ ] been tested in a test IoTDB cluster.
<!-- 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
--
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]