HBASE-2185 HTable - put(Put) , put(List<Put) code duplication
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@908161 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
74cc78ac2d
commit
d32839d1a0
|
@ -348,6 +348,7 @@ Release 0.21.0 - Unreleased
|
|||
(Lars Francke via Stack)
|
||||
HBASE-2178 Hooks for replication
|
||||
HBASE-2180 Bad random read performance from synchronizing hfile.fddatainputstream
|
||||
HBASE-2194 HTable - put(Put) , put(List<Put) code duplication (Kay Kay via Stack)
|
||||
|
||||
NEW FEATURES
|
||||
HBASE-1961 HBase EC2 scripts
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.client;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -445,12 +446,7 @@ public class HTable implements HTableInterface {
|
|||
* @since 0.20.0
|
||||
*/
|
||||
public synchronized void put(final Put put) throws IOException {
|
||||
validatePut(put);
|
||||
writeBuffer.add(put);
|
||||
currentWriteBufferSize += put.heapSize();
|
||||
if(autoFlush || currentWriteBufferSize > writeBufferSize) {
|
||||
flushCommits();
|
||||
}
|
||||
doPut(Arrays.asList(put));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -462,6 +458,19 @@ public class HTable implements HTableInterface {
|
|||
* @since 0.20.0
|
||||
*/
|
||||
public synchronized void put(final List<Put> puts) throws IOException {
|
||||
doPut(puts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal helper method.
|
||||
* Need to synchronize this instance to prevent race conditions on the internal
|
||||
* data structures.
|
||||
* <p>
|
||||
* If autoFlush is false, the update is buffered.
|
||||
* @param puts
|
||||
* @throws IOException
|
||||
*/
|
||||
private void doPut(final List<Put> puts) throws IOException {
|
||||
for (Put put : puts) {
|
||||
validatePut(put);
|
||||
writeBuffer.add(put);
|
||||
|
@ -471,7 +480,7 @@ public class HTable implements HTableInterface {
|
|||
flushCommits();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Atomically increments a column value. If the column value already exists
|
||||
* and is not a big-endian long, this could throw an exception.<p>
|
||||
|
|
Loading…
Reference in New Issue