-
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
infoschema,domain: introduce InfoSchemaV2, core data struct etc #51058
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/test-infra repository. |
This is extracted from #50591 tidb/pkg/infoschema/builder.go Lines 1140 to 1144 in 350b887
|
/retest |
@tiancaiamao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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/test-infra repository. |
/ok-to-test |
/retest |
/retest-required |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #51058 +/- ##
=================================================
- Coverage 72.2960% 55.2738% -17.0222%
=================================================
Files 1467 1576 +109
Lines 361760 609583 +247823
=================================================
+ Hits 261538 336940 +75402
- Misses 80904 249544 +168640
- Partials 19318 23099 +3781
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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
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
func (is *infoschemaV2) SchemaExists(schema model.CIStr) bool { | ||
var ok bool | ||
// TODO: support different version | ||
is.schemaMap.Scan(func(item schemaItem) bool { |
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.
use Descend
?
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.
This is a full memory Scan
, it does not matter whether we Descend
or Ascend
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 Descend
can only search items from [pivot, first], no need a full scan, ok for now
func (is *infoschemaV2) SchemaExists(schema model.CIStr) bool { | ||
var ok bool | ||
// TODO: support different version | ||
is.schemaMap.Scan(func(item schemaItem) bool { |
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 Descend
can only search items from [pivot, first], no need a full scan, ok for 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.
LGTM for BR part
pkg/infoschema/infoschema_v2.go
Outdated
// Try to avoid repeated concurrency loading. | ||
res, err, _ := loadTableSF.Do(fmt.Sprintf("%d-%d", dbID, tblID), func() (ret any, 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.
Will there be concurrent queries using different ts
on same dbID-tblID
?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, GMHDBJD, tangenta, YuJuncen 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: ref #50959
Problem Summary:
What changed and how does it work?
This commit introduce the
infoschema_v2.go
file, include the core data struct, implement some of the APIs.It's not a completed work, the code can barely run some basic operations.
There is still a long way to make the code smooth, but I fire this PR early and it is ready for review now. Why?
Because I hope we can provide infoschema v2 in tidb 8.0, GA or at least RC, time is limited.
This commit provide a solid foundation that we can work on together.
With the core data struct introduced, we can fullfill the missing things and split the tasks parallelly.
Later, I, @GMHDBJD and other team members will continue the development.
Check List
Tests
Enable infoschema v2 here:
https://github.com/pingcap/tidb/compare/master...tiancaiamao:infoschema-v2-pr?expand=1#diff-d82e5bb6499a8d8c00f3d55ec95bccda3fab6d4cc45529cecf06552bfa973b1bR21
Start tidb, create some tabe, insert data, drop table, verify the basic operations etc...
This commit doesn't break anyting because the new code is not used now.
We need prepare a test plan document and add tests later.
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.