Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxiaojian committed Mar 6, 2024
1 parent fd9027e commit 133fe51
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -210,17 +206,14 @@ 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;
}
if (snapshot.id() < fromSnapshot.id()) {
fileIO.copyFileUtf8(
snapshotManager.snapshotPath(snapshot.id()),
snapshotManager.snapshotPath(branchName, snapshot.id()));
} else {
// clear useless files
rollbackHelper.cleanLargerThan(snapshot);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 133fe51

Please sign in to comment.