ddl: Fix the physically drop storage instance may block removing regions#9442
Merged
ti-chi-bot[bot] merged 5 commits intopingcap:release-7.1from Sep 20, 2024
Merged
Conversation
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
/run-all-tests |
Lloyd-Pottiger
approved these changes
Sep 20, 2024
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CalvinNeo, Lloyd-Pottiger The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Contributor
[LGTM Timeline notifier]Timeline:
|
Contributor
Author
|
/cherry-pick release-6.5 |
ti-chi-bot
pushed a commit
to ti-chi-bot/tiflash
that referenced
this pull request
Jan 22, 2025
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Member
|
@JaySon-Huang: new pull request created to branch DetailsIn response to this:
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. |
12 tasks
ti-chi-bot bot
pushed a commit
that referenced
this pull request
Jan 22, 2025
…ons (#9442) (#9811) close #9437 ddl: Fix the physical drop storage instance may block removing regions Make sure physical drop storage instance only happen after all related regions are removed Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io> Signed-off-by: JaySon-Huang <tshent@qq.com> Co-authored-by: JaySon <tshent@qq.com> Co-authored-by: JaySon-Huang <tshent@qq.com>
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 problem does this PR solve?
Issue Number: close #9437
Problem Summary:
When a table is dropped in tidb, and exceeds the gc_safepoint, tiflash will generate an
InterpreterDropQueryto physically remove the data from the tiflash instance. The "DropQuery" will callDeltaMergeStore::dropAllSegmentsto remove the Segment at DeltaTree storage one by one. Because there are many segments for the table, runningDeltaMergeStore::dropAllSegmentsis slow.https://github.com/pingcap/tiflash/blob/v7.1.3/dbms/src/TiDB/Schema/SchemaSyncService.cpp#L216-L227
https://github.com/pingcap/tiflash/blob/v7.1.3/dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp#L342-L349
However,
DeltaMergeStore::dropAllSegmentsdoes not check that all Regions have been removed from TiFlash before the physical drop action is performed. So at the same time, there are some Region removed actions are performed.All the raftstore threads that try to remove Region will run into
removeObsoleteDataInStorage, callingDeltaMergeStore::flushCacheand try to acquire a read latch on table_id=563080. At last, all the raftsotre threads are blocked by the thread that executingDeltaMergeStore::dropAllSegments.But more raft-message comes into the tiflash instance, the memory usage grows and cause OOM kills. After restarts, the tiflash instance runs into the same blocking again. And at last, all the segments (around 30,000 in total) are removed from tiflash. And tiflash begins to catch-up the raft message.
What is changed and how it works?
Pick PRs:
Check List
Tests
Side effects
Documentation
Release note