[
https://issues.apache.org/jira/browse/HBASE-12809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Solomon Duskis resolved HBASE-12809.
------------------------------------
Resolution: Duplicate
This was fixed in a different issue.
> Remove unnecessary calls to Table.setAutoFlush()
> ------------------------------------------------
>
> Key: HBASE-12809
> URL: https://issues.apache.org/jira/browse/HBASE-12809
> Project: HBase
> Issue Type: Sub-task
> Components: hbase
> 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)