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

domain,server,session: optimize gc safepoint advancing for internal transaction #32726

Merged
merged 38 commits into from Apr 7, 2022

Conversation

TonsnakeLin
Copy link
Contributor

@TonsnakeLin TonsnakeLin commented Mar 2, 2022

Signed-off-by: TonsnakeLin lpbgytong@163.com

What problem does this PR solve?

TiDB advances gc safepoint every tidb_gc_run_interval time with step tidb_gc_life_time. If there is a long time transaction from user client lives more than tidb_gc_life_time, the safpoint can't be advanced until the long transaction is finished or lives than 24h. This mechanism ensures the continuous advancement of gc safepoint and ensures that the data that active transactions need to access will not be cleared.
However, Internal transactions run in TiDB don't comply with the mechanism above. If the internal transaction lives more than tidb_gc_life_time, maybe failed because the data it needs to access was cleared. This PR is used to solve the problem that internal transactions run in TiDB may be executed failed because the accessed data was cleared.

Issue Number: close #32725

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

image

image

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 2, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • sticnarf
  • youjiali1995

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 2, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Mar 2, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@sre-bot
Copy link
Contributor

sre-bot commented Mar 2, 2022

@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 2, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Mar 2, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@TonsnakeLin TonsnakeLin changed the title optimize gc safepoint advancing for internal transaction domain,server,session: optimize gc safepoint advancing for internal transaction Mar 2, 2022
@TonsnakeLin
Copy link
Contributor Author

/run-check_title

@TonsnakeLin TonsnakeLin requested a review from a team as a code owner March 3, 2022 08:29
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 7, 2022
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 8, 2022
@TonsnakeLin
Copy link
Contributor Author

/run-check_dev

@TonsnakeLin
Copy link
Contributor Author

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 21, 2022
@TonsnakeLin
Copy link
Contributor Author

@cfzjywxk @MyonKeminta @youjiali1995 @sticnarf @you06

sessionctx/variable/sysvar.go Outdated Show resolved Hide resolved
sessionctx/variable/sysvar.go Outdated Show resolved Hide resolved
sessionctx/variable/tidb_vars.go Outdated Show resolved Hide resolved
sessionctx/variable/varsutil.go Outdated Show resolved Hide resolved
sessionctx/variable/varsutil.go Outdated Show resolved Hide resolved
sessionctx/variable/varsutil.go Outdated Show resolved Hide resolved
kv/txn.go Outdated Show resolved Hide resolved
kv/txn.go Outdated Show resolved Hide resolved
util/processinfo.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 25, 2022
kv/txn.go Outdated Show resolved Hide resolved
domain/infosync/info.go Outdated Show resolved Hide resolved
kv/txn.go Outdated Show resolved Hide resolved
kv/txn.go Outdated Show resolved Hide resolved
kv/txn.go Outdated Show resolved Hide resolved
kv/txn.go Outdated Show resolved Hide resolved
TonsnakeLin and others added 5 commits April 7, 2022 09:35
Co-authored-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: TonsnakeLin <lpbgytong@163.com>
Co-authored-by: Lei Zhao <zlwgx1023@gmail.com>
2.rwmutex to mutext

Signed-off-by: TonsnakeLin <lpbgytong@163.com>
Signed-off-by: TonsnakeLin <lpbgytong@163.com>
Signed-off-by: TonsnakeLin <lpbgytong@163.com>
Copy link
Contributor

@sticnarf sticnarf left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 7, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 7, 2022
@youjiali1995
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 539fe82

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 7, 2022
@cfzjywxk
Copy link
Contributor

cfzjywxk commented Apr 7, 2022

/merge

@cfzjywxk
Copy link
Contributor

cfzjywxk commented Apr 7, 2022

/run-unit-test

@ti-chi-bot
Copy link
Member

@TonsnakeLin: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize gc safepoint advancing for internal transaction
7 participants