[fix](filecache) avoid crash when late holder cleanup sees removed cache cell#62437
Open
freemandealer wants to merge 3 commits intoapache:masterfrom
Open
[fix](filecache) avoid crash when late holder cleanup sees removed cache cell#62437freemandealer wants to merge 3 commits intoapache:masterfrom
freemandealer wants to merge 3 commits intoapache:masterfrom
Conversation
…ache cell When FileBlocksHolder is destroyed late, the corresponding file block may\nhave already been removed or replaced in block file cache metadata.\n\nBlockFileCache::remove() previously assumed get_cell() always returned\nthe current cell for the file block and dereferenced it unconditionally.\nThat can crash during the duplicate cleanup path after cache metadata has\nalready been cleared.\n\nThis change keeps the fix scoped to the stop-bleeding path: if the cache\ncell is missing or no longer points to the same file block, skip the\nduplicate remove.\n\nAdd a unit test that simulates late holder cleanup after cache metadata\nhas already been manually removed from the cache.
Add warning logs for the stop-bleeding duplicate remove path so we can\ndistinguish between a missing cache cell and a replaced cache cell.\n\nThe log includes the current block hash/offset/size/type/state and, for\ncell mismatch, the block currently attached to the cache cell as well.
Add a unit test for the stop-bleeding duplicate remove path where the old\nfile block loses its cache metadata first and a new file block is then\ncreated with the same hash and offset before the old holder is destroyed.\n\nThe test verifies that late holder cleanup skips the stale remove without\nremoving the new cache entry.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
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.
Problem Summary:
When FileBlocksHolder is destroyed late, the corresponding file block may already be removed or replaced in block file cache metadata.
BlockFileCache::remove()can dereference a stale cache cell during duplicate cleanup and crash.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)