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" "READ" "ONLY" | ||
| { | ||
| $$ = &ast.BeginStmt{ |
There was a problem hiding this comment.
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.
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.
Is this SQL a valid one?
START TRANSACTION READ ONLY WITH TIMESTAMP BOUND MAX STALENESS 1 + 1
There was a problem hiding this comment.
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 |
…_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>
* 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