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 the partition and propagate failure cause to the consumer if possible.
AvailabilityProvider.AvailabilityHelper
AVAILABLE
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()
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, or
void setup() throws IOException
IOException
ResultPartitionID getPartitionId()
int getNumberOfSubpartitions()
int getNumTargetKeyGroups()
void emitRecord(ByteBuffer record, int targetSubpartition) throws IOException
IOException
void broadcastRecord(ByteBuffer record) throws IOException
IOException
void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
AbstractEvent
to all channels.IOException
void notifyEndOfData() throws IOException
ResultPartitionWriter
have emitted all the
user records.IOException
CompletableFuture<Void> getAllDataProcessedFuture()
void setMetricGroup(TaskIOMetricGroup metrics)
ResultPartitionWriter
.ResultSubpartitionView createSubpartitionView(int index, BufferAvailabilityListener availabilityListener) throws IOException
IOException
void 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.
IOException
boolean isFinished()
void release(Throwable cause)
boolean isReleased()
void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.