fix: clean role privileges when dropping objects - #27745
Draft
ck89119 wants to merge 22 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #27723
What this PR does / why we need it:
GRANTand persistent object replacement/deletion through database-before-relation catalog locks.ALTER VIEW; includeALTER VIEWin lifecycle admission.mo_tablescatalog row for source-relation DROP while skipping only the unavailable source storage lock.EXECUTEbefore transaction admission and use the prepared statement's binding database when classifying unqualified temporary-table aliases.CREATE OR REPLACE VIEW,ALTER VIEW, andDROP SEQUENCEin the persistent lifecycle protocol.DROP TABLEtargets against session temporary aliases before admission, so temp-only drops remain valid in existing optimistic transactions while mixed/persistent drops use the catalog protocol.Validation:
TestIssue26087ConcurrentDataBranchQuotapassed.DROP TABLE tbound in d1 was rejected despite an execute-time d2 temporary alias; d1.t remained.mo_role_privsrows.clone_subscription.sql: 106/106 passed after separating clone owner mode from snapshot-operator selection.pkg/frontendandpkg/sql/compilepackage runs passed;go vet ./pkg/frontend ./pkg/sql/compilepassed.golangci-lint 2.6.2 -c .golangci.yml ./pkg/frontend ./pkg/sql/compile— 0 issues.Additional review closures
TxnHandler.Createwhen storage initialization or validity checking fails; admission rejection still preserves a pre-existing transaction.ALTER SEQUENCE, skip replacement-only DROP cleanup, and admit ALTER through the pessimistic-RC lifecycle protocol.__mo_index_relations before catalog lookup/mutation, preventing internal index tables from becoming user authorization objects.Additional validation:
Binary admission and legacy-index follow-up
PrepareStmt.defaultDatabasein the binary COM_STMT_EXECUTE input beforedoComQuery, so transaction admission sees the correct PREPARE-time binding even though binary execution supplies the inner AST.Validation: