use of io.prestosql.snapshot.MultiInputSnapshotState in project hetu-core by openlookeng.
the class PartitionedOutputBuffer method enqueue.
@Override
public void enqueue(int partitionNumber, List<SerializedPage> pages, String origin) {
requireNonNull(pages, "pages is null");
// this can happen with a limit query
if (!state.get().canAddPages()) {
return;
}
if (!isSnapshotEnabled) {
doEnqueue(partitionNumber, pages);
return;
}
// but still arrives at the buffer *before* the marker. These pages are potentially used twice, if we resume from this marker.
if (pages.size() == 1 && pages.get(0).isMarkerPage()) {
// Broadcast marker to all clients
for (int i = 0; i < partitions.size(); i++) {
MultiInputSnapshotState snapshotState = snapshotStates.get(i);
synchronized (snapshotState) {
// All marker related processing is handled by this utility method
List<SerializedPage> processedPages = snapshotState.processSerializedPages(pages, origin);
doEnqueue(i, processedPages);
}
}
} else {
MultiInputSnapshotState snapshotState = snapshotStates.get(partitionNumber);
synchronized (snapshotState) {
List<SerializedPage> processedPages = snapshotState.processSerializedPages(pages, origin);
doEnqueue(partitionNumber, processedPages);
}
}
}
Aggregations