hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r729562 - in /hadoop/hbase/branches/0.19_on_hadoop_0.18: ./ src/java/org/apache/hadoop/hbase/regionserver/ src/java/org/apache/hadoop/hbase/util/
Date Fri, 26 Dec 2008 23:25:24 GMT
Author: apurtell
Date: Fri Dec 26 15:25:24 2008
New Revision: 729562

URL: http://svn.apache.org/viewvc?rev=729562&view=rev
Log:
merge up to trunk (revision 729561)

Modified:
    hadoop/hbase/branches/0.19_on_hadoop_0.18/CHANGES.txt
    hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
    hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java
    hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/util/Threads.java

Modified: hadoop/hbase/branches/0.19_on_hadoop_0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19_on_hadoop_0.18/CHANGES.txt?rev=729562&r1=729561&r2=729562&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19_on_hadoop_0.18/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.19_on_hadoop_0.18/CHANGES.txt Fri Dec 26 15:25:24 2008
@@ -117,6 +117,7 @@
                (Tim Sell via Stack)
    HBASE-543,  HBASE-1046, HBase-1051 A region's state is kept in several places
                in the master opening the possibility for race conditions
+   HBASE-1072  Change Thread.join on exit to a timed Thread.join
 
   IMPROVEMENTS
    HBASE-901   Add a limit to key length, check key and value length on client side
@@ -189,6 +190,7 @@
    HBASE-1069  Show whether HRegion major compacts or not in INFO level
    HBASE-1066  Master should support close/open/reassignment/enable/disable
                operations on individual regions
+   HBASE-1062  Compactions at (re)start on a large table can overwhelm DFS
 
   NEW FEATURES
    HBASE-875   Use MurmurHash instead of JenkinsHash [in bloomfilters]

Modified: hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java?rev=729562&r1=729561&r2=729562&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
(original)
+++ hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
Fri Dec 26 15:25:24 2008
@@ -61,7 +61,7 @@
   
   private final HashSet<HRegion> regionsInQueue = new HashSet<HRegion>();
 
-  private int limit = 1;
+  private volatile int limit = 1;
 
   /** @param server */
   public CompactSplitThread(HRegionServer server) {
@@ -77,7 +77,6 @@
   public void run() {
     while (!this.server.isStopRequested() && this.server.isInSafeMode()) {
       try {
-        LOG.debug("in safe mode, deferring compactions");
         Thread.sleep(this.frequency);
       } catch (InterruptedException ex) {
         continue;

Modified: hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=729562&r1=729561&r2=729562&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Fri Dec 26 15:25:24 2008
@@ -199,6 +199,9 @@
   final LogRoller logRoller;
   final LogFlusher logFlusher;
   
+  // safemode processing
+  SafeModeThread safeModeThread;
+
   // flag set after we're done setting up server threads (used for testing)
   protected volatile boolean isOnline;
 
@@ -523,7 +526,8 @@
     }
     join();
 
-    runThread(this.hdfsShutdownThread);
+    runThread(this.hdfsShutdownThread,
+      this.conf.getLong("hbase.dfs.shutdown.wait", 30000));
     LOG.info(Thread.currentThread().getName() + " exiting");
   }
 
@@ -531,12 +535,12 @@
    * Run and wait on passed thread in HRS context.
    * @param t
    */
-  public void runThread(final Thread t) {
+  public void runThread(final Thread t, final long dfsShutdownWait) {
     if (t ==  null) {
       return;
     }
     t.start();
-    Threads.shutdown(t);
+    Threads.shutdown(t, dfsShutdownWait);
   }
 
   /**
@@ -590,14 +594,6 @@
       this.logFlusher.setHLog(log);
       // Init in here rather than in constructor after thread name has been set
       this.metrics = new RegionServerMetrics();
-      // start thread for turning off safemode
-      if (conf.getInt("hbase.regionserver.safemode.period", 0) < 1) {
-        safeMode.set(false);
-        compactSplitThread.setLimit(-1);
-        LOG.debug("skipping safe mode");
-      } else {
-        new SafemodeThread().start();
-      }
       startServiceThreads();
       isOnline = true;
     } catch (Throwable e) {
@@ -730,13 +726,7 @@
   /**
    * Thread for toggling safemode after some configurable interval.
    */
-  private class SafemodeThread extends Thread {
-
-    public void start() {
-      // make this thread a daemon so it will not delay any shutdown
-      this.setDaemon(true);
-      super.start();
-    }
+  private class SafeModeThread extends Thread {
 
     public void run() {
       // first, wait the required interval before turning off safemode
@@ -745,6 +735,11 @@
       try {
         Thread.sleep(safemodeInterval);
       } catch (InterruptedException ex) {
+        // turn off safemode and limits on the way out due to some kind of
+        // abnormal condition so we do not prevent such things as memcache
+        // flushes and worsen the situation
+        safeMode.set(false);
+        compactSplitThread.setLimit(-1);
         if (LOG.isDebugEnabled()) {
           LOG.debug(this.getName() + " exiting on interrupt");
         }
@@ -763,7 +758,8 @@
         2, 2, 2, 2, 2, 2,
         3, 3, 3, 3, 3, 3, 3, 3, 
         4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-        -1 };
+        -1
+      };
       for (int i = 0; i < limitSteps.length; i++) {
         if (LOG.isDebugEnabled()) {
           LOG.debug("setting compaction limit to " + limitSteps[i]);
@@ -772,11 +768,11 @@
         try {
           Thread.sleep(compactionCheckInterval);
         } catch (InterruptedException ex) {
+          // unlimit compactions before exiting
+          compactSplitThread.setLimit(-1);
           if (LOG.isDebugEnabled()) {
             LOG.debug(this.getName() + " exiting on interrupt");
           }
-          // unlimit compactions before exiting
-          compactSplitThread.setLimit(-1);
           return;
         }
       }
@@ -1003,6 +999,18 @@
       this.infoServer.setAttribute("regionserver", this);
       this.infoServer.start();
     }
+
+    // Set up the safe mode handler if safe mode has been configured.
+    if (conf.getInt("hbase.regionserver.safemode.period", 0) < 1) {
+      safeMode.set(false);
+      compactSplitThread.setLimit(-1);
+      LOG.debug("skipping safe mode");
+    } else {
+      this.safeModeThread = new SafeModeThread();
+      Threads.setDaemonThreadRunning(this.safeModeThread, n + ".safeMode",
+        handler);
+    }
+
     // Start Server.  This service is like leases in that it internally runs
     // a thread.
     this.server.start();

Modified: hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java?rev=729562&r1=729561&r2=729562&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java
(original)
+++ hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java
Fri Dec 26 15:25:24 2008
@@ -122,7 +122,6 @@
   public void run() {
     while (!this.server.isStopRequested() && this.server.isInSafeMode()) {
       try {
-        LOG.debug("in safe mode, deferring memcache flushes");
         Thread.sleep(threadWakeFrequency);
       } catch (InterruptedException ex) {
         continue;

Modified: hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/util/Threads.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/util/Threads.java?rev=729562&r1=729561&r2=729562&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/util/Threads.java
(original)
+++ hadoop/hbase/branches/0.19_on_hadoop_0.18/src/java/org/apache/hadoop/hbase/util/Threads.java
Fri Dec 26 15:25:24 2008
@@ -63,12 +63,25 @@
    * @param t Thread to shutdown
    */
   public static void shutdown(final Thread t) {
+    shutdown(t, -1);
+  }
+
+  /**
+   * Shutdown passed thread using isAlive and join.
+   * @param joinwait Pass -1 if we're to wait forever.
+   * @param t Thread to shutdown
+   */
+  public static void shutdown(final Thread t, final long joinwait) {
     while (t.isAlive()) {
       try {
-        t.join();
+        if (joinwait == -1) {
+          t.join();
+        } else {
+          t.join(joinwait);
+        }
       } catch (InterruptedException e) {
-        LOG.warn(t.getName(), e);
+        LOG.warn(t.getName() + "; joinwait=" + joinwait, e);
       }
     }
   }
-}
+}
\ No newline at end of file



Mime
View raw message