use of org.apache.druid.indexing.common.actions.ResetDataSourceMetadataAction in project druid by druid-io.
the class SeekableStreamIndexTaskRunner method sendResetRequestAndWait.
protected void sendResetRequestAndWait(Map<StreamPartition<PartitionIdType>, SequenceOffsetType> outOfRangePartitions, TaskToolbox taskToolbox) throws IOException {
Map<PartitionIdType, SequenceOffsetType> partitionOffsetMap = CollectionUtils.mapKeys(outOfRangePartitions, StreamPartition::getPartitionId);
boolean result = taskToolbox.getTaskActionClient().submit(new ResetDataSourceMetadataAction(task.getDataSource(), createDataSourceMetadata(new SeekableStreamEndSequenceNumbers<>(ioConfig.getStartSequenceNumbers().getStream(), partitionOffsetMap))));
if (result) {
log.makeAlert("Offsets were reset automatically, potential data duplication or loss").addData("task", task.getId()).addData("dataSource", task.getDataSource()).addData("partitions", partitionOffsetMap.keySet()).emit();
requestPause();
} else {
log.makeAlert("Failed to send offset reset request").addData("task", task.getId()).addData("dataSource", task.getDataSource()).addData("partitions", ImmutableSet.copyOf(partitionOffsetMap.keySet())).emit();
}
}
Aggregations