-
Notifications
You must be signed in to change notification settings - Fork 411
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
PageStorage: Fix unexpected dmfile removed after shutdown (#6558) #6603
PageStorage: Fix unexpected dmfile removed after shutdown (#6558) #6603
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
@JaySon-Huang: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: f4731d6
|
This is an automated cherry-pick of #6558
What problem does this PR solve?
Issue Number: close #6486
Problem Summary:
From the log file, we can see that (almost all) dmfile are removed after "Release DeltaMerge Store end". This should not happen because we will check the
path_pool_weak_ref
is valid or not in the remover callback (introduced in #5699).tiflash/dbms/src/Storages/DeltaMerge/DeltaMergeStore_InternalBg.cpp
Lines 70 to 77 in 5bd0e89
However, it do happen :(
Maybe there are some background tasks that is being handled and keep a shared_ptr of
path_pool
ordelta-merge-store
so the detect is false positive passed.I can reproduce the similar problem by a unit test
tiflash/dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp
Lines 136 to 149 in eac71b9
What is changed and how it works?
shutdown_called
inStoragePathPool
StoragePathPool::shutdown
before removing the callbacks from global page storageLocalDMFileGcScanner
/LocalDMFileGcRemover
instead of lambda functions to make sure the callbacks won't contain unexpected shared_ptrsremover
callback will NOT be called if the ns_id is invalid inPageDirectory::getAliveExternalIds
scanner
is safe to be calledSome refactor:
StoragePool::dataRegisterExternalPagesCallbacks, enableGC
intoStoragePool::startup
StoragePool::dataUnregisterExternalPagesCallbacks
intoStoragePool::shutdown
to ensure the orders inside shutdownCheck List
Tests
Side effects
Documentation
Release note