-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BugFix] fix MetdataCache concurrency issue #52968
Merged
Merged
Conversation
This file contains 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
luohaha
force-pushed
the
fix-rowset-cache
branch
from
November 18, 2024 09:03
5df7939
to
805c948
Compare
kevincai
approved these changes
Nov 18, 2024
Signed-off-by: luohaha <[email protected]>
luohaha
force-pushed
the
fix-rowset-cache
branch
from
November 18, 2024 12:53
805c948
to
90ff21e
Compare
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 10 / 10 (100.00%) file detail
|
wyb
approved these changes
Nov 19, 2024
@Mergifyio backport branch-3.3 |
@Mergifyio backport branch-3.2 |
✅ Backports have been created
|
✅ Backports have been created
|
mergify bot
pushed a commit
that referenced
this pull request
Nov 19, 2024
Signed-off-by: luohaha <[email protected]> (cherry picked from commit 4bb449f)
42 tasks
mergify bot
pushed a commit
that referenced
this pull request
Nov 19, 2024
Signed-off-by: luohaha <[email protected]> (cherry picked from commit 4bb449f)
42 tasks
wanpengfei-git
pushed a commit
that referenced
this pull request
Nov 19, 2024
Co-authored-by: Yixin Luo <[email protected]>
wanpengfei-git
pushed a commit
that referenced
this pull request
Nov 19, 2024
Co-authored-by: Yixin Luo <[email protected]>
Smith-Cruise
pushed a commit
to Smith-Cruise/starrocks
that referenced
this pull request
Nov 26, 2024
Signed-off-by: luohaha <[email protected]>
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.
Why I'm doing:
In previous PR, we introduced
MetadataCache
to achieve LRU strategy for rowset metadata memory manage, and when rowset been evict, then we will call this function:to close rowset and release metadata memory.
But in some case, this rowset which pointer point to could has been destroy, but
_cache_value_deleter
doesn't know that and will still keep callingclose()
, and it will lead to concurrency issue.What I'm doing:
This pull request includes several changes to the
MetadataCache
class and related functionality in therowset
module. The main goals are to improve memory management by usingstd::weak_ptr
for cached rowsets and to rename thewarmup_rowset
method torefresh_rowset
for clarity. Additionally, a new concurrency test is added to ensure thread safety.Memory management improvements:
be/src/storage/rowset/metadata_cache.cpp
: ChangedMetadataCache::cache_rowset
to usestd::weak_ptr<Rowset>
for better memory management and updated the_insert
method accordingly. [1] [2]be/src/storage/rowset/metadata_cache.cpp
: Modified_cache_value_deleter
to handlestd::weak_ptr<Rowset>
and ensure proper cleanup of cached rowsets.Method renaming for clarity:
be/src/storage/rowset/metadata_cache.cpp
andbe/src/storage/rowset/metadata_cache.h
: Renamedwarmup_rowset
torefresh_rowset
to better reflect its purpose. [1] [2] [3]be/src/storage/rowset/rowset.cpp
: Updated calls towarmup_rowset
to use the newrefresh_rowset
method.be/test/storage/rowset/metadata_cache_test.cpp
: Updated test cases to userefresh_rowset
instead ofwarmup_rowset
. [1] [2]New test for concurrency:
be/test/storage/rowset/metadata_cache_test.cpp
: Added a new testtest_concurrency_issue
to verify the thread safety of theMetadataCache
when caching rowsets concurrently.What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: