Repository navigation
Fix premature recovery from DiskFull read-only mode - #19126
Open
d-wang-commit wants to merge 1 commit into
Open
d-wang-commit wants to merge 1 commit into
d-wang-commit wants to merge 1 commit into
Conversation
Require affected directories to recover before restoring Running status. Preserve manual and unrecoverable read-only reasons.
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.
Description
Keep DiskFull recovery consistent with directory protection
A data or snapshot filesystem can remain full while the aggregate free-space ratio exceeds the warning threshold. Directory selection then enters
ReadOnly(DiskFull), but the next heartbeat restoresRunningusing only the aggregate ratio. Repeated operations can keep switching the node between these states without any space being freed.Record a recovery check for each failed directory source in
CommonConfig. The heartbeat restoresRunningonly when the aggregate check passes and every recorded source has an eligible directory with space. Constructor failures use an immutable folder list as the key; liveFolderManagerinstances use their identity and retain their folder-health restrictions. Repeated reports for the same key replace the callback. Leaving read-only mode clears the recorded checks.Filesystem checks run outside the status lock. Recovery rechecks the exact
ReadOnly(DiskFull)state before changing it, preserving manual, stopping, and unrecoverable-error transitions. The existing IOException retry and unrecoverable-error handling remain unchanged.Tests
CommonConfigTestfor multiple failed sources, callback replacement, concurrent higher-priority reasons, and manual reset.DataNodeInternalRPCServiceImplDiskTestfor healthy aggregate metrics with blocked sources, and recovered sources with zero or insufficient aggregate space.FolderManagerDiskFullRecoveryTestfor repeated snapshot initialization failures, multiple directory groups, unhealthy candidates, and callers that opt out of changing node status. Run the existingFolderManagerTestas regression coverage.mvn -B -ntp -o test -Dtest=CommonConfigTest,FolderManagerTest,FolderManagerDiskFullRecoveryTest,DataNodeInternalRPCServiceImplDiskTest -Dsurefire.failIfNoSpecifiedTests=false: passed; 54 tests, 0 failures/errors, 4 pre-existing skips.mvn -B -ntp -o test-compile -DskipTests -P with-zh-locale: passed.git diff --check: passed.Side effects and risks
Recovery now probes previously failed directories using the existing
hasSpacebehavior, including its retries, so a heartbeat may spend longer checking a full filesystem. Callback references are retained until the node leaves read-only mode, with one entry per distinct key. Folder health uses a concurrent map because recovery reads it from the heartbeat thread.Space checks are snapshots. A new disk-full report racing with the final recovery step can still require the next business operation to trigger protection again; this change addresses repeated recovery while already-recorded sources remain full.
This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
CommonConfig: records failed sources and coordinates guarded disk recovery.DirectoryStrategy,FolderManager,DataRegion: register the recovery condition at directory-related DiskFull entries.DataNodeInternalRPCServiceImpl: uses the shared recovery method after the aggregate disk check passes.CommonConfigTest,DataNodeInternalRPCServiceImplDiskTest,FolderManagerDiskFullRecoveryTest: cover state transitions, heartbeat gates, and directory failures.