[server] Support altering table.log.ttl table option#3233
Open
Kaixuan-Duan wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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.ttlto be altered by adding it toFlussConfigUtils.ALTERABLE_TABLE_OPTIONS. - Make
RemoteLogTabletTTL mutable/visible across threads and add update/access methods; wire TTL updates throughReplicaandReplicaManager. - 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.
Contributor
Author
|
@luoyuxia I have addressed the feedback. PTAL |
c7ec4da to
6bf6a2f
Compare
6bf6a2f to
11064e1
Compare
11064e1 to
9dfad70
Compare
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.
Purpose
Linked issue: close #3231
Brief change log
ConfigOptions.TABLE_LOG_TTL.key()toFlussConfigUtils.ALTERABLE_TABLE_OPTIONSso the validator no longer rejects ALTER on this option.RemoteLogTablet#ttlMsfromfinaltovolatileand addgetTtlMs()/updateTtlMs(long)so the remote-log expiration check can observe the new value without recreating the tablet.Replica#updateLogTtlMs(long)which looks up the correspondingRemoteLogTabletviaRemoteLogManagerand applies the new TTL, guarded by anIllegalStateExceptionfallback for the case where the tablet has not been registered yet.ReplicaManager#updateReplicaTableConfigto collect atableIdToLogTtlMsmap from the metadata diff and dispatchupdateLogTtlMsto each affected replica, mirroring howtable.log.tiered.local-segmentsis already handled.Tests
./mvnw -pl fluss-client,fluss-server -am test \
-Dtest='FlussAdminITCase#testAlterTableLogTtl,'\
'RemoteLogTabletTest,'\
'RemoteLogManagerTest,'\
'RemoteLogTTLTest' \
-DfailIfNoTests=false
API and Format
Documentation