Skip to content
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

statistics: do not analyze non exist table anymore #57244

Merged

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Nov 8, 2024

What problem does this PR solve?

Issue Number: close #57227

Problem Summary:

What changed and how does it work?

After #57222, we can handle most cases where tables have been dropped. However, there is still a chance that we might attempt to analyze a non-existent table or use incorrect information to perform the analysis.

In this PR, I check the schema and table information before performing the actual analysis. This helps minimize unnecessary analysis work.

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

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 8, 2024
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 76.21622% with 44 lines in your changes missing coverage. Please review.

Project coverage is 74.0005%. Comparing base (b5cf2c3) to head (fce206b).
Report is 16 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57244        +/-   ##
================================================
+ Coverage   72.8947%   74.0005%   +1.1057%     
================================================
  Files          1667       1699        +32     
  Lines        460811     472502     +11691     
================================================
+ Hits         335907     349654     +13747     
+ Misses       104249     101584      -2665     
- Partials      20655      21264       +609     
Flag Coverage Δ
integration 46.5914% <0.0000%> (?)
unit 72.6144% <76.2162%> (+0.3270%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 45.2047% <ø> (+0.1278%) ⬆️

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. do-not-merge/needs-linked-issue labels Nov 8, 2024
@Rustin170506 Rustin170506 force-pushed the rustin-patch-pq-non-exist-table branch from eaa6dc4 to 4c6941a Compare November 8, 2024 12:15
Copy link
Member Author

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

🔢 Self-check (PR reviewed by myself and ready for feedback.)

// Analyze table with this version of statistics.
TableStatsVer int
// Weight is used to calculate the priority of the job.
Weight float64

// Lazy initialized.
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we should put these fields into a substruct. But the PR is too big. I will do it later.

@Rustin170506 Rustin170506 changed the title WIP: statistics: do not analyze non exist table anymore statistics: do not analyze non exist table anymore Nov 8, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 8, 2024
@Rustin170506 Rustin170506 force-pushed the rustin-patch-pq-non-exist-table branch from 0653319 to 22f3c10 Compare November 9, 2024 02:13
@Rustin170506 Rustin170506 force-pushed the rustin-patch-pq-non-exist-table branch 2 times, most recently from cf93429 to a645cf5 Compare November 11, 2024 08:58
@Rustin170506
Copy link
Member Author

/retest

1 similar comment
@Rustin170506
Copy link
Member Author

/retest

@Rustin170506 Rustin170506 force-pushed the rustin-patch-pq-non-exist-table branch 2 times, most recently from 8fed1f1 to 6e2aefe Compare November 12, 2024 01:48
@Rustin170506 Rustin170506 force-pushed the rustin-patch-pq-non-exist-table branch from 6e2aefe to 26196e3 Compare November 12, 2024 01:50
Copy link
Member Author

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

🔢 Self-check (PR reviewed by myself and ready for feedback.)

Copy link
Member

@time-and-fate time-and-fate left a comment

Choose a reason for hiding this comment

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

Others LGTM.

Comment on lines 51 to 53
TableSchema string
TableName string
Indexes []string
Copy link
Member

Choose a reason for hiding this comment

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

What about unifying the naming, like DBName/SchemaName, TableName and IndexesNames?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 12, 2024
@Rustin170506
Copy link
Member Author

/retest

1 similar comment
@Rustin170506
Copy link
Member Author

/retest

Copy link

ti-chi-bot bot commented Nov 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: time-and-fate, winoros

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 12, 2024
Copy link

ti-chi-bot bot commented Nov 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-12 06:22:59.386949067 +0000 UTC m=+337341.577818063: ☑️ agreed by time-and-fate.
  • 2024-11-12 12:51:27.114987816 +0000 UTC m=+360649.305856813: ☑️ agreed by winoros.

@purelind
Copy link
Contributor

/test all

@Rustin170506
Copy link
Member Author

/retest

@purelind
Copy link
Contributor

/test all

Copy link

tiprow bot commented Nov 12, 2024

@Rustin170506: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow fce206b link true /test fast_test_tiprow

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.

@ti-chi-bot ti-chi-bot bot merged commit 2ad93c2 into pingcap:master Nov 12, 2024
23 of 24 checks passed
@Rustin170506 Rustin170506 deleted the rustin-patch-pq-non-exist-table branch November 13, 2024 01:02
Rustin170506 added a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
Rustin170506 added a commit to ti-chi-bot/tidb that referenced this pull request Nov 13, 2024
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 13, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #57334.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The priority queue cannot correctly handle the drop database event
5 participants