You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "LiebingYu (via GitHub)" <gi...@apache.org> on 2026/01/15 08:33:53 UTC

[PR] [server] Update tablet server metadata cache when TableRegistration changed [fluss]

LiebingYu opened a new pull request, #2378:
URL: https://github.com/apache/fluss/pull/2378

   <!--
   *Thank you very much for contributing to Fluss - we are happy that you want to help us improve Fluss. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/fluss/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no issue.
   
     - Name the pull request in the format "[component] Title of the pull request", where *[component]* should be replaced by the name of the component being changed. Typically, this corresponds to the component label assigned to the issue (e.g., [kv], [log], [client], [flink]). Skip *[component]* if you are unsure about which is the best component.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
   
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes.
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
   
   
   **(The sections below can be removed for hotfixes or typos)**
   -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #2375 
   
   <!-- What is the purpose of the change -->
   
   ### Brief change log
   
   <!-- Please describe the changes made in this pull request and explain how they address the issue -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [server] Update tablet server metadata cache when TableRegistration changed [fluss]

Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #2378:
URL: https://github.com/apache/fluss/pull/2378#discussion_r2710830265


##########
fluss-server/src/main/java/org/apache/fluss/server/replica/ReplicaManager.java:
##########
@@ -459,9 +460,28 @@ public void maybeUpdateMetadataCache(int coordinatorEpoch, ClusterMetadata clust
                     // check or apply coordinator epoch.
                     validateAndApplyCoordinatorEpoch(coordinatorEpoch, "updateMetadataCache");
                     metadataCache.updateClusterMetadata(clusterMetadata);
+                    updateReplicaTableConfig(clusterMetadata);
                 });
     }
 
+    private void updateReplicaTableConfig(ClusterMetadata clusterMetadata) {
+        for (TableMetadata tableMetadata : clusterMetadata.getTableMetadataList()) {
+            TableInfo tableInfo = tableMetadata.getTableInfo();
+            long tableId = tableInfo.getTableId();
+            boolean dataLakeEnabled = tableInfo.getTableConfig().isDataLakeEnabled();

Review Comment:
   nit: 
   ```
   if (tableInfo.getTableConfig().getDataLakeFormat().isPresent()) {
                   boolean dataLakeEnabled = tableInfo.getTableConfig().isDataLakeEnabled();
                   for (Map.Entry<TableBucket, HostedReplica> entry : allReplicas.entrySet()) {
                       HostedReplica hostedReplica = entry.getValue();
                       if (hostedReplica instanceof OnlineReplica) {
                           Replica replica = ((OnlineReplica) hostedReplica).getReplica();
                           if (replica.getTableBucket().getTableId() == tableId) {
                               replica.updateIsDataLakeEnabled(dataLakeEnabled);
                           }
                       }
                   }
               }
   ```
   ?
   
   add another lake format check to avoid loop replicas for all tables?



##########
fluss-server/src/main/java/org/apache/fluss/server/coordinator/CoordinatorEventProcessor.java:
##########
@@ -720,6 +723,47 @@ private void processSchemaChange(SchemaChangeEvent schemaChangeEvent) {
                 null);
     }
 
+    private void processTableRegistrationChange(TableRegistrationChangeEvent event) {
+        TablePath tablePath = event.getTablePath();
+        Long tableId = coordinatorContext.getTableIdByPath(tablePath);
+
+        // Skip if the table is not yet registered in coordinator context.
+        // Should not happen in normal cases.
+        if (tableId == null) {
+            return;

Review Comment:
   nit: add warning log?



##########
fluss-server/src/test/java/org/apache/fluss/server/log/remote/RemoteLogITCase.java:
##########
@@ -202,6 +214,233 @@ void testFollowerFetchAlreadyMoveToRemoteLog(boolean withWriterId) throws Except
         FLUSS_CLUSTER_EXTENSION.waitUntilReplicaExpandToIsr(tb, follower);
     }
 
+    @Test
+    void testRemoteLogTTLWithLakeDisabled() throws Exception {

Review Comment:
   Could we just combine these three test methods into one test method
   
   **Stage A: Lake Disabled (Initial)**
   
   Action: Create a table with TABLE_DATALAKE_ENABLED = false.
   
   Expectation: Expired remote log segments are deleted physically as soon as the TTL is reached.
   
   **Stage B: Dynamic Enable & Retention**
   
   Action: Dynamically alter the table to set TABLE_DATALAKE_ENABLED = true, produce new data, and advance the clock.
   
   Expectation: Expired segments are NOT deleted because the lakeLogEndOffset has not yet reached the segment offsets. This ensures data safety for the lake tiering.
   
   **Stage C: Lake Progress Update (Cleanup)**
   
   Action: Simulate lake tiering completion by calling logTablet.updateLakeLogEndOffset(...).
   
   Expectation: The cleanup coordinator now allows the deletion of expired segments that have been successfully tiered to the lake.
   
   **Stage D: Dynamic Disable (Revert to Direct Cleanup)**
   
   Action: Dynamically alter the table back to TABLE_DATALAKE_ENABLED = false and produce new data.
   
   Expectation: The system resumes the direct physical deletion of expired segments, ignoring the lake offset status.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [server] Update tablet server metadata cache when TableRegistration changed [fluss]

Posted by "Jackeyzhe (via GitHub)" <gi...@apache.org>.
Jackeyzhe commented on code in PR #2378:
URL: https://github.com/apache/fluss/pull/2378#discussion_r2703058648


##########
fluss-server/src/test/java/org/apache/fluss/server/log/remote/RemoteLogITCase.java:
##########
@@ -213,6 +444,24 @@ private static Configuration initConfig() {
         // set a shorter max log time to allow replica shrink from isr. Don't be too low, otherwise
         // normal follower synchronization will also be affected
         conf.set(ConfigOptions.LOG_REPLICA_MAX_LAG_TIME, Duration.ofSeconds(5));
+
+        conf.set(ConfigOptions.DATALAKE_FORMAT, DataLakeFormat.PAIMON);
         return conf;
     }
+
+    private static AlterTableRequest newAlterTableRequest(

Review Comment:
   maybe can reuse newAlterTableRequest in `newDropTableRequest`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [server] Update tablet server metadata cache when TableRegistration changed [fluss]

Posted by "wuchong (via GitHub)" <gi...@apache.org>.
wuchong commented on code in PR #2378:
URL: https://github.com/apache/fluss/pull/2378#discussion_r2723896572


##########
fluss-server/src/main/java/org/apache/fluss/server/replica/ReplicaManager.java:
##########
@@ -459,9 +460,30 @@ public void maybeUpdateMetadataCache(int coordinatorEpoch, ClusterMetadata clust
                     // check or apply coordinator epoch.
                     validateAndApplyCoordinatorEpoch(coordinatorEpoch, "updateMetadataCache");
                     metadataCache.updateClusterMetadata(clusterMetadata);
+                    updateReplicaTableConfig(clusterMetadata);
                 });
     }
 
+    private void updateReplicaTableConfig(ClusterMetadata clusterMetadata) {
+        for (TableMetadata tableMetadata : clusterMetadata.getTableMetadataList()) {
+            TableInfo tableInfo = tableMetadata.getTableInfo();
+            if (tableInfo.getTableConfig().getDataLakeFormat().isPresent()) {
+                long tableId = tableInfo.getTableId();
+                boolean dataLakeEnabled = tableInfo.getTableConfig().isDataLakeEnabled();
+
+                for (Map.Entry<TableBucket, HostedReplica> entry : allReplicas.entrySet()) {

Review Comment:
   nit: The complexity is `O(M x N)` where M is the number of `TableMetadata`, and N is the number of Replicas. We can improve the complexity to `O(M+N)`. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [server] Update tablet server metadata cache when TableRegistration changed [fluss]

Posted by "wuchong (via GitHub)" <gi...@apache.org>.
wuchong merged PR #2378:
URL: https://github.com/apache/fluss/pull/2378


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@fluss.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org