Skip to content

Commit

Permalink
Compaction Operator parallelism in paimon MUST be one (#3758)
Browse files Browse the repository at this point in the history
This closes #3758.
  • Loading branch information
discivigour authored Jul 24, 2024
1 parent 10a982e commit 094e925
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.paimon.predicate.Predicate;
import org.apache.paimon.table.FileStoreTable;
import org.apache.paimon.table.source.EndOfScanException;
import org.apache.paimon.utils.Preconditions;

import org.apache.flink.api.connector.source.Boundedness;
import org.apache.flink.configuration.Configuration;
Expand Down Expand Up @@ -74,6 +75,9 @@ public BucketUnawareCompactSource(
@Override
public void open(Configuration parameters) throws Exception {
compactionCoordinator = new AppendOnlyTableCompactionCoordinator(table, streaming, filter);
Preconditions.checkArgument(
this.getRuntimeContext().getNumberOfParallelSubtasks() == 1,
"Compaction Operator parallelism in paimon MUST be one.");
}

@Override
Expand Down Expand Up @@ -120,12 +124,15 @@ public static DataStreamSource<AppendOnlyCompactionTask> buildSource(
String tableIdentifier) {
final StreamSource<AppendOnlyCompactionTask, BucketUnawareCompactSource> sourceOperator =
new StreamSource<>(source);
return new DataStreamSource<>(
env,
new CompactionTaskTypeInfo(),
sourceOperator,
false,
COMPACTION_COORDINATOR_NAME + " : " + tableIdentifier,
streaming ? Boundedness.CONTINUOUS_UNBOUNDED : Boundedness.BOUNDED);
return (DataStreamSource<AppendOnlyCompactionTask>)
new DataStreamSource<>(
env,
new CompactionTaskTypeInfo(),
sourceOperator,
false,
COMPACTION_COORDINATOR_NAME + " : " + tableIdentifier,
streaming ? Boundedness.CONTINUOUS_UNBOUNDED : Boundedness.BOUNDED)
.setParallelism(1)
.setMaxParallelism(1);
}
}

0 comments on commit 094e925

Please sign in to comment.