hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r772703 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Date Thu, 07 May 2009 16:47:40 GMT
Author: stack
Date: Thu May  7 16:47:39 2009
New Revision: 772703

URL: http://svn.apache.org/viewvc?rev=772703&view=rev
Log:
HBASE-1386 NPE in housekeeping

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=772703&r1=772702&r2=772703&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Thu May  7 16:47:39 2009
@@ -115,6 +115,7 @@
    HBASE-1377  RS address is null in master web UI
    HBASE-1344  WARN IllegalStateException: Cannot set a region as open if it has
                not been pending
+   HBASE-1386  NPE in housekeeping
 
   IMPROVEMENTS
    HBASE-1089  Add count of regions on filesystem to master UI; add percentage

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=772703&r1=772702&r2=772703&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Thu
May  7 16:47:39 2009
@@ -1124,6 +1124,7 @@
     }
     return true;
   }
+
   /*
    * Run some housekeeping tasks before we go into 'hibernation' sleeping at
    * the end of the main HRegionServer run loop.
@@ -1132,12 +1133,16 @@
     // If the todo list has > 0 messages, iterate looking for open region
     // messages. Send the master a message that we're working on its
     // processing so it doesn't assign the region elsewhere.
-    if (this.toDo.size() <= 0) {
+    if (this.toDo.isEmpty()) {
       return;
     }
     // This iterator is 'safe'.  We are guaranteed a view on state of the
     // queue at time iterator was taken out.  Apparently goes from oldest.
     for (ToDoEntry e: this.toDo) {
+      HMsg msg = e.msg;
+      if (msg == null) {
+        LOG.warn("Message is empty: " + e);
+      }
       if (e.msg.isType(HMsg.Type.MSG_REGION_OPEN)) {
         addProcessingMessage(e.msg.getRegionInfo());
       }
@@ -1299,15 +1304,16 @@
   /*
    * Data structure to hold a HMsg and retries count.
    */
-  private static class ToDoEntry {
-    protected int tries;
+  private static final class ToDoEntry {
+    protected volatile int tries;
     protected final HMsg msg;
-    ToDoEntry(HMsg msg) {
+
+    ToDoEntry(final HMsg msg) {
       this.tries = 0;
       this.msg = msg;
     }
   }
-  
+
   final BlockingQueue<ToDoEntry> toDo = new LinkedBlockingQueue<ToDoEntry>();
   private Worker worker;
   private Thread workerThread;



Mime
View raw message