-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
infoschema: add WithRefillOption for TableByName and TableByID #55511
Conversation
Hi @tiancaiamao. 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 #55511 +/- ##
================================================
+ Coverage 72.9200% 75.3841% +2.4640%
================================================
Files 1576 1598 +22
Lines 440817 450746 +9929
================================================
+ Hits 321444 339791 +18347
+ Misses 99599 89699 -9900
- Partials 19774 21256 +1482
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -161,8 +161,9 @@ func checkTableForeignKeysValid(sctx sessionctx.Context, is infoschema.InfoSchem | |||
} | |||
|
|||
referredFKInfos := is.GetTableReferredForeignKeys(schema, tbInfo.Name.L) | |||
ctx := infoschema.WithRefillOption(context.Background(), false) |
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.
seems it's always false right now
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.
Yes, we do not fill cache for TableByName in some place like in a loop that may visit a lot tables.
// By default, TableByID does not refill schema cache, and TableByName does. | ||
// The behavior can be changed by providing the context.Context. |
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.
why we have such a difference?
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.
please add this comment to TableByName
and TableByID
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.
Because when we call TableByID
, we need to know the table ID.
And how we know it? usually TableByName
is called already.
Co-authored-by: lance6716 <[email protected]>
Co-authored-by: D3Hunter <[email protected]>
@tiancaiamao: The following test failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, hawkingrei, lance6716, tangenta 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 |
…e-upstream * origin/master: parser: call `SetText` correctly for `CreateViewStmt` (#55520) lighting: expose limited fields for `kv.Session` (#55517) show: prefilter table name with like pattern and show full tables (#55396) Planner: Do not allow cardinality to go below 1 (#55242) *: replace maps.Copy which is for map clone with std maps.Clone (#55530) infoschema: add WithRefillOption for TableByName and TableByID (#55511) domain: change groupSize in splitForConcurrentFetch (#55518) ddl: fix resuming to wrong checkpoint when failed during adding index (#55506)
…e-upstream * origin/master: parser: call `SetText` correctly for `CreateViewStmt` (pingcap#55520) lighting: expose limited fields for `kv.Session` (pingcap#55517) show: prefilter table name with like pattern and show full tables (pingcap#55396) Planner: Do not allow cardinality to go below 1 (pingcap#55242) *: replace maps.Copy which is for map clone with std maps.Clone (pingcap#55530) infoschema: add WithRefillOption for TableByName and TableByID (pingcap#55511) domain: change groupSize in splitForConcurrentFetch (pingcap#55518) ddl: fix resuming to wrong checkpoint when failed during adding index (pingcap#55506) Signed-off-by: Wish <[email protected]>
What problem does this PR solve?
Issue Number: ref #50959
Problem Summary:
What changed and how does it work?
Use context to pass the refill option for TableByName/TableByID
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.