domain: make the transaction from `initStatsCtx` blocking gc (#53602)
This is an automated cherry-pick of #53602
What problem does this PR solve?
Issue Number: close #53592
Problem Summary:
The initStatsCtx is not get from internal session pool, so it's not tracked by min start ts service, thus gc lifetime can overtake it easily.
What changed and how does it work?
Insert it into tracked session table and it will block gc.
Check List
Tests
- [ ] Unit test
- [ ] Integration test
- [x] Manual test (add detailed scripts or steps below)
- [ ] No need to test
- [ ] I checked and no code files have been changed.
I reproduce the test mentioned in issue, the stats are loaded successfully after 30min.
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.
fix a bug that tidb will report gc lifetime too short when tidb bootstrap with slow loading statistics
/retest
@hawkingrei @lance6716 PTAL
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.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: hawkingrei, lance6716
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [hawkingrei,lance6716]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
[LGTM Timeline notifier]
Timeline:
2024-05-31 05:13:36.066388469 +0000 UTC m=+3012569.823524043: :ballot_box_with_check: agreed by hawkingrei.2024-11-07 01:50:46.955297115 +0000 UTC m=+1092159.794452663: :ballot_box_with_check: agreed by lance6716.
/retest
/retest
/retest
/retest
/retest
/retest
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Please upload report for BASE (
release-7.1@ec98fc7). Learn more about missing BASE report.
Additional details and impacted files
@@ Coverage Diff @@
## release-7.1 #53637 +/- ##
================================================
Coverage ? 73.4747%
================================================
Files ? 1212
Lines ? 381026
Branches ? 0
================================================
Hits ? 279958
Misses ? 83193
Partials ? 17875