use of org.apache.flink.api.connector.sink2.TwoPhaseCommittingSink.PrecommittingSinkWriter in project flink by apache.
the class SinkWriterOperator method emitCommittables.
private void emitCommittables(Long checkpointId) throws IOException, InterruptedException {
if (!emitDownstream) {
// although no committables are forwarded
if (sinkWriter instanceof PrecommittingSinkWriter) {
((PrecommittingSinkWriter<?, ?>) sinkWriter).prepareCommit();
}
return;
}
Collection<CommT> committables = ((PrecommittingSinkWriter<?, CommT>) sinkWriter).prepareCommit();
StreamingRuntimeContext runtimeContext = getRuntimeContext();
int indexOfThisSubtask = runtimeContext.getIndexOfThisSubtask();
output.collect(new StreamRecord<>(new CommittableSummary<>(indexOfThisSubtask, runtimeContext.getNumberOfParallelSubtasks(), checkpointId, committables.size(), committables.size(), 0)));
for (CommT committable : committables) {
output.collect(new StreamRecord<>(new CommittableWithLineage<>(committable, checkpointId, indexOfThisSubtask)));
}
}
Aggregations