-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: check table/database existance using infoschema only #53882
Conversation
Hi @D3Hunter. 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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #53882 +/- ##
=================================================
- Coverage 74.5995% 56.2672% -18.3324%
=================================================
Files 1508 1638 +130
Lines 358344 614091 +255747
=================================================
+ Hits 267323 345532 +78209
- Misses 71701 245178 +173477
- Partials 19320 23381 +4061
Flags with carried forward coverage won't be shown. Click here to find out more.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wjhuang2016, zimulala 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: ref #53246
Problem Summary:
currently we're checking table/database existence using infoschema when its version=latest version, else we will iterating all objects to check, when we run them using multiple threads, it's more likely that its version != latest version, so will go into iterating way.
we don't have a meta kv that can check table/database existence in a fast way, we need iterating all of them and check, it makes table/database creation slower and slower. but we don't need to check it this way, the rationle is:
checking using cached info schema should be enough, as:
jobs creating same table running concurrently.
if there are 2 owners A and B, we have 2 consecutive jobs J1 and J2 which
are creating the same table T. those 2 jobs might be running concurrently when
A sees J1 first and B sees J2 first. But for B sees J2 first, J1 must already
be done and synced, and been deleted from tidb_ddl_job table, as we are querying
jobs in the order of job id. During syncing J1, B should have synced the schema
with the latest schema version, so when B runs J2, below check will see the table
T already exists, and J2 will fail.
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.