-
Notifications
You must be signed in to change notification settings - Fork 6k
ddl: support refresh meta ddl #60837
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
Conversation
Hi @River2000i. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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 kubernetes-sigs/prow repository. |
Hi @River2000i. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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 kubernetes-sigs/prow repository. |
/ok-to-test |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #60837 +/- ##
================================================
+ Coverage 73.1447% 74.8062% +1.6615%
================================================
Files 1724 1746 +22
Lines 477109 497778 +20669
================================================
+ Hits 348980 372369 +23389
+ Misses 106725 102247 -4478
- Partials 21404 23162 +1758
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
/retest |
1 similar comment
/retest |
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.
rest LGTM!
@@ -1699,3 +1699,25 @@ func onAlterNoCacheTable(jobCtx *jobContext, job *model.Job) (ver int64, err err | |||
} | |||
return ver, err | |||
} | |||
|
|||
func onRefreshMeta(jobCtx *jobContext, job *model.Job) (ver int64, err error) { |
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.
could we add check here or at RefreshMeta
to verify that the info schema doesn't have tableInfo with same table id or name as the job specified but without restoreMode? so to be safe that refresh doesn't override anything unexpected.
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 we can skip refresh when tableinfo is exist in info schema and the tablemode isn't restoreMode?
if err != nil { | ||
job.State = model.JobStateCancelled | ||
return 0, errors.Trace(err) | ||
} |
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.
if underlying table is removed by BR, can we update that to info schema as well. Right now it's assuming underlying TiKV also contain the specified table meta KV.
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.
if underlying table is removed by BR
now skip table validate in ddl
LGTM, but maybe please have DDL team to take another look of the change? |
/retest |
pkg/infoschema/builder.go
Outdated
} | ||
return applyDropSchema(b, schemaDiff), nil | ||
} | ||
// Schema exists in kv but not in infoschema, drop it from infoschema. |
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.
drop -> create?
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.
fix in bfeca3c
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Benjamin2037, GMHDBJD, Leavrth, wjhuang2016 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:
|
/unhold |
/retest |
1 similar comment
/retest |
What problem does this PR solve?
Issue Number: close #60924
Problem Summary:
When BR uses Tablemode, which is expected to be set to
RestoreMode
when full restore batch crate tables, including tables created during log backup. However, if an exchange partition occurs during log backup, the table will still be a partition during full restore. In log restoring, the table ID will exchange with partition ID, which exchange by meta kv directly instead of infoschema, so the table mode cannot be modified for the table(since the new table ID is not store in infoschema). In addition to exchange partition, this problem may also occur in operations such as drop table\schema. The root cause is that br will directly restore meta kv, which leads to inconsistency between meta kv and infoschema.What changed and how does it work?
Implement
RefreshMeta()
DDL to update schema version by schema ID and new table ID. So infoschema can be consistent with meta kv when br restore meta kv.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.