From 3447934a75f970b5853d7c217f3c861f81316acf Mon Sep 17 00:00:00 2001 From: Lucas Capistrant Date: Mon, 16 Nov 2020 11:59:14 -0600 Subject: [PATCH] Ensure Krb auth before killing YARN apps in graceful shutdown (#9785) --- .../src/main/java/org/apache/druid/indexer/JobHelper.java | 5 ++--- .../apache/druid/indexing/common/task/HadoopIndexTask.java | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java index 84f5c8f8127..c047c2b34e4 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/JobHelper.java @@ -97,9 +97,8 @@ public class JobHelper * Dose authenticate against a secured hadoop cluster * In case of any bug fix make sure to fix the code at HdfsStorageAuthentication#authenticate as well. * - * @param config containing the principal name and keytab path. */ - public static void authenticate(HadoopDruidIndexerConfig config) + public static void authenticate() { String principal = HadoopDruidIndexerConfig.HADOOP_KERBEROS_CONFIG.getPrincipal(); String keytab = HadoopDruidIndexerConfig.HADOOP_KERBEROS_CONFIG.getKeytab(); @@ -348,7 +347,7 @@ public class JobHelper public static void ensurePaths(HadoopDruidIndexerConfig config) { - authenticate(config); + authenticate(); // config.addInputPaths() can have side-effects ( boo! :( ), so this stuff needs to be done before anything else try { Job job = Job.getInstance( diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java index e24df910e1c..1236e359bd3 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java @@ -35,6 +35,7 @@ import org.apache.druid.indexer.HadoopDruidIndexerConfig; import org.apache.druid.indexer.HadoopDruidIndexerJob; import org.apache.druid.indexer.HadoopIngestionSpec; import org.apache.druid.indexer.IngestionState; +import org.apache.druid.indexer.JobHelper; import org.apache.druid.indexer.MetadataStorageUpdaterJobHandler; import org.apache.druid.indexer.TaskMetricsGetter; import org.apache.druid.indexer.TaskMetricsUtils; @@ -762,6 +763,8 @@ public class HadoopIndexTask extends HadoopTask implements ChatHandler } if (jobId != null) { + // This call to JobHelper#authenticate will be transparent if already authenticated or using inseucre Hadoop. + JobHelper.authenticate(); int res = ToolRunner.run(new JobClient(), new String[]{ "-kill", jobId