Skip to content

Commit 7bd7b67

Browse files
committed
[core] Remove get latest snapshot in FileStoreWrite when ignorePreviousFiles
1 parent b8e5a4b commit 7bd7b67

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreWrite.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -433,25 +433,23 @@ public WriterContainer<T> createWriterContainer(
433433
}
434434
}
435435

436-
Snapshot latestSnapshot = snapshotManager.latestSnapshot();
436+
Snapshot previousSnapshot = ignorePreviousFiles ? null : snapshotManager.latestSnapshot();
437437
List<DataFileMeta> restoreFiles = new ArrayList<>();
438438
int totalBuckets;
439-
if (!ignorePreviousFiles && latestSnapshot != null) {
440-
totalBuckets = scanExistingFileMetas(latestSnapshot, partition, bucket, restoreFiles);
439+
if (previousSnapshot != null) {
440+
totalBuckets = scanExistingFileMetas(previousSnapshot, partition, bucket, restoreFiles);
441441
} else {
442442
totalBuckets = getDefaultBucketNum(partition);
443443
}
444444

445445
IndexMaintainer<T> indexMaintainer =
446446
indexFactory == null
447447
? null
448-
: indexFactory.createOrRestore(
449-
ignorePreviousFiles ? null : latestSnapshot, partition, bucket);
448+
: indexFactory.createOrRestore(previousSnapshot, partition, bucket);
450449
DeletionVectorsMaintainer deletionVectorsMaintainer =
451450
dvMaintainerFactory == null
452451
? null
453-
: dvMaintainerFactory.createOrRestore(
454-
ignorePreviousFiles ? null : latestSnapshot, partition, bucket);
452+
: dvMaintainerFactory.createOrRestore(previousSnapshot, partition, bucket);
455453
RecordWriter<T> writer =
456454
createWriter(
457455
partition.copy(),
@@ -468,7 +466,7 @@ public WriterContainer<T> createWriterContainer(
468466
totalBuckets,
469467
indexMaintainer,
470468
deletionVectorsMaintainer,
471-
latestSnapshot == null ? null : latestSnapshot.id());
469+
previousSnapshot == null ? null : previousSnapshot.id());
472470
}
473471

474472
@Override

0 commit comments

Comments
 (0)