Search in sources :

Example 11 with KafkaIndexTaskIOConfig

use of org.apache.druid.indexing.kafka.KafkaIndexTaskIOConfig in project druid by druid-io.

the class KafkaSupervisor method createIndexTasks.

@Override
protected List<SeekableStreamIndexTask<Integer, Long, KafkaRecordEntity>> createIndexTasks(int replicas, String baseSequenceName, ObjectMapper sortingMapper, TreeMap<Integer, Map<Integer, Long>> sequenceOffsets, SeekableStreamIndexTaskIOConfig taskIoConfig, SeekableStreamIndexTaskTuningConfig taskTuningConfig, RowIngestionMetersFactory rowIngestionMetersFactory) throws JsonProcessingException {
    final String checkpoints = sortingMapper.writerFor(CHECKPOINTS_TYPE_REF).writeValueAsString(sequenceOffsets);
    final Map<String, Object> context = createBaseTaskContexts();
    context.put(CHECKPOINTS_CTX_KEY, checkpoints);
    // Kafka index task always uses incremental handoff since 0.16.0.
    // The below is for the compatibility when you want to downgrade your cluster to something earlier than 0.16.0.
    // Kafka index task will pick up LegacyKafkaIndexTaskRunner without the below configuration.
    context.put("IS_INCREMENTAL_HANDOFF_SUPPORTED", true);
    List<SeekableStreamIndexTask<Integer, Long, KafkaRecordEntity>> taskList = new ArrayList<>();
    for (int i = 0; i < replicas; i++) {
        String taskId = IdUtils.getRandomIdWithPrefix(baseSequenceName);
        taskList.add(new KafkaIndexTask(taskId, new TaskResource(baseSequenceName, 1), spec.getDataSchema(), (KafkaIndexTaskTuningConfig) taskTuningConfig, (KafkaIndexTaskIOConfig) taskIoConfig, context, sortingMapper));
    }
    return taskList;
}
Also used : KafkaIndexTaskIOConfig(org.apache.druid.indexing.kafka.KafkaIndexTaskIOConfig) KafkaIndexTask(org.apache.druid.indexing.kafka.KafkaIndexTask) TaskResource(org.apache.druid.indexing.common.task.TaskResource) SeekableStreamIndexTask(org.apache.druid.indexing.seekablestream.SeekableStreamIndexTask) KafkaIndexTaskTuningConfig(org.apache.druid.indexing.kafka.KafkaIndexTaskTuningConfig) ArrayList(java.util.ArrayList)

Aggregations

KafkaIndexTaskIOConfig (org.apache.druid.indexing.kafka.KafkaIndexTaskIOConfig)11 KafkaIndexTask (org.apache.druid.indexing.kafka.KafkaIndexTask)10 Test (org.junit.Test)10 KafkaDataSourceMetadata (org.apache.druid.indexing.kafka.KafkaDataSourceMetadata)9 Executor (java.util.concurrent.Executor)8 TaskRunnerListener (org.apache.druid.indexing.overlord.TaskRunnerListener)8 ArrayList (java.util.ArrayList)6 Collection (java.util.Collection)5 HashMap (java.util.HashMap)5 TaskLocation (org.apache.druid.indexer.TaskLocation)5 RealtimeIndexTask (org.apache.druid.indexing.common.task.RealtimeIndexTask)5 Task (org.apache.druid.indexing.common.task.Task)5 ImmutableMap (com.google.common.collect.ImmutableMap)4 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 KafkaIndexTaskTuningConfig (org.apache.druid.indexing.kafka.KafkaIndexTaskTuningConfig)2 TaskReportData (org.apache.druid.indexing.seekablestream.supervisor.TaskReportData)2 File (java.io.File)1 TaskInfoProvider (org.apache.druid.indexing.common.TaskInfoProvider)1 TaskResource (org.apache.druid.indexing.common.task.TaskResource)1