-
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: remove NewTxn and NewStaleTxnWithStartTS in session #35885
Conversation
Signed-off-by: SpadeA-Tang <[email protected]>
[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. |
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
@SpadeA-Tang: 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/test-infra repository. |
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/11c1d2c9468824b1fd3f7eca4682535676475e8e |
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
func (s *session) GetPreparedTxnFuture() sessionctx.TxnFuture { | ||
if !s.txn.validOrPending() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this? I think it is reasonable if a txn is not prepared the TxnFuture
should return a nil value.
sessiontxn/isolation/base.go
Outdated
if err := sessiontxn.CheckBeforeNewTxn(p.ctx, p.sctx); err != nil { | ||
return err | ||
} | ||
if err := p.prepareTxnNotConsiderSnapshotTS(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok if we call p.prepareTxn(false)
here ?
sessiontxn/staleread/provider.go
Outdated
txnCtx.InfoSchema = p.is | ||
return nil | ||
txnFuture := p.sctx.GetPreparedTxnFuture() | ||
if txnFuture == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts is prepared in line 97. I think we can guarantee txnFuture is not nil here. Maybe this line is not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's unnecessary.
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
Signed-off-by: SpadeA-Tang <[email protected]>
util/mock/context.go
Outdated
@@ -61,9 +61,16 @@ type Context struct { | |||
|
|||
type wrapTxn struct { | |||
kv.Transaction | |||
prepared bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we store the oracle.Future
here instead prepared
such that we can get a "real" transaction when call Wait
.
Signed-off-by: SpadeA-Tang <[email protected]>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: fd9fc8a
|
Signed-off-by: SpadeA-Tang <[email protected]>
/run-mysql-test |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 7fea97c
|
TiDB MergeCI notify🔴 Bad News! New failing [1] after this pr merged.
|
Signed-off-by: SpadeA-Tang [email protected]
What problem does this PR solve?
Issue Number: close #35884
Problem Summary:
What is changed and how it works?
Remove the
NewTxn
andNewStaleTxnWithStartTS
in session and let the transaction context provider to make the creation of new transaction.The mode of creation a new transaction now is: prepareTxn/prepareTxnWithOracleTS + activation.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.