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 stats meta count and modify count for dropped table partitions #48929

Merged

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Nov 27, 2023

What problem does this PR solve?

Issue Number: close #48182

Problem Summary:

What changed and how does it work?

Based on this design doc, we will only update the count and modfiy_count for it. Then it will use the count and modify_count to determine if we need to trigger an auto-analysis task.

So in this PR, I updated the count and modify count of the global table.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test
  • 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

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
dropped table partitions

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@ti-chi-bot ti-chi-bot bot added 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. labels Nov 27, 2023
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Merging #48929 (acf1509) into master (d3f399f) will increase coverage by 1.6541%.
Report is 18 commits behind head on master.
The diff coverage is 4.0816%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #48929        +/-   ##
================================================
+ Coverage   70.9584%   72.6126%   +1.6541%     
================================================
  Files          1368       1390        +22     
  Lines        404999     415363     +10364     
================================================
+ Hits         287381     301606     +14225     
+ Misses        97587      94740      -2847     
+ Partials      20031      19017      -1014     
Flag Coverage Δ
integration 43.7069% <4.1666%> (?)
unit 70.9733% <8.6956%> (+0.0149%) ⬆️

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

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

@hawkingrei
Copy link
Member

/retest

count

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
UpdateStatsMetaDelta

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@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 Nov 28, 2023
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@Rustin170506
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 28, 2023
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
pkg/statistics/handle/ddl/ddl.go Outdated Show resolved Hide resolved
Comment on lines +129 to +133
logutil.StatsLogger.Warn(
"drop partition with pseudo stats, "+
"usually it won't happen because we always load stats when initializing the handle",
zap.String("table", globalTableInfo.Name.O),
zap.String("partition", def.Name.O),
Copy link
Member

Choose a reason for hiding this comment

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

I think db name should also be printed, but looks like it would take much extra work to implement that.

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to pass the info schema here. And it involves a lot of test changes. I will do it in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

See #49011

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.

Not big problems. I'm OK to merge it now.

@ti-chi-bot ti-chi-bot bot added the lgtm label Nov 28, 2023
Copy link

ti-chi-bot bot commented Nov 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [qw4990,time-and-fate]

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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 28, 2023
Copy link

ti-chi-bot bot commented Nov 28, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-28 08:45:03.920014677 +0000 UTC m=+912332.585240872: ☑️ agreed by qw4990.
  • 2023-11-28 15:54:31.618621606 +0000 UTC m=+938100.283847802: ☑️ agreed by time-and-fate.

@time-and-fate
Copy link
Member

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 28, 2023
@time-and-fate
Copy link
Member

time-and-fate commented Nov 28, 2023

Just /hold it in case it's merged accidentally by the bot.
Feel free to /unhold it.

@hawkingrei
Copy link
Member

/test all

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@Rustin170506
Copy link
Member Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 29, 2023
@ti-chi-bot ti-chi-bot bot merged commit c426cd9 into pingcap:master Nov 29, 2023
16 checks passed
@Rustin170506 Rustin170506 deleted the rustin-patch-drop-partition-count branch November 29, 2023 03:06
@Rustin170506 Rustin170506 mentioned this pull request Nov 29, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiDB can not update stats correctly after drop a partition
4 participants