From 133fe51520681ca06bea7809f9826f655333b8bf Mon Sep 17 00:00:00 2001 From: sunxiaojian Date: Wed, 6 Mar 2024 23:51:49 +0800 Subject: [PATCH] fixed --- .../apache/paimon/table/AbstractFileStoreTable.java | 3 +-- .../java/org/apache/paimon/utils/BranchManager.java | 11 ++--------- .../java/org/apache/paimon/utils/SnapshotManager.java | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java b/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java index 419afbe13365c..0fcab535a359e 100644 --- a/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java +++ b/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java @@ -493,8 +493,7 @@ public TagManager tagManager() { @Override public BranchManager branchManager() { - return new BranchManager( - fileIO, path, snapshotManager(), tagManager(), schemaManager(), rollbackHelper()); + return new BranchManager(fileIO, path, snapshotManager(), tagManager(), schemaManager()); } private RollbackHelper rollbackHelper() { diff --git a/paimon-core/src/main/java/org/apache/paimon/utils/BranchManager.java b/paimon-core/src/main/java/org/apache/paimon/utils/BranchManager.java index 8db36f1d6d4d5..04e7ba4364be2 100644 --- a/paimon-core/src/main/java/org/apache/paimon/utils/BranchManager.java +++ b/paimon-core/src/main/java/org/apache/paimon/utils/BranchManager.java @@ -26,7 +26,6 @@ import org.apache.paimon.schema.TableSchema; import org.apache.paimon.table.FileStoreTable; import org.apache.paimon.table.FileStoreTableFactory; -import org.apache.paimon.table.RollbackHelper; import org.apache.paimon.tag.TableTag; import org.slf4j.Logger; @@ -58,21 +57,18 @@ public class BranchManager { private final SnapshotManager snapshotManager; private final TagManager tagManager; private final SchemaManager schemaManager; - private final RollbackHelper rollbackHelper; public BranchManager( FileIO fileIO, Path path, SnapshotManager snapshotManager, TagManager tagManager, - SchemaManager schemaManager, - RollbackHelper rollbackHelper) { + SchemaManager schemaManager) { this.fileIO = fileIO; this.tablePath = path; this.snapshotManager = snapshotManager; this.tagManager = tagManager; this.schemaManager = schemaManager; - this.rollbackHelper = rollbackHelper; } /** Commit specify branch to main. */ @@ -210,7 +206,7 @@ private void calculateCopyMainBranchToTargetBranch(String branchName) throws IOE Snapshot fromSnapshot = snapshotManager.snapshot(fromBranch.getCreatedFromSnapshot()); while (snapshots.hasNext()) { Snapshot snapshot = snapshots.next(); - if (snapshotManager.branchSnapshotExists(branchName, snapshot.id())) { + if (snapshotManager.snapshotExists(branchName, snapshot.id())) { // If it already exists, skip it directly. continue; } @@ -218,9 +214,6 @@ private void calculateCopyMainBranchToTargetBranch(String branchName) throws IOE fileIO.copyFileUtf8( snapshotManager.snapshotPath(snapshot.id()), snapshotManager.snapshotPath(branchName, snapshot.id())); - } else { - // clear useless files - rollbackHelper.cleanLargerThan(snapshot); } } diff --git a/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java b/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java index 0282a7e53c966..66d90c4ea4bb0 100644 --- a/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java +++ b/paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java @@ -103,7 +103,7 @@ public Snapshot snapshot(String branchName, long snapshotId) { return Snapshot.fromPath(fileIO, snapshotPath); } - public boolean branchSnapshotExists(String branchName, long snapshotId) { + public boolean snapshotExists(String branchName, long snapshotId) { Path path = snapshotPath(branchName, snapshotId); try { return fileIO.exists(path);