public interface ResultPartitionWriter extends AutoCloseable, AvailabilityProvider
If AutoCloseable.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 |
---|---|
default boolean |
addBufferConsumer(BufferConsumer bufferConsumer,
int subpartitionIndex)
Adds the bufferConsumer to the subpartition with the given index.
|
boolean |
addBufferConsumer(BufferConsumer bufferConsumer,
int subpartitionIndex,
boolean isPriorityEvent)
Adds the bufferConsumer to the subpartition with the given index.
|
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 consumption from enqueued
BufferConsumers in one
specified subpartition. |
void |
flushAll()
Manually trigger consumption from enqueued
BufferConsumers in all
subpartitions. |
BufferBuilder |
getBufferBuilder(int targetChannel)
Requests a
BufferBuilder from this partition for writing data. |
int |
getNumberOfSubpartitions() |
int |
getNumTargetKeyGroups() |
ResultPartitionID |
getPartitionId() |
ResultSubpartition |
getSubpartition(int subpartitionIndex)
Returns the subpartition with the given index.
|
void |
readRecoveredState(ChannelStateReader stateReader)
Reads the previous output states with the given reader for unaligned checkpoint.
|
void |
setup()
Setup partition, potentially heavy-weight, blocking operation comparing to just creation.
|
BufferBuilder |
tryGetBufferBuilder(int targetChannel)
Try to request a
BufferBuilder from this partition for writing data. |
close
getAvailableFuture, isApproximatelyAvailable, isAvailable
void setup() throws IOException
IOException
void readRecoveredState(ChannelStateReader stateReader) throws IOException, InterruptedException
IOException
InterruptedException
ResultPartitionID getPartitionId()
int getNumberOfSubpartitions()
int getNumTargetKeyGroups()
BufferBuilder getBufferBuilder(int targetChannel) throws IOException, InterruptedException
BufferBuilder
from this partition for writing data.IOException
InterruptedException
BufferBuilder tryGetBufferBuilder(int targetChannel) throws IOException
BufferBuilder
from this partition for writing data.
Returns null
if no buffer is available or the buffer provider has been
destroyed.
IOException
boolean addBufferConsumer(BufferConsumer bufferConsumer, int subpartitionIndex, boolean isPriorityEvent) throws IOException
This method takes the ownership of the passed bufferConsumer
and thus is
responsible for releasing it's resources.
To avoid problems with data re-ordering, before adding new BufferConsumer
the
previously added one the given subpartitionIndex
must be marked as BufferConsumer.isFinished()
.
IOException
default boolean addBufferConsumer(BufferConsumer bufferConsumer, int subpartitionIndex) throws IOException
This method takes the ownership of the passed bufferConsumer
and thus is
responsible for releasing it's resources.
To avoid problems with data re-ordering, before adding new BufferConsumer
the
previously added one the given subpartitionIndex
must be marked as BufferConsumer.isFinished()
.
IOException
ResultSubpartition getSubpartition(int subpartitionIndex)
void flushAll()
BufferConsumers
in all
subpartitions.void flush(int subpartitionIndex)
BufferConsumers
in one
specified subpartition.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
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.