-
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
session: if txn invalid do not active it and return an error #13935
Conversation
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
/run-all-tests |
Codecov Report
@@ Coverage Diff @@
## master #13935 +/- ##
===========================================
Coverage 80.3329% 80.3329%
===========================================
Files 480 480
Lines 121035 121035
===========================================
Hits 97231 97231
Misses 16086 16086
Partials 7718 7718 |
/run-all-tests |
@@ -82,7 +82,7 @@ func (e *BatchPointGetExec) initialize(ctx context.Context) error { | |||
return err | |||
} | |||
|
|||
txn, err := e.ctx.Txn(true) | |||
txn, err := e.ctx.Txn(false) |
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.
Do we need to check all these Txn(true)
usages, seems many
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've checked all of them. In another way, if Txn(true)
, it prefers to return an error when txn is invalid, but all the tests passed.
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
LGTM |
PTAL @cfzjywxk @lysu @tiancaiamao |
LGTM |
1 similar comment
LGTM |
/run-all-tests |
cherry pick to release-3.0 failed |
…#13935) Conflicts: executor/batch_point_get.go executor/point_get.go
What problem does this PR solve?
If txn invalid, it is better to do not active it and return an error.
What is changed and how it works?
We should obey some rules,
if session.Txn(true), the txn should always be valid otherwise return an error for it.
if session.Txn(false), maybe we do not need to active the txn or it is close due to the lazy execute select statement, we should always check the txn is valid or not.
Check List
Tests
Code changes
Related changes