-
Notifications
You must be signed in to change notification settings - Fork 409
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
ddl: Fix the physically drop storage instance may block removing regions #9442
ddl: Fix the physically drop storage instance may block removing regions #9442
Conversation
/run-all-tests |
/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
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
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
InterpreterDropQuery
to physically remove the data from the tiflash instance. The "DropQuery" will callDeltaMergeStore::dropAllSegments
to remove the Segment at DeltaTree storage one by one. Because there are many segments for the table, runningDeltaMergeStore::dropAllSegments
is 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::dropAllSegments
does 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::flushCache
and 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