-
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: fix panic for TableByID
when table id is negative
#52016
Conversation
Hi @lcwangchao. 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. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #52016 +/- ##
=================================================
- Coverage 70.7412% 54.6636% -16.0777%
=================================================
Files 1486 1597 +111
Lines 439485 609186 +169701
=================================================
+ Hits 310897 333003 +22106
- Misses 109161 253072 +143911
- Partials 19427 23111 +3684
Flags with carried forward coverage won't be shown. Click here to find out more.
|
[LGTM Timeline notifier]Timeline:
|
1c53d57
to
d40e09c
Compare
/retest |
@lcwangchao: 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. |
b33ddc6
to
bb899a3
Compare
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.
@zimulala has some ideas to sync
@@ -970,9 +971,10 @@ func NewBuilder(r autoid.Requirement, factory func() (pools.Resource, error), in | |||
} | |||
|
|||
func tableBucketIdx(tableID int64) int { | |||
intest.Assert(tableID > 0) |
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 this tableID > 0
be false in the test scenario? If so, whether it is possible to encounter real scenes. If not, is the test unnecessary?
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.
We found tableID <= 0
in some test cases but they are handled before tableBucketIdx
. However, adding assert here for two propose:
-
Provide a more clear reason for the failed test even if it would also fail without the assert function. The assert function is a more straightforward way to check the constraints.
-
This assert also checks
tableID
should not be0
. It may not fail if some codes building infoschema with an zero id table.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, BornChanger, tiancaiamao, 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 |
What problem does this PR solve?
Issue Number: close #52012
What changed and how does it work?
tableBucketIdx should always return an non-negative value.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.