tidb icon indicating copy to clipboard operation
tidb copied to clipboard

statistics: avoid frequantly syncing stats simultaneously

Open hawkingrei opened this issue 1 year ago • 5 comments

What problem does this PR solve?

Issue Number: close #54481

Problem Summary:

What changed and how does it work?

Now, StatsCacheImpl.Update can sync stats by version from the storage. we have many scenarios to call it. such as domain.loadStatsWorker and Analyze. When customers use lightning, lightning will trigger the multi-analyzed tasks simultaneously. so it also triggers multi StatsCacheImpl.Update simultaneously. it is unnecessary.

add a singleflight for StatsCacheImpl.Update

Check List

Tests

  • [x] 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

hawkingrei avatar Sep 09 '24 04:09 hawkingrei

[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 hawkingrei and additionally assign gmhdbjd for approval(Please 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

ti-chi-bot[bot] avatar Sep 09 '24 04:09 ti-chi-bot[bot]

Codecov Report

:x: Patch coverage is 69.04762% with 13 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 56.4437%. Comparing base (f9c4773) to head (fbf7c0e). :warning: Report is 2537 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #55938         +/-   ##
=================================================
- Coverage   72.9463%   56.4437%   -16.5026%     
=================================================
  Files          1605       1755        +150     
  Lines        446061     632116     +186055     
=================================================
+ Hits         325385     356790      +31405     
- Misses       100628     250449     +149821     
- Partials      20048      24877       +4829     
Flag Coverage Δ
integration 32.1875% <69.0476%> (?)

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 62.8920% <ø> (+17.1106%) :arrow_up:
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Sep 09 '24 04:09 codecov[bot]

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

Test name Commit Details Required Rerun command
fast_test_tiprow fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d 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.

tiprow[bot] avatar Sep 10 '24 01:09 tiprow[bot]

PR needs rebase.

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.

ti-chi-bot[bot] avatar Oct 04 '24 07:10 ti-chi-bot[bot]

@hawkingrei: 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
idc-jenkins-ci-tidb/mysql-test fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test mysql-test
idc-jenkins-ci-tidb/check_dev fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test check-dev
idc-jenkins-ci-tidb/unit-test fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test unit-test
idc-jenkins-ci-tidb/check_dev_2 fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test check-dev2
pull-unit-test-ddlv1 fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test pull-unit-test-ddlv1
pull-integration-e2e-test fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test pull-integration-e2e-test
pull-integration-realcluster-test-next-gen fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test pull-integration-realcluster-test-next-gen
pull-unit-test-next-gen fbf7c0eeaff218be7027e33634bed0e5c1f0ef2d link true /test pull-unit-test-next-gen

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.

ti-chi-bot[bot] avatar Sep 26 '25 15:09 ti-chi-bot[bot]