HBASE-12611 Create autoCommit() method and remove clearBufferOnFail (Solomon Duskis)
This commit is contained in:
parent
da0e807dd3
commit
4b1983c89d
|
@ -116,7 +116,6 @@ public class HTable implements HTableInterface, RegionLocator {
|
|||
private TableConfiguration tableConfiguration;
|
||||
protected List<Row> writeAsyncBuffer = new LinkedList<Row>();
|
||||
private long writeBufferSize;
|
||||
private boolean clearBufferOnFail = true;
|
||||
private boolean autoFlush = true;
|
||||
protected long currentWriteBufferSize = 0 ;
|
||||
private boolean closed = false;
|
||||
|
@ -1092,8 +1091,7 @@ public class HTable implements HTableInterface, RegionLocator {
|
|||
while (!writeAsyncBuffer.isEmpty()) {
|
||||
ap.submit(tableName, writeAsyncBuffer, true, null, false);
|
||||
}
|
||||
List<Row> failedRows = clearBufferOnFail ? null : writeAsyncBuffer;
|
||||
RetriesExhaustedWithDetailsException error = ap.waitForAllPreviousOpsAndReset(failedRows);
|
||||
RetriesExhaustedWithDetailsException error = ap.waitForAllPreviousOpsAndReset(null);
|
||||
if (error != null) {
|
||||
throw error;
|
||||
}
|
||||
|
@ -1568,7 +1566,7 @@ public class HTable implements HTableInterface, RegionLocator {
|
|||
@Deprecated
|
||||
@Override
|
||||
public void setAutoFlush(boolean autoFlush) {
|
||||
setAutoFlush(autoFlush, autoFlush);
|
||||
this.autoFlush = autoFlush;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1576,7 +1574,7 @@ public class HTable implements HTableInterface, RegionLocator {
|
|||
*/
|
||||
@Override
|
||||
public void setAutoFlushTo(boolean autoFlush) {
|
||||
setAutoFlush(autoFlush, clearBufferOnFail);
|
||||
this.autoFlush = autoFlush;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1585,7 +1583,6 @@ public class HTable implements HTableInterface, RegionLocator {
|
|||
@Override
|
||||
public void setAutoFlush(boolean autoFlush, boolean clearBufferOnFail) {
|
||||
this.autoFlush = autoFlush;
|
||||
this.clearBufferOnFail = autoFlush || clearBufferOnFail;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -735,11 +735,12 @@ public class TestAsyncProcess {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testWithNoClearOnFail() throws IOException {
|
||||
HTable ht = new HTable();
|
||||
ht.ap = new MyAsyncProcess(createHConnection(), conf, true);
|
||||
ht.setAutoFlush(false);
|
||||
ht.setAutoFlushTo(false);
|
||||
|
||||
Put p = createPut(1, false);
|
||||
ht.put(p);
|
||||
|
@ -757,6 +758,7 @@ public class TestAsyncProcess {
|
|||
}
|
||||
Assert.assertEquals(1, ht.writeAsyncBuffer.size());
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testBatch() throws IOException, InterruptedException {
|
||||
|
@ -806,7 +808,7 @@ public class TestAsyncProcess {
|
|||
ht.ap.serverTrackerTimeout = 1;
|
||||
|
||||
Put p = createPut(1, false);
|
||||
ht.setAutoFlush(false);
|
||||
ht.setAutoFlushTo(false);
|
||||
ht.put(p);
|
||||
|
||||
try {
|
||||
|
@ -828,7 +830,7 @@ public class TestAsyncProcess {
|
|||
Assert.assertNotNull(ht.ap.createServerErrorTracker());
|
||||
|
||||
Put p = createPut(1, true);
|
||||
ht.setAutoFlush(false);
|
||||
ht.setAutoFlushTo(false);
|
||||
ht.put(p);
|
||||
|
||||
try {
|
||||
|
|
|
@ -1837,7 +1837,7 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
|
|||
* @throws IOException
|
||||
*/
|
||||
public int loadTable(final HTable t, final byte[][] f, byte[] value, boolean writeToWAL) throws IOException {
|
||||
t.setAutoFlush(false);
|
||||
t.setAutoFlushTo(false);
|
||||
int rowCount = 0;
|
||||
for (byte[] row : HBaseTestingUtility.ROWS) {
|
||||
Put put = new Put(row);
|
||||
|
|
Loading…
Reference in New Issue