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

WIP(POC): Batch stats delta dumping #58331

Closed

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Dec 17, 2024

What problem does this PR solve?

Issue Number: close #57869

Problem Summary:

What changed and how does it work?

In this PR, I tried to dump the stats delta batch by batch to speed up the process.

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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/planner SIG: Planner labels Dec 17, 2024
Copy link

ti-chi-bot bot commented Dec 17, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from rustin170506, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@Rustin170506 Rustin170506 force-pushed the rustin-patch-poc-delta branch 2 times, most recently from a475f23 to cea998a Compare December 17, 2024 08:24
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 82.01058% with 34 lines in your changes missing coverage. Please review.

Project coverage is 73.6755%. Comparing base (aec0fc5) to head (d020c84).
Report is 177 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58331        +/-   ##
================================================
+ Coverage   73.2097%   73.6755%   +0.4658%     
================================================
  Files          1679       1711        +32     
  Lines        462339     490043     +27704     
================================================
+ Hits         338477     361042     +22565     
- Misses       103082     106982      +3900     
- Partials      20780      22019      +1239     
Flag Coverage Δ
integration 45.6264% <0.0000%> (?)
unit 72.2794% <82.0105%> (-0.0650%) ⬇️

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

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

@Rustin170506
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed do-not-merge/needs-triage-completed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 17, 2024

// Execute locked updates
if len(lockedValues) > 0 {
sql := fmt.Sprintf("insert into mysql.stats_table_locked (version, table_id, modify_count, count) values %s "+
Copy link
Member

@winoros winoros Dec 17, 2024

Choose a reason for hiding this comment

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

From the doc https://docs.pingcap.com/tidb/stable/pessimistic-transaction,
our autocommit is still the optimistic lock, which may be a problem when the number of tables is large and the writes of one table are not gathered into one TiDB.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Seems that ExecCtx doesn't pass the WrapTxn

Copy link
Member Author

Choose a reason for hiding this comment

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

@Rustin170506
Copy link
Member Author

/retest

1 similar comment
@Rustin170506
Copy link
Member Author

/retest

@Rustin170506 Rustin170506 force-pushed the rustin-patch-poc-delta branch from 8b71846 to d1b01ac Compare December 18, 2024 06:14
@Rustin170506
Copy link
Member Author

/retest

@Rustin170506 Rustin170506 force-pushed the rustin-patch-poc-delta branch from c8c78ea to abec344 Compare December 26, 2024 12:36
Signed-off-by: Rustin170506 <[email protected]>
Copy link

tiprow bot commented Jan 2, 2025

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

Test name Commit Details Required Rerun command
tidb_parser_test d020c84 link true /test tidb_parser_test
fast_test_tiprow d020c84 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. 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.

Excessive Stats Updaing Duration in Clusters with Over One Million Tables and Active Workloads
2 participants