-
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
planner: recalculate as-of ts of staleread when plan is cached #43204
Conversation
[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 submitting an approval review. |
/retest |
@@ -179,7 +182,7 @@ func (p *staleReadProcessor) OnSelectTable(tn *ast.TableName) error { | |||
} | |||
return nil | |||
} | |||
return p.evaluateFromStmtTSOrSysVariable(stmtAsOfTS) | |||
return p.evaluateFromStmtTSOrSysVariable(stmtAsOfTS, evaluateTS) |
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.
What's the difference between OnExecutePreparedStmt
and OnSelectTable
, why do we need to calculate the TS
in two places? Is it possible to merge them into one?
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.
Here we set the ts evaluator which needs to be calculated to staleness processor when preparing, and it'll be returned and set to plan cache.
When invoking OnExecutePreparedStmt
, it only uses the ts evaluator from plan cache, so it's not necessary to set a evaluator that requires calculation to get a timestamp.
@@ -201,7 +204,7 @@ func (p *staleReadProcessor) OnExecutePreparedStmt(preparedTSEvaluator Staleness | |||
return err | |||
} | |||
} | |||
return p.evaluateFromStmtTSOrSysVariable(stmtTS) | |||
return p.evaluateFromStmtTSOrSysVariable(stmtTS, 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.
We could add some comments about the above logic.
2d2f46f
to
98dd779
Compare
Signed-off-by: you06 <you1474600@gmail.com> lint Signed-off-by: you06 <you1474600@gmail.com> add more test cases Signed-off-by: you06 <you1474600@gmail.com> add comment Signed-off-by: you06 <you1474600@gmail.com> add comment Signed-off-by: you06 <you1474600@gmail.com>
98dd779
to
d19bd5a
Compare
Signed-off-by: you06 <you1474600@gmail.com>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 12458ad
|
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #43044
Problem Summary:
What is changed and how it works?
Recalculate the snapshot ts for staleread when it's provided by as of statement.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.