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

JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 5782b5e37e [core] Skip tag copy in fastForward when branch has no tags 
(#7800)
5782b5e37e is described below

commit 5782b5e37eb3daaa64f03c9a847b95d9d184b3de
Author: Arnav Balyan <[email protected]>
AuthorDate: Sun May 10 07:47:01 2026 +0530

    [core] Skip tag copy in fastForward when branch has no tags (#7800)
    
    - fastForward copies the tag directory to main, even when the branch did
    not have a tag created.
    - On object store,`listStatus` on the missing directory throws FNF
    exception, causing failure for fastforward for branch without tags.
    - Add a guard to check that the tag dir exists before the copy
    operation.
---
 .../paimon/utils/FileSystemBranchManager.java      |  9 ++++---
 .../apache/paimon/table/SimpleTableTestBase.java   | 29 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/utils/FileSystemBranchManager.java
 
b/paimon-core/src/main/java/org/apache/paimon/utils/FileSystemBranchManager.java
index 3257ea1060..9c09637d1c 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/utils/FileSystemBranchManager.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/utils/FileSystemBranchManager.java
@@ -195,10 +195,11 @@ public class FileSystemBranchManager implements 
BranchManager {
                     schemaManager.copyWithBranch(branchName).schemaDirectory(),
                     schemaManager.schemaDirectory(),
                     true);
-            fileIO.copyFiles(
-                    tagManager.copyWithBranch(branchName).tagDirectory(),
-                    tagManager.tagDirectory(),
-                    true);
+            // Continue fast-forward even without tags.
+            Path branchTagDirectory = 
tagManager.copyWithBranch(branchName).tagDirectory();
+            if (fileIO.exists(branchTagDirectory)) {
+                fileIO.copyFiles(branchTagDirectory, 
tagManager.tagDirectory(), true);
+            }
             snapshotManager.invalidateCache();
         } catch (IOException e) {
             throw new RuntimeException(
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/table/SimpleTableTestBase.java 
b/paimon-core/src/test/java/org/apache/paimon/table/SimpleTableTestBase.java
index 7681443b14..cfdccc197e 100644
--- a/paimon-core/src/test/java/org/apache/paimon/table/SimpleTableTestBase.java
+++ b/paimon-core/src/test/java/org/apache/paimon/table/SimpleTableTestBase.java
@@ -1356,6 +1356,35 @@ public abstract class SimpleTableTestBase {
                         "4|40|400|binary|varbinary|mapKey:mapVal|multiset");
     }
 
+    @Test
+    public void testFastForwardWithoutTag() throws Exception {
+        FileStoreTable table = createFileStoreTable();
+
+        try (StreamTableWrite write = table.newWrite(commitUser);
+                StreamTableCommit commit = table.newCommit(commitUser)) {
+            write.write(rowData(0, 0, 0L));
+            commit.commit(0, write.prepareCommit(false, 1));
+        }
+
+        table.createBranch(BRANCH_NAME);
+        FileStoreTable tableBranch = createBranchTable(BRANCH_NAME);
+
+        try (StreamTableWrite write = tableBranch.newWrite(commitUser);
+                StreamTableCommit commit = tableBranch.newCommit(commitUser)) {
+            write.write(rowData(2, 20, 200L));
+            commit.commit(1, write.prepareCommit(false, 2));
+        }
+
+        table.fastForward(BRANCH_NAME);
+
+        assertThat(
+                        getResult(
+                                table.newRead(),
+                                
toSplits(table.newSnapshotReader().read().dataSplits()),
+                                BATCH_ROW_TO_STRING))
+                .contains("2|20|200|binary|varbinary|mapKey:mapVal|multiset");
+    }
+
     @Test
     public void testUnsupportedTagName() throws Exception {
         FileStoreTable table = createFileStoreTable();

Reply via email to