Add ReadOnly status reason and StatusReason display - #18594
Open
d-wang-commit wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)Stopping > Manual > UnrecoverableError > DiskFull, plus alegacy unclassified (null) reason at the lowest priority.
same-priority
UnrecoverableErrorkeeps the first reason. Status and reason are written atomically.Trigger point classification
DiskFullSET SYSTEM TO READONLY(local or cluster-wide) →ManualStoppingUnrecoverableError, <timestamp>, <message>; the message istruncated to 256 chars with
...and falls back to the exception class name when emptyReason propagation & display
statusReasonalongsidestatus, read from one snapshot to avoid torn pairs.SHOW CLUSTER/SHOW CLUSTER DETAILS/SHOW CONFIGNODES/SHOW DATANODESinsert aStatusReasoncolumnright after
Statusonly when at least one node has a reason; nodes without one show NULL, and theStatuscolumn keeps the plain status (no more merged
ReadOnly(DiskFull)strings).information_schema.NODESgains astatus_reasoncolumn.Tests
CommonConfigTest(priority chain, first-UnrecoverableError-wins, unclassified-reason semantics, truncation / class-name fallback, same-status reason preservation);DataNodeInternalRPCServiceImplDiskTest(auto-recovery only for an exactReadOnly+DiskFull state);
DataNodeInternalRPCServiceImplSetSystemStatusTest(Manual classification);Show*TaskTest(dynamic column layouts incl. old-ConfigNode fallback);NodeCacheTest(reason propagation; a failure-detectorUnknownnever carries a reason);FolderManagerTest;DataNodeShutdownHookTest.IoTDBSetSystemStatusTableIT(end-to-end Manual reason through SHOW DATANODES, plain status in the NODES view);IoTDBDatabaseIT(NODES schema).Negative effects
This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR