-
Notifications
You must be signed in to change notification settings - Fork 489
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
Add Cloud Spanner style read only transaction #610
Add Cloud Spanner style read only transaction #610
Conversation
Codecov Report
@@ Coverage Diff @@
## master #610 +/- ##
==========================================
- Coverage 79.9% 79.84% -0.07%
==========================================
Files 32 32
Lines 12613 12631 +18
==========================================
+ Hits 10079 10085 +6
- Misses 1933 1949 +16
+ Partials 601 597 -4
Continue to review full report at Codecov.
|
| "START" "TRANSACTION" "WITH" "CONSISTENT" "SNAPSHOT" | ||
{ | ||
$$ = &ast.BeginStmt{} | ||
} | ||
| "START" "TRANSACTION" "READ" "ONLY" | ||
{ | ||
$$ = &ast.BeginStmt{ |
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.
TiDB should handle this later on, because MySQL also has "start transaction read only" and we should keep the compatibility.
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.
START TRANSACTION READ ONLY
is parsed separately which doesn't specify any Bound therefore can have different execution plan on TiDB.
In addition it would have the same semantic as START TRANSACTION READ ONLY WITH TIMESTAMP BOUND STRONG
. Therefore we can add them together in this PR.
{"START TRANSACTION READ ONLY", true, "START TRANSACTION READ ONLY"}, | ||
{"START TRANSACTION READ ONLY WITH TIMESTAMP BOUND", false, ""}, | ||
{"START TRANSACTION READ ONLY WITH TIMESTAMP BOUND STRONG", true, "START TRANSACTION READ ONLY WITH TIMESTAMP BOUND STRONG"}, | ||
{"START TRANSACTION READ ONLY WITH TIMESTAMP BOUND MAX STALENESS '00:00:10'", true, "START TRANSACTION READ ONLY WITH TIMESTAMP BOUND MAX STALENESS '00:00:10'"}, |
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 SQL a valid one?
START TRANSACTION READ ONLY WITH TIMESTAMP BOUND MAX STALENESS 1 + 1
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.
STALENESS
should take an expression that can be evaluated or converted to TIME
.
TIMESTAMP
would take an expression that can be evaluated or converted to DATETIME
or TIMESTAMP
on the other hand.
Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>
LGTM |
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.
Rest LGTM
…_spanner_style_read_only_transaction Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>
…_spanner_style_read_only_transaction Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>
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.
LGTM
* Add Cloud Spanner style read only transaction * Put non keywords to the right place Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>
* Add Cloud Spanner style read only transaction * Put non keywords to the right place Signed-off-by: Xiaoguang Sun <sunxiaoguang@zhihu.com>
What is changed and how it works?
Add extra syntax for Cloud Spanner style read only transaction
Tests
parser_test.go was modified to include tests for new syntax
Code changes
No
Yes
No