Skip to content

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

Merged
wuchong merged 3 commits into
apache:mainfrom
Kaixuan-Duan:issue-3231-support-alter-ttl
Aug 20, 2026
Merged

wuchong merged 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.

@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 3 times, most recently from 11064e1 to 9dfad70 Compare June 1, 2026 15:35
@luoyuxia

luoyuxia commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

cc @swuferhong

@Kaixuan-Duan
Kaixuan-Duan force-pushed the issue-3231-support-alter-ttl branch 2 times, most recently from 338dc0e to 922f1fb Compare August 13, 2026 12:29
@Kaixuan-Duan
Kaixuan-Duan force-pushed the issue-3231-support-alter-ttl branch from bb93ad5 to 6be55c3 Compare August 13, 2026 15:44
@Kaixuan-Duan

Copy link
Copy Markdown
Contributor Author

@wuchong Thanks for the review. I've addressed comments. Could you please take a look?

@Kaixuan-Duan
Kaixuan-Duan force-pushed the issue-3231-support-alter-ttl branch 2 times, most recently from cdb00bf to 13b1413 Compare August 19, 2026 07:25
@wuchong
wuchong force-pushed the issue-3231-support-alter-ttl branch from 627ea16 to 31261fe Compare August 19, 2026 16:15
@wuchong

wuchong commented Aug 19, 2026

Copy link
Copy Markdown
Member

@Kaixuan-Duan I appended 2 commits to improve the tests and implementations. @gyang94 could you help to review this as well?

Cover shortened table log TTL propagation through client fetch, remote
segment expiration, and local cleanup on leader and follower replicas.
Replace per-option replica updates with a full TableInfo snapshot and
derive mutable log-tablet settings from TableConfig.

AI-Contributed/Feature: 0/19
AI-Contributed/UT: 0/2
@wuchong
wuchong force-pushed the issue-3231-support-alter-ttl branch from 31261fe to a88c2fa Compare August 19, 2026 16:38
@gyang94

gyang94 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

LGTM

@wuchong
wuchong merged commit fccf047 into apache:main Aug 20, 2026
34 of 36 checks passed
@Kaixuan-Duan
Kaixuan-Duan deleted the issue-3231-support-alter-ttl branch September 15, 2026 08:19
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

5 participants