[
https://issues.apache.org/jira/browse/HBASE-10717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13929914#comment-13929914
]
haosdent commented on HBASE-10717:
----------------------------------
"hadoop.security.token.service.use_ip" is false in
"/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/resources/core-site.xml".
So getCanonicalServiceName of "hdfs://localhost:8020" would return
"localhost:8020" while getCanonicalServiceName of "hdfs://127.0.0.1:8020" would
return "127.0.0.1:8020".
{code}
static {
Configuration conf = new Configuration();
boolean useIp = conf.getBoolean(
CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP,
CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP_DEFAULT);
setTokenServiceUseIp(useIp);
}
/**
* For use only by tests and initialization
*/
@InterfaceAudience.Private
static void setTokenServiceUseIp(boolean flag) {
useIpForTokenService = flag;
hostResolver = !useIpForTokenService
? new QualifiedHostResolver()
: new StandardHostResolver();
}
{code}
{code}
/**
* Construct the service key for a token
* @param addr InetSocketAddress of remote connection with a token
* @return "ip:port" or "host:port" depending on the value of
* hadoop.security.token.service.use_ip
*/
public static Text buildTokenService(InetSocketAddress addr) {
String host = null;
if (useIpForTokenService) {
if (addr.isUnresolved()) { // host has no ip address
throw new IllegalArgumentException(
new UnknownHostException(addr.getHostName())
);
}
host = addr.getAddress().getHostAddress();
} else {
host = addr.getHostName().toLowerCase();
}
return new Text(host + ":" + addr.getPort());
}
{code}
> TestFSHDFSUtils#testIsSameHdfs fails with IllegalArgumentException running
> against hadoop 2.3
> ---------------------------------------------------------------------------------------------
>
> Key: HBASE-10717
> URL: https://issues.apache.org/jira/browse/HBASE-10717
> Project: HBase
> Issue Type: Sub-task
> Reporter: Ted Yu
> Assignee: Ted Yu
> Fix For: 0.98.1, 0.99.0
>
> Attachments: 10717-v1.txt
>
>
> {code}
> testIsSameHdfs(org.apache.hadoop.hbase.util.TestFSHDFSUtils) Time elapsed:
> 0.001 sec <<< ERROR!
> java.lang.IllegalArgumentException: port out of range:-1
> at java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
> at java.net.InetSocketAddress.<init>(InetSocketAddress.java:224)
> at
> org.apache.hadoop.hbase.util.FSHDFSUtils.getNNAddresses(FSHDFSUtils.java:88)
> at
> org.apache.hadoop.hbase.util.FSHDFSUtils.isSameHdfs(FSHDFSUtils.java:118)
> at
> org.apache.hadoop.hbase.util.TestFSHDFSUtils.testIsSameHdfs(TestFSHDFSUtils.java:118)
> {code}
> It came from the following line:
> {code}
> InetSocketAddress addr = new InetSocketAddress(uri.getHost(),
> uri.getPort());
> {code}
> where uri is hdfs://127.0.0.1
--
This message was sent by Atlassian JIRA
(v6.2#6252)