Fix table.jsp so it shows region locations and counts -- just before we replace all this jsp stuff. Location was broke by 1502

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1099101 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-05-03 15:54:08 +00:00
parent ca952ac00b
commit 59392e209f
2 changed files with 10 additions and 11 deletions

View File

@ -146,8 +146,8 @@
<% ServerName [] serverNames = servers.toArray(new ServerName[servers.size()]); <% ServerName [] serverNames = servers.toArray(new ServerName[servers.size()]);
Arrays.sort(serverNames); Arrays.sort(serverNames);
for (ServerName serverName: serverNames) { for (ServerName serverName: serverNames) {
// HARDCODED FOR NOW; FIX -- READ FROM ZK int infoPort = conf.getInt("hbase.regionserver.info.port", 60030);
String hostname = serverName.getHostname() + ":60030"; String hostname = serverName.getHostname() + ":" + infoPort;
String url = "http://" + hostname + "/"; String url = "http://" + hostname + "/";
HServerLoad hsl = master.getServerManager().getLoad(serverName); HServerLoad hsl = master.getServerManager().getLoad(serverName);
String loadStr = hsl == null? "-": hsl.toString(); String loadStr = hsl == null? "-": hsl.toString();

View File

@ -8,6 +8,7 @@
import="org.apache.hadoop.hbase.HRegionInfo" import="org.apache.hadoop.hbase.HRegionInfo"
import="org.apache.hadoop.hbase.ServerName" import="org.apache.hadoop.hbase.ServerName"
import="org.apache.hadoop.hbase.HServerAddress" import="org.apache.hadoop.hbase.HServerAddress"
import="org.apache.hadoop.hbase.ServerName"
import="org.apache.hadoop.hbase.HServerInfo" import="org.apache.hadoop.hbase.HServerInfo"
import="org.apache.hadoop.hbase.HServerLoad" import="org.apache.hadoop.hbase.HServerLoad"
import="org.apache.hadoop.hbase.HServerLoad.RegionLoad" import="org.apache.hadoop.hbase.HServerLoad.RegionLoad"
@ -29,6 +30,9 @@
if (showFragmentation) { if (showFragmentation) {
frags = FSUtils.getTableFragmentation(master); frags = FSUtils.getTableFragmentation(master);
} }
// HARDCODED FOR NOW TODO: FIX GET FROM ZK
// This port might be wrong if RS actually ended up using something else.
int infoPort = conf.getInt("hbase.regionserver.info.port", 60030);
%> %>
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
@ -84,9 +88,7 @@
if(tableName.equals(Bytes.toString(HConstants.ROOT_TABLE_NAME))) { if(tableName.equals(Bytes.toString(HConstants.ROOT_TABLE_NAME))) {
%> %>
<%= tableHeader %> <%= tableHeader %>
// HARDCODED FOR NOW TODO: FIX GET FROM ZK
<% <%
int infoPort = 60020; // HARDCODED FOR NOW -- TODO FIX
String url = "http://" + rl.getHostname() + ":" + infoPort + "/"; String url = "http://" + rl.getHostname() + ":" + infoPort + "/";
%> %>
<tr> <tr>
@ -106,7 +108,6 @@
HRegionInfo meta = HRegionInfo.FIRST_META_REGIONINFO; HRegionInfo meta = HRegionInfo.FIRST_META_REGIONINFO;
ServerName metaLocation = master.getCatalogTracker().getMetaLocation(); ServerName metaLocation = master.getCatalogTracker().getMetaLocation();
for (int i = 0; i < 1; i++) { for (int i = 0; i < 1; i++) {
int infoPort = 60020; // HARDCODED FOR NOW -- TODO FIX
String url = "http://" + metaLocation.getHostname() + ":" + infoPort + "/"; String url = "http://" + metaLocation.getHostname() + ":" + infoPort + "/";
%> %>
<tr> <tr>
@ -139,16 +140,15 @@
</table> </table>
<% <%
Map<String, Integer> regDistribution = new HashMap<String, Integer>(); Map<String, Integer> regDistribution = new HashMap<String, Integer>();
Map<HRegionInfo, HServerAddress> regions = table.getRegionsInfo(); Map<HRegionInfo, ServerName> regions = table.getRegionLocations();
if(regions != null && regions.size() > 0) { %> if(regions != null && regions.size() > 0) { %>
<%= tableHeader %> <%= tableHeader %>
<% <%
for (Map.Entry<HRegionInfo, HServerAddress> hriEntry : regions.entrySet()) { for (Map.Entry<HRegionInfo, ServerName> hriEntry : regions.entrySet()) {
HRegionInfo regionInfo = hriEntry.getKey(); HRegionInfo regionInfo = hriEntry.getKey();
HServerAddress addr = hriEntry.getValue(); ServerName addr = hriEntry.getValue();
long req = 0; long req = 0;
int infoPort = 0;
String urlRegionServer = null; String urlRegionServer = null;
if (addr != null) { if (addr != null) {
@ -159,9 +159,8 @@
req = map.get(regionInfo.getRegionName()).getRequestsCount(); req = map.get(regionInfo.getRegionName()).getRequestsCount();
} }
// This port might be wrong if RS actually ended up using something else. // This port might be wrong if RS actually ended up using something else.
int port = conf.getInt("hbase.regionserver.info.port", 60030);
urlRegionServer = urlRegionServer =
"http://" + addr.getHostname().toString() + ":" + port + "/"; "http://" + addr.getHostname().toString() + ":" + infoPort + "/";
Integer i = regDistribution.get(urlRegionServer); Integer i = regDistribution.get(urlRegionServer);
if (null == i) i = new Integer(0); if (null == i) i = new Integer(0);
regDistribution.put(urlRegionServer, i+1); regDistribution.put(urlRegionServer, i+1);