You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 19:42:55 UTC

svn commit: r1181934 - in /hbase/branches/0.89/src/main: java/org/apache/hadoop/hbase/monitoring/ java/org/apache/hadoop/hbase/regionserver/ resources/hbase-webapps/static/ resources/hbase-webapps/taskmonitor/

Author: nspiegelberg
Date: Tue Oct 11 17:42:54 2011
New Revision: 1181934

URL: http://svn.apache.org/viewvc?rev=1181934&view=rev
Log:
Clearly report leaked monitored tasks and aborted tasks in the Task Monitor

Summary:
The current reporting of task leaks and aborted tasks is inaccessible and
sometimes nonexistent. This patch improves reporting to be clear, changes the
color-coding for aborted tasks in the JSP task monitor, and provides a color key
to clearly explain to the user which state each row is in.

Additionally, one source of leaked tasks is patched up in store compactions by
aborting at the proper time rather than leaking the task.

Test Plan: Compiled and ran on dev server.
Reviewed By: nspiegelberg
Reviewers: nspiegelberg, kannan
CC: hbase@lists, nspiegelberg
Differential Revision: 305064

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
    hbase/branches/0.89/src/main/resources/hbase-webapps/static/hbase.css
    hbase/branches/0.89/src/main/resources/hbase-webapps/taskmonitor/taskmonitor.jsp

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java?rev=1181934&r1=1181933&r2=1181934&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java Tue Oct 11 17:42:54 2011
@@ -89,6 +89,7 @@ public class TaskMonitor {
         // assume it's done.
         if (stat.getState() == MonitoredTaskImpl.State.RUNNING) {
           LOG.warn("Status " + stat + " appears to have been leaked");
+          stat.setStatus("monitor leaked");
           stat.cleanup();
         }
       }

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=1181934&r1=1181933&r2=1181934&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java Tue Oct 11 17:42:54 2011
@@ -655,6 +655,10 @@ public class Store implements HeapSize {
       StoreFile.Writer writer = compactStores(filesToCompact, cr.isMajor(), maxId);
       // Move the compaction into place.
       sf = completeCompaction(filesToCompact, writer);
+    } catch (IOException ioe) {
+      // rather than leak the status, we abort here, then rethrow the exception
+      status.abort("IOException thrown");
+      throw ioe;
     } finally {
       synchronized (filesCompacting) {
         filesCompacting.removeAll(filesToCompact);

Modified: hbase/branches/0.89/src/main/resources/hbase-webapps/static/hbase.css
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/resources/hbase-webapps/static/hbase.css?rev=1181934&r1=1181933&r2=1181934&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/resources/hbase-webapps/static/hbase.css (original)
+++ hbase/branches/0.89/src/main/resources/hbase-webapps/static/hbase.css Tue Oct 11 17:42:54 2011
@@ -24,5 +24,5 @@ tr.task-monitor-IDLE td {
 }
 
 tr.task-monitor-ABORTED td {
-  background-color: #ffa;
+  background-color: #f66;
 }

Modified: hbase/branches/0.89/src/main/resources/hbase-webapps/taskmonitor/taskmonitor.jsp
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/resources/hbase-webapps/taskmonitor/taskmonitor.jsp?rev=1181934&r1=1181933&r2=1181934&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/resources/hbase-webapps/taskmonitor/taskmonitor.jsp (original)
+++ hbase/branches/0.89/src/main/resources/hbase-webapps/taskmonitor/taskmonitor.jsp Tue Oct 11 17:42:54 2011
@@ -3,12 +3,13 @@
   import="org.codehaus.jettison.json.JSONArray"
   import="org.codehaus.jettison.json.JSONException"
   import="org.codehaus.jettison.json.JSONObject"
+  import="org.apache.hadoop.util.StringUtils"
   import="org.apache.hadoop.hbase.ipc.HBaseRPC"
   import="org.apache.hadoop.hbase.monitoring.MonitoredTask"
   import="org.apache.hadoop.hbase.monitoring.TaskMonitor" %><%
   TaskMonitor taskMonitor = TaskMonitor.get();
-  long now = System.currentTimeMillis();
   List<MonitoredTask> tasks = taskMonitor.getTasks();
+  long now = System.currentTimeMillis();
   Collections.reverse(tasks);
 %><?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -27,7 +28,20 @@
   <% if(tasks.isEmpty()) { %>
     <p>No tasks currently running on this node.</p>
   <% } else { %>
-    <table>
+    <table style="float:right">
+      <tr class="task-monitor-RUNNING">
+        <td>RUNNING</td>
+      </tr>
+      <tr class="task-monitor-COMPLETE">
+        <td>COMPLETE</td>
+      </tr>
+      <tr class="task-monitor-ABORTED">
+        <td>ABORTED</td>
+      </tr>
+    </table>
+    <p>Each task's state is indicated by its background color according to the
+    key.</p>
+    <table style="clear:right">
       <tr>
         <th>Description</th>
         <th>Status</th>
@@ -37,9 +51,13 @@
         <tr class="task-monitor-<%= task.getState() %>">
           <td><%= task.getDescription() %></td>
           <td><%= task.getStatus() %></td>
-          <td><%= now - task.getStartTime() %>ms
-            <% if(task.getCompletionTimestamp() != -1) { %>
-              (Completed <%= now - task.getCompletionTimestamp() %>ms ago)
+          <td><%= StringUtils.formatTimeDiff(now, task.getStartTime()) %>
+            <% if (task.getState() == MonitoredTask.State.COMPLETE) { %>
+              (Completed <%= StringUtils.formatTimeDiff(now,
+                              task.getCompletionTimestamp()) %> ago)
+            <% } else if (task.getState() == MonitoredTask.State.ABORTED) { %>
+              (Aborted <%= StringUtils.formatTimeDiff(now,
+                            task.getCompletionTimestamp()) %> ago)
             <% } %>
           </td>
         </tr>