Author: boryas
Date: Fri Jul 23 22:49:25 2010
New Revision: 967292
URL: http://svn.apache.org/viewvc?rev=967292&view=rev
Log:
HDFS-1308. job conf key for the services name of DelegationToken for HFTP url
is constructed incorrectly in HFTPFileSystem
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=967292&r1=967291&r2=967292&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Fri Jul 23 22:49:25 2010
@@ -160,6 +160,9 @@ Trunk (unreleased changes)
HDFS-1085. HFTP read may fail silently on the client side if there is an
exception on the server side. (szetszwo)
+ HDFS-1308. job conf key for the services name of DelegationToken for HFTP
+ url is constructed incorrectly in HFTPFileSystem (boryas)
+
Release 0.21.0 - Unreleased
INCOMPATIBLE CHANGES
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java
URL:
http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java?rev=967292&r1=967291&r2=967292&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HftpFileSystem.java Fri
Jul 23 22:49:25 2010
@@ -47,11 +47,13 @@ import org.apache.hadoop.fs.MD5MD5CRC32F
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hdfs.server.common.JspHelper;
+import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.tools.DelegationTokenFetcher;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.Credentials;
+import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.security.token.TokenIdentifier;
@@ -110,17 +112,16 @@ public class HftpFileSystem extends File
nnAddr = NetUtils.createSocketAddr(name.toString());
if (UserGroupInformation.isSecurityEnabled()) {
- StringBuffer sb = new StringBuffer(HFTP_SERVICE_NAME_KEY);
// configuration has the actual service name for this url. Build the key
// and get it.
- final String key = sb.append(NetUtils.normalizeHostName(name.getHost())).
- append(".").append(name.getPort()).toString();
+ final String key = HftpFileSystem.HFTP_SERVICE_NAME_KEY +
+ SecurityUtil.buildDTServiceName(name, NameNode.DEFAULT_PORT);
- LOG.debug("Trying to find DT for " + name + " using key=" + key + ";
conf=" + conf.get(key, ""));
+ LOG.debug("Trying to find DT for " + name + " using key=" + key +
+ "; conf=" + conf.get(key, ""));
Text nnServiceNameText = new Text(conf.get(key, ""));
- Collection<Token<? extends TokenIdentifier>> tokens =
- ugi.getTokens();
+ Collection<Token<? extends TokenIdentifier>> tokens = ugi.getTokens();
//try finding a token for this namenode (esp applicable for tasks
//using hftp). If there exists one, just set the delegationField
for (Token<? extends TokenIdentifier> t : tokens) {