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 global count and modify_count only if partition is not locked #47319

Merged
merged 8 commits into from
Sep 28, 2023

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Sep 27, 2023

What problem does this PR solve?

Issue Number: ref #46351

close #47335

Problem Summary:

What is changed and how it works?

  • Update global count and modify_count only if the partition is not locked.
  • Do not allow to use of unlock stats t to unlock the partition.
  • Added more tests.
  • Changed it to use zap.Any() to print log.
  • Made sure we can have negative deltas in lock info
[2023/09/27 16:28:31.742 +08:00] [INFO] [lock_stats.go:86] ["lock table"] [category=stats] [tables="{\"102\":{\"PartitionInfo\":null,\"FullName\":\"test.t\"},\"104\":{\"PartitionInfo\":null,\"FullName\":\"test.t1\"}}"]

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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 27, 2023
@tiprow
Copy link

tiprow bot commented Sep 27, 2023

Hi @hi-rustin. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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/test-infra repository.

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #47319 (1413ad7) into master (e7abbca) will increase coverage by 0.4208%.
Report is 4 commits behind head on master.
The diff coverage is 86.9565%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #47319        +/-   ##
================================================
+ Coverage   72.3510%   72.7718%   +0.4207%     
================================================
  Files          1352       1373        +21     
  Lines        400815     407406      +6591     
================================================
+ Hits         289994     296477      +6483     
- Misses        91660      92172       +512     
+ Partials      19161      18757       -404     
Flag Coverage Δ
integration 38.5796% <46.7391%> (?)
unit 72.3803% <86.9565%> (+0.0293%) ⬆️

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

Components Coverage Δ
dumpling 53.9913% <ø> (ø)
parser 84.7651% <ø> (ø)
br 48.7691% <ø> (-4.3308%) ⬇️

@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 Sep 27, 2023
statistics/handle/update.go Outdated Show resolved Hide resolved
statistics/handle/lockstats/lock_stats.go Outdated Show resolved Hide resolved
@Rustin170506
Copy link
Member Author

/retest

@tiprow
Copy link

tiprow bot commented Sep 27, 2023

@hi-rustin: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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/test-infra repository.

@Rustin170506
Copy link
Member Author

/hold

@ti-chi-bot ti-chi-bot bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 27, 2023
@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 Sep 27, 2023
@Rustin170506
Copy link
Member Author

/retest

@tiprow
Copy link

tiprow bot commented Sep 28, 2023

@hi-rustin: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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/test-infra repository.

@Rustin170506
Copy link
Member Author

/retest

… not locked

statistics: fix order

statistics: add more tests

statistics: fix test

statistics: fix test

statistics: add more tests

statistics: better code

statistics: fix wrong condition

statistics: update comment
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 28, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 28, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-27 08:59:21.970521588 +0000 UTC m=+5959.557631717: ☑️ agreed by qw4990.
  • 2023-09-28 07:56:46.842668101 +0000 UTC m=+88604.429778243: ☑️ agreed by time-and-fate.

@Rustin170506
Copy link
Member Author

/retest

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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 the approved label Sep 28, 2023
@Rustin170506
Copy link
Member Author

/retest

1 similar comment
@Rustin170506
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 05b9786 into pingcap:master Sep 28, 2023
14 of 16 checks passed
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Sep 28, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@Rustin170506 Rustin170506 deleted the rustin-patch-count branch September 28, 2023 09:44
ti-chi-bot bot pushed a commit that referenced this pull request Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved component/statistics lgtm needs-cherry-pick-release-7.4 release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot correctly update count and modify_count when locking a table that has locked partitions
5 participants