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.AvailabilityHelper
AVAILABLE
Modifier and Type | Method and Description |
---|---|
void |
abortCheckpoint(long checkpointId,
CheckpointException cause)
Abort the checkpoint.
|
void |
alignedBarrierTimeout(long checkpointId)
Timeout the aligned barrier to unaligned barrier.
|
void |
broadcastEvent(AbstractEvent event,
boolean isPriorityEvent)
Writes the given
AbstractEvent to all subpartitions. |
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(ResultSubpartitionIndexSet indexSet,
BufferAvailabilityListener availabilityListener)
Returns a reader for the subpartition with the given index range.
|
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 |
setMaxOverdraftBuffersPerGate(int maxOverdraftBuffersPerGate)
Sets the max overdraft buffer size of per gate.
|
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 setMaxOverdraftBuffersPerGate(int maxOverdraftBuffersPerGate)
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 subpartitions.IOException
void alignedBarrierTimeout(long checkpointId) throws IOException
IOException
void abortCheckpoint(long checkpointId, CheckpointException cause)
void 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))IOException
CompletableFuture<Void> getAllDataProcessedFuture()
void setMetricGroup(TaskIOMetricGroup metrics)
ResultPartitionWriter
.ResultSubpartitionView createSubpartitionView(ResultSubpartitionIndexSet indexSet, 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–2024 The Apache Software Foundation. All rights reserved.