HDFS-5317. Merging change r1530114 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1530117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cd4411ce1c
commit
ad8948e8e0
|
@ -159,6 +159,9 @@ Release 2.2.0 - 2013-10-13
|
|||
HDFS-5291. Standby namenode after transition to active goes into safemode.
|
||||
(jing9)
|
||||
|
||||
HDFS-5317. Go back to DFS Home link does not work on datanode webUI
|
||||
(Haohui Mai via brandonli)
|
||||
|
||||
Release 2.1.1-beta - 2013-09-23
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
|||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.MemoryMXBean;
|
||||
import java.lang.management.MemoryUsage;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
|
@ -60,6 +61,7 @@ import org.apache.hadoop.hdfs.server.namenode.startupprogress.Status;
|
|||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.Step;
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StepType;
|
||||
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols;
|
||||
import org.apache.hadoop.http.HttpConfig;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.net.NodeBase;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
|
@ -738,11 +740,11 @@ class NamenodeJspHelper {
|
|||
}
|
||||
|
||||
private void generateNodeDataHeader(JspWriter out, DatanodeDescriptor d,
|
||||
String suffix, boolean alive, int nnHttpPort, String nnaddr, String scheme)
|
||||
String suffix, boolean alive, int nnInfoPort, String nnaddr, String scheme)
|
||||
throws IOException {
|
||||
// from nn_browsedfscontent.jsp:
|
||||
String url = "///" + JspHelper.Url.authority(scheme, d)
|
||||
+ "/browseDirectory.jsp?namenodeInfoPort=" + nnHttpPort + "&dir="
|
||||
+ "/browseDirectory.jsp?namenodeInfoPort=" + nnInfoPort + "&dir="
|
||||
+ URLEncoder.encode("/", "UTF-8")
|
||||
+ JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnaddr);
|
||||
|
||||
|
@ -759,9 +761,9 @@ class NamenodeJspHelper {
|
|||
}
|
||||
|
||||
void generateDecommissioningNodeData(JspWriter out, DatanodeDescriptor d,
|
||||
String suffix, boolean alive, int nnHttpPort, String nnaddr, String scheme)
|
||||
String suffix, boolean alive, int nnInfoPort, String nnaddr, String scheme)
|
||||
throws IOException {
|
||||
generateNodeDataHeader(out, d, suffix, alive, nnHttpPort, nnaddr, scheme);
|
||||
generateNodeDataHeader(out, d, suffix, alive, nnInfoPort, nnaddr, scheme);
|
||||
if (!alive) {
|
||||
return;
|
||||
}
|
||||
|
@ -785,7 +787,7 @@ class NamenodeJspHelper {
|
|||
}
|
||||
|
||||
void generateNodeData(JspWriter out, DatanodeDescriptor d, String suffix,
|
||||
boolean alive, int nnHttpPort, String nnaddr, String scheme) throws IOException {
|
||||
boolean alive, int nnInfoPort, String nnaddr, String scheme) throws IOException {
|
||||
/*
|
||||
* Say the datanode is dn1.hadoop.apache.org with ip 192.168.0.5 we use:
|
||||
* 1) d.getHostName():d.getPort() to display. Domain and port are stripped
|
||||
|
@ -797,7 +799,7 @@ class NamenodeJspHelper {
|
|||
* interact with datanodes.
|
||||
*/
|
||||
|
||||
generateNodeDataHeader(out, d, suffix, alive, nnHttpPort, nnaddr, scheme);
|
||||
generateNodeDataHeader(out, d, suffix, alive, nnInfoPort, nnaddr, scheme);
|
||||
if (!alive) {
|
||||
out.print("<td class=\"decommissioned\"> " +
|
||||
d.isDecommissioned() + "\n");
|
||||
|
@ -863,11 +865,8 @@ class NamenodeJspHelper {
|
|||
final List<DatanodeDescriptor> dead = new ArrayList<DatanodeDescriptor>();
|
||||
dm.fetchDatanodes(live, dead, true);
|
||||
|
||||
InetSocketAddress nnSocketAddress =
|
||||
(InetSocketAddress)context.getAttribute(
|
||||
NameNodeHttpServer.NAMENODE_ADDRESS_ATTRIBUTE_KEY);
|
||||
String nnaddr = nnSocketAddress.getAddress().getHostAddress() + ":"
|
||||
+ nnSocketAddress.getPort();
|
||||
String nnaddr = nn.getServiceRpcAddress().getAddress().getHostName() + ":"
|
||||
+ nn.getServiceRpcAddress().getPort();
|
||||
|
||||
whatNodes = request.getParameter("whatNodes"); // show only live or only
|
||||
// dead nodes
|
||||
|
@ -903,16 +902,11 @@ class NamenodeJspHelper {
|
|||
|
||||
counterReset();
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
if (live.isEmpty() && dead.isEmpty()) {
|
||||
out.print("There are no datanodes in the cluster");
|
||||
} else {
|
||||
|
||||
int nnHttpPort = nn.getHttpAddress().getPort();
|
||||
int nnInfoPort = request.getServerPort();
|
||||
out.print("<div id=\"dfsnodetable\"> ");
|
||||
if (whatNodes.equals("LIVE")) {
|
||||
out.print("<a name=\"LiveNodes\" id=\"title\">" + "Live Datanodes : "
|
||||
|
@ -954,7 +948,7 @@ class NamenodeJspHelper {
|
|||
|
||||
JspHelper.sortNodeList(live, sorterField, sorterOrder);
|
||||
for (int i = 0; i < live.size(); i++) {
|
||||
generateNodeData(out, live.get(i), port_suffix, true, nnHttpPort,
|
||||
generateNodeData(out, live.get(i), port_suffix, true, nnInfoPort,
|
||||
nnaddr, request.getScheme());
|
||||
}
|
||||
}
|
||||
|
@ -975,7 +969,7 @@ class NamenodeJspHelper {
|
|||
JspHelper.sortNodeList(dead, sorterField, sorterOrder);
|
||||
for (int i = 0; i < dead.size(); i++) {
|
||||
generateNodeData(out, dead.get(i), port_suffix, false,
|
||||
nnHttpPort, nnaddr, request.getScheme());
|
||||
nnInfoPort, nnaddr, request.getScheme());
|
||||
}
|
||||
|
||||
out.print("</table>\n");
|
||||
|
@ -1006,7 +1000,7 @@ class NamenodeJspHelper {
|
|||
JspHelper.sortNodeList(decommissioning, "name", "ASC");
|
||||
for (int i = 0; i < decommissioning.size(); i++) {
|
||||
generateDecommissioningNodeData(out, decommissioning.get(i),
|
||||
port_suffix, true, nnHttpPort, nnaddr, request.getScheme());
|
||||
port_suffix, true, nnInfoPort, nnaddr, request.getScheme());
|
||||
}
|
||||
out.print("</table>\n");
|
||||
}
|
||||
|
|
|
@ -61,9 +61,10 @@ public class TestDatanodeJsp {
|
|||
|
||||
InetSocketAddress nnIpcAddress = cluster.getNameNode().getNameNodeAddress();
|
||||
InetSocketAddress nnHttpAddress = cluster.getNameNode().getHttpAddress();
|
||||
int dnInfoPort = cluster.getDataNodes().get(0).getInfoPort();
|
||||
|
||||
URL url = new URL("http://localhost:" + dnInfoPort + "/"
|
||||
String base = JspHelper.Url.url("http", cluster.getDataNodes().get(0)
|
||||
.getDatanodeId());
|
||||
|
||||
URL url = new URL(base + "/"
|
||||
+ "browseDirectory.jsp" + JspHelper.getUrlParam("dir",
|
||||
URLEncoder.encode(testPath.toString(), "UTF-8"), true)
|
||||
+ JspHelper.getUrlParam("namenodeInfoPort", Integer
|
||||
|
|
Loading…
Reference in New Issue