Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7315B66BB for ; Thu, 28 Jul 2011 00:22:30 +0000 (UTC) Received: (qmail 46549 invoked by uid 500); 28 Jul 2011 00:22:30 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 46492 invoked by uid 500); 28 Jul 2011 00:22:29 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 46481 invoked by uid 99); 28 Jul 2011 00:22:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 00:22:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jul 2011 00:22:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4912323888BD for ; Thu, 28 Jul 2011 00:22:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@hbase.apache.org From: tedyu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110728002205.4912323888BD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) 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 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. *

* 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.