Author: cnauroth Date: Tue Oct 1 22:33:23 2013 New Revision: 1528234 URL: http://svn.apache.org/r1528234 Log: YARN-1215. Merging change r1528233 from trunk to branch-2.
Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestConverterUtils.java Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1528234&r1=1528233&r2=1528234&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Tue Oct 1 22:33:23 2013 @@ -39,6 +39,8 @@ Release 2.3.0 - UNRELEASED YARN-1188. The context of QueueMetrics becomes default when using FairScheduler (Tsuyoshi Ozawa via Sandy Ryza) + YARN-1215. Yarn URL should include userinfo. (Chuan Liu via cnauroth) + Release 2.2.0 - UNRELEASED INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java?rev=1528234&r1=1528233&r2=1528234&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java Tue Oct 1 22:33:23 2013 @@ -57,6 +57,22 @@ public abstract class URL { public abstract void setScheme(String scheme); /** + * Get the user info of the URL. + * @return user info of the URL + */ + @Public + @Stable + public abstract String getUserInfo(); + + /** + * Set the user info of the URL. + * @param userInfo user info of the URL + */ + @Public + @Stable + public abstract void setUserInfo(String userInfo); + + /** * Get the host of the URL. * @return host of the URL */ Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto?rev=1528234&r1=1528233&r2=1528234&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto Tue Oct 1 22:33:23 2013 @@ -100,6 +100,7 @@ message URLProto { optional string host = 2; optional int32 port = 3; optional string file = 4; + optional string userInfo = 5; } enum LocalResourceVisibilityProto { Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java?rev=1528234&r1=1528233&r2=1528234&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/URLPBImpl.java Tue Oct 1 22:33:23 2013 @@ -113,6 +113,26 @@ public class URLPBImpl extends URL { } builder.setScheme((scheme)); } + + @Override + public String getUserInfo() { + URLProtoOrBuilder p = viaProto ? proto : builder; + if (!p.hasUserInfo()) { + return null; + } + return (p.getUserInfo()); + } + + @Override + public void setUserInfo(String userInfo) { + maybeInitBuilder(); + if (userInfo == null) { + builder.clearUserInfo(); + return; + } + builder.setUserInfo((userInfo)); + } + @Override public String getHost() { URLProtoOrBuilder p = viaProto ? proto : builder; Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java?rev=1528234&r1=1528233&r2=1528234&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java Tue Oct 1 22:33:23 2013 @@ -69,6 +69,9 @@ public class ConverterUtils { String authority = ""; if (url.getHost() != null) { authority = url.getHost(); + if (url.getUserInfo() != null) { + authority = url.getUserInfo() + "@" + authority; + } if (url.getPort() > 0) { authority += ":" + url.getPort(); } @@ -102,6 +105,9 @@ public class ConverterUtils { if (uri.getHost() != null) { url.setHost(uri.getHost()); } + if (uri.getUserInfo() != null) { + url.setUserInfo(uri.getUserInfo()); + } url.setPort(uri.getPort()); url.setScheme(uri.getScheme()); url.setFile(uri.getPath()); Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestConverterUtils.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestConverterUtils.java?rev=1528234&r1=1528233&r2=1528234&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestConverterUtils.java (original) +++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestConverterUtils.java Tue Oct 1 22:33:23 2013 @@ -39,6 +39,14 @@ public class TestConverterUtils { } @Test + public void testConvertUrlWithUserinfo() throws URISyntaxException { + Path expectedPath = new Path("foo://username:passw...@example.com:8042"); + URL url = ConverterUtils.getYarnUrlFromPath(expectedPath); + Path actualPath = ConverterUtils.getPathFromYarnURL(url); + assertEquals(expectedPath, actualPath); + } + + @Test public void testContainerId() throws URISyntaxException { ContainerId id = TestContainerId.newContainerId(0, 0, 0, 0); String cid = ConverterUtils.toString(id);