Class DiskTierProducerAgent
java.lang.Object
org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.disk.DiskTierProducerAgent
- All Implemented Interfaces:
AutoCloseable,NettyServiceProducer,TierProducerAgent
public class DiskTierProducerAgent
extends Object
implements TierProducerAgent, NettyServiceProducer
The disk tier implementation of
TierProducerAgent.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the agent.voidconnectionBroken(NettyConnectionId connectionId) NettyConnectionWriterrelated to a connection id will be notified when the netty connection is broken.voidconnectionEstablished(TieredStorageSubpartitionId subpartitionId, NettyConnectionWriter nettyConnectionWriter) NettyConnectionWriterwill be created when a netty connection is established for a subpartition.booleantryStartNewSegment(TieredStorageSubpartitionId subpartitionId, int segmentId, int minNumBuffers) Try to start a new segment in the Tier.booleantryWrite(TieredStorageSubpartitionId subpartitionId, Buffer finishedBuffer, Object bufferOwner, int numRemainingConsecutiveBuffers) Writes the finishedBufferto the consumer.
-
Method Details
-
tryStartNewSegment
public boolean tryStartNewSegment(TieredStorageSubpartitionId subpartitionId, int segmentId, int minNumBuffers) Description copied from interface:TierProducerAgentTry to start a new segment in the Tier.- Specified by:
tryStartNewSegmentin interfaceTierProducerAgent- Parameters:
subpartitionId- subpartition id that the new segment belongs tosegmentId- id of the new segmentminNumBuffers- the minimum number of buffers that are expected to be written to the newly created segment.- Returns:
- true if the segment can be started, false otherwise.
-
tryWrite
public boolean tryWrite(TieredStorageSubpartitionId subpartitionId, Buffer finishedBuffer, Object bufferOwner, int numRemainingConsecutiveBuffers) Description copied from interface:TierProducerAgentWrites the finishedBufferto the consumer.Note that the method is successfully executed (without throwing any exception), the buffer should be released by the caller, otherwise the tier should be responsible to recycle the buffer.
- Specified by:
tryWritein interfaceTierProducerAgent- Parameters:
subpartitionId- the subpartition id that the buffer is writing tofinishedBuffer- the writing bufferbufferOwner- the current owner of this writing buffernumRemainingConsecutiveBuffers- number of buffers that would be passed in the following invocations and should be written to the same segment as this one- Returns:
- return true if the buffer is written successfully, return false if the current segment can not store this buffer(and the following consecutive ones) and the current segment is finished. When returning false, the agent should try start a new segment before writing the buffer.
-
connectionEstablished
public void connectionEstablished(TieredStorageSubpartitionId subpartitionId, NettyConnectionWriter nettyConnectionWriter) Description copied from interface:NettyServiceProducerNettyConnectionWriterwill be created when a netty connection is established for a subpartition.- Specified by:
connectionEstablishedin interfaceNettyServiceProducer- Parameters:
subpartitionId- subpartition id indicates the id of subpartition.nettyConnectionWriter- writer is used to write buffers to netty connection.
-
connectionBroken
Description copied from interface:NettyServiceProducerNettyConnectionWriterrelated to a connection id will be notified when the netty connection is broken.- Specified by:
connectionBrokenin interfaceNettyServiceProducer- Parameters:
connectionId- connection id is the id of connection.
-
close
public void close()Description copied from interface:TierProducerAgentClose the agent.Note this only releases resources directly hold by the agent, which excludes resources managed by the resource registry.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTierProducerAgent
-