-
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
ddl: Skip updating the tombstone_ts if the table is already tombstone (release-6.5) #9230
ddl: Skip updating the tombstone_ts if the table is already tombstone (release-6.5) #9230
Conversation
c4b74a9
to
a0fc643
Compare
/run-all-tests |
Signed-off-by: JaySon-Huang <[email protected]>
Signed-off-by: JaySon-Huang <[email protected]>
9bca9b1
to
6ce0236
Compare
/run-all-tests |
/run-all-tests |
/run-all-tests |
/run-all-tests |
void SchemaBuilder<Getter, NameMapper>::applyRenameTable(const DBInfoPtr & new_db_info, TableID table_id, std::string_view action) | ||
{ |
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.
Maybe use enum instead of string_view
?
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.
No. I think string_view is better than enum. Because something I attach more info than just a enum name. For example, attaching the table_id
tiflash/dbms/src/TiDB/Schema/SchemaBuilder.cpp
Lines 682 to 683 in 5b9d758
/// Apply changes to physical tables. | |
auto reason = fmt::format("ApplyPartitionDiff-logical_table_id={}", orig_table_info.id); |
tiflash/dbms/src/TiDB/Schema/SchemaBuilder.cpp
Lines 1241 to 1245 in 5b9d758
// If "CREATE DATABASE" is executed in TiFlash after user has executed "DROP DATABASE" | |
// in TiDB, then TiFlash may not create the IDatabase instance. Make sure we can access | |
// to the IDatabase when creating IStorage. | |
const auto database_mapped_name = name_mapper.mapDatabaseName(*db_info); | |
ensureLocalDatabaseExist(db_info->id, database_mapped_name, fmt::format("CreatePhysicalTable-table_id={}", table_info->id)); |
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
[LGTM Timeline notifier]Timeline:
|
/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, JinheLin, 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 |
What problem does this PR solve?
Issue Number: close #9227
Problem Summary: #9227 (comment)
In
SchemaBuilder::syncAllSchema
, each table that does not exists in tikv but still in the tiflash instance. TiFlash will executeapplyDropPhysicalTable
for each table, wich will update the "tombstone_ts" of the table in its ".sql" file.Even if the table is already "tombstone", the function will update the "tombstone_ts" by a newer tso from PD. This make the IStorage instance still exist even after the gc_safepoint is exceed than the drop timepoint + gc_lifetime.
tiflash/dbms/src/TiDB/Schema/SchemaBuilder.cpp
Lines 1437 to 1451 in 28a2314
tiflash/dbms/src/TiDB/Schema/SchemaBuilder.cpp
Lines 1240 to 1268 in 28a2314
What is changed and how it works?
Skip updating the tombstone_ts if the table is already tombstone. So even if the "syncAllSchema" is called repeatedly, the dropped IStorage instance can be physically removed from TiFlash instances correctly. And the time spend on "syncAllSchema" won't become longer and longer.
Check List
Tests
Run the following test scripts. It will make tiflash run into sync all schema frequently.
In the v6.5.10 version, after that script ran,
Side effects
Documentation
Release note