hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r654301 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Date Wed, 07 May 2008 22:08:23 GMT
Author: jimk
Date: Wed May  7 15:08:21 2008
New Revision: 654301

URL: http://svn.apache.org/viewvc?rev=654301&view=rev
Log:
HBASE-611   regionserver should do basic health check before reporting alls-well to the master

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=654301&r1=654300&r2=654301&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed May  7 15:08:21 2008
@@ -46,6 +46,8 @@
    HBASE-47    Option to set TTL for columns in hbase
                (Andrew Purtell via Bryan Duxbury and Stack)
    HBASE-600   Filters have excessive DEBUG logging
+   HBASE-611   regionserver should do basic health check before reporting
+               alls-well to the master
 
 Release 0.1.1 - 04/11/2008
 

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=654301&r1=654300&r2=654301&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 Wed
May  7 15:08:21 2008
@@ -270,7 +270,7 @@
       init(reportForDuty(sleeper));
       long lastMsg = 0;
       // Now ask master what it wants us to do and tell it what we have done
-      for (int tries = 0; !stopRequested.get();) {
+      for (int tries = 0; !stopRequested.get() && isHealthy();) {
         long now = System.currentTimeMillis();
         if (lastMsg != 0 && (now - lastMsg) >= serverLeaseTimeout) {
           // It has been way too long since we last reported to the master.
@@ -576,7 +576,26 @@
         serverInfo.getServerAddress().toString());
   }
 
-  /* Run some housekeeping tasks before we go into 'hibernation' sleeping at
+  /*
+   * Verify that server is healthy
+   */
+  private boolean isHealthy() {
+    if (!fsOk) {
+      // File system problem
+      return false;
+    }
+    // Verify that all threads are alive
+    if (!(leases.isAlive() && compactSplitThread.isAlive() &&
+        cacheFlusher.isAlive() && logRoller.isAlive() &&
+        workerThread.isAlive())) {
+      // One or more threads are no longer alive - shut down
+      stop();
+      return false;
+    }
+    return true;
+  }
+  /*
+   * Run some housekeeping tasks before we go into 'hibernation' sleeping at
    * the end of the main HRegionServer run loop.
    */
   private void housekeeping() {



Mime
View raw message