-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
txn: fix retried transactions' statements is not inclueded in TIDB_TRX #28480
Conversation
[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. Reviewer can indicate their review by submitting an approval review. |
81ed1e7
to
c2c9e33
Compare
/cc @MyonKeminta @cfzjywxk |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: cceb7a1
|
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.2 in PR #28670 |
@longfangsong Does 5.1 branch need this? |
Yes, we should cherry-pick this to 5.1 if possible. However, it seems there are no 5.1 bug triage plan here |
/label needs-cherry-pick-5.1 |
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-5.1 in PR #28716 |
I just notice that it looks that the |
What problem does this PR solve?
Problem Summary:
Currently the retried transactions' statements won't be inclueded in TIDB_TRX.
The reason is:
If we meet an retryable error here:
tidb/session/session.go
Line 701 in 091ae3b
note the origin datasource of TIDB_TRX for this transaction is resetted here inside
doCommit
:tidb/session/session.go
Line 489 in 091ae3b
(and will be resetted again here if retry more than once):
tidb/session/session.go
Line 972 in 091ae3b
But during retrying, we use
st.Exec
(which may restart the transaction withsession.Txn
) instead ofsession.ExecStament
, andst.Exec
will not record statements.tidb/session/session.go
Line 929 in 091ae3b
What is changed and how it works?
What's Changed:
Collect them during retry.
Check List
Tests
Side effects
Documentation
Release note