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

@ -152,6 +152,9 @@ Release 0.23.1 - UNRELEASED
HDFS-2502. hdfs-default.xml should include dfs.name.dir.restore.
(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

View File

@ -380,7 +380,13 @@ static void redirectToRandomDataNode(ServletContext context,
final NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context);
final Configuration conf = (Configuration) context
.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);
String tokenString = getDelegationToken(
nn.getRpcServer(), request, conf, ugi);