HBASE-10446 Backup master gives Error 500 for debug dump

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1562986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2014-01-30 21:37:00 +00:00
parent 3f9f4e00b6
commit b3b3d0ddff
2 changed files with 19 additions and 3 deletions

View File

@ -100,8 +100,14 @@ public class MasterDumpServlet extends StateDumpServlet {
private void dumpRIT(HMaster master, PrintWriter out) { private void dumpRIT(HMaster master, PrintWriter out) {
AssignmentManager am = master.getAssignmentManager();
if (am == null) {
out.println("AssignmentManager is not initialized");
return;
}
Map<String, RegionState> regionsInTransition = Map<String, RegionState> regionsInTransition =
master.getAssignmentManager().getRegionStates().getRegionsInTransition(); am.getRegionStates().getRegionsInTransition();
for (Map.Entry<String, RegionState> e : regionsInTransition.entrySet()) { for (Map.Entry<String, RegionState> e : regionsInTransition.entrySet()) {
String rid = e.getKey(); String rid = e.getKey();
RegionState rs = e.getValue(); RegionState rs = e.getValue();
@ -110,8 +116,13 @@ public class MasterDumpServlet extends StateDumpServlet {
} }
private void dumpServers(HMaster master, PrintWriter out) { private void dumpServers(HMaster master, PrintWriter out) {
Map<ServerName, ServerLoad> servers = ServerManager sm = master.getServerManager();
master.getServerManager().getOnlineServers(); if (sm == null) {
out.println("ServerManager is not initialized");
return;
}
Map<ServerName, ServerLoad> servers = sm.getOnlineServers();
for (Map.Entry<ServerName, ServerLoad> e : servers.entrySet()) { for (Map.Entry<ServerName, ServerLoad> e : servers.entrySet()) {
out.println(e.getKey() + ": " + e.getValue()); out.println(e.getKey() + ": " + e.getValue());
} }

View File

@ -55,6 +55,11 @@ public abstract class StateDumpServlet extends HttpServlet {
protected void dumpExecutors(ExecutorService service, PrintWriter out) protected void dumpExecutors(ExecutorService service, PrintWriter out)
throws IOException { throws IOException {
if (service == null) {
out.println("ExecutorService is not initialized");
return;
}
Map<String, ExecutorStatus> statuses = service.getAllExecutorStatuses(); Map<String, ExecutorStatus> statuses = service.getAllExecutorStatuses();
for (ExecutorStatus status : statuses.values()) { for (ExecutorStatus status : statuses.values()) {
status.dumpTo(out, " "); status.dumpTo(out, " ");