Skip to content

meta: fix infoschema compare foreign key field is null to decide whether it must load #60235

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

River2000i
Copy link
Contributor

@River2000i River2000i commented Mar 24, 2025

What problem does this PR solve?

Issue Number: close #60044

Problem Summary: information schema v2 judge a table's foreign key field is null incorrect. Now fk_info may be null or []. Now we only judge it is null or not.

What changed and how does it work?

additional compare fk_info is []. When neither null nor [], the table is considered to be a foreign key related table.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Copy link

ti-chi-bot bot commented Mar 24, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign gmhdbjd for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Mar 24, 2025
Copy link

ti-chi-bot bot commented Mar 24, 2025

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

Copy link

tiprow bot commented Mar 24, 2025

Hi @River2000i. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

@River2000i River2000i changed the title meta: fix infoschema compare foreign key field whether it must load meta: fix infoschema compare foreign key field is null whether it must load Mar 24, 2025
@River2000i River2000i changed the title meta: fix infoschema compare foreign key field is null whether it must load meta: fix infoschema compare foreign key field is null to decide whether it must load Mar 24, 2025
@Benjamin2037
Copy link
Collaborator

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Mar 24, 2025
Copy link

codecov bot commented Mar 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.9175%. Comparing base (6dd95c9) to head (a4c5088).

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #60235        +/-   ##
================================================
+ Coverage   73.1710%   74.9175%   +1.7464%     
================================================
  Files          1708       1754        +46     
  Lines        471864     480021      +8157     
================================================
+ Hits         345268     359620     +14352     
+ Misses       105372      97785      -7587     
- Partials      21224      22616      +1392     
Flag Coverage Δ
integration 48.8646% <46.1538%> (?)
unit 72.3545% <100.0000%> (-0.0177%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 62.2737% <ø> (+15.1049%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -1109,8 +1111,19 @@ var checkAttributesInOrder = []string{
// then it does not need to be loaded and this function will return false.
// Otherwise, it will return true, indicating that the table info should be loaded.
// Since attributes are checked in sequence, it's important to choose the order carefully.
func isTableInfoMustLoad(json []byte, filterAttrs ...string) bool {
// isCheckForeignKeyAttrsInOrder check foreign key or not, since fk_info contains two null situations.
func isTableInfoMustLoad(json []byte, isCheckForeignKeyAttrsInOrder bool, filterAttrs ...string) bool {
Copy link
Contributor

@joechenrh joechenrh Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we split it into two functions, one use default filterAttrs(foreign key and checkAttributesInOrder) and another use passed in filters?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-9.0-beta.1 ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

infoschema v2 loads all the tables when starts
3 participants