Skip to content

Readonly status reasons - #18463

Open
zerolbsony wants to merge 5 commits into
apache:masterfrom
zerolbsony:readonly-status-reasons
Open

Readonly status reasons#18463
zerolbsony wants to merge 5 commits into
apache:masterfrom
zerolbsony:readonly-status-reasons

Conversation

@zerolbsony

Copy link
Copy Markdown
Contributor

No description provided.

CRZbulabula and others added 5 commits August 13, 2026 11:56
…check

ConfigNode now reports its own NodeStatus.ReadOnly when its critical
directories (systemDir, consensusDir) are unwritable or near-full,
mirroring the existing DataNode behavior. NodeStatus reasons are
extended with a new DISK_CRASH constant alongside DISK_FULL, and the
ConfigNode heartbeat carries status/statusReason back to the leader.

- node-commons: new DiskChecker utility (probe + state-machine apply),
  with priority DiskCrash > DiskFull and recovery to Running when the
  reason was disk-related. i18n messages added in en + zh.
- thrift-confignode: TConfigNodeHeartbeatResp gains optional status
  and statusReason fields (forward-compatible).
- confignode: leader self-checks before fanning out heartbeats;
  follower self-checks on receive and reports back; cache reads from
  CommonConfig for the leader's self entry, otherwise from the sample.
- datanode: FolderManager exposes a static hasAnyAbnormalFolder()
  aggregator; sampleDiskLoad treats any ABNORMAL folder as DiskCrash
  (which wins over DiskFull) and reuses DiskChecker.apply.
…sive crash detect

Three changes that let ReadOnly state actually shape Raft behavior on ConfigNode:

- Utils.rejectWrite / stallApply now match ConfigRegion in addition to DataRegion,
  so a ReadOnly ConfigNode leader hits the same forceStepDownLeader path that
  DataRegion leaders already use. Comment at RatisConsensus.write updated.
- New NodeStatus.priorityForStatus maps Running=0, ReadOnly(DiskFull)=-1,
  ReadOnly(DiskCrash)=-2. HeartbeatService runs a reconciliation step on the
  leader (same cadence as the load-sampling pass, after async fanout) that pushes
  each ConfigNode peer's desired priority into Ratis. Unknown/Removing/manual
  ReadOnly are left empty so transient blips do not churn the group config.
  IConsensus gains a default-no-op reconfigurePeerPriorities; RatisConsensus
  overrides it to rebuild the peer list and call sendReconfiguration.
- Replace DiskChecker.check (active testWrite probe) with a passive observer
  threaded through Ratis. ApplicationStateMachineProxy gains a diskFailureListener
  parameter and fires it from the applyTransaction catch when Utils.isDiskFailure
  matches the cause (IOError / FileSystemException). RatisConsensus also tags
  IOException out of writeLocallyWithRetry / writeRemotelyWithRetry so log-write
  failures register as DiskCrash. DiskChecker keeps only checkFreeRatio (for the
  DiskFull path) and apply (for the state machine); DiskCrash is now sticky on
  both DataNode and ConfigNode until restart.

DiskCheckerTest trimmed to drop testWrite-specific cases and to assert that
NORMAL no longer recovers DiskCrash; 14 cases pass.
Mark DataNode as ReadOnly(WALBlocked) when WAL write blocking
persists, and let ConfigNode move Region leaders away from the
blocked DataNode. Add UT and IT coverage for WAL block status and
leader balance behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants