luoyuxia commented on code in PR #1940:
URL: https://github.com/apache/fluss/pull/1940#discussion_r2690317476


##########
fluss-server/src/main/java/org/apache/fluss/server/log/LogTablet.java:
##########
@@ -516,9 +522,15 @@ public void updateMinRetainOffset(long minRetainOffset) {
         }
     }
 
+    public void updateIsDataLakeEnabled(boolean isDataLakeEnabled) {
+        this.isDataLakeEnabled = isDataLakeEnabled;
+    }
+
     public void updateLakeTableSnapshotId(long snapshotId) {
         if (snapshotId > this.lakeTableSnapshotId) {
             this.lakeTableSnapshotId = snapshotId;
+            // it means the data lake is enabled if we have got the snapshot id
+            this.isDataLakeEnabled = true;

Review Comment:
   Currently, we rely this to update `isDataLakeEnabled` dynamically, in the 
other pr, we should rely on `updateMetataRequest` .



##########
fluss-server/src/main/java/org/apache/fluss/server/log/remote/RemoteLogTablet.java:
##########
@@ -147,8 +147,21 @@ public List<RemoteLogSegment> allRemoteLogSegments() {
         return inReadLock(lock, () -> 
currentManifest.getRemoteLogSegmentList());
     }
 
-    /** Returns the expired segments based on the given time. */
-    public List<RemoteLogSegment> expiredRemoteLogSegments(long currentTimeMs) 
{
+    /**
+     * Returns the expired segments based on the given time and lake log end 
offset.
+     *
+     * <p>Only segments that have been tiered to lake (i.e., 
remoteLogEndOffset <= lakeLogEndOffset)
+     * can be safely deleted. This ensures that we don't delete segments that 
haven't been tiered to
+     * lake yet.
+     *
+     * @param currentTimeMs the current time in milliseconds
+     * @param isDataLakeEnabled whether data lake is enabled
+     * @param lakeLogEndOffset the log end offset that has been synced to 
lake, -1 if no lake sync
+     *     has occurred
+     * @return list of expired segments that can be safely deleted
+     */
+    public List<RemoteLogSegment> expiredRemoteLogSegments(
+            long currentTimeMs, boolean isDataLakeEnabled, long 
lakeLogEndOffset) {

Review Comment:
   ```suggestion
               long currentTimeMs, Long lakeLogEndOffset) {
   ```
   null represent lake table?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to