Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
import org.apache.paimon.operation.commit.CommitRollback;
import org.apache.paimon.operation.commit.CommitScanner;
import org.apache.paimon.operation.commit.ConflictDetection;
import org.apache.paimon.operation.commit.DataEvolutionChangesProvider;
import org.apache.paimon.operation.commit.ManifestEntryChanges;
import org.apache.paimon.operation.commit.ReassignCompactChangesProvider;
import org.apache.paimon.operation.commit.RetryCommitResult;
import org.apache.paimon.operation.commit.RetryCommitResult.CommitFailRetryResult;
import org.apache.paimon.operation.commit.RetryCommitResult.ManifestMergeResult;
Expand Down Expand Up @@ -381,10 +381,13 @@ public int commit(ManifestCommittable committable, boolean checkAppendFiles) {

attempts +=
tryCommit(
CommitChangesProvider.provider(
changes.appendTableFiles,
changes.appendChangelog,
changes.appendIndexFiles),
dataEvolutionChangesProvider(
new CommitChanges(
changes.appendTableFiles,
changes.appendChangelog,
changes.appendIndexFiles),
commitKind,
Collections.emptySet()),
committable.identifier(),
committable.watermark(),
committable.properties(),
Expand All @@ -400,11 +403,12 @@ public int commit(ManifestCommittable committable, boolean checkAppendFiles) {
|| !changes.compactIndexFiles.isEmpty()) {
attempts +=
tryCommit(
compactChangesProvider(
dataEvolutionChangesProvider(
new CommitChanges(
changes.compactTableFiles,
changes.compactChangelog,
changes.compactIndexFiles),
CommitKind.COMPACT,
materializedBuckets),
committable.identifier(),
committable.watermark(),
Expand Down Expand Up @@ -589,11 +593,12 @@ private int overwritePartition(
if (withCompact) {
attempts +=
tryCommit(
compactChangesProvider(
dataEvolutionChangesProvider(
new CommitChanges(
changes.compactTableFiles,
emptyList(),
changes.compactIndexFiles),
CommitKind.COMPACT,
Collections.emptySet()),
committable.identifier(),
committable.watermark(),
Expand Down Expand Up @@ -858,15 +863,22 @@ private Set<Pair<BinaryRow, Integer>> materializedBuckets(List<CommitMessage> co
}

@VisibleForTesting
CommitChangesProvider compactChangesProvider(
CommitChanges changes, Set<Pair<BinaryRow, Integer>> materializedBuckets) {
CommitChangesProvider dataEvolutionChangesProvider(
CommitChanges changes,
CommitKind commitKind,
Set<Pair<BinaryRow, Integer>> materializedBuckets) {
if (materializedBuckets.isEmpty()) {
Long lastSafeSnapshot = options.commitLastSafeSnapshot().orElse(null);
if (options.dataEvolutionEnabled()
&& (commitKind == CommitKind.COMPACT
|| (commitKind == CommitKind.APPEND
&& changes.tableFiles.isEmpty()
&& changes.changelogFiles.isEmpty()
&& !changes.indexFiles.isEmpty()))
&& !conflictDetection.shouldCheckRowIdFromSnapshot(CommitKind.COMPACT)
&& lastSafeSnapshot != null
&& lastSafeSnapshot >= 0) {
return new ReassignCompactChangesProvider(
return new DataEvolutionChangesProvider(
fileIO, pathFactory, snapshotManager, lastSafeSnapshot, changes);
}
return CommitChangesProvider.provider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@

import static org.apache.paimon.utils.Preconditions.checkState;

/** Reuses immutable compact outputs after verified, metadata-only row-id reassignments. */
public final class ReassignCompactChangesProvider implements CommitChangesProvider {
/** Reuses immutable outputs after verified, metadata-only row-id reassignments. */
public final class DataEvolutionChangesProvider implements CommitChangesProvider {

private final FileIO fileIO;
private final FileStorePathFactory paths;
Expand All @@ -54,7 +54,7 @@ public final class ReassignCompactChangesProvider implements CommitChangesProvid
private long checkedSnapshot;
private CommitChanges changes;

public ReassignCompactChangesProvider(
public DataEvolutionChangesProvider(
FileIO fileIO,
FileStorePathFactory paths,
SnapshotManager snapshots,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public void check(
Set<Long> rebasedReassignments) {
Set<BinaryRow> newPartitions = new HashSet<>(newChangedPartitions);
for (long id = lastSafeSnapshot + 1; id < newSnapshotId; id++) {
if (newCommitKind == CommitKind.COMPACT && rebasedReassignments.contains(id)) {
if ((newCommitKind == CommitKind.COMPACT || newCommitKind == CommitKind.APPEND)
&& rebasedReassignments.contains(id)) {
continue;
}
Snapshot snapshot = snapshotManager.snapshot(id);
Expand Down
Loading
Loading