svn merge -c 1464548 Merging from trunk to branch-2 to fix HDFS-4548.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1464553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2013-04-04 14:03:51 +00:00
parent 2190ac6fd9
commit c6f70e7072
2 changed files with 4 additions and 9 deletions

View File

@ -2218,6 +2218,8 @@ Release 0.23.7 - UNRELEASED
HDFS-4649. Webhdfs cannot list large directories (daryn via kihwal)
HDFS-4548. Webhdfs doesn't renegotiate SPNEGO token (daryn via kihwal)
Release 0.23.6 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -156,7 +156,6 @@ public class WebHdfsFileSystem extends FileSystem
private URI uri;
private boolean hasInitedToken;
private Token<?> delegationToken;
private final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
private RetryPolicy retryPolicy = null;
private Path workingDir;
@ -481,6 +480,8 @@ public class WebHdfsFileSystem extends FileSystem
try {
if (op.getRequireAuth()) {
LOG.debug("open AuthenticatedURL connection");
UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
conn = new AuthenticatedURL(AUTH).openConnection(url, authToken);
} else {
LOG.debug("open URL connection");
@ -1006,20 +1007,12 @@ public class WebHdfsFileSystem extends FileSystem
@Override
public long renew(final Token<?> token, final Configuration conf
) throws IOException, InterruptedException {
final UserGroupInformation ugi = UserGroupInformation.getLoginUser();
// update the kerberos credentials, if they are coming from a keytab
ugi.reloginFromKeytab();
return getWebHdfs(token, conf).renewDelegationToken(token);
}
@Override
public void cancel(final Token<?> token, final Configuration conf
) throws IOException, InterruptedException {
final UserGroupInformation ugi = UserGroupInformation.getLoginUser();
// update the kerberos credentials, if they are coming from a keytab
ugi.checkTGTAndReloginFromKeytab();
getWebHdfs(token, conf).cancelDelegationToken(token);
}
}