YARN-8346. Upgrading to 3.1 kills running containers with error 'Opportunistic container queue is full'. Contributed by Jason Lowe.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4cc0c9b0 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4cc0c9b0 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4cc0c9b0 Branch: refs/heads/YARN-7402 Commit: 4cc0c9b0baa93f5a1c0623eee353874e858a7caa Parents: 7a87add Author: Rohith Sharma K S <rohithsharm...@apache.org> Authored: Thu May 24 12:23:47 2018 +0530 Committer: Rohith Sharma K S <rohithsharm...@apache.org> Committed: Thu May 24 12:23:47 2018 +0530 ---------------------------------------------------------------------- .../yarn/security/ContainerTokenIdentifier.java | 4 ++-- .../yarn/security/TestYARNTokenIdentifier.java | 25 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/4cc0c9b0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java index 37c74b8..8dea65f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java @@ -292,7 +292,7 @@ public class ContainerTokenIdentifier extends TokenIdentifier { */ public ContainerType getContainerType(){ if (!proto.hasContainerType()) { - return null; + return ContainerType.TASK; } return convertFromProtoFormat(proto.getContainerType()); } @@ -303,7 +303,7 @@ public class ContainerTokenIdentifier extends TokenIdentifier { */ public ExecutionType getExecutionType(){ if (!proto.hasExecutionType()) { - return null; + return ExecutionType.GUARANTEED; } return convertFromProtoFormat(proto.getExecutionType()); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/4cc0c9b0/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/security/TestYARNTokenIdentifier.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/security/TestYARNTokenIdentifier.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/security/TestYARNTokenIdentifier.java index 51fbe9a..8109b5e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/security/TestYARNTokenIdentifier.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/security/TestYARNTokenIdentifier.java @@ -37,6 +37,7 @@ import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.impl.pb.LogAggregationContextPBImpl; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.nodelabels.CommonNodeLabelsManager; +import org.apache.hadoop.yarn.proto.YarnSecurityTokenProtos.ContainerTokenIdentifierProto; import org.apache.hadoop.yarn.proto.YarnSecurityTokenProtos.YARNDelegationTokenIdentifierProto; import org.apache.hadoop.yarn.security.client.ClientToAMTokenIdentifier; import org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier; @@ -170,6 +171,30 @@ public class TestYARNTokenIdentifier { } @Test + public void testContainerTokenIdentifierProtoMissingFields() + throws IOException { + ContainerTokenIdentifierProto.Builder builder = + ContainerTokenIdentifierProto.newBuilder(); + ContainerTokenIdentifierProto proto = builder.build(); + Assert.assertFalse(proto.hasContainerType()); + Assert.assertFalse(proto.hasExecutionType()); + Assert.assertFalse(proto.hasNodeLabelExpression()); + + byte[] tokenData = proto.toByteArray(); + DataInputBuffer dib = new DataInputBuffer(); + dib.reset(tokenData, tokenData.length); + ContainerTokenIdentifier tid = new ContainerTokenIdentifier(); + tid.readFields(dib); + + Assert.assertEquals("container type", + ContainerType.TASK, tid.getContainerType()); + Assert.assertEquals("execution type", + ExecutionType.GUARANTEED, tid.getExecutionType()); + Assert.assertEquals("node label expression", + CommonNodeLabelsManager.NO_LABEL, tid.getNodeLabelExpression()); + } + + @Test public void testContainerTokenIdentifier() throws IOException { testContainerTokenIdentifier(false, false); } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org