Class BatchAppenderatorDriver
java.lang.Object
org.apache.druid.segment.realtime.appenderator.BaseAppenderatorDriver
org.apache.druid.segment.realtime.appenderator.BatchAppenderatorDriver
- All Implemented Interfaces:
Closeable,AutoCloseable
This class is specifialized for batch ingestion. In batch ingestion, the segment lifecycle is like:
APPENDING -> PUSHED_AND_DROPPED -> PUBLISHED
- APPENDING: Segment is available for appending.
- PUSHED_AND_DROPPED: Segment is pushed to deep storage and dropped from the local storage.
- PUBLISHED: Segment's metadata is published to metastore.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.druid.segment.realtime.appenderator.BaseAppenderatorDriver
BaseAppenderatorDriver.SegmentsForSequence -
Field Summary
Fields inherited from class org.apache.druid.segment.realtime.appenderator.BaseAppenderatorDriver
appenderator, executor, segments -
Constructor Summary
ConstructorsConstructorDescriptionBatchAppenderatorDriver(Appenderator appenderator, SegmentAllocator segmentAllocator, PublishedSegmentRetriever segmentRetriever, DataSegmentKiller dataSegmentKiller) Creates a driver for batch ingestion. -
Method Summary
Modifier and TypeMethodDescriptionAdd a row.com.google.common.util.concurrent.ListenableFuture<SegmentsAndCommitMetadata>publishAll(Set<DataSegment> segmentsToBeOverwritten, Set<DataSegment> tombstones, TransactionalSegmentPublisher publisher, Function<Set<DataSegment>, Set<DataSegment>> outputSegmentsAnnotateFunction, SegmentSchemaMapping segmentSchemaMapping) Publish all segments.pushAllAndClear(long pushAndClearTimeoutMs) Push and drop all segments in theSegmentWithState.SegmentState.APPENDINGstate.startJob()startJob(AppenderatorDriverSegmentLockHelper lockHelper) This method always returns null because batch ingestion doesn't support restoring tasks on failures.Methods inherited from class org.apache.druid.segment.realtime.appenderator.BaseAppenderatorDriver
append, clear, close, getSegments
-
Constructor Details
-
BatchAppenderatorDriver
public BatchAppenderatorDriver(Appenderator appenderator, SegmentAllocator segmentAllocator, PublishedSegmentRetriever segmentRetriever, DataSegmentKiller dataSegmentKiller) Creates a driver for batch ingestion.
-
-
Method Details
-
startJob
-
startJob
This method always returns null because batch ingestion doesn't support restoring tasks on failures.- Specified by:
startJobin classBaseAppenderatorDriver- Returns:
- always null
-
add
Add a row. Must not be called concurrently from multiple threads.- Parameters:
row- the row to addsequenceName- sequenceName for this row's segment- Returns:
AppenderatorDriverAddResult- Throws:
IOException- if there is an I/O error while allocating or writing to a segment
-
pushAllAndClear
public SegmentsAndCommitMetadata pushAllAndClear(long pushAndClearTimeoutMs) throws InterruptedException, ExecutionException, TimeoutException Push and drop all segments in theSegmentWithState.SegmentState.APPENDINGstate.- Parameters:
pushAndClearTimeoutMs- timeout for pushing and dropping segments- Returns:
SegmentsAndCommitMetadatafor pushed and dropped segments- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
publishAll
public com.google.common.util.concurrent.ListenableFuture<SegmentsAndCommitMetadata> publishAll(@Nullable Set<DataSegment> segmentsToBeOverwritten, @Nullable Set<DataSegment> tombstones, TransactionalSegmentPublisher publisher, Function<Set<DataSegment>, Set<DataSegment>> outputSegmentsAnnotateFunction, SegmentSchemaMapping segmentSchemaMapping) Publish all segments.- Parameters:
segmentsToBeOverwritten- segments which can be overwritten by new segments published by the given publisherpublisher- segment publisher- Returns:
- a
ListenableFuturefor the publish task
-