Skip to content

Replace the WITH Staleness to AS OF clause #24291

@nolouch

Description

@nolouch

Background

This is a subtask of #21094. Ref #22765, #22506

pingcap/parser#1206 has implemented the syntax of AS OF clause, so we can replace begin a staleness read-only transaction with AS OF clause, which like:

START TRANSACTION READ ONLY AS OF TIMESTAMP '2020-02-02'

Note: The AS OF TIMESTAMP clause can be used only when the transaction is read-only. If the transaction contains any writes, or if the READ WRITE mode is specified, an error will be returned.

Implementation

Now that BeginStmt is marked with ReadOnly, we need to add AsOfClause in the statement. and then replace the origin process logic in #21897. and also we may need to implement the funcCallExpr, because we should judge the read_ts_in(xxxx,xxx). and should be noted the function is deterministic function.

  • add the syntax in the BeginStmt
  • replace the with staleness to AS OF cluase

Metadata

Metadata

Assignees

Labels

type/enhancementThe issue or PR belongs to an enhancement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions