HBASE-16954 Unify HTable#checkAndDelete with AP (ChiaPing Tsai)

This commit is contained in:
daoye.ch 2016-10-31 09:15:29 +08:00
parent ba6d952324
commit 6ce05d44e5
2 changed files with 5 additions and 21 deletions

View File

@ -529,8 +529,7 @@ public class HTable implements Table {
return ResponseConverter.getResult(request, response, getRpcControllerCellScanner());
}
};
List<Row> rows = new ArrayList<Row>();
rows.add(delete);
List<Delete> rows = Collections.singletonList(delete);
AsyncRequestFuture ars = multiAp.submitAll(pool, tableName, rows,
null, null, callable, writeRpcTimeout);
ars.waitUntilDone();
@ -762,21 +761,8 @@ public class HTable implements Table {
*/
@Override
public boolean checkAndDelete(final byte [] row, final byte [] family, final byte [] qualifier,
final byte [] value, final Delete delete)
throws IOException {
ClientServiceCallable<Boolean> callable = new ClientServiceCallable<Boolean>(this.connection, getName(), row,
this.rpcControllerFactory.newController()) {
@Override
protected Boolean rpcCall() throws Exception {
MutateRequest request = RequestConverter.buildMutateRequest(
getLocation().getRegionInfo().getRegionName(), row, family, qualifier,
new BinaryComparator(value), CompareType.EQUAL, delete);
MutateResponse response = doMutate(request);
return Boolean.valueOf(response.getProcessed());
}
};
return rpcCallerFactory.<Boolean> newCaller(this.writeRpcTimeout).
callWithRetries(callable, this.operationTimeout);
final byte [] value, final Delete delete) throws IOException {
return checkAndDelete(row, family, qualifier, CompareOp.EQUAL, value, delete);
}
/**
@ -801,9 +787,7 @@ public class HTable implements Table {
return ResponseConverter.getResult(request, response, getRpcControllerCellScanner());
}
};
List<Row> rows = new ArrayList<Row>();
rows.add(delete);
List<Delete> rows = Collections.singletonList(delete);
Object[] results = new Object[1];
AsyncRequestFuture ars = multiAp.submitAll(pool, tableName, rows,
null, results, callable, -1);

View File

@ -153,7 +153,7 @@ public class SplitLogTask {
/**
* @param data Serialized date to parse.
* @return An SplitLogTaskState instance made of the passed <code>data</code>
* @throws DeserializationException
* @throws DeserializationException
* @see #toByteArray()
*/
public static SplitLogTask parseFrom(final byte [] data) throws DeserializationException {