@InterfaceAudience.Private @InterfaceStability.Evolving public class BufferedMutatorImpl extends Object implements BufferedMutator
Used to communicate with a single HBase table similar to HTable
but meant for batched, potentially asynchronous puts. Obtain an instance from
a Connection
and call close()
afterwards.
While this can be used accross threads, great care should be used when doing so. Errors are global to the buffered mutator and the Exceptions can be thrown on any thread that causes the flush for requests.
ConnectionFactory
,
Connection
BufferedMutator.ExceptionListener
限定符和类型 | 字段和说明 |
---|---|
protected org.apache.hadoop.hbase.client.AsyncProcess |
ap |
protected ClusterConnection |
connection |
static long |
MIN_WRITE_BUFFER_PERIODIC_FLUSH_TIMERTICK_MS
Having the timer tick run more often that once every 100ms is needless and will
probably cause too many timer events firing having a negative impact on performance.
|
限定符和类型 | 方法和说明 |
---|---|
void |
close()
Performs a
BufferedMutator.flush() and releases any resources held. |
void |
disableWriteBufferPeriodicFlush()
Disable periodic flushing of the write buffer.
|
void |
flush()
Executes all the buffered, asynchronous
Mutation operations and waits until they
are done. |
org.apache.hadoop.conf.Configuration |
getConfiguration()
Returns the
Configuration object used by this instance. |
protected long |
getExecutedWriteBufferPeriodicFlushes() |
TableName |
getName()
Gets the fully qualified table name instance of the table that this BufferedMutator writes to.
|
List<Row> |
getWriteBuffer()
已过时。
Going away when we drop public support for
HTableInterface .
Ó |
long |
getWriteBufferPeriodicFlushTimeoutMs()
Returns the current periodic flush timeout value in milliseconds.
|
long |
getWriteBufferPeriodicFlushTimerTickMs()
Returns the current periodic flush timertick interval in milliseconds.
|
long |
getWriteBufferSize()
Returns the maximum size in bytes of the write buffer for this HTable.
|
void |
mutate(List<? extends Mutation> ms)
Send some
Mutation s to the table. |
void |
mutate(Mutation m)
Sends a
Mutation to the table. |
void |
setOperationTimeout(int operationTimeout) |
void |
setRpcTimeout(int writeRpcTimeout) |
void |
setWriteBufferPeriodicFlush(long timeoutMs)
Sets the maximum time before the buffer is automatically flushed checking once per second.
|
void |
setWriteBufferPeriodicFlush(long timeoutMs,
long timerTickMs)
Sets the maximum time before the buffer is automatically flushed.
|
void |
setWriteBufferSize(long writeBufferSize)
已过时。
Going away when we drop public support for
HTableInterface . |
void |
validatePut(Put put) |
protected ClusterConnection connection
public static final long MIN_WRITE_BUFFER_PERIODIC_FLUSH_TIMERTICK_MS
protected org.apache.hadoop.hbase.client.AsyncProcess ap
public TableName getName()
BufferedMutator
getName
在接口中 BufferedMutator
public org.apache.hadoop.conf.Configuration getConfiguration()
BufferedMutator
Configuration
object used by this instance.
The reference returned is not a copy, so any change made to it will affect this instance.
getConfiguration
在接口中 BufferedMutator
public void mutate(Mutation m) throws InterruptedIOException, RetriesExhaustedWithDetailsException
BufferedMutator
Mutation
to the table. The mutations will be buffered and sent over the
wire as part of a batch. Currently only supports Put
and Delete
mutations.mutate
在接口中 BufferedMutator
m
- The data to send.InterruptedIOException
RetriesExhaustedWithDetailsException
public void mutate(List<? extends Mutation> ms) throws InterruptedIOException, RetriesExhaustedWithDetailsException
BufferedMutator
Mutation
s to the table. The mutations will be buffered and sent over the
wire as part of a batch. There is no guarantee of sending entire content of mutations
in a single batch; it will be broken up according to the write buffer capacity.mutate
在接口中 BufferedMutator
ms
- The data to send.InterruptedIOException
RetriesExhaustedWithDetailsException
protected long getExecutedWriteBufferPeriodicFlushes()
public void validatePut(Put put) throws IllegalArgumentException
public void close() throws IOException
BufferedMutator
BufferedMutator.flush()
and releases any resources held.close
在接口中 Closeable
close
在接口中 AutoCloseable
close
在接口中 BufferedMutator
IOException
- if a remote or network exception occurs.public void flush() throws InterruptedIOException, RetriesExhaustedWithDetailsException
BufferedMutator
Mutation
operations and waits until they
are done.@Deprecated public void setWriteBufferSize(long writeBufferSize) throws RetriesExhaustedWithDetailsException, InterruptedIOException
HTableInterface
.HTable.setWriteBufferSize(long)
only. This ought
not be called for production uses.public long getWriteBufferSize()
The default value comes from the configuration parameter hbase.client.write.buffer
.
getWriteBufferSize
在接口中 BufferedMutator
public void setWriteBufferPeriodicFlush(long timeoutMs, long timerTickMs)
timeoutMs
- The maximum number of milliseconds how long records may be buffered
before they are flushed. Set to 0 to disable.timerTickMs
- The number of milliseconds between each check if the
timeout has been exceeded. Must be 100ms (as defined in
MIN_WRITE_BUFFER_PERIODIC_FLUSH_TIMERTICK_MS
)
or larger to avoid performance problems.public void disableWriteBufferPeriodicFlush()
public void setWriteBufferPeriodicFlush(long timeoutMs)
timeoutMs
- The maximum number of milliseconds how long records may be buffered
before they are flushed. Set to 0 to disable.public long getWriteBufferPeriodicFlushTimeoutMs()
public long getWriteBufferPeriodicFlushTimerTickMs()
public void setRpcTimeout(int writeRpcTimeout)
public void setOperationTimeout(int operationTimeout)
@Deprecated public List<Row> getWriteBuffer()
HTableInterface
.
ÓHTable.getWriteBuffer()
only. This should not beÓ
called from production uses.Copyright © 2007–2022 The Apache Software Foundation. All rights reserved.