hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r615413 - in /hadoop/core/trunk/src/contrib/hbase: CHANGES.txt src/java/org/apache/hadoop/hbase/HRegion.java
Date Sat, 26 Jan 2008 00:38:16 GMT
Author: stack
Date: Fri Jan 25 16:38:15 2008
New Revision: 615413

URL: http://svn.apache.org/viewvc?rev=615413&view=rev
Log:
HADOOP-2712 under load, regions won't split

Modified:
    hadoop/core/trunk/src/contrib/hbase/CHANGES.txt
    hadoop/core/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java

Modified: hadoop/core/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hbase/CHANGES.txt?rev=615413&r1=615412&r2=615413&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ hadoop/core/trunk/src/contrib/hbase/CHANGES.txt Fri Jan 25 16:38:15 2008
@@ -149,6 +149,7 @@
    HADOOP-2688 IllegalArgumentException processing a shutdown stops
                server going down and results in millions of lines of output
    HADOOP-2706 HBase Shell crash
+   HADOOP-2712 under load, regions won't split
    
   IMPROVEMENTS
    HADOOP-2401 Add convenience put method that takes writable

Modified: hadoop/core/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java?rev=615413&r1=615412&r2=615413&view=diff
==============================================================================
--- hadoop/core/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java (original)
+++ hadoop/core/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegion.java Fri
Jan 25 16:38:15 2008
@@ -207,14 +207,19 @@
   final Path regiondir;
   private final Path regionCompactionDir;
 
+  /*
+   * Data structure of write state flags used coordinating flushes,
+   * compactions and closes.
+   */
   static class WriteState {
     // Set while a memcache flush is happening.
     volatile boolean flushing = false;
     // Set while a compaction is running.
     volatile boolean compacting = false;
-    // Gets set by last flush before close.  If set, cannot compact or flush
-    // again.
+    // Gets set in close. If set, cannot compact or flush again.
     volatile boolean writesEnabled = true;
+    // Gets set in close to prevent new compaction starting
+    volatile boolean disableCompactions = false;
   }
 
   volatile WriteState writestate = new WriteState();
@@ -385,6 +390,11 @@
     }
     synchronized (splitLock) {
       synchronized (writestate) {
+        // Can be a compaction running and it can take a long time to
+        // complete -- minutes.  Meantime, we want flushes to keep happening
+        // if we are taking on lots of updates.  But we don't want another
+        // compaction to start so set disableCompactions flag.
+        this.writestate.disableCompactions = true;
         while (writestate.compacting || writestate.flushing) {
           LOG.debug("waiting for" +
               (writestate.compacting ? " compaction" : "") +
@@ -403,7 +413,7 @@
         // region.
         writestate.writesEnabled = false;
         LOG.debug("compactions and cache flushes disabled for region " +
-            regionName);
+          regionName);
       }
       lock.writeLock().lock();
       LOG.debug("new updates and scanners for region " + regionName +
@@ -412,7 +422,6 @@
       try {
         // Wait for active scanners to finish. The write lock we hold will prevent
         // new scanners from being created.
-
         synchronized (activeScannerCount) {
           while (activeScannerCount.get() != 0) {
             LOG.debug("waiting for " + activeScannerCount.get() +
@@ -566,7 +575,6 @@
    */
   HRegion[] splitRegion(final RegionUnavailableListener listener)
     throws IOException {
-
     synchronized (splitLock) {
       Text midKey = new Text();
       if (closed.get() || !needsSplit(midKey)) {
@@ -760,14 +768,15 @@
     }
     try {
       synchronized (writestate) {
-        if (!writestate.compacting && writestate.writesEnabled) {
+        if (!writestate.compacting && writestate.writesEnabled &&
+            !this.writestate.disableCompactions) {
           writestate.compacting = true;
-
         } else {
           LOG.info("NOT compacting region " +
               this.regionInfo.getRegionName().toString() + ": compacting=" +
               writestate.compacting + ", writesEnabled=" +
-              writestate.writesEnabled);
+              writestate.writesEnabled + ", writestate.disableCompactions=" +
+              this.writestate.disableCompactions);
             return false;
         }
       }
@@ -820,9 +829,8 @@
       return false;
     }
     synchronized (writestate) {
-      if ((!writestate.flushing) && writestate.writesEnabled) {
+      if (!writestate.flushing && writestate.writesEnabled) {
         writestate.flushing = true;
-
       } else {
         if(LOG.isDebugEnabled()) {
           LOG.debug("NOT flushing memcache for region " +



Mime
View raw message