feat(tables): gate RTAS per-table behind 'replace.enabled' table property#2
Closed
jiang95-dev wants to merge 2 commits into
Closed
feat(tables): gate RTAS per-table behind 'replace.enabled' table property#2jiang95-dev wants to merge 2 commits into
jiang95-dev wants to merge 2 commits into
Conversation
…erty Add a per-table flag that gates the RTAS (Replace Table As Select) command. RTAS is now blocked by default and is only allowed when the table has the regular table property 'replace.enabled' set to true. The gate is enforced in TablesServiceImpl (stageReplace) and IcebergSnapshotsServiceImpl (replaceCommit) via AuthorizationUtils.checkReplaceTableEnabled, which reads the table's persisted properties (so it cannot be bypassed by the incoming request body) and returns HTTP 400 when RTAS is disabled. Updated existing replace tests to opt in, added a negative test, and opted in the Spark/app RTAS integration tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add RTASTest.testRTASFailsWhenReplaceDisabled which creates a table without opting into RTAS and asserts that REPLACE TABLE ... AS SELECT is rejected with a BadRequestException carrying the "Replace (RTAS) is not enabled" message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
|
Superseded by linkedin#640 (published upstream). |
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.
Summary
Add a per-table flag that gates the RTAS (Replace Table As Select) command. RTAS is now blocked by default and is only permitted when the table has the regular table property
replace.enabledset totrue. The gate reads the table's persisted properties (not the incoming request body), so it cannot be bypassed by the same request that performs the replace, and it is independent of the existing creator-only replace check.Changes
Details:
replace.enabled(default absent/false⇒ RTAS blocked). ConstantAuthorizationUtils.RTAS_ENABLED_TABLE_PROP.AuthorizationUtils.checkReplaceTableEnabled(TableDto)throwsUnsupportedClientOperationException(RTAS_ON_DISABLED_TABLE)(HTTP 400) when the property is nottrue. Called from:TablesServiceImpl.putTableon thestageReplacepath.IcebergSnapshotsServiceImpl.putIcebergSnapshotson thereplaceCommitpath.RTAS_ON_DISABLED_TABLEtoUnsupportedClientOperationException.Operation.ALTER TABLE db.t SET TBLPROPERTIES ('replace.enabled'='true')).Testing Done
For all the boxes checked:
services/tablesunit/e2e tests run and pass locally (:services:tables:testforTablesControllerTest,SnapshotsControllerTest,PoliciesSpecMapperTest,TableDtoMappingTest).TablesControllerTest.testStagedReplaceFailsWhenRtasDisabled(asserts 400 + message whenreplace.enabledis not set).testStagedReplaceandtestPutSnapshotsReplaceCommitto opt in via the property.RTASTest(4 cases),RTASJavaTest(2 cases),OperationsTestRTAS case.Additional Information
Existing tables that relied on RTAS will be blocked until
replace.enabled=trueis set on them. This is the intended opt-in default for gating the destructive replace operation.