-
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
executor: implement set transaction read only as of transaction #24766
executor: implement set transaction read only as of transaction #24766
Conversation
Signed-off-by: yisaer <[email protected]>
/cc @xhebox |
executor/stale_txn_test.go
Outdated
|
||
func (s *testStaleTxnSerialSuite) TestSetTransactionReadOnlyAsOf(c *C) { | ||
tk := testkit.NewTestKit(c, s.store) | ||
tk.MustExec(`SET TRANSACTION READ ONLY as of timestamp '2021-04-21 00:42:12'`) |
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.
Should support expression? our bound read is a function call.
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 is already supported, the testcase updated.
Signed-off-by: yisaer <[email protected]>
/lgtm |
@xhebox: Thanks for your review. The bot only counts In 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. |
…action_read_only_as_of
97b2c43
to
7f7643f
Compare
/label sig/sql-infra |
@Yisaer: The label(s) In 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. |
/sig sql-infra |
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.
The rest LGTM.
sessionctx/variable/varsutil.go
Outdated
s.TxnReadTS = GoTimeToTS(t1) | ||
return err | ||
} | ||
|
||
// GoTimeToTS converts a Go time to uint64 timestamp. | ||
func GoTimeToTS(t time.Time) uint64 { |
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 this function is duplicated with oracle.GoTimeToTS
, maybe we should remove it and use the latter.
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.
updated.
Signed-off-by: yisaer <[email protected]> fix test Signed-off-by: yisaer <[email protected]>
b320672
to
8e32482
Compare
/lgtm |
executor/simple.go
Outdated
e.ctx.GetSessionVars().SetInTxn(true) | ||
return 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 do you set it and return? To walk around s.ReadOnly
part?
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.
updated.
@@ -825,6 +825,13 @@ var defaultSysVars = []*SysVar{ | |||
}, GetSession: func(s *SessionVars) (string, error) { | |||
return s.TxnScope.GetVarValue(), nil | |||
}}, | |||
{Scope: ScopeSession, Name: TiDBTxnReadTS, Value: "", SetSession: func(s *SessionVars, val string) error { |
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 this sysvar exposed to users?
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 it is ok to exposed it.
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.
The problem is, users may also use this variable to set read ts.
54308ce
to
8085f85
Compare
Signed-off-by: yisaer <[email protected]> address the comment Signed-off-by: yisaer <[email protected]> address the comment Signed-off-by: yisaer <[email protected]>
8085f85
to
ce2df75
Compare
…action_read_only_as_of
Signed-off-by: yisaer <[email protected]> address the comment Signed-off-by: yisaer <[email protected]>
2cb8e67
to
6c938a7
Compare
/lgtm |
[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 writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 6c938a7
|
Signed-off-by: yisaer <[email protected]>
e2b4d41
to
3c465d0
Compare
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 3c465d0
|
@Yisaer: 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. |
Signed-off-by: yisaer [email protected]
What problem does this PR solve?
Issue Number: ref #21094
What is changed and how it works?
Implement
Set Transaction read only as of .....
statement.Check List
Tests
Release note