-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: txnManager providers GetReadSnapshot and GetForUpdateSnapshot. #35788
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. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/38cc80ad149db24e5f4d597823cbd26080b89541 |
executor/adapter.go
Outdated
@@ -254,7 +254,7 @@ func (a *ExecStmt) PointGet(ctx context.Context, is infoschema.InfoSchema) (*rec | |||
} else { | |||
// CachedPlan type is already checked in last step | |||
pointGetPlan := a.PsStmt.PreparedAst.CachedPlan.(*plannercore.PointGetPlan) | |||
exec.Init(pointGetPlan, startTs) | |||
exec.Init(pointGetPlan, startTs, 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.
Why pass a nil snapshot?
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.
It does not have snapshot originally here.
executor/batch_point_get.go
Outdated
snapshot.SetOption(kv.TaskID, stmtCtx.TaskID) | ||
snapshot.SetOption(kv.ReadReplicaScope, e.readReplicaScope) | ||
snapshot.SetOption(kv.IsStalenessReadOnly, e.isStaleness) | ||
e.snapshot.SetOption(kv.TaskID, stmtCtx.TaskID) |
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.
I think kv.TaskID
, kv. ReplicaRead
and kv.IsStalenessReadOnly
can be set in provider. And kv.IsStalenessReadOnly
should and should only be set in StalenessProvider
.
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, I will refactor it.
Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
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.
Overall LGTM
Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: ffb32d9
|
/run-mysql-test |
TiDB MergeCI notify
|
What problem does this PR solve?
Issue Number: close #35810
Problem Summary:
What is changed and how it works?
Now, the acquisition of snapshot is not managed by transaction manager and is usually done by first fetching appropriate tso and then use that tso to acquire snapshot.
This PR adds new method for
TxnManager
to transfer the management of snapshot acquisition toTxnManager
which shields the tricy optimization when acquiring snapshot:Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.