HDFS-2567. When 0 DNs are available, show a proper error when trying to browse DFS via web UI. Contributed by Harsh J

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1204131 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2011-11-20 06:28:37 +00:00
parent 8686a00c7a
commit 5573b691d5
2 changed files with 10 additions and 1 deletions

View File

@ -153,6 +153,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);