hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r934283 - in /hadoop/hbase/branches/0.20_pre_durability: CHANGES.txt conf/hbase-default.xml src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Date Thu, 15 Apr 2010 04:10:33 GMT
Author: stack
Date: Thu Apr 15 04:10:32 2010
New Revision: 934283

URL: http://svn.apache.org/viewvc?rev=934283&view=rev
Log:
HBASE-1892 [performance] make hbase splits run faster

Modified:
    hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
    hadoop/hbase/branches/0.20_pre_durability/conf/hbase-default.xml
    hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Modified: hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt?rev=934283&r1=934282&r2=934283&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.20_pre_durability/CHANGES.txt Thu Apr 15 04:10:32 2010
@@ -75,6 +75,7 @@ Release 0.20.4 - Unreleased
    HBASE-2412  [stargate] PerformanceEvaluation
    HBASE-2440  Master UI should check against known bad JDK versions and warn
                the use (Todd Lipcon via Stack)
+   HBASE-1892  [performance] make hbase splits run faster
 
   NEW FEATURES
    HBASE-2257  [stargate] multiuser mode

Modified: hadoop/hbase/branches/0.20_pre_durability/conf/hbase-default.xml
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/conf/hbase-default.xml?rev=934283&r1=934282&r2=934283&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/conf/hbase-default.xml (original)
+++ hadoop/hbase/branches/0.20_pre_durability/conf/hbase-default.xml Thu Apr 15 04:10:32 2010
@@ -293,6 +293,21 @@
     </description>
   </property>
   <property>
+    <name>hbase.hregion.preclose.flush.size</name>
+    <value>5242880</value>
+    <description>
+      If the memstores in a region are this size or larger when we go
+      to close, run a "pre-flush" to clear out memstores before we put up
+      the region closed flag and take the region offline.  On close,
+      a flush is run under the close flag up to empty memory.  During
+      this time the region is offline and we are not taking on any writes.
+      If the memstore content large, this flush could take a long time to
+      complete.  The preflush is meant to clean out the bulk of the memstore
+      before putting up the close flag and taking the region offline so the
+      flush that runs under the close flag has little to do.
+    </description>
+  </property>
+  <property>
     <name>hbase.hregion.memstore.block.multiplier</name>
     <value>2</value>
     <description>

Modified: hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=934283&r1=934282&r2=934283&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hadoop/hbase/branches/0.20_pre_durability/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Thu Apr 15 04:10:32 2010
@@ -475,13 +475,14 @@ public class HRegion implements HConstan
       LOG.warn("region " + this + " already closed");
       return null;
     }
-    this.closing.set(true);
     synchronized (splitLock) {
+      boolean wasFlushing = false;
       synchronized (writestate) {
         // Disable compacting and flushing by background threads for this
         // region.
         writestate.writesEnabled = false;
-        LOG.debug("Closing " + this + ": compactions & flushes disabled ");
+        wasFlushing = writestate.flushing;
+        LOG.debug("Closing " + this + ": disabling compactions & flushes");
         while (writestate.compacting || writestate.flushing) {
           LOG.debug("waiting for" +
               (writestate.compacting ? " compaction" : "") +
@@ -495,7 +496,15 @@ public class HRegion implements HConstan
           }
         }
       }
+      // If we were not just flushing, is it worth doing a preflush...one
+      // that will clear out of the bulk of the memstore before we put up
+      // the close flag?
+      if (!abort && !wasFlushing && worthPreFlushing()) {
+        LOG.info("Running close preflush of " + this.getRegionNameAsString());
+        internalFlushcache();
+      }
       newScannerLock.writeLock().lock();
+      this.closing.set(true);
       try {
         splitsAndClosesLock.writeLock().lock();
         LOG.debug("Updates disabled for region, no outstanding scanners on " +
@@ -528,6 +537,14 @@ public class HRegion implements HConstan
     }
   }
 
+   /**
+    * @return True if its worth doing a flush before we put up the close flag.
+    */
+  private boolean worthPreFlushing() {
+    return this.memstoreSize.get() >
+      this.conf.getLong("hbase.hregion.preclose.flush.size", 1024 * 1024 * 5);
+  }
+
   //////////////////////////////////////////////////////////////////////////////
   // HRegion accessors
   //////////////////////////////////////////////////////////////////////////////



Mime
View raw message