Repository: tez Updated Branches: refs/heads/branch-0.8 6f8ddf429 -> 84a2a41e1
TEZ-3568. Update SecurityUtils configuration to pick user provided configuration. Contributed by Harish Jaiprakash. (cherry picked from commit c909f45a71672f072ddda4b63eeaf79bac7c7f95) Project: http://git-wip-us.apache.org/repos/asf/tez/repo Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/84a2a41e Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/84a2a41e Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/84a2a41e Branch: refs/heads/branch-0.8 Commit: 84a2a41e1fbb354473ee3f053fecb9079a547375 Parents: 6f8ddf4 Author: Siddharth Seth <[email protected]> Authored: Mon Jan 9 15:20:16 2017 -0800 Committer: Siddharth Seth <[email protected]> Committed: Mon Jan 9 15:21:52 2017 -0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/tez/common/TezUtilsInternal.java | 21 ++++++++++++++++++++ .../org/apache/tez/dag/app/DAGAppMaster.java | 2 ++ .../org/apache/tez/runtime/task/TezChild.java | 2 ++ 4 files changed, 26 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tez/blob/84a2a41e/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index c740bf3..1b808fa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -7,6 +7,7 @@ INCOMPATIBLE CHANGES ALL CHANGES: + TEZ-3568. Update SecurityUtils configuration to pick user provided configuration. TEZ-3559. TEZ_LIB_URIS doesn't work with schemes different than the defaultFS TEZ-3549. TaskAttemptImpl does not initialize TEZ_TASK_PROGRESS_STUCK_INTERVAL_MS correctly TEZ-3537. ArrayIndexOutOfBoundsException with empty environment variables/Port YARN-3768 to Tez http://git-wip-us.apache.org/repos/asf/tez/blob/84a2a41e/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java ---------------------------------------------------------------------- diff --git a/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java b/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java index 08a9aa8..b8c05e7 100644 --- a/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java +++ b/tez-common/src/main/java/org/apache/tez/common/TezUtilsInternal.java @@ -22,6 +22,8 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.nio.charset.Charset; import java.util.BitSet; import java.util.List; @@ -39,6 +41,7 @@ import com.google.protobuf.TextFormat; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.Credentials; +import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.log4j.Appender; import org.apache.tez.dag.api.DagTypeConverters; @@ -48,6 +51,7 @@ import org.apache.tez.dag.records.TezVertexID; import org.apache.tez.hadoop.shim.HadoopShim; import org.apache.tez.serviceplugins.api.TaskAttemptEndReason; import org.apache.tez.dag.api.TezConstants; +import org.apache.tez.dag.api.TezUncheckedException; import org.apache.tez.dag.api.records.DAGProtos; import org.apache.tez.dag.api.records.DAGProtos.ConfigurationProto; import org.apache.tez.dag.api.records.DAGProtos.PlanKeyValuePair; @@ -354,4 +358,21 @@ public class TezUtilsInternal { hadoopShim.setHadoopCallerContext("tez_app:" + appID.toString()); } + @Private + public static void setSecurityUtilConfigration(Logger log, Configuration conf) { + // Use reflection to invoke SecurityUtil.setConfiguration when available, version 2.6.0 of + // hadoop does not support it, it is currently available from 2.9.0. + // Remove this when the minimum supported hadoop version has the above method. + Class<SecurityUtil> clz = SecurityUtil.class; + try { + Method method = clz.getMethod("setConfiguration", Configuration.class); + method.invoke(null, conf); + } catch (NoSuchMethodException e) { + // This is not available, so ignore it. + } catch (SecurityException | IllegalAccessException | IllegalArgumentException | + InvocationTargetException e) { + log.warn("Error invoking SecurityUtil.setConfiguration: ", e); + throw new TezUncheckedException("Error invoking SecurityUtil.setConfiguration", e); + } + } } http://git-wip-us.apache.org/repos/asf/tez/blob/84a2a41e/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java ---------------------------------------------------------------------- diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java index 61c6f76..7ad6405 100644 --- a/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java +++ b/tez-dag/src/main/java/org/apache/tez/dag/app/DAGAppMaster.java @@ -2363,6 +2363,8 @@ public class DAGAppMaster extends AbstractService { UserGroupInformation.setConfiguration(conf); Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials(); + TezUtilsInternal.setSecurityUtilConfigration(LOG, conf); + DAGAppMaster appMaster = new DAGAppMaster(applicationAttemptId, containerId, nodeHostString, Integer.parseInt(nodePortString), http://git-wip-us.apache.org/repos/asf/tez/blob/84a2a41e/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java ---------------------------------------------------------------------- diff --git a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java index 2255ed7..0417688 100644 --- a/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java +++ b/tez-runtime-internals/src/main/java/org/apache/tez/runtime/task/TezChild.java @@ -462,6 +462,8 @@ public class TezChild { // for each and every task, and reading it back from disk. Also needs to be per vertex. Limits.setConfiguration(conf); + TezUtilsInternal.setSecurityUtilConfigration(LOG, conf); + // singleton of ObjectRegistry for this JVM ObjectRegistryImpl objectRegistry = new ObjectRegistryImpl();
