*: stale reads compatible with prepare (#25156)#25371
Conversation
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
|
/run-all-tests |
|
@xhebox you're already a collaborator in bot's repo. |
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
|
/run-all-tests |
|
/run-integration-common-test |
|
@nolouch: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. DetailsIn response to this:
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. |
|
/merge |
|
@Yisaer: DetailsIn response to this:
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. |
|
@Yisaer needs one more approval. |
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
|
/merge |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: e4770f2 |
|
/run-check_dev |
|
/merge |
|
@ti-srebot: 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. DetailsInstructions 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. |
|
/run-check_dev |
1 similar comment
|
/run-check_dev |
cherry-pick #25156 to release-5.1
You can switch your code base to this Pull Request by using git-extras:
# In tidb repo: git pr https://github.com/pingcap/tidb/pull/25371After apply modifications, you can push your change to this PR via:
What problem does this PR solve?
Issue Number: close #24932
Problem Summary: Prepare is now compatible with stale reads.
What is changed and how it works?
What's Changed:
snapshotTS != 0is used to indicate that it is a stale read.CachedPrepareStmthas a new fieldSnapshotTSto store the result of preprocessing inPrepareExec.newExecutorBuilderhas a new parameter,snapshotTS. It is passed fromsession.ExecutePreparedStmt, alongcachedPlanExecorCompileExecutePreparedStmt. The one in session comes fromCachedPrepareStmt.IsCachedExecOkandOptimizePreparedPlan, ifsnapshotTS != 0.plannercore.Executeplan has a new fieldSnapshotTSto store the timestamp fromCachedPrepareStmt.executorExec.buildExecutewill assignsnapshotTSfromplannercore.Executeplan toexecutorBuilder.1-3 covered the prepared execution directly from session/mysql-protocol, and 4-5 covered the execution from plain SQL.
NEW CHANGES: to support dynamic timestamp like
NOW() - INTERVAL 1 SECOND:CachedPrepareStmtdo not store infoschema anymore. You need to recheck infoschema before execute to ensure consistency anyway.As Ofstatements evaluation is stored/prepared as a closure to support dynamic re-evaluation. For non-prepare statements, they can useLastSnapshotTSto avoid re-evaluation.Check List
Tests
Release note