hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1151689 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/client/HTable.java src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
Date Thu, 28 Jul 2011 00:24:12 GMT
Author: tedyu
Date: Thu Jul 28 00:24:11 2011
New Revision: 1151689

URL: http://svn.apache.org/viewvc?rev=1151689&view=rev
Log:
HBASE-4143  HTable.doPut(List) should check the writebuffer length every so often
               (Doug Meil via Ted Yu)

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1151689&r1=1151688&r2=1151689&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Jul 28 00:24:11 2011
@@ -340,6 +340,8 @@ Release 0.91.0 - Unreleased
    HBASE-4139  [stargate] Update ScannerModel with support for filter package
                additions
    HBASE-1938  Make in-memory table scanning faster (nkeywal)
+   HBASE-4143  HTable.doPut(List) should check the writebuffer length every so often
+               (Doug Meil via Ted Yu)
 
   TASKS
    HBASE-3559  Move report of split to master OFF the heartbeat channel

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java?rev=1151689&r1=1151688&r2=1151689&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java Thu Jul 28 00:24:11
2011
@@ -113,7 +113,8 @@ public class HTable implements HTableInt
   private long maxScannerResultSize;
   private boolean closed;
   private int operationTimeout;
-
+  private static final int DOPUT_WB_CHECK = 10;    // i.e., doPut checks the writebuffer
every X Puts.
+  
   /**
    * Creates an object to access a HBase table.
    * Internally it creates a new instance of {@link Configuration} and a new
@@ -706,10 +707,20 @@ public class HTable implements HTableInt
   }
 
   private void doPut(final List<Put> puts) throws IOException {
+    int n = 0;
     for (Put put : puts) {
       validatePut(put);
       writeBuffer.add(put);
       currentWriteBufferSize += put.heapSize();
+     
+      // we need to periodically see if the writebuffer is full instead of waiting until
the end of the List
+      n++;
+      if (n == DOPUT_WB_CHECK) {
+        if (autoFlush || currentWriteBufferSize > writeBufferSize) {
+          flushCommits();
+          n = 0;
+        }
+      }
     }
     if (autoFlush || currentWriteBufferSize > writeBufferSize) {
       flushCommits();

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java?rev=1151689&r1=1151688&r2=1151689&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java Thu Jul
28 00:24:11 2011
@@ -190,8 +190,9 @@ public interface HTableInterface {
    * until the internal buffer is full.
    * <p>
    * This can be used for group commit, or for submitting user defined
-   * batches, but sending large lists of values is not recommended. That may
-   * produce performance problems.
+   * batches.  The writeBuffer will be periodically inspected while the List
+   * is processed, so depending on the List size the writeBuffer may flush
+   * not at all, or more than once.
    * @param puts The list of mutations to apply. The batch put is done by
    * aggregating the iteration of the Puts over the write buffer
    * at the client-side for a single RPC call.



Mime
View raw message