mirror of https://github.com/apache/druid.git
Merge pull request #934 from metamx/fix-hadoop-metadata-injection
metadata update handler injection not needed for indexing service
This commit is contained in:
commit
27d4b2bdea
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package io.druid.indexer;
|
package io.druid.indexer;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.metamx.common.logger.Logger;
|
import com.metamx.common.logger.Logger;
|
||||||
|
@ -45,6 +46,11 @@ public class HadoopDruidIndexerJob implements Jobby
|
||||||
config.verify();
|
config.verify();
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
|
Preconditions.checkArgument(
|
||||||
|
!config.isUpdaterJobSpecSet() || handler != null,
|
||||||
|
"MetadataStorageUpdaterJobHandler must not be null if ioConfig.metadataUpdateSpec is specified."
|
||||||
|
);
|
||||||
|
|
||||||
if (config.isUpdaterJobSpecSet()) {
|
if (config.isUpdaterJobSpecSet()) {
|
||||||
metadataStorageUpdaterJob = new MetadataStorageUpdaterJob(
|
metadataStorageUpdaterJob = new MetadataStorageUpdaterJob(
|
||||||
config,
|
config,
|
||||||
|
|
|
@ -290,10 +290,16 @@ public class HadoopIndexTask extends AbstractTask
|
||||||
.withTuningConfig(theSchema.getTuningConfig().withVersion(version))
|
.withTuningConfig(theSchema.getTuningConfig().withVersion(version))
|
||||||
);
|
);
|
||||||
|
|
||||||
HadoopDruidIndexerJob job = new HadoopDruidIndexerJob(
|
// MetadataStorageUpdaterJobHandler is only needed when running standalone without indexing service
|
||||||
config,
|
// In that case the whatever runs the Hadoop Index Task must ensure MetadataStorageUpdaterJobHandler
|
||||||
injector.getInstance(MetadataStorageUpdaterJobHandler.class)
|
// can be injected based on the configuration given in config.getSchema().getIOConfig().getMetadataUpdateSpec()
|
||||||
);
|
final MetadataStorageUpdaterJobHandler maybeHandler;
|
||||||
|
if (config.isUpdaterJobSpecSet()) {
|
||||||
|
maybeHandler = injector.getInstance(MetadataStorageUpdaterJobHandler.class);
|
||||||
|
} else {
|
||||||
|
maybeHandler = null;
|
||||||
|
}
|
||||||
|
HadoopDruidIndexerJob job = new HadoopDruidIndexerJob(config, maybeHandler);
|
||||||
|
|
||||||
log.info("Starting a hadoop index generator job...");
|
log.info("Starting a hadoop index generator job...");
|
||||||
if (job.run()) {
|
if (job.run()) {
|
||||||
|
|
Loading…
Reference in New Issue