You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluss.apache.org by ja...@apache.org on 2026/08/12 11:18:26 UTC

(fluss) branch main updated: [server] Fix remote log start offset of RemoteLogManifest may expose an expired physical prefix (#3956)

This is an automated email from the ASF dual-hosted git repository.

wuchong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss.git


The following commit(s) were added to refs/heads/main by this push:
     new 7f7fe2487 [server] Fix remote log start offset of RemoteLogManifest may expose an expired physical prefix (#3956)
7f7fe2487 is described below

commit 7f7fe2487895a1bc3c69397bc69fd833fc346c1b
Author: Yang Guo <ji...@outlook.com>
AuthorDate: Wed Aug 12 19:18:21 2026 +0800

    [server] Fix remote log start offset of RemoteLogManifest may expose an expired physical prefix (#3956)
---
 .../org/apache/fluss/remote/RemoteLogManifest.java | 22 ++++++++++++++++++----
 .../fluss/remote/RemoteLogManifestOverlapTest.java | 10 +++++++++-
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/fluss-common/src/main/java/org/apache/fluss/remote/RemoteLogManifest.java b/fluss-common/src/main/java/org/apache/fluss/remote/RemoteLogManifest.java
index 6a0f2ad8b..9fe912bef 100644
--- a/fluss-common/src/main/java/org/apache/fluss/remote/RemoteLogManifest.java
+++ b/fluss-common/src/main/java/org/apache/fluss/remote/RemoteLogManifest.java
@@ -142,21 +142,35 @@ public class RemoteLogManifest {
                 physicalTablePath, tableBucket, newSegments, newHighestCopiedEndOffset);
     }
 
+    /**
+     * Returns the inclusive logical start offset exposed by this manifest, or {@link
+     * Long#MAX_VALUE} if this manifest is empty.
+     *
+     * <p>The returned value is the start of the logical range visible through the manifest, not
+     * necessarily the physical start offset of its first persisted segment.
+     */
     public long getRemoteLogStartOffset() {
         long startOffset = Long.MAX_VALUE;
         for (RemoteLogSegment remoteLogSegment : remoteLogSegmentList) {
-            if (remoteLogSegment.remoteLogStartOffset() < startOffset) {
-                startOffset = remoteLogSegment.remoteLogStartOffset();
+            if (remoteLogSegment.logicalStartOffset() < startOffset) {
+                startOffset = remoteLogSegment.logicalStartOffset();
             }
         }
         return startOffset;
     }
 
+    /**
+     * Returns the exclusive logical end offset exposed by this manifest, or {@code -1} if this
+     * manifest is empty.
+     *
+     * <p>The returned value is the end of the logical range visible through the manifest, rather
+     * than a physical segment boundary.
+     */
     public long getRemoteLogEndOffset() {
         long endOffset = -1;
         for (RemoteLogSegment remoteLogSegment : remoteLogSegmentList) {
-            if (endOffset == -1 || remoteLogSegment.remoteLogEndOffset() > endOffset) {
-                endOffset = remoteLogSegment.remoteLogEndOffset();
+            if (endOffset == -1 || remoteLogSegment.logicalEndOffset() > endOffset) {
+                endOffset = remoteLogSegment.logicalEndOffset();
             }
         }
         return endOffset;
diff --git a/fluss-common/src/test/java/org/apache/fluss/remote/RemoteLogManifestOverlapTest.java b/fluss-common/src/test/java/org/apache/fluss/remote/RemoteLogManifestOverlapTest.java
index e9cecaaf2..1286f64d5 100644
--- a/fluss-common/src/test/java/org/apache/fluss/remote/RemoteLogManifestOverlapTest.java
+++ b/fluss-common/src/test/java/org/apache/fluss/remote/RemoteLogManifestOverlapTest.java
@@ -153,10 +153,18 @@ class RemoteLogManifestOverlapTest {
 
         assertThat(result.getRemoteLogSegmentList())
                 .containsExactly(replacement.withLogicalRange(10L, 25L));
-        assertThat(result.getRemoteLogStartOffset()).isEqualTo(5L);
+        assertThat(result.getRemoteLogStartOffset()).isEqualTo(10L);
         assertThat(result.getRemoteLogEndOffset()).isEqualTo(25L);
     }
 
+    @Test
+    void testRemoteLogOffsetsUseLogicalRange() {
+        RemoteLogManifest result = manifest(segment(5L, 25L).withLogicalRange(10L, 20L));
+
+        assertThat(result.getRemoteLogStartOffset()).isEqualTo(10L);
+        assertThat(result.getRemoteLogEndOffset()).isEqualTo(20L);
+    }
+
     @Test
     void testAlreadyCoveredCandidateIsUnused() {
         RemoteLogSegment covered = segment(2L, 8L);