HBASE-4934 Display Master server and Regionserver start time on respective info servers

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1220304 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-12-18 00:04:23 +00:00
parent fa03d03ddf
commit d9c8e9954a
4 changed files with 35 additions and 4 deletions

View File

@ -111,6 +111,8 @@ org.apache.hadoop.hbase.HBaseConfiguration;
</td>
<td>Coprocessors currently loaded loaded by the master</td>
</tr>
<tr><td>HMaster Start Time</td><td><% new Date(master.getMasterStartTime()) %></td><td>Date stamp of when this HMaster was started</td></tr>
<tr><td>HMaster Active Time</td><td><% new Date(master.getMasterActiveTime()) %></td><td>Date stamp of when this HMaster became active</td></tr>
</table>
<& ../common/TaskMonitorTmpl; filter = filter &>
@ -202,7 +204,7 @@ org.apache.hadoop.hbase.HBaseConfiguration;
</%java>
<table>
<tr><th rowspan="<% servers.size() + 1%>"></th><th>ServerName</th><th>Load</th></tr>
<tr><th rowspan="<% servers.size() + 1%>"></th><th>ServerName</th><th>Start time</th><th>Load</th></tr>
<%java>
ServerName [] serverNames = servers.toArray(new ServerName[servers.size()]);
Arrays.sort(serverNames);
@ -217,12 +219,13 @@ org.apache.hadoop.hbase.HBaseConfiguration;
totalRegions += hsl.getNumberOfRegions();
totalRequests += hsl.getNumberOfRequests();
}
long startcode = serverName.getStartcode();
</%java>
<tr><td><a href="<% url %>"><% serverName %></a></td></td><td><% loadStr %></td></tr>
<tr><td><a href="<% url %>"><% serverName %></a></td><td><% new Date(startcode) %></td><td><% loadStr %></td></tr>
<%java>
}
</%java>
<tr><th>Total: </th><td>servers: <% servers.size() %></td><td>requestsPerSecond=<% totalRequests %>, numberOfOnlineRegions=<% totalRegions %></td></tr>
<tr><th>Total: </th><td>servers: <% servers.size() %></td><td></td><td>requestsPerSecond=<% totalRequests %>, numberOfOnlineRegions=<% totalRegions %></td></tr>
</table>
<p>Load is requests per second and count of regions loaded</p>

View File

@ -96,6 +96,7 @@ org.apache.hadoop.hbase.HBaseConfiguration;
<% java.util.Arrays.toString(regionServer.getCoprocessors()) %>
</td>
<td>Coprocessors currently loaded by this regionserver</td>
<tr><td>RS Start Time</td><td><% new Date(regionServer.getStartcode()) %></td><td>Date stamp of when this region server was started</td></tr>
</tr>
</table>

View File

@ -199,7 +199,10 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
private volatile boolean loadBalancerRunning = false;
// Time stamps for when a hmaster was started and when it became active
private long masterStartTime;
private long masterActiveTime;
/**
* Initializes the HMaster. The steps are as follows:
* <p>
@ -301,6 +304,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
"(Also watching cluster state node)");
Thread.sleep(c.getInt("zookeeper.session.timeout", 180 * 1000));
}
}
/**
@ -317,6 +321,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
MonitoredTask startupStatus =
TaskMonitor.get().createStatus("Master startup");
startupStatus.setDescription("Master startup");
masterStartTime = System.currentTimeMillis();
try {
/*
* Block on becoming the active master.
@ -458,6 +463,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
*/
status.setStatus("Initializing Master file system");
this.masterActiveTime = System.currentTimeMillis();
// TODO: Do this using Dependency Injection, using PicoContainer, Guice or Spring.
this.fileSystemManager = new MasterFileSystem(this, this, metrics);
@ -1353,6 +1359,20 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
return CoprocessorHost.getLoadedCoprocessors().toString();
}
/**
* @return timestamp in millis when HMaster was started.
*/
public long getMasterStartTime() {
return masterStartTime;
}
/**
* @return timestamp in millis when HMaster became the active master.
*/
public long getMasterActiveTime() {
return masterActiveTime;
}
/**
* @return array of coprocessor SimpleNames.
*/

View File

@ -2970,6 +2970,13 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
return this.requestCount;
}
/**
* @return time stamp in millis of when this region server was started
*/
public long getStartcode() {
return this.startcode;
}
/** @return reference to FlushRequester */
public FlushRequester getFlushRequester() {
return this.cacheFlusher;