Fix incursive deadlock in ~Snapshot (#2277)#2281
Merged
ti-srebot merged 2 commits intopingcap:release-5.1from Jul 15, 2021
Merged
Fix incursive deadlock in ~Snapshot (#2277)#2281ti-srebot merged 2 commits intopingcap:release-5.1from
ti-srebot merged 2 commits intopingcap:release-5.1from
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Contributor
|
/run-all-tests |
Contributor
|
/merge |
Collaborator
Author
|
/run-all-tests |
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.
cherry-pick #2277 to release-5.1
You can switch your code base to this Pull Request by using git-extras:
# In tics repo: git pr https://github.com/pingcap/tics/pull/2281After apply modifications, you can push your change to this PR via:
What problem does this PR solve?
Issue Number: close #2249
Problem Summary:
Running
./dbms/src/Storages/Page/tests/page_stress_page_storage "" 120 8 1024, it will create 8 writing threads and 1024 reading threads.It will throw the same exception as #2249. The backtrace is[1].
We can see that inside
~Snapshot, it callsremoveExpiredSnapshotsand release another snapshot. It cause incursive deadlock onvset->read_write_mutex.#2229 Add some logic in
removeExpiredSnapshotsand make it more likely to run into this case.[1] backtrace
[2] https://github.com/pingcap/tics/blob/8a4e9a6745e540144201b12194f820dea3ea0f11/dbms/src/Storages/Page/mvcc/VersionSetWithDelta.h#L149-L154
What is changed and how it works?
vset->removeExpiredSnapshotsinside~Snapshot, only remove useless snapshot weak_ptrs inPageEntriesVersionSetWithDelta::listAllLiveFilesMergeDeltaTaskPool::length(a small data race fixing)Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
./dbms/src/Storages/Page/tests/page_stress_page_storage "" 120 8 1024, it won't throw error "Resource deadlock avoided"Side effects
Release note