fix: support ACCOUNT clause in RESTORE ... FROM PITR - #24591
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
|
7889457 to
dd00ace
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed multi-angle: parser/AST support for scoped RESTORE ACCOUNT ... DATABASE/TABLE ... FROM PITR is wired correctly, doRestorePitr now treats explicit ACCOUNT as cross-account only at account-restore level, and scoped PITR restore only allows explicit ACCOUNT when it matches the current tenant, which keeps the behavior aligned with snapshot semantics. The added parser/frontend/distributed coverage matches the change.
Summary
Closes #24545.
This PR fixes the grammar inconsistency between
RESTORE ... FROM SNAPSHOTandRESTORE ... FROM PITR.Previously,
RESTORE ACCOUNT <tenant> DATABASE ... TABLE ... FROM SNAPSHOT ...was accepted, but the equivalentFROM PITRforms failed in the parser. This change adds support for theACCOUNTclause in scoped PITR restore statements and keeps the restore privilege checks aligned with the existing snapshot behavior.What changed
RESTORE ACCOUNT <acc> DATABASE <db> FROM PITR ...RESTORE ACCOUNT <acc> DATABASE <db> TABLE <tbl> FROM PITR ...ACCOUNTas cross-account restore at the account restore levelACCOUNTwhen it matches the current tenantTesting
go test ./pkg/sql/parsers/dialect/mysql -run 'TestValid|TestPitrInternal' -count=1test/distributed/cases/pitr/pitr_restore_account_clause.sqlNotes
pkg/frontendtargeted tests were not runnable in this environment because unrelated native dependencies failed to build (for exampleusearch.hwas missing)mo-testersetup