Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

planner: update AnalyzeTableStmt to use NonPartitionTableID for non-partitioned tables #59937

Merged
merged 2 commits into from
Mar 6, 2025

Conversation

Rustin170506
Copy link
Member

What problem does this PR solve?

Issue Number: close None

Problem Summary:

What changed and how does it work?

  1. Ensure that all code uses the constant statistics.NonPartitionTableID.
  2. Remove the unnecessary interface.

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

…artitioned tables

Signed-off-by: Rustin170506 <techregister@pm.me>
Signed-off-by: Rustin170506 <techregister@pm.me>
@Rustin170506 Rustin170506 added the skip-issue-check Indicates that a PR no need to check linked issue. label Mar 6, 2025
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 6, 2025
@Rustin170506 Rustin170506 requested a review from Copilot March 6, 2025 07:49

Choose a reason for hiding this comment

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

PR Overview

This PR updates the AnalyzeTableStmt implementation to use the new constant statistics.NonPartitionTableID for non-partitioned tables, ensuring consistency across analyze tasks. Key changes include:

  • Replacing the hardcoded value -1 with statistics.NonPartitionTableID in various analyze task functions.
  • Removing the now unnecessary UpdateStatsVersion function from the statistics package.
  • Updating the StatsReadWriter interface to reflect the removal of the deprecated method.

Reviewed Changes

File Description
pkg/planner/core/planbuilder.go Replaced occurrences of -1 with statistics.NonPartitionTableID.
pkg/statistics/handle/storage/stats_read_writer.go Removed the obsolete UpdateStatsVersion function.
pkg/statistics/handle/types/interfaces.go Updated interface by removing the UpdateStatsVersion method.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

@Rustin170506 Rustin170506 requested review from AilinKid and qw4990 March 6, 2025 07:51
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 6, 2025
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 73.6106%. Comparing base (a6094f7) to head (4a9dc1f).
Report is 12 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59937        +/-   ##
================================================
+ Coverage   72.9269%   73.6106%   +0.6837%     
================================================
  Files          1700       1731        +31     
  Lines        469718     478754      +9036     
================================================
+ Hits         342551     352414      +9863     
+ Misses       106052     104450      -1602     
- Partials      21115      21890       +775     
Flag Coverage Δ
integration 45.7425% <80.0000%> (?)
unit 72.1804% <60.0000%> (+0.0519%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 44.7779% <ø> (-0.1056%) ⬇️
🚀 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.

Copy link

ti-chi-bot bot commented Mar 6, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, qw4990

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 Mar 6, 2025
Copy link

ti-chi-bot bot commented Mar 6, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-03-06 07:58:44.542885413 +0000 UTC m=+514837.671805163: ☑️ agreed by qw4990.
  • 2025-03-06 08:07:46.605303126 +0000 UTC m=+515379.734222868: ☑️ agreed by AilinKid.

@ti-chi-bot ti-chi-bot bot merged commit 41e4903 into pingcap:master Mar 6, 2025
25 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. skip-issue-check Indicates that a PR no need to check linked issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants