You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Solomon Duskis (JIRA)" <ji...@apache.org> on 2015/01/06 00:02:34 UTC
[jira] [Created] (HBASE-12809) Remove unnecessary calls to
Table.setAutoFlush()
Solomon Duskis created HBASE-12809:
--------------------------------------
Summary: Remove unnecessary calls to Table.setAutoFlush()
Key: HBASE-12809
URL: https://issues.apache.org/jira/browse/HBASE-12809
Project: HBase
Issue Type: Sub-task
Affects Versions: 1.0.0, 2.0.0
Reporter: Solomon Duskis
Assignee: Solomon Duskis
It looks like there are a lot of places where setAutoFlushTo() is called in places where that's not necessary. HBASE-12728 will likely result in removing the flushCommits() method from Table. The patch for this issue should remove all unnecessary calls to setAutoFlushTo() to prepare for the full fix.
setAutoFlushTo(true) is unnecessary on newly constructed HTables, since autoFlush is true by default. Calls like the following
{code}
table.setAutoFlushTo(false);
for(...) {
Put put = new Put(...);
...
table.put(put);
}
table.flushCommits();
{code}
Is equivalent in functionality to:
{code}
List<Put> puts = new ArrayList<>();
for(...) {
Put put = new Put(...);
...
puts.add(put);
}
table.put(puts);
{code}
The put(List<Put>) semantics ought to be the preferred approach.
Note: here's the code for put(Put) and put(List<Put>):
{code:title=HTable.java|borderStyle=solid}
@Override
public void put(final Put put)
throws InterruptedIOException, RetriesExhaustedWithDetailsException {
doPut(put);
if (autoFlush) {
flushCommits();
}
}
@Override
public void put(final List<Put> puts)
throws InterruptedIOException, RetriesExhaustedWithDetailsException {
for (Put put : puts) {
doPut(put);
}
if (autoFlush) {
flushCommits();
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)