HBASE-4359 Show dead RegionServer names in the HMaster info page

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1170421 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-09-14 02:54:15 +00:00
parent 12cc83fd03
commit bf5a6641bf
4 changed files with 42 additions and 2 deletions

View File

@ -474,6 +474,8 @@ Release 0.91.0 - Unreleased
(ramkrishna.s.vasudevan) (ramkrishna.s.vasudevan)
HBASE-4347 Remove duplicated code from Put, Delete, Get, Scan, MultiPut HBASE-4347 Remove duplicated code from Put, Delete, Get, Scan, MultiPut
(Lars Hofhansl) (Lars Hofhansl)
HBASE-4359 Show dead RegionServer names in the HMaster info page
(Harsh J)
TASKS TASKS
HBASE-3559 Move report of split to master OFF the heartbeat channel HBASE-3559 Move report of split to master OFF the heartbeat channel

View File

@ -24,6 +24,7 @@ Map<String, Integer> frags = null;
ServerName rootLocation = null; ServerName rootLocation = null;
ServerName metaLocation = null; ServerName metaLocation = null;
List<ServerName> servers = null; List<ServerName> servers = null;
Set<ServerName> deadServers = null;
boolean showAppendWarning = false; boolean showAppendWarning = false;
String filter = "general"; String filter = "general";
String format = "html"; String format = "html";
@ -111,6 +112,9 @@ org.apache.hadoop.hbase.HTableDescriptor;
<%if (servers != null) %> <%if (servers != null) %>
<& regionServers &> <& regionServers &>
</%if> </%if>
<%if (deadServers != null) %>
<& deadRegionServers &>
</%if>
<& AssignmentManagerStatusTmpl; assignmentManager=master.getAssignmentManager()&> <& AssignmentManagerStatusTmpl; assignmentManager=master.getAssignmentManager()&>
@ -215,3 +219,26 @@ org.apache.hadoop.hbase.HTableDescriptor;
<p>Load is requests per second and count of regions loaded</p> <p>Load is requests per second and count of regions loaded</p>
</%if> </%if>
</%def> </%def>
<%def deadRegionServers>
<h2>Dead Region Servers</h2>
<%if (deadServers != null && deadServers.size() > 0)%>
<table>
<tr><th rowspan="<% deadServers.size() + 1%>"></th><th>Address</th><th>Start Code</th></tr>
<%java>
ServerName [] deadServerNames = deadServers.toArray(new ServerName[deadServers.size()]);
Arrays.sort(deadServerNames);
for (ServerName deadServerName: deadServerNames) {
int infoPort = master.getConfiguration().getInt("hbase.regionserver.info.port", 60030);
String hostname = deadServerName.getHostname() + ":" + infoPort;
long startcode = deadServerName.getStartcode();
</%java>
<tr><td><% hostname %></td><td><% startcode %></tr>
<%java>
}
</%java>
<tr><th>Total: </th><td>servers: <% deadServers.size() %></td></tr>
</table>
</%if>
</%def>

View File

@ -23,6 +23,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -59,6 +60,7 @@ public class MasterStatusServlet extends HttpServlet {
ServerName rootLocation = getRootLocationOrNull(master); ServerName rootLocation = getRootLocationOrNull(master);
ServerName metaLocation = master.getCatalogTracker().getMetaLocation(); ServerName metaLocation = master.getCatalogTracker().getMetaLocation();
List<ServerName> servers = master.getServerManager().getOnlineServersList(); List<ServerName> servers = master.getServerManager().getOnlineServersList();
Set<ServerName> deadServers = master.getServerManager().getDeadServers();
response.setContentType("text/html"); response.setContentType("text/html");
MasterStatusTmpl tmpl = new MasterStatusTmpl() MasterStatusTmpl tmpl = new MasterStatusTmpl()
@ -66,7 +68,8 @@ public class MasterStatusServlet extends HttpServlet {
.setShowAppendWarning(shouldShowAppendWarning(conf)) .setShowAppendWarning(shouldShowAppendWarning(conf))
.setRootLocation(rootLocation) .setRootLocation(rootLocation)
.setMetaLocation(metaLocation) .setMetaLocation(metaLocation)
.setServers(servers); .setServers(servers)
.setDeadServers(deadServers);
if (request.getParameter("filter") != null) if (request.getParameter("filter") != null)
tmpl.setFilter(request.getParameter("filter")); tmpl.setFilter(request.getParameter("filter"));
if (request.getParameter("format") != null) if (request.getParameter("format") != null)

View File

@ -23,8 +23,10 @@ import static org.junit.Assert.*;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.NavigableMap; import java.util.NavigableMap;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -134,11 +136,17 @@ public class TestMasterStatusServlet {
List<ServerName> servers = Lists.newArrayList( List<ServerName> servers = Lists.newArrayList(
new ServerName("rootserver:123,12345"), new ServerName("rootserver:123,12345"),
new ServerName("metaserver:123,12345")); new ServerName("metaserver:123,12345"));
Set<ServerName> deadServers = new HashSet<ServerName>(
Lists.newArrayList(
new ServerName("badserver:123,12345"),
new ServerName("uglyserver:123,12345"))
);
new MasterStatusTmpl() new MasterStatusTmpl()
.setRootLocation(new ServerName("rootserver:123,12345")) .setRootLocation(new ServerName("rootserver:123,12345"))
.setMetaLocation(new ServerName("metaserver:123,12345")) .setMetaLocation(new ServerName("metaserver:123,12345"))
.setServers(servers) .setServers(servers)
.setDeadServers(deadServers)
.render(new StringWriter(), .render(new StringWriter(),
master, admin); master, admin);
} }