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: enhance dumpStatsDeltaToKV to return updated batch updates and ensure proper sorting #58929

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Jan 15, 2025

What problem does this PR solve?

Issue Number: ref #57869, close #58903

Problem Summary:

What changed and how does it work?

  1. Remove useless map update.
  2. Make sure we use the right slice to update the delta map and record the historical stats meta.
    3. I also updated it to use SELECT FOR UPDATE NOWAIT to avoid the deadlock in the first place.

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

@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 Jan 15, 2025
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Project coverage is 73.7997%. Comparing base (a3cc774) to head (9af1d9b).
Report is 12 commits behind head on master.

Current head 9af1d9b differs from pull request most recent head 0d2e044

Please upload reports for the commit 0d2e044 to get more accurate results.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58929        +/-   ##
================================================
+ Coverage   73.1217%   73.7997%   +0.6780%     
================================================
  Files          1680       1710        +30     
  Lines        464543     472855      +8312     
================================================
+ Hits         339682     348966      +9284     
+ Misses       103984     102323      -1661     
- Partials      20877      21566       +689     
Flag Coverage Δ
integration 45.7430% <0.0000%> (?)
unit 72.3191% <69.2307%> (+0.0148%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.4106% <ø> (-0.0178%) ⬇️

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 15, 2025
@Rustin170506 Rustin170506 force-pushed the rustin-patch-dump-stats-fix branch from a9572c5 to 0d2e044 Compare January 15, 2025 09:07
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 15, 2025
@Rustin170506
Copy link
Member Author

Tested it in our test-infra:
image

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 15, 2025
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.)

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 15, 2025
@Rustin170506 Rustin170506 force-pushed the rustin-patch-dump-stats-fix branch from 9af1d9b to 0d2e044 Compare January 15, 2025 13:18
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 15, 2025
Copy link

ti-chi-bot bot commented Jan 16, 2025

[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 Jan 16, 2025
Copy link

ti-chi-bot bot commented Jan 16, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-15 13:04:33.232964698 +0000 UTC m=+123744.688010831: ☑️ agreed by winoros.
  • 2025-01-16 07:29:19.670832991 +0000 UTC m=+190031.125879125: ☑️ agreed by time-and-fate.

@ti-chi-bot ti-chi-bot bot merged commit 803f928 into pingcap:master Jan 16, 2025
25 checks passed
@Rustin170506 Rustin170506 added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Jan 16, 2025
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jan 16, 2025
@ti-chi-bot
Copy link
Member

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

Rustin170506 added a commit to Rustin170506/tidb that referenced this pull request Jan 16, 2025
Rustin170506 added a commit to Rustin170506/tidb that referenced this pull request Jan 16, 2025
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify_count and Row_count is error in Table 'stats_meta'
4 participants