hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1151688 - in /hbase/branches/0.90: 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:22:04 GMT
Author: tedyu
Date: Thu Jul 28 00:22:03 2011
New Revision: 1151688

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

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

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1151688&r1=1151687&r2=1151688&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Thu Jul 28 00:22:03 2011
@@ -109,6 +109,8 @@ Release 0.90.4 - Unreleased
    HBASE-4142  Advise against large batches in javadoc for HTable#put(List<Put>)
    HBASE-4139  [stargate] Update ScannerModel with support for filter package
                 additions
+   HBASE-4143  HTable.doPut(List) should check the writebuffer length every so often
+               (Doug Meil via Ted Yu)
 
 Release 0.90.3 - May 19th, 2011
   BUG FIXES

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTable.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTable.java?rev=1151688&r1=1151687&r2=1151688&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTable.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTable.java Thu Jul 28
00:22:03 2011
@@ -100,6 +100,7 @@ public class HTable implements HTableInt
   private int maxKeyValueSize;
   private ExecutorService pool;  // For Multi
   private long maxScannerResultSize;
+  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.
@@ -675,10 +676,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/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java?rev=1151688&r1=1151687&r2=1151688&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
Thu Jul 28 00:22:03 2011
@@ -183,8 +183,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