Conversation
…rship handoff Release local cached copies at final mapping release without deleting checkpoint-owned sources. Guard touches of closed cache entries under the cache lock so existing readers can safely fall back to their source streams. Generated-by: GitHub Copilot CLI 1.0.84-5
Collaborator
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.
What is the purpose of the change
Release ForSt's local cached copy when a mapping reaches zero references, even if the source file is owned by a checkpoint. The checkpoint-owned source must remain untouched.
Jira: https://issues.apache.org/jira/browse/FLINK-40685
Brief change log
FileStateHandlehandoff, owned files, and correct-position open-reader fallback before and after physical cache removal on both Flink-marked and unmarked threads.Verifying this change
Six new
MappingEntryTestcases cover real file and cache lifecycle behavior. Three fail on unchanged Apache masterc7f0069db4d95a4fdf5af0eb038cafffe8c0b2bbbecause cache invalidation is skipped. The Flink-marked reader also detects a stale-node failure with the ownership-only fix, establishing the need for the closed-entry guard.The same two reader cases now hold the cache entry's removal monitor: read byte 1 from cache, release the mapping, read byte 2 while removal is blocked, then allow removal and read bytes 3 and 4. Without the position-handoff amendment, both return byte 1 instead of 2. No executor injection, worker-count assumptions or sleeps are needed to enforce this interleaving.
With the complete amended fix, all 338 focused cases pass, without failures, errors or skips:
./mvnw -B -ntp -pl flink-state-backends/flink-statebackend-forst \ -Dflink.forkCountUnitTest=1 \ -Dtest=MappingEntryTest,FileMappingManagerTest,ForStFlinkFileSystemTest,DoubleListLruTest testUsing Maven 3.9.16 and JDK 17, module
clean verifypassed with the strengthened queued-removal cases and separate test JVMs: per-class XML reports record 984 passing invocations, including two integration invocations, and 54 existing skipped invocations, with no failures or errors. Spotless, Checkstyle and the module's API compatibility check passed.The initial reused-fork module run exposed existing thread-local pollution: the unchanged
ForStAsyncAndSyncCompatibilityTest#testForStTransFromAsyncToSyncfollowed byForStFlinkFileSystemTest#testSstFileInCachealso fails on unchanged upstream production. The same existing pair passes with separate test JVMs. No existing tests were changed or excluded.Full-reactor
clean verifyhas not been run.Does this pull request potentially affect one of the following parts:
Documentation
Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot CLI 1.0.84-5