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

*: GC old infoschema version in the btree nodes #58390

Merged
merged 6 commits into from
Dec 24, 2024

Conversation

tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Dec 18, 2024

What problem does this PR solve?

Issue Number: ref #58321

Problem Summary:

What changed and how does it work?

If the user create table , drop table, create table , drop table ...
Or add and drop index or column, or just truncate table many many times...
Or even the simple create table, the intermediate version for DDL small steps...

There would be a not of historial schema version in the infoschema v2 btree.
We can GC those historial schema version.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Run a 'add add column / drop column ' workload, watch the tidb log:

grep 'GC compact old' /home/genius/.tiup/data/zzz/tidb-0/tidb.log |less

[2024/12/18 19:46:15.125 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=70] [deleted=0]
[2024/12/18 19:46:17.133 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=70] [deleted=0]
[2024/12/18 19:46:19.133 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=70] [deleted=0]
[2024/12/18 19:46:23.218 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=70] [deleted=0]
[2024/12/18 19:46:27.310 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=22839] [deleted=22823]
[2024/12/18 19:46:29.291 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=22839] [deleted=0]
[2024/12/18 19:46:31.215 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=22839] [deleted=0]
[2024/12/18 19:46:33.143 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=22839] [deleted=0]
...
[2024/12/18 20:01:24.719 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=22839] [deleted=0]
[2024/12/18 20:01:26.775 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=42334] [deleted=19495]
[2024/12/18 20:01:28.775 +08:00] [INFO] [cache.go:401] ["GC compact old schema version"] [version=42334] [deleted=0]

The GC runs 20min a time, and in this case there are a lot MVCC data each deletion.

  • 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 Dec 18, 2024
Copy link

tiprow bot commented Dec 18, 2024

Hi @tiancaiamao. 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-sigs/prow repository.

@tiancaiamao
Copy link
Contributor Author

tiancaiamao commented Dec 18, 2024

Make the log more reasonable:

[2024/12/18 21:22:54.429 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=175547] ["oldest version"=98527] [deleted=0] [takes=1.814835ms]
[2024/12/18 21:22:58.650 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=175676] ["oldest version"=98527] [deleted=0] [takes=1.617596ms]
[2024/12/18 21:23:06.835 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=175934] ["oldest version"=132973] [deleted=64] [takes=2.018252ms]
[2024/12/18 21:23:10.728 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=176063] ["oldest version"=132973] [deleted=0] [takes=1.798532ms]
...
[2024/12/18 21:28:16.059 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=185996] ["oldest version"=157790] [deleted=1025] [takes=948.643µs]
[2024/12/18 21:28:20.018 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=186125] ["oldest version"=157790] [deleted=1025] [takes=1.237869ms]
[2024/12/18 21:28:23.958 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=186254] ["oldest version"=157790] [deleted=1025] [takes=1.682899ms]
[2024/12/18 21:28:27.882 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=186383] ["oldest version"=157790] [deleted=1025] [takes=1.410113ms]
[2024/12/18 21:28:39.664 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=186770] ["oldest version"=157790] [deleted=1025] [takes=1.126656ms]
[2024/12/18 21:28:47.466 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=187028] ["oldest version"=157790] [deleted=1025] [takes=1.164026ms]
[2024/12/18 21:28:51.338 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=187157] ["oldest version"=157790] [deleted=1025] [takes=1.399202ms]
[2024/12/18 21:28:55.226 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=187286] ["oldest version"=157790] [deleted=1025] [takes=1.492452ms]
[2024/12/18 21:28:59.167 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=187415] ["oldest version"=157790] [deleted=1025] [takes=1.86831ms]
[2024/12/18 21:29:03.164 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=187544] ["oldest version"=157790] [deleted=1025] [takes=1.733568ms]
[2024/12/18 21:29:10.835 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=187802] ["oldest version"=157790] [deleted=1025] [takes=1.38586ms]
[2024/12/18 21:29:14.712 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=187931] ["oldest version"=157790] [deleted=1025] [takes=1.467281ms]
[2024/12/18 21:29:19.118 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=188060] ["oldest version"=157790] [deleted=1025] [takes=2.424672ms]
[2024/12/18 21:29:23.206 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=188189] ["oldest version"=157790] [deleted=1025] [takes=1.89863ms]
[2024/12/18 21:29:31.080 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=188447] ["oldest version"=157790] [deleted=1025] [takes=2.353789ms]
[2024/12/18 21:29:34.983 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=188576] ["oldest version"=157790] [deleted=1025] [takes=3.398791ms]
[2024/12/18 21:29:38.846 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=188705] ["oldest version"=157790] [deleted=1025] [takes=1.773697ms]
[2024/12/18 21:29:42.811 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=188834] ["oldest version"=157790] [deleted=1025] [takes=1.747976ms]
[2024/12/18 21:29:46.669 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=188963] ["oldest version"=157790] [deleted=1025] [takes=1.94771ms]
[2024/12/18 21:29:50.559 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=189092] ["oldest version"=157790] [deleted=1025] [takes=2.744175ms]
[2024/12/18 21:29:54.468 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=189221] ["oldest version"=157790] [deleted=1025] [takes=2.299326ms]
[2024/12/18 21:29:58.285 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=189350] ["oldest version"=157790] [deleted=1025] [takes=2.238904ms]
[2024/12/18 21:30:02.277 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=189479] ["oldest version"=157790] [deleted=216] [takes=1.578681ms]
[2024/12/18 21:30:06.246 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=189608] ["oldest version"=157790] [deleted=0] [takes=1.270505ms]
[2024/12/18 21:30:10.089 +08:00] [INFO] [cache.go:403] ["GC compact old schema version"] ["current version"=189737] ["oldest version"=157790] [deleted=0] [takes=1.318647ms]

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 28 lines in your changes missing coverage. Please review.

Project coverage is 74.8912%. Comparing base (e403d8f) to head (852de2d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58390        +/-   ##
================================================
+ Coverage   73.5231%   74.8912%   +1.3680%     
================================================
  Files          1681       1726        +45     
  Lines        464262     472440      +8178     
================================================
+ Hits         341340     353816     +12476     
+ Misses       102084      96351      -5733     
- Partials      20838      22273      +1435     
Flag Coverage Δ
integration 49.2147% <66.6666%> (?)
unit 72.2769% <3.5714%> (-0.0080%) ⬇️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 61.6328% <ø> (+15.8463%) ⬆️

@tiancaiamao
Copy link
Contributor Author

/test unit-test

Copy link

tiprow bot commented Dec 19, 2024

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

In response to this:

/test unit-test

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 ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 23, 2024
Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Dec 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, wjhuang2016

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 Dec 24, 2024
Copy link

ti-chi-bot bot commented Dec 24, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-23 08:17:18.109818704 +0000 UTC m=+1463228.198621250: ☑️ agreed by wjhuang2016.
  • 2024-12-24 07:17:27.530349947 +0000 UTC m=+1546037.619152490: ☑️ agreed by GMHDBJD.

Copy link

tiprow bot commented Dec 24, 2024

@tiancaiamao: 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 3f63507 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.

@ti-chi-bot ti-chi-bot bot merged commit 6806af4 into pingcap:master Dec 24, 2024
25 checks passed
@tiancaiamao tiancaiamao deleted the gc-infoschema branch December 24, 2024 14:38
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.

3 participants