HBASE-24650 Change the return types of the new CheckAndMutate methods introduced in HBASE-8458 (#1991)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
a1d7e6e253
commit
34e807a8b5
|
@ -367,7 +367,7 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
|
|||
* @param checkAndMutate The CheckAndMutate object.
|
||||
* @return A {@link CompletableFuture}s that represent the result for the CheckAndMutate.
|
||||
*/
|
||||
CompletableFuture<Boolean> checkAndMutate(CheckAndMutate checkAndMutate);
|
||||
CompletableFuture<CheckAndMutateResult> checkAndMutate(CheckAndMutate checkAndMutate);
|
||||
|
||||
/**
|
||||
* Batch version of checkAndMutate. The specified CheckAndMutates are batched only in the sense
|
||||
|
@ -378,15 +378,16 @@ public interface AsyncTable<C extends ScanResultConsumerBase> {
|
|||
* @return A list of {@link CompletableFuture}s that represent the result for each
|
||||
* CheckAndMutate.
|
||||
*/
|
||||
List<CompletableFuture<Boolean>> checkAndMutate(List<CheckAndMutate> checkAndMutates);
|
||||
List<CompletableFuture<CheckAndMutateResult>> checkAndMutate(
|
||||
List<CheckAndMutate> checkAndMutates);
|
||||
|
||||
/**
|
||||
* A simple version of batch checkAndMutate. It will fail if there are any failures.
|
||||
*
|
||||
* @param checkAndMutates The list of rows to apply.
|
||||
* @return A {@link CompletableFuture} that wrapper the result boolean list.
|
||||
* @return A {@link CompletableFuture} that wrapper the result list.
|
||||
*/
|
||||
default CompletableFuture<List<Boolean>> checkAndMutateAll(
|
||||
default CompletableFuture<List<CheckAndMutateResult>> checkAndMutateAll(
|
||||
List<CheckAndMutate> checkAndMutates) {
|
||||
return allOf(checkAndMutate(checkAndMutates));
|
||||
}
|
||||
|
|
|
@ -206,12 +206,13 @@ class AsyncTableImpl implements AsyncTable<ScanResultConsumer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Boolean> checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
public CompletableFuture<CheckAndMutateResult> checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
return wrap(rawTable.checkAndMutate(checkAndMutate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompletableFuture<Boolean>> checkAndMutate(List<CheckAndMutate> checkAndMutates) {
|
||||
public List<CompletableFuture<CheckAndMutateResult>> checkAndMutate(
|
||||
List<CheckAndMutate> checkAndMutates) {
|
||||
return rawTable.checkAndMutate(checkAndMutates).stream()
|
||||
.map(this::wrap).collect(toList());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
|
||||
/**
|
||||
* Represents a result of a CheckAndMutate operation
|
||||
*/
|
||||
@InterfaceAudience.Public
|
||||
public class CheckAndMutateResult {
|
||||
private final boolean success;
|
||||
private final Result result;
|
||||
|
||||
public CheckAndMutateResult(boolean success, Result result) {
|
||||
this.success = success;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether the CheckAndMutate operation is successful or not
|
||||
*/
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return It is used only for CheckAndMutate operations with Increment/Append. Otherwise null
|
||||
*/
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -348,8 +348,7 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
.action((controller, loc, stub) -> RawAsyncTableImpl.this.mutateRow(controller,
|
||||
loc, stub, mutation,
|
||||
(rn, rm) -> RequestConverter.buildMutateRequest(rn, row, family, qualifier, op, value,
|
||||
null, timeRange, rm),
|
||||
resp -> resp.getExists()))
|
||||
null, timeRange, rm), CheckAndMutateResult::isSuccess))
|
||||
.call();
|
||||
}
|
||||
}
|
||||
|
@ -409,8 +408,7 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
.action((controller, loc, stub) -> RawAsyncTableImpl.this.mutateRow(controller,
|
||||
loc, stub, mutation,
|
||||
(rn, rm) -> RequestConverter.buildMutateRequest(rn, row, null, null, null, null,
|
||||
filter, timeRange, rm),
|
||||
resp -> resp.getExists()))
|
||||
filter, timeRange, rm), CheckAndMutateResult::isSuccess))
|
||||
.call();
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +419,7 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Boolean> checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
public CompletableFuture<CheckAndMutateResult> checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
if (checkAndMutate.getAction() instanceof Put) {
|
||||
validatePut((Put) checkAndMutate.getAction(), conn.connConf.getMaxKeyValueSize());
|
||||
}
|
||||
|
@ -431,7 +429,7 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
if (mutation instanceof Put) {
|
||||
validatePut((Put) mutation, conn.connConf.getMaxKeyValueSize());
|
||||
}
|
||||
return RawAsyncTableImpl.this.<Boolean> newCaller(checkAndMutate.getRow(),
|
||||
return RawAsyncTableImpl.this.<CheckAndMutateResult> newCaller(checkAndMutate.getRow(),
|
||||
mutation.getPriority(), rpcTimeoutNs)
|
||||
.action((controller, loc, stub) -> RawAsyncTableImpl.mutate(controller,
|
||||
loc, stub, mutation,
|
||||
|
@ -439,22 +437,23 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
checkAndMutate.getFamily(), checkAndMutate.getQualifier(),
|
||||
checkAndMutate.getCompareOp(), checkAndMutate.getValue(), checkAndMutate.getFilter(),
|
||||
checkAndMutate.getTimeRange(), m),
|
||||
(c, r) -> r.getProcessed()))
|
||||
(c, r) -> ResponseConverter.getCheckAndMutateResult(r)))
|
||||
.call();
|
||||
} else if (checkAndMutate.getAction() instanceof RowMutations) {
|
||||
RowMutations rowMutations = (RowMutations) checkAndMutate.getAction();
|
||||
return RawAsyncTableImpl.this.<Boolean> newCaller(checkAndMutate.getRow(),
|
||||
return RawAsyncTableImpl.this.<CheckAndMutateResult> newCaller(checkAndMutate.getRow(),
|
||||
rowMutations.getMaxPriority(), rpcTimeoutNs)
|
||||
.action((controller, loc, stub) -> RawAsyncTableImpl.this.mutateRow(controller,
|
||||
loc, stub, rowMutations,
|
||||
(rn, rm) -> RequestConverter.buildMutateRequest(rn, checkAndMutate.getRow(),
|
||||
.action((controller, loc, stub) ->
|
||||
RawAsyncTableImpl.this.<CheckAndMutateResult, CheckAndMutateResult> mutateRow(
|
||||
controller, loc, stub, rowMutations,
|
||||
(rn, rm) -> RequestConverter.buildMutateRequest(rn, checkAndMutate.getRow(),
|
||||
checkAndMutate.getFamily(), checkAndMutate.getQualifier(),
|
||||
checkAndMutate.getCompareOp(), checkAndMutate.getValue(), checkAndMutate.getFilter(),
|
||||
checkAndMutate.getTimeRange(), rm),
|
||||
resp -> resp.getExists()))
|
||||
resp -> resp))
|
||||
.call();
|
||||
} else {
|
||||
CompletableFuture<Boolean> future = new CompletableFuture<>();
|
||||
CompletableFuture<CheckAndMutateResult> future = new CompletableFuture<>();
|
||||
future.completeExceptionally(new DoNotRetryIOException(
|
||||
"CheckAndMutate doesn't support " + checkAndMutate.getAction().getClass().getName()));
|
||||
return future;
|
||||
|
@ -462,18 +461,19 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<CompletableFuture<Boolean>> checkAndMutate(List<CheckAndMutate> checkAndMutates) {
|
||||
public List<CompletableFuture<CheckAndMutateResult>> checkAndMutate(
|
||||
List<CheckAndMutate> checkAndMutates) {
|
||||
return batch(checkAndMutates, rpcTimeoutNs).stream()
|
||||
.map(f -> f.thenApply(r -> ((Result)r).getExists()))
|
||||
.collect(toList());
|
||||
.map(f -> f.thenApply(r -> (CheckAndMutateResult) r)).collect(toList());
|
||||
}
|
||||
|
||||
// We need the MultiRequest when constructing the org.apache.hadoop.hbase.client.MultiResponse,
|
||||
// so here I write a new method as I do not want to change the abstraction of call method.
|
||||
private <RESP> CompletableFuture<RESP> mutateRow(HBaseRpcController controller,
|
||||
@SuppressWarnings("unchecked")
|
||||
private <RES, RESP> CompletableFuture<RESP> mutateRow(HBaseRpcController controller,
|
||||
HRegionLocation loc, ClientService.Interface stub, RowMutations mutation,
|
||||
Converter<MultiRequest, byte[], RowMutations> reqConvert,
|
||||
Function<Result, RESP> respConverter) {
|
||||
Function<RES, RESP> respConverter) {
|
||||
CompletableFuture<RESP> future = new CompletableFuture<>();
|
||||
try {
|
||||
byte[] regionName = loc.getRegion().getRegionName();
|
||||
|
@ -497,7 +497,7 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
"Failed to mutate row: " + Bytes.toStringBinary(mutation.getRow()), ex));
|
||||
} else {
|
||||
future.complete(respConverter
|
||||
.apply((Result) multiResp.getResults().get(regionName).result.get(0)));
|
||||
.apply((RES) multiResp.getResults().get(regionName).result.get(0)));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
future.completeExceptionally(e);
|
||||
|
@ -514,12 +514,15 @@ class RawAsyncTableImpl implements AsyncTable<AdvancedScanResultConsumer> {
|
|||
@Override
|
||||
public CompletableFuture<Void> mutateRow(RowMutations mutation) {
|
||||
return this.<Void> newCaller(mutation.getRow(), mutation.getMaxPriority(), writeRpcTimeoutNs)
|
||||
.action((controller, loc, stub) -> this.<Void> mutateRow(controller, loc, stub, mutation,
|
||||
(rn, rm) -> {
|
||||
RegionAction.Builder regionMutationBuilder = RequestConverter.buildRegionAction(rn, rm);
|
||||
regionMutationBuilder.setAtomic(true);
|
||||
return MultiRequest.newBuilder().addRegionAction(regionMutationBuilder.build()).build();
|
||||
}, resp -> null))
|
||||
.action((controller, loc, stub) ->
|
||||
this.<Result, Void> mutateRow(controller, loc, stub, mutation,
|
||||
(rn, rm) -> {
|
||||
RegionAction.Builder regionMutationBuilder = RequestConverter
|
||||
.buildRegionAction(rn, rm);
|
||||
regionMutationBuilder.setAtomic(true);
|
||||
return MultiRequest.newBuilder().addRegionAction(regionMutationBuilder.build())
|
||||
.build();
|
||||
}, resp -> null))
|
||||
.call();
|
||||
}
|
||||
|
||||
|
|
|
@ -432,11 +432,11 @@ public interface Table extends Closeable {
|
|||
* it performs the specified action.
|
||||
*
|
||||
* @param checkAndMutate The CheckAndMutate object.
|
||||
* @return boolean that represents the result for the CheckAndMutate.
|
||||
* @return A CheckAndMutateResult object that represents the result for the CheckAndMutate.
|
||||
* @throws IOException if a remote or network exception occurs.
|
||||
*/
|
||||
default boolean checkAndMutate(CheckAndMutate checkAndMutate) throws IOException {
|
||||
return checkAndMutate(Collections.singletonList(checkAndMutate))[0];
|
||||
default CheckAndMutateResult checkAndMutate(CheckAndMutate checkAndMutate) throws IOException {
|
||||
return checkAndMutate(Collections.singletonList(checkAndMutate)).get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -445,10 +445,12 @@ public interface Table extends Closeable {
|
|||
* atomically (and thus, each may fail independently of others).
|
||||
*
|
||||
* @param checkAndMutates The list of CheckAndMutate.
|
||||
* @return A array of boolean that represents the result for each CheckAndMutate.
|
||||
* @return A list of CheckAndMutateResult objects that represents the result for each
|
||||
* CheckAndMutate.
|
||||
* @throws IOException if a remote or network exception occurs.
|
||||
*/
|
||||
default boolean[] checkAndMutate(List<CheckAndMutate> checkAndMutates) throws IOException {
|
||||
default List<CheckAndMutateResult> checkAndMutate(List<CheckAndMutate> checkAndMutates)
|
||||
throws IOException {
|
||||
throw new NotImplementedException("Add an implementation!");
|
||||
}
|
||||
|
||||
|
|
|
@ -300,13 +300,14 @@ class TableOverAsyncTable implements Table {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAndMutate(CheckAndMutate checkAndMutate) throws IOException {
|
||||
public CheckAndMutateResult checkAndMutate(CheckAndMutate checkAndMutate) throws IOException {
|
||||
return FutureUtils.get(table.checkAndMutate(checkAndMutate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] checkAndMutate(List<CheckAndMutate> checkAndMutates) throws IOException {
|
||||
return Booleans.toArray(FutureUtils.get(table.checkAndMutateAll(checkAndMutates)));
|
||||
public List<CheckAndMutateResult> checkAndMutate(List<CheckAndMutate> checkAndMutates)
|
||||
throws IOException {
|
||||
return FutureUtils.get(table.checkAndMutateAll(checkAndMutates));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.Cell;
|
|||
import org.apache.hadoop.hbase.CellScanner;
|
||||
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
||||
import org.apache.hadoop.hbase.ServerName;
|
||||
import org.apache.hadoop.hbase.client.CheckAndMutateResult;
|
||||
import org.apache.hadoop.hbase.client.RegionInfo;
|
||||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.client.SingleResponse;
|
||||
|
@ -156,29 +157,56 @@ public final class ResponseConverter {
|
|||
// This RegionAction is from a RowMutations/CheckAndMutate in a batch.
|
||||
// If there is an exception from the server, the exception is set at
|
||||
// the RegionActionResult level, which has been handled above.
|
||||
responseValue = actionResult.getProcessed() ?
|
||||
if (actions.hasCondition()) {
|
||||
Result result = null;
|
||||
if (actionResult.getResultOrExceptionCount() > 0) {
|
||||
ResultOrException roe = actionResult.getResultOrException(0);
|
||||
if (roe.hasResult()) {
|
||||
Result r = ProtobufUtil.toResult(roe.getResult(), cells);
|
||||
if (!r.isEmpty()) {
|
||||
result = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
responseValue = new CheckAndMutateResult(actionResult.getProcessed(), result);
|
||||
} else {
|
||||
responseValue = actionResult.getProcessed() ?
|
||||
ProtobufUtil.EMPTY_RESULT_EXISTS_TRUE :
|
||||
ProtobufUtil.EMPTY_RESULT_EXISTS_FALSE;
|
||||
}
|
||||
results.add(regionName, index, responseValue);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
|
||||
if (roe.hasException()) {
|
||||
responseValue = ProtobufUtil.toException(roe.getException());
|
||||
} else if (roe.hasResult()) {
|
||||
responseValue = ProtobufUtil.toResult(roe.getResult(), cells);
|
||||
} else if (roe.hasServiceResult()) {
|
||||
responseValue = roe.getServiceResult();
|
||||
} else {
|
||||
// Sometimes, the response is just "it was processed". Generally, this occurs for things
|
||||
// like mutateRows where either we get back 'processed' (or not) and optionally some
|
||||
// statistics about the regions we touched.
|
||||
responseValue = actionResult.getProcessed() ?
|
||||
ProtobufUtil.EMPTY_RESULT_EXISTS_TRUE :
|
||||
ProtobufUtil.EMPTY_RESULT_EXISTS_FALSE;
|
||||
if (actions.hasCondition()) {
|
||||
Result result = null;
|
||||
if (actionResult.getResultOrExceptionCount() > 0) {
|
||||
ResultOrException roe = actionResult.getResultOrException(0);
|
||||
Result r = ProtobufUtil.toResult(roe.getResult(), cells);
|
||||
if (!r.isEmpty()) {
|
||||
result = r;
|
||||
}
|
||||
}
|
||||
responseValue = new CheckAndMutateResult(actionResult.getProcessed(), result);
|
||||
results.add(regionName, 0, responseValue);
|
||||
} else {
|
||||
for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
|
||||
if (roe.hasException()) {
|
||||
responseValue = ProtobufUtil.toException(roe.getException());
|
||||
} else if (roe.hasResult()) {
|
||||
responseValue = ProtobufUtil.toResult(roe.getResult(), cells);
|
||||
} else if (roe.hasServiceResult()) {
|
||||
responseValue = roe.getServiceResult();
|
||||
} else {
|
||||
// Sometimes, the response is just "it was processed". Generally, this occurs for things
|
||||
// like mutateRows where either we get back 'processed' (or not) and optionally some
|
||||
// statistics about the regions we touched.
|
||||
responseValue = actionResult.getProcessed() ?
|
||||
ProtobufUtil.EMPTY_RESULT_EXISTS_TRUE :
|
||||
ProtobufUtil.EMPTY_RESULT_EXISTS_FALSE;
|
||||
}
|
||||
results.add(regionName, roe.getIndex(), responseValue);
|
||||
}
|
||||
results.add(regionName, roe.getIndex(), responseValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +220,21 @@ public final class ResponseConverter {
|
|||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a CheckAndMutateResult object from a protocol buffer MutateResponse
|
||||
*
|
||||
* @return a CheckAndMutateResult object
|
||||
*/
|
||||
public static CheckAndMutateResult getCheckAndMutateResult(
|
||||
ClientProtos.MutateResponse mutateResponse) {
|
||||
boolean success = mutateResponse.getProcessed();
|
||||
Result result = null;
|
||||
if (mutateResponse.hasResult()) {
|
||||
result = ProtobufUtil.toResult(mutateResponse.getResult());
|
||||
}
|
||||
return new CheckAndMutateResult(success, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a throwable to an action result.
|
||||
*
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.apache.hadoop.hbase.KeyValue;
|
|||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.client.Append;
|
||||
import org.apache.hadoop.hbase.client.CheckAndMutate;
|
||||
import org.apache.hadoop.hbase.client.CheckAndMutateResult;
|
||||
import org.apache.hadoop.hbase.client.Delete;
|
||||
import org.apache.hadoop.hbase.client.Durability;
|
||||
import org.apache.hadoop.hbase.client.Get;
|
||||
|
@ -746,12 +747,12 @@ public class RemoteHTable implements Table {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
public CheckAndMutateResult checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
throw new NotImplementedException("Implement later");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] checkAndMutate(List<CheckAndMutate> checkAndMutates) {
|
||||
public List<CheckAndMutateResult> checkAndMutate(List<CheckAndMutate> checkAndMutates) {
|
||||
throw new NotImplementedException("Implement later");
|
||||
}
|
||||
|
||||
|
|
|
@ -113,12 +113,13 @@ public class DummyAsyncTable<C extends ScanResultConsumerBase> implements AsyncT
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Boolean> checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
public CompletableFuture<CheckAndMutateResult> checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompletableFuture<Boolean>> checkAndMutate(List<CheckAndMutate> checkAndMutates) {
|
||||
public List<CompletableFuture<CheckAndMutateResult>> checkAndMutate(
|
||||
List<CheckAndMutate> checkAndMutates) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -632,7 +632,7 @@ public class TestAsyncTable {
|
|||
.ifNotExists(FAMILY, QUALIFIER)
|
||||
.build(new Put(row).addColumn(FAMILY, QUALIFIER, concat(VALUE, i))))
|
||||
.thenAccept(x -> {
|
||||
if (x) {
|
||||
if (x.isSuccess()) {
|
||||
successCount.incrementAndGet();
|
||||
successIndex.set(i);
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ public class TestAsyncTable {
|
|||
.build(
|
||||
new Delete(row).addColumn(FAMILY, QUALIFIER).addColumn(FAMILY, concat(QUALIFIER, i))))
|
||||
.thenAccept(x -> {
|
||||
if (x) {
|
||||
if (x.isSuccess()) {
|
||||
successCount.incrementAndGet();
|
||||
successIndex.set(i);
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ public class TestAsyncTable {
|
|||
.ifEquals(FAMILY, QUALIFIER, VALUE)
|
||||
.build(mutation))
|
||||
.thenAccept(x -> {
|
||||
if (x) {
|
||||
if (x.isSuccess()) {
|
||||
successCount.incrementAndGet();
|
||||
successIndex.set(i);
|
||||
}
|
||||
|
@ -739,50 +739,50 @@ public class TestAsyncTable {
|
|||
Put put = new Put(row);
|
||||
put.addColumn(FAMILY, QUALIFIER, ts, VALUE);
|
||||
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifNotExists(FAMILY, QUALIFIER)
|
||||
.build(put)).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifEquals(FAMILY, QUALIFIER, VALUE)
|
||||
.timeRange(TimeRange.at(ts + 10000))
|
||||
.build(put)).get();
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifEquals(FAMILY, QUALIFIER, VALUE)
|
||||
.timeRange(TimeRange.at(ts))
|
||||
.build(put)).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
RowMutations rm = new RowMutations(row).add((Mutation) put);
|
||||
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifEquals(FAMILY, QUALIFIER, VALUE)
|
||||
.timeRange(TimeRange.at(ts + 10000))
|
||||
.build(rm)).get();
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifEquals(FAMILY, QUALIFIER, VALUE)
|
||||
.timeRange(TimeRange.at(ts))
|
||||
.build(rm)).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Delete delete = new Delete(row).addColumn(FAMILY, QUALIFIER);
|
||||
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifEquals(FAMILY, QUALIFIER, VALUE)
|
||||
.timeRange(TimeRange.at(ts + 10000))
|
||||
.build(delete)).get();
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifEquals(FAMILY, QUALIFIER, VALUE)
|
||||
.timeRange(TimeRange.at(ts))
|
||||
.build(delete)).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -797,45 +797,45 @@ public class TestAsyncTable {
|
|||
table.put(put).get();
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d")))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
Result r = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("b")))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("E"), Bytes.toBytes("e")))).get();
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("E"))).get());
|
||||
|
||||
// Delete with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.build(new Delete(row).addColumns(FAMILY, Bytes.toBytes("D")))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get());
|
||||
|
||||
// Mutate with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("b")))
|
||||
.build(new RowMutations(row)
|
||||
.add((Mutation) new Put(row)
|
||||
.addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d")))
|
||||
.add((Mutation) new Delete(row).addColumns(FAMILY, Bytes.toBytes("A"))))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
r = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("A"))).get());
|
||||
}
|
||||
|
@ -852,44 +852,44 @@ public class TestAsyncTable {
|
|||
table.put(put).get();
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("b"))))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d")))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
Result r = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("c"))))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("E"), Bytes.toBytes("e")))).get();
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("E"))).get());
|
||||
|
||||
// Delete with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("b"))))
|
||||
.build(new Delete(row).addColumns(FAMILY, Bytes.toBytes("D")))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get());
|
||||
|
||||
// Mutate with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
|
@ -899,10 +899,10 @@ public class TestAsyncTable {
|
|||
.add((Mutation) new Put(row)
|
||||
.addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d")))
|
||||
.add((Mutation) new Delete(row).addColumns(FAMILY, Bytes.toBytes("A"))))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
r = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("D"))).get();
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("A"))).get());
|
||||
}
|
||||
|
@ -915,25 +915,25 @@ public class TestAsyncTable {
|
|||
table.put(new Put(row).addColumn(FAMILY, Bytes.toBytes("A"), 100, Bytes.toBytes("a"))).get();
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new FilterList(
|
||||
new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(FAMILY)),
|
||||
new QualifierFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("A"))),
|
||||
new TimestampsFilter(Collections.singletonList(100L))))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("b")))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("B"))).get();
|
||||
assertEquals("b", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
Result r = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("B"))).get();
|
||||
assertEquals("b", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new FilterList(
|
||||
new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(FAMILY)),
|
||||
new QualifierFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("A"))),
|
||||
new TimestampsFilter(Collections.singletonList(101L))))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("C"), Bytes.toBytes("c")))).get();
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("C"))).get());
|
||||
}
|
||||
|
@ -947,24 +947,24 @@ public class TestAsyncTable {
|
|||
.get();
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.timeRange(TimeRange.between(0, 101))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("b")))).get();
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("B"))).get();
|
||||
assertEquals("b", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
Result r = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("B"))).get();
|
||||
assertEquals("b", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(row)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.timeRange(TimeRange.between(0, 100))
|
||||
.build(new Put(row).addColumn(FAMILY, Bytes.toBytes("C"), Bytes.toBytes("c"))))
|
||||
.get();
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("C"))).get());
|
||||
}
|
||||
|
@ -993,11 +993,11 @@ public class TestAsyncTable {
|
|||
.ifEquals(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("a"))
|
||||
.build(new Put(row2).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("f")));
|
||||
|
||||
List<Boolean> results =
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("A"))).get();
|
||||
assertEquals("e", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("A"))));
|
||||
|
@ -1016,8 +1016,8 @@ public class TestAsyncTable {
|
|||
|
||||
results = table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("A"))).get());
|
||||
|
||||
|
@ -1041,8 +1041,8 @@ public class TestAsyncTable {
|
|||
|
||||
results = table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(row3)).get();
|
||||
assertEquals("f", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("F"))));
|
||||
|
@ -1075,11 +1075,11 @@ public class TestAsyncTable {
|
|||
.ifNotExists(FAMILY, Bytes.toBytes("B"))
|
||||
.build(new Put(row2).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("f")));
|
||||
|
||||
List<Boolean> results =
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("A"))).get();
|
||||
assertEquals("e", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("A"))));
|
||||
|
@ -1098,8 +1098,8 @@ public class TestAsyncTable {
|
|||
|
||||
results = table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("A"))).get();
|
||||
assertEquals("a", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("A"))));
|
||||
|
@ -1120,8 +1120,8 @@ public class TestAsyncTable {
|
|||
|
||||
results = table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(row3).addColumn(FAMILY, Bytes.toBytes("C"))).get();
|
||||
assertEquals("e", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("C"))));
|
||||
|
@ -1162,11 +1162,11 @@ public class TestAsyncTable {
|
|||
Bytes.toBytes("b"))))
|
||||
.build(new Put(row2).addColumn(FAMILY, Bytes.toBytes("F"), Bytes.toBytes("h")));
|
||||
|
||||
List<Boolean> results =
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("C"))).get();
|
||||
assertEquals("g", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("C"))));
|
||||
|
@ -1193,8 +1193,8 @@ public class TestAsyncTable {
|
|||
|
||||
results = table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(row).addColumn(FAMILY, Bytes.toBytes("C"))).get());
|
||||
|
||||
|
@ -1226,8 +1226,8 @@ public class TestAsyncTable {
|
|||
|
||||
results = table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(row)).get();
|
||||
assertNull(result.getValue(FAMILY, Bytes.toBytes("A")));
|
||||
|
@ -1269,11 +1269,11 @@ public class TestAsyncTable {
|
|||
.timeRange(TimeRange.between(0, 100))
|
||||
.build(new Put(row2).addColumn(FAMILY, Bytes.toBytes("F"), Bytes.toBytes("h")));
|
||||
|
||||
List<Boolean> results =
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutateAll(Arrays.asList(checkAndMutate1, checkAndMutate2)).get();
|
||||
|
||||
assertTrue(results.get(0));
|
||||
assertFalse(results.get(1));
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(row).addColumn(FAMILY, Bytes.toBytes("C"))).get();
|
||||
assertEquals("g", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("C"))));
|
||||
|
|
|
@ -367,11 +367,11 @@ public class TestAsyncTableBatch {
|
|||
List<Row> actions = Arrays.asList(checkAndMutate1, get, mutations, checkAndMutate2, put);
|
||||
List<Object> results = table.batchAll(actions).get();
|
||||
|
||||
assertTrue(((Result) results.get(0)).getExists());
|
||||
assertTrue(((CheckAndMutateResult) results.get(0)).isSuccess());
|
||||
assertEquals("b",
|
||||
Bytes.toString(((Result) results.get(1)).getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
assertTrue(((Result) results.get(2)).getExists());
|
||||
assertFalse(((Result) results.get(3)).getExists());
|
||||
assertFalse(((CheckAndMutateResult) results.get(3)).isSuccess());
|
||||
assertTrue(((Result) results.get(4)).isEmpty());
|
||||
|
||||
Result result = table.get(new Get(row1)).get();
|
||||
|
|
|
@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
|
|||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.apache.hadoop.hbase.CompareOperator;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -367,10 +368,10 @@ public class TestCheckAndMutate {
|
|||
|
||||
// put the same row again with C column deleted
|
||||
RowMutations rm = makeRowMutationsWithColumnCDeleted();
|
||||
boolean res = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
CheckAndMutateResult res = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifEquals(FAMILY, Bytes.toBytes("A"), Bytes.toBytes("a"))
|
||||
.build(rm));
|
||||
assertTrue(res);
|
||||
assertTrue(res.isSuccess());
|
||||
|
||||
// get row back and assert the values
|
||||
getOneRowAndAssertAllButCExist(table);
|
||||
|
@ -399,45 +400,45 @@ public class TestCheckAndMutate {
|
|||
getOneRowAndAssertAllExist(table);
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY,
|
||||
Bytes.toBytes("A"), CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d"))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
Result r = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("b")))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("E"), Bytes.toBytes("e"))));
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("E"))));
|
||||
|
||||
// Delete with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.build(new Delete(ROWKEY).addColumns(FAMILY, Bytes.toBytes("D"))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
// Mutate with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("b")))
|
||||
.build(new RowMutations(ROWKEY)
|
||||
.add((Mutation) new Put(ROWKEY)
|
||||
.addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d")))
|
||||
.add((Mutation) new Delete(ROWKEY).addColumns(FAMILY, Bytes.toBytes("A")))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
r = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A"))));
|
||||
}
|
||||
|
@ -452,44 +453,44 @@ public class TestCheckAndMutate {
|
|||
getOneRowAndAssertAllExist(table);
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("b"))))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d"))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
Result r = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("c"))))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("E"), Bytes.toBytes("e"))));
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("E"))));
|
||||
|
||||
// Delete with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("B"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("b"))))
|
||||
.build(new Delete(ROWKEY).addColumns(FAMILY, Bytes.toBytes("D"))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
// Mutate with success
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new FilterList(
|
||||
new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||
Bytes.toBytes("a")),
|
||||
|
@ -499,10 +500,10 @@ public class TestCheckAndMutate {
|
|||
.add((Mutation) new Put(ROWKEY)
|
||||
.addColumn(FAMILY, Bytes.toBytes("D"), Bytes.toBytes("d")))
|
||||
.add((Mutation) new Delete(ROWKEY).addColumns(FAMILY, Bytes.toBytes("A")))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
r = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("D")));
|
||||
assertEquals("d", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("D"))));
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A"))));
|
||||
}
|
||||
|
@ -515,25 +516,25 @@ public class TestCheckAndMutate {
|
|||
table.put(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A"), 100, Bytes.toBytes("a")));
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new FilterList(
|
||||
new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(FAMILY)),
|
||||
new QualifierFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("A"))),
|
||||
new TimestampsFilter(Collections.singletonList(100L))))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("b"))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("B")));
|
||||
assertEquals("b", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
Result r = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("B")));
|
||||
assertEquals("b", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new FilterList(
|
||||
new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(FAMILY)),
|
||||
new QualifierFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("A"))),
|
||||
new TimestampsFilter(Collections.singletonList(101L))))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("C"), Bytes.toBytes("c"))));
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("C"))));
|
||||
}
|
||||
|
@ -546,23 +547,23 @@ public class TestCheckAndMutate {
|
|||
table.put(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A"), 100, Bytes.toBytes("a")));
|
||||
|
||||
// Put with success
|
||||
boolean ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
CheckAndMutateResult result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY,
|
||||
Bytes.toBytes("A"), CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.timeRange(TimeRange.between(0, 101))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("b"))));
|
||||
assertTrue(ok);
|
||||
assertTrue(result.isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("B")));
|
||||
assertEquals("b", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
Result r = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("B")));
|
||||
assertEquals("b", Bytes.toString(r.getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
|
||||
// Put with failure
|
||||
ok = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
result = table.checkAndMutate(CheckAndMutate.newBuilder(ROWKEY)
|
||||
.ifMatches(new SingleColumnValueFilter(FAMILY, Bytes.toBytes("A"),
|
||||
CompareOperator.EQUAL, Bytes.toBytes("a")))
|
||||
.timeRange(TimeRange.between(0, 100))
|
||||
.build(new Put(ROWKEY).addColumn(FAMILY, Bytes.toBytes("C"), Bytes.toBytes("c"))));
|
||||
assertFalse(ok);
|
||||
assertFalse(result.isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("C"))));
|
||||
}
|
||||
|
@ -594,10 +595,11 @@ public class TestCheckAndMutate {
|
|||
.ifEquals(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("a"))
|
||||
.build(new Put(ROWKEY2).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("f")));
|
||||
|
||||
boolean[] results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A")));
|
||||
assertEquals("e", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("A"))));
|
||||
|
@ -616,8 +618,8 @@ public class TestCheckAndMutate {
|
|||
|
||||
results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A"))));
|
||||
|
||||
|
@ -641,8 +643,8 @@ public class TestCheckAndMutate {
|
|||
|
||||
results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(ROWKEY3));
|
||||
assertEquals("f", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("F"))));
|
||||
|
@ -672,10 +674,11 @@ public class TestCheckAndMutate {
|
|||
.ifNotExists(FAMILY, Bytes.toBytes("B"))
|
||||
.build(new Put(ROWKEY2).addColumn(FAMILY, Bytes.toBytes("B"), Bytes.toBytes("f")));
|
||||
|
||||
boolean[] results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A")));
|
||||
assertEquals("e", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("A"))));
|
||||
|
@ -694,8 +697,8 @@ public class TestCheckAndMutate {
|
|||
|
||||
results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("A")));
|
||||
assertEquals("a", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("A"))));
|
||||
|
@ -716,8 +719,8 @@ public class TestCheckAndMutate {
|
|||
|
||||
results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(ROWKEY3).addColumn(FAMILY, Bytes.toBytes("C")));
|
||||
assertEquals("e", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("C"))));
|
||||
|
@ -757,10 +760,11 @@ public class TestCheckAndMutate {
|
|||
Bytes.toBytes("b"))))
|
||||
.build(new Put(ROWKEY2).addColumn(FAMILY, Bytes.toBytes("F"), Bytes.toBytes("h")));
|
||||
|
||||
boolean[] results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("C")));
|
||||
assertEquals("g", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("C"))));
|
||||
|
@ -787,8 +791,8 @@ public class TestCheckAndMutate {
|
|||
|
||||
results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
assertFalse(table.exists(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("C"))));
|
||||
|
||||
|
@ -820,8 +824,8 @@ public class TestCheckAndMutate {
|
|||
|
||||
results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
result = table.get(new Get(ROWKEY));
|
||||
assertNull(result.getValue(FAMILY, Bytes.toBytes("A")));
|
||||
|
@ -862,10 +866,11 @@ public class TestCheckAndMutate {
|
|||
.timeRange(TimeRange.between(0, 100))
|
||||
.build(new Put(ROWKEY2).addColumn(FAMILY, Bytes.toBytes("F"), Bytes.toBytes("h")));
|
||||
|
||||
boolean[] results = table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
List<CheckAndMutateResult> results =
|
||||
table.checkAndMutate(Arrays.asList(checkAndMutate1, checkAndMutate2));
|
||||
|
||||
assertTrue(results[0]);
|
||||
assertFalse(results[1]);
|
||||
assertTrue(results.get(0).isSuccess());
|
||||
assertFalse(results.get(1).isSuccess());
|
||||
|
||||
Result result = table.get(new Get(ROWKEY).addColumn(FAMILY, Bytes.toBytes("C")));
|
||||
assertEquals("g", Bytes.toString(result.getValue(FAMILY, Bytes.toBytes("C"))));
|
||||
|
|
|
@ -484,11 +484,11 @@ public class TestFromClientSide3 {
|
|||
Object[] results = new Object[actions.size()];
|
||||
table.batch(actions, results);
|
||||
|
||||
assertTrue(((Result) results[0]).getExists());
|
||||
assertTrue(((CheckAndMutateResult) results[0]).isSuccess());
|
||||
assertEquals("b",
|
||||
Bytes.toString(((Result) results[1]).getValue(FAMILY, Bytes.toBytes("B"))));
|
||||
assertTrue(((Result) results[2]).getExists());
|
||||
assertFalse(((Result) results[3]).getExists());
|
||||
assertFalse(((CheckAndMutateResult) results[3]).isSuccess());
|
||||
assertTrue(((Result) results[4]).isEmpty());
|
||||
|
||||
Result result = table.get(new Get(row1));
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.HConstants;
|
|||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.client.Append;
|
||||
import org.apache.hadoop.hbase.client.CheckAndMutate;
|
||||
import org.apache.hadoop.hbase.client.CheckAndMutateResult;
|
||||
import org.apache.hadoop.hbase.client.Delete;
|
||||
import org.apache.hadoop.hbase.client.Get;
|
||||
import org.apache.hadoop.hbase.client.Increment;
|
||||
|
@ -433,12 +434,12 @@ public class ThriftTable implements Table {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
public CheckAndMutateResult checkAndMutate(CheckAndMutate checkAndMutate) {
|
||||
throw new NotImplementedException("Implement later");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean[] checkAndMutate(List<CheckAndMutate> checkAndMutates) {
|
||||
public List<CheckAndMutateResult> checkAndMutate(List<CheckAndMutate> checkAndMutates) {
|
||||
throw new NotImplementedException("Implement later");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue