Skip to content

[server] Support altering table.log.ttl table option#3233

Open
Kaixuan-Duan wants to merge 3 commits into
apache:mainfrom
Kaixuan-Duan:issue-3231-support-alter-ttl
Open

[server] Support altering table.log.ttl table option#3233
Kaixuan-Duan wants to merge 3 commits into
apache:mainfrom
Kaixuan-Duan:issue-3231-support-alter-ttl

Conversation

@Kaixuan-Duan

@Kaixuan-Duan Kaixuan-Duan commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #3231

Brief change log

  • Add ConfigOptions.TABLE_LOG_TTL.key() to FlussConfigUtils.ALTERABLE_TABLE_OPTIONS so the validator no longer rejects ALTER on this option.
  • Change RemoteLogTablet#ttlMs from final to volatile and add getTtlMs() / updateTtlMs(long) so the remote-log expiration check can observe the new value without recreating the tablet.
  • Add Replica#updateLogTtlMs(long) which looks up the corresponding RemoteLogTablet via RemoteLogManager and applies the new TTL, guarded by an IllegalStateException fallback for the case where the tablet has not been registered yet.
  • Extend ReplicaManager#updateReplicaTableConfig to collect a tableIdToLogTtlMs map from the metadata diff and dispatch updateLogTtlMs to each affected replica, mirroring how table.log.tiered.local-segments is already handled.

Tests

./mvnw -pl fluss-client,fluss-server -am test \
-Dtest='FlussAdminITCase#testAlterTableLogTtl,'\
'RemoteLogTabletTest,'\
'RemoteLogManagerTest,'\
'RemoteLogTTLTest' \
-DfailIfNoTests=false

API and Format

Documentation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables ALTER TABLE ... SET ('table.log.ttl' = ...) by allowing the option through config validation and propagating updated TTL values into the server-side remote-log expiration logic without requiring tablet recreation.

Changes:

  • Allow table.log.ttl to be altered by adding it to FlussConfigUtils.ALTERABLE_TABLE_OPTIONS.
  • Make RemoteLogTablet TTL mutable/visible across threads and add update/access methods; wire TTL updates through Replica and ReplicaManager.
  • Add/extend tests to validate TTL alteration persistence and runtime effect on remote-log expiration.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
fluss-common/src/main/java/org/apache/fluss/config/FlussConfigUtils.java Allows table.log.ttl to pass ALTER-table option validation.
fluss-server/src/main/java/org/apache/fluss/server/log/remote/RemoteLogTablet.java Makes TTL mutable (volatile) and adds TTL getter/updater for runtime expiration decisions.
fluss-server/src/main/java/org/apache/fluss/server/replica/Replica.java Adds updateLogTtlMs to apply TTL changes to the associated RemoteLogTablet.
fluss-server/src/main/java/org/apache/fluss/server/replica/ReplicaManager.java Propagates TTL values from metadata updates to online replicas.
fluss-server/src/test/java/org/apache/fluss/server/log/remote/RemoteLogTabletTest.java Adds unit coverage for TTL update behavior affecting expiration results.
fluss-server/src/test/java/org/apache/fluss/server/log/remote/RemoteLogManagerTest.java Adds integration-style test ensuring replica-driven TTL updates reach RemoteLogTablet.
fluss-client/src/test/java/org/apache/fluss/client/admin/FlussAdminITCase.java Adds IT coverage verifying ALTER persists TTL into TableInfo and reset reverts to default.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fluss-server/src/main/java/org/apache/fluss/server/replica/Replica.java Outdated
Comment thread fluss-server/src/main/java/org/apache/fluss/server/replica/Replica.java Outdated
@Kaixuan-Duan

Copy link
Copy Markdown
Contributor Author

@luoyuxia I have addressed the feedback. PTAL

@Kaixuan-Duan Kaixuan-Duan force-pushed the issue-3231-support-alter-ttl branch from c7ec4da to 6bf6a2f Compare June 1, 2026 14:04
@Kaixuan-Duan Kaixuan-Duan force-pushed the issue-3231-support-alter-ttl branch from 6bf6a2f to 11064e1 Compare June 1, 2026 14:06
@Kaixuan-Duan Kaixuan-Duan force-pushed the issue-3231-support-alter-ttl branch from 11064e1 to 9dfad70 Compare June 1, 2026 15:35
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.

Support alter table.log.ttl

2 participants