Class TransactionalSegmentPublisher
java.lang.Object
org.apache.druid.segment.realtime.appenderator.TransactionalSegmentPublisher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract SegmentPublishResultpublishAnnotatedSegments(Set<DataSegment> segmentsToBeOverwritten, Set<DataSegment> segmentsToPublish, Object commitMetadata, SegmentSchemaMapping segmentSchemaMapping) Publish segments, along with some commit metadata, in a single transaction.final SegmentPublishResultpublishSegments(Set<DataSegment> segmentsToBeOverwritten, Set<DataSegment> segmentsToPublish, Function<Set<DataSegment>, Set<DataSegment>> outputSegmentsAnnotateFunction, Object commitMetadata, SegmentSchemaMapping segmentSchemaMapping) Applies the given annotate function on the segments and tries to publish them.boolean
-
Constructor Details
-
TransactionalSegmentPublisher
public TransactionalSegmentPublisher()
-
-
Method Details
-
publishAnnotatedSegments
public abstract SegmentPublishResult publishAnnotatedSegments(@Nullable Set<DataSegment> segmentsToBeOverwritten, Set<DataSegment> segmentsToPublish, @Nullable Object commitMetadata, @Nullable SegmentSchemaMapping segmentSchemaMapping) throws IOException Publish segments, along with some commit metadata, in a single transaction.- Returns:
- publish result that indicates if segments were published or not. If it is unclear if the segments were published or not, this method must throw an exception. The behavior is similar to IndexerSQLMetadataStorageCoordinator's announceHistoricalSegments.
- Throws:
IOException- if there was an I/O error when publishingRuntimeException- if we cannot tell if the segments were published or not, for some other reason
-
publishSegments
public final SegmentPublishResult publishSegments(@Nullable Set<DataSegment> segmentsToBeOverwritten, Set<DataSegment> segmentsToPublish, Function<Set<DataSegment>, Set<DataSegment>> outputSegmentsAnnotateFunction, @Nullable Object commitMetadata, @Nullable SegmentSchemaMapping segmentSchemaMapping) throws IOExceptionApplies the given annotate function on the segments and tries to publish them. If the action fails with a retryable failure, it can be retried uptoMAX_RETRIEStimes.- Throws:
IOException
-
supportsEmptyPublish
public boolean supportsEmptyPublish()- Returns:
- true if this publisher has action to take when publishing with an empty segment set. The publisher used by the seekable stream tasks is an example where this is true.
-