Skip to content

Gate RTAS with 'replace.enabled' table property#640

Merged
jiang95-dev merged 3 commits into
linkedin:mainfrom
jiang95-dev:lejiang/gate-rtas
Jun 29, 2026
Merged

Gate RTAS with 'replace.enabled' table property#640
jiang95-dev merged 3 commits into
linkedin:mainfrom
jiang95-dev:lejiang/gate-rtas

Conversation

@jiang95-dev

@jiang95-dev jiang95-dev commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a per-table flag that gates the RTAS command. RTAS is now blocked by default and is only permitted when the table has the regular table property replace.enabled set to true. The purpose is to disallow it in prod but allow it in testing until the feature is fully-fledged. The gate is set up in repo layer to check the table property when it sees the stagedReplace or replaceCommit flag. We also disallow RTAS when WAP or replication is enabled.

Changes

  • Client-facing API Changes
  • Internal API Changes
  • Bug Fixes
  • New Features
  • Performance Improvements
  • Code Style
  • Refactoring
  • Documentation
  • Tests

Testing Done

  • Manually Tested on local docker setup. Please include commands ran, and their output.
  • Added new tests for the changes made.
  • Updated existing tests to reflect the changes made.
  • No tests added or updated. Please explain why. If unsure, please feel free to ask for help.
  • Some other form of testing like staging or soak time in production. Please explain.

Additional Information

  • Breaking Changes
  • Deprecations
  • Large PR broken into smaller PRs, and PR plan linked in the description.

@jiang95-dev jiang95-dev changed the title feat(tables): gate RTAS per-table behind 'replace.enabled' table property Gate RTAS with 'replace.enabled' table property Jun 24, 2026
mkuchenbecker
mkuchenbecker previously approved these changes Jun 25, 2026

@mkuchenbecker mkuchenbecker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you try to enable this table property we need a follow up to check if WAP or replication are enabled.

@mkuchenbecker

Copy link
Copy Markdown
Collaborator

please look at the suggestion

…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>

test(spark): add negative RTAS itest for disabled-by-default gate

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>

fix

fix

fix

add wap and replication

style

style

style
@mkuchenbecker

Copy link
Copy Markdown
Collaborator

Tests are failing

@mkuchenbecker

Copy link
Copy Markdown
Collaborator

This may break integration tests for Trino if they're already automated; please work with them to update before this rolls out.

@jiang95-dev jiang95-dev merged commit 3faac06 into linkedin:main Jun 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants