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 2012/04/20 00:49:30 UTC

svn commit: r1328142 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase: client/HTable.java regionserver/HRegion.java

Author: stack
Date: Thu Apr 19 22:49:30 2012
New Revision: 1328142

URL: http://svn.apache.org/viewvc?rev=1328142&view=rev
Log:
HBASE-5824 HRegion.incrementColumnValue is not used in trunk

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

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=1328142&r1=1328141&r2=1328142&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 Apr 19 22:49:30 2012
@@ -829,21 +829,39 @@ public class HTable implements HTableInt
   }
 
   private void doPut(final List<Put> puts) throws IOException {
-    int n = 0;
-    for (Put put : puts) {
+    if (autoFlush && puts.size() == 1) {
+      final Put put = puts.get(0);
       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 == 0 && currentWriteBufferSize > writeBufferSize) {
+      new ServerCallable<Void>(connection, tableName, put.getRow(),
+          operationTimeout) {
+        public Void call() throws IOException {
+          try {
+            MutateRequest request = RequestConverter.buildMutateRequest(
+              location.getRegionInfo().getRegionName(), put);
+            server.mutate(null, request);
+          } catch (ServiceException se) {
+            throw ProtobufUtil.getRemoteException(se);
+          }
+          return null;
+        }
+      }.withRetries();
+    } else {
+      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 == 0 && currentWriteBufferSize > writeBufferSize) {
+          flushCommits();
+        }
+      }
+      if (autoFlush || currentWriteBufferSize > writeBufferSize) {
         flushCommits();
       }
     }
-    if (autoFlush || currentWriteBufferSize > writeBufferSize) {
-      flushCommits();
-    }
   }
 
   /**

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1328142&r1=1328141&r2=1328142&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Thu Apr 19 22:49:30 2012
@@ -44,7 +44,6 @@ import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CompletionService;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ConcurrentSkipListMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
@@ -4634,7 +4633,9 @@ public class HRegion implements HeapSize
    * @param writeToWAL
    * @return The new value.
    * @throws IOException
+   * @deprecated use {@link #increment(Increment, Integer, boolean)}
    */
+  @Deprecated
   public long incrementColumnValue(byte [] row, byte [] family,
       byte [] qualifier, long amount, boolean writeToWAL)
   throws IOException {