HDFS-2567. svn merge -c 1204131 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1204132 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2011-11-20 06:29:38 +00:00
parent fd771a4f51
commit 336e46c562
2 changed files with 10 additions and 1 deletions

View File

@ -46,6 +46,9 @@ Release 0.23.1 - UNRELEASED
HDFS-2502. hdfs-default.xml should include dfs.name.dir.restore. HDFS-2502. hdfs-default.xml should include dfs.name.dir.restore.
(harsh via eli) (harsh via eli)
HDFS-2567. When 0 DNs are available, show a proper error when
trying to browse DFS via web UI. (harsh via eli)
Release 0.23.0 - 2011-11-01 Release 0.23.0 - 2011-11-01
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -380,7 +380,13 @@ class NamenodeJspHelper {
final NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context); final NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context);
final Configuration conf = (Configuration) context final Configuration conf = (Configuration) context
.getAttribute(JspHelper.CURRENT_CONF); .getAttribute(JspHelper.CURRENT_CONF);
final DatanodeID datanode = getRandomDatanode(nn); // We can't redirect if there isn't a DN to redirect to.
// Lets instead show a proper error message.
if (nn.getNamesystem().getNumLiveDataNodes() < 1) {
throw new IOException("Can't browse the DFS since there are no " +
"live nodes available to redirect to.");
}
final DatanodeID datanode = getRandomDatanode(nn);;
UserGroupInformation ugi = JspHelper.getUGI(context, request, conf); UserGroupInformation ugi = JspHelper.getUGI(context, request, conf);
String tokenString = getDelegationToken( String tokenString = getDelegationToken(
nn.getRpcServer(), request, conf, ugi); nn.getRpcServer(), request, conf, ugi);