You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/06/26 05:31:48 UTC

svn commit: r671714 - in /hadoop/hbase/branches/0.1: CHANGES.txt src/java/org/apache/hadoop/hbase/HRegion.java src/java/org/apache/hadoop/hbase/HStore.java

Author: stack
Date: Wed Jun 25 20:31:48 2008
New Revision: 671714

URL: http://svn.apache.org/viewvc?rev=671714&view=rev
Log:
HBASE-707 High-load import of data into single table/family never triggers split

Modified:
    hadoop/hbase/branches/0.1/CHANGES.txt
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java

Modified: hadoop/hbase/branches/0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/CHANGES.txt?rev=671714&r1=671713&r2=671714&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.1/CHANGES.txt Wed Jun 25 20:31:48 2008
@@ -25,6 +25,7 @@
                because HScannerInterface's output incorrect (LN via Jim Kellerman)
    HBASE-613   Timestamp-anchored scanning fails to find all records
    HBASE-709   Deadlock while rolling WAL-log while finishing flush
+   HBASE-707   High-load import of data into single table/family never triggers split
 
 Release 0.1.2 - 05/13/2008
 

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java?rev=671714&r1=671713&r2=671714&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java Wed Jun 25 20:31:48 2008
@@ -898,19 +898,17 @@
   }
   /**
    * Compact all the stores.  This should be called periodically to make sure 
-   * the stores are kept manageable.  
+   * the stores are kept manageable.
    *
    * <p>This operation could block for a long time, so don't call it from a 
    * time-sensitive thread.
-   *
-   * @return Returns TRUE if the compaction has completed.  FALSE, if the
-   * compaction was not carried out, because the HRegion is busy doing
-   * something else storage-intensive (like flushing the cache). The caller
-   * should check back later.
    * 
+   * <p>
    * Note that no locking is necessary at this level because compaction only
    * conflicts with a region split, and that cannot happen because the region
    * server does them sequentially and not in parallel.
+   *
+   * @return Returns TRUE if a compaction.  FALSE, if no compaction.
    * @throws IOException
    */
   public boolean compactStores() throws IOException {
@@ -923,11 +921,6 @@
    *
    * <p>This operation could block for a long time, so don't call it from a 
    * time-sensitive thread.
-   *
-   * @return Returns TRUE if the compaction has completed.  FALSE, if the
-   * compaction was not carried out, because the HRegion is busy doing
-   * something else storage-intensive (like flushing the cache). The caller
-   * should check back later.
    * 
    * Note that no locking is necessary at this level because compaction only
    * conflicts with a region split, and that cannot happen because the region
@@ -935,6 +928,7 @@
    * 
    * @param force True to force a compaction regardless of thresholds (Needed
    * by merge).
+   * @return Returns TRUE if a compaction.  FALSE, if no compaction.
    * @throws IOException
    */
   private boolean compactStores(final boolean force) throws IOException {
@@ -955,19 +949,20 @@
       }
       long startTime = System.currentTimeMillis();
       LOG.info("checking compaction on region " + getRegionName());
-      boolean status = true;
+      boolean status = false;
       doRegionCompactionPrep();
       for (HStore store : stores.values()) {
-        if (!store.compact(force)) {
-          status = false;
+        if (store.compact(force)) {
+          // A compaction was run. Set status to true.
+          status = true;
         }
       }
       doRegionCompactionCleanup();
 
-      LOG.info("checking compaction completed on region " + getRegionName() + " in " +
+      LOG.info("checking compaction completed on region " + getRegionName() +
+        "; status: " + status + "; " +
         StringUtils.formatTimeDiff(System.currentTimeMillis(), startTime));
       return status;
-      
     } finally {
       synchronized (writestate) {
         writestate.compacting = false;

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java?rev=671714&r1=671713&r2=671714&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HStore.java Wed Jun 25 20:31:48 2008
@@ -1466,7 +1466,7 @@
    * @throws IOException
    * @param force True to force a compaction regardless of thresholds (Needed
    * by merge).
-   * @return true if compaction completed successfully
+   * @return Returns TRUE if a compaction.  FALSE, if no compaction.
    */
   boolean compact(final boolean force) throws IOException {
     synchronized (compactLock) {
@@ -1475,7 +1475,7 @@
       List<HStoreFile> filesToCompact =
         new ArrayList<HStoreFile>(this.storefiles.values());
       if (filesToCompact.size() == 0) {
-        return true;
+        return false;
       }
       if (!force && !hasReferences(filesToCompact) &&
           filesToCompact.size() < compactionThreshold) {
@@ -1514,7 +1514,7 @@
       return true;
     }
   }
-  
+
   /*
    * Compact passed <code>toCompactFiles</code> into <code>compactedOut</code>.
    * We create a new set of MapFile.Reader objects so we don't screw up the