Package io.trino.execution.buffer
Interface OutputBuffer
- All Known Implementing Classes:
ArbitraryOutputBuffer,BroadcastOutputBuffer,LazyOutputBuffer,PartitionedOutputBuffer,SpoolingExchangeOutputBuffer
public interface OutputBuffer
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort the buffer, discarding all pages, but blocking readers.voidacknowledge(PipelinedOutputBuffers.OutputBufferId bufferId, long token) Acknowledges the previously received pages from the output buffer.voidaddStateChangeListener(StateMachine.StateChangeListener<BufferState> stateChangeListener) Add a listener which fires anytime the buffer state changes.voiddestroy()Destroys the buffer, discarding all pages.voiddestroy(PipelinedOutputBuffers.OutputBufferId bufferId) Destroys the specified output buffer, discarding all pages.voidAdds a split-up page to a specific partition.voidAdds a split-up page to an unpartitioned buffer.com.google.common.util.concurrent.ListenableFuture<BufferResult> get(PipelinedOutputBuffers.OutputBufferId bufferId, long token, io.airlift.units.DataSize maxSize) Gets pages from the output buffer, and acknowledges all pages received from the last request.Returns non empty failure cause if the buffer is in stateBufferState.FAILEDgetInfo()Gets the current state of this buffer.longgetState()Get buffer stateGet buffer statusdoubleGet the memory utilization percentage.com.google.common.util.concurrent.ListenableFuture<Void> isFull()Get a future that will be completed when the buffer is not full.voidNotify buffer that no more pages will be added.voidsetOutputBuffers(OutputBuffers newOutputBuffers) Updates the buffer configuration.
-
Method Details
-
getInfo
OutputBufferInfo getInfo()Gets the current state of this buffer. This method is guaranteed to not block or acquire contended locks, but the stats in the info object may be internally inconsistent. -
getState
BufferState getState()Get buffer state -
getUtilization
double getUtilization()Get the memory utilization percentage. -
getStatus
OutputBufferStatus getStatus()Get buffer status -
addStateChangeListener
Add a listener which fires anytime the buffer state changes. Listener is always notified asynchronously using a dedicated notification thread pool so, care should be taken to avoid leakingthiswhen adding a listener in a constructor. Additionally, it is possible notifications are observed out of order due to the asynchronous execution. -
setOutputBuffers
Updates the buffer configuration. -
get
com.google.common.util.concurrent.ListenableFuture<BufferResult> get(PipelinedOutputBuffers.OutputBufferId bufferId, long token, io.airlift.units.DataSize maxSize) Gets pages from the output buffer, and acknowledges all pages received from the last request. The initial token is zero. Subsequent tokens are acquired from the next token field in the BufferResult returned from the previous request. If the buffer result is marked as complete, the client must call abort to acknowledge receipt of the final state. -
acknowledge
Acknowledges the previously received pages from the output buffer. -
destroy
Destroys the specified output buffer, discarding all pages. -
isFull
com.google.common.util.concurrent.ListenableFuture<Void> isFull()Get a future that will be completed when the buffer is not full. -
enqueue
Adds a split-up page to an unpartitioned buffer. If no-more-pages has been set, the enqueue page call is ignored. This can happen with limit queries. -
enqueue
Adds a split-up page to a specific partition. If no-more-pages has been set, the enqueue page call is ignored. This can happen with limit queries. -
setNoMorePages
void setNoMorePages()Notify buffer that no more pages will be added. Any future calls to enqueue a page are ignored. -
destroy
void destroy()Destroys the buffer, discarding all pages. -
abort
void abort()Abort the buffer, discarding all pages, but blocking readers. It is expected that readers will be unblocked when the failed query is cleaned up. -
getPeakMemoryUsage
long getPeakMemoryUsage()- Returns:
- the peak memory usage of this output buffer.
-
getFailureCause
Returns non empty failure cause if the buffer is in stateBufferState.FAILED
-