-
Notifications
You must be signed in to change notification settings - Fork 6.1k
executor: prevent SELECT AS OF TIMESTAMP with autocommit = 0 #65978
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
base: master
Are you sure you want to change the base?
executor: prevent SELECT AS OF TIMESTAMP with autocommit = 0 #65978
Conversation
Issue Number: close pingcap#65957 According to Stale Read Product Design, SELECT ... AS OF TIMESTAMP should only be used in implicit transactions with autocommit = 1. This commit adds validation to prevent AS OF TIMESTAMP from being used when autocommit = 0, returning an appropriate error message. Changes: - Add hasAsOfClauseInResultSet() helper to recursively check for AS OF clauses - Add hasAsOfClauseInSetOpr() helper to check set operations - Add validation in ResetContextOfStmt() for SelectStmt and SetOprStmt - Return ErrWrongUsage when AS OF TIMESTAMP is used with autocommit = 0 Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=Angel98518
|
[FORMAT CHECKER NOTIFICATION] Notice: To remove the For example:
📖 For more info, you can check the "Contribute Code" section in the development guide. |
|
Hi @Angel98518. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Welcome @Angel98518! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Angel98518. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
@Angel98518: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@Angel98518: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
This PR is earlier, please wait for it. |
What problem does this PR solve?
Issue Number: close #65957
According to the description in Stale Read Product Design,
SELECT ... AS OF TIMESTAMPshould only be used in implicit transactions with autocommit = 1. However, we can still successfully execute theSELECT ... AS OF TIMESTAMPstatement even withautocommit = 0.What changed and how does it work?
This PR adds validation to prevent
SELECT ... AS OF TIMESTAMPfrom being used whenautocommit = 0. The validation:Changes:
hasAsOfClauseInResultSet()helper to recursively check for AS OF clauses in ResultSetNodehasAsOfClauseInSetOpr()helper to check set operations (UNION, etc.)ResetContextOfStmt()for bothSelectStmtandSetOprStmtErrWrongUsagewhen AS OF TIMESTAMP is used with autocommit = 0Check List
Tests
Side effects
Documentation
Release note
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=Angel98518