public interface ResultPartitionWriter extends AutoCloseable, AvailabilityProvider
If close() is called before fail(Throwable) or finish(), it abruptly
triggers failure and cancellation of production. In this case fail(Throwable) still needs to be called afterwards to fully release all
resources associated the partition and propagate failure cause to the consumer if possible.
AvailabilityProvider.AvailabilityHelperAVAILABLE| Modifier and Type | Method and Description |
|---|---|
void |
broadcastEvent(AbstractEvent event,
boolean isPriorityEvent)
Writes the given
AbstractEvent to all channels. |
void |
broadcastRecord(ByteBuffer record)
Writes the given serialized record to all subpartitions.
|
void |
close()
Closes the partition writer which releases the allocated resource, for example the buffer
pool.
|
ResultSubpartitionView |
createSubpartitionView(int index,
BufferAvailabilityListener availabilityListener)
Returns a reader for the subpartition with the given index.
|
void |
emitRecord(ByteBuffer record,
int targetSubpartition)
Writes the given serialized record to the target subpartition.
|
void |
fail(Throwable throwable)
Fail the production of the partition.
|
void |
finish()
Successfully finish the production of the partition.
|
void |
flush(int subpartitionIndex)
Manually trigger the consumption of data from the given subpartitions.
|
void |
flushAll()
Manually trigger the consumption of data from all subpartitions.
|
CompletableFuture<Void> |
getAllDataProcessedFuture()
Gets the future indicating whether all the records has been processed by the downstream
tasks.
|
int |
getNumberOfSubpartitions() |
int |
getNumTargetKeyGroups() |
ResultPartitionID |
getPartitionId() |
boolean |
isFinished() |
boolean |
isReleased() |
void |
notifyEndOfData(StopMode mode)
Notifies the downstream tasks that this
ResultPartitionWriter have emitted all the
user records. |
void |
release(Throwable cause)
Releases the partition writer which releases the produced data and no reader can consume the
partition any more.
|
void |
setMetricGroup(TaskIOMetricGroup metrics)
Sets the metric group for the
ResultPartitionWriter. |
void |
setup()
Setup partition, potentially heavy-weight, blocking operation comparing to just creation.
|
and, getAvailableFuture, isApproximatelyAvailable, isAvailable, orvoid setup()
throws IOException
IOExceptionResultPartitionID getPartitionId()
int getNumberOfSubpartitions()
int getNumTargetKeyGroups()
void emitRecord(ByteBuffer record, int targetSubpartition) throws IOException
IOExceptionvoid broadcastRecord(ByteBuffer record) throws IOException
IOExceptionvoid broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
AbstractEvent to all channels.IOExceptionvoid notifyEndOfData(StopMode mode) throws IOException
ResultPartitionWriter have emitted all the
user records.mode - tells if we should flush all records or not (it is false in case of
stop-with-savepoint (--no-drain))IOExceptionCompletableFuture<Void> getAllDataProcessedFuture()
void setMetricGroup(TaskIOMetricGroup metrics)
ResultPartitionWriter.ResultSubpartitionView createSubpartitionView(int index, BufferAvailabilityListener availabilityListener) throws IOException
IOExceptionvoid flushAll()
void flush(int subpartitionIndex)
void fail(@Nullable Throwable throwable)
This method propagates non-null failure causes to consumers on a best-effort
basis. This call also leads to the release of all resources associated with the partition.
Closing of the partition is still needed afterwards if it has not been done before.
throwable - failure causevoid finish()
throws IOException
Closing of partition is still needed afterwards.
IOExceptionboolean isFinished()
void release(Throwable cause)
boolean isReleased()
void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.