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: update the global stats correctly after truncate a partition #49362

Merged
merged 15 commits into from
Dec 13, 2023

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Dec 12, 2023

What problem does this PR solve?

Issue Number: close #39681

Problem Summary:

What changed and how does it work?

  • Relocated truncate partition logic to truncate_partition.go.
  • Updated the global stats correctly, updated the count, and modify_count for the global table.
  • Added test case for truncating one partition and multiple partitions.
  • Fixed the broken old test case for global stats.

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.

Fix TiDB global stats meta update issue after truncating tables

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 12, 2023
@Rustin170506 Rustin170506 changed the title refactor: relocate truncate partition logic to truncate_partition.go WIP: NOT READY FOR REVIEW Dec 12, 2023
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 12, 2023
Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Merging #49362 (8f52893) into master (0b39f99) will increase coverage by 0.6738%.
Report is 20 commits behind head on master.
The diff coverage is 0.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49362        +/-   ##
================================================
+ Coverage   71.0491%   71.7229%   +0.6738%     
================================================
  Files          1368       1415        +47     
  Lines        401712     418955     +17243     
================================================
+ Hits         285413     300487     +15074     
- Misses        96443      99629      +3186     
+ Partials      19856      18839      -1017     
Flag Coverage Δ
integration 43.9467% <0.0000%> (?)
unit 71.0495% <ø> (+0.0003%) ⬆️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 47.7924% <ø> (-5.1010%) ⬇️

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 12, 2023
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 12, 2023
@Rustin170506 Rustin170506 changed the title WIP: NOT READY FOR REVIEW statistics: update the global stats correctly after truncate a partition Dec 12, 2023
@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 Dec 12, 2023
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

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

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 13, 2023
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

Copy link

ti-chi-bot bot commented Dec 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, 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 Dec 13, 2023
Copy link

ti-chi-bot bot commented Dec 13, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-13 04:04:37.668472402 +0000 UTC m=+415368.705699329: ☑️ agreed by hawkingrei.
  • 2023-12-13 07:16:05.994617208 +0000 UTC m=+426857.031844135: ☑️ agreed by qw4990.

Signed-off-by: hi-rustin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved component/statistics lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Truncate partition does not update global statistics
3 participants