HBASE-8458 Support for batch version of checkAndMutate() (addendum) (#1899)

This commit is contained in:
Toshihiro Suzuki 2020-06-14 19:27:00 +09:00 committed by GitHub
parent fd5002d0da
commit d6e9c3164d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -600,8 +600,6 @@ public final class RequestConverter {
for (Action action : rowMutationsList) { for (Action action : rowMutationsList) {
builder.clear(); builder.clear();
getRegionActionBuilderWithRegion(builder, regionName); getRegionActionBuilderWithRegion(builder, regionName);
actionBuilder.clear();
mutationBuilder.clear();
buildNoDataRegionAction((RowMutations) action.getAction(), cells, builder, actionBuilder, buildNoDataRegionAction((RowMutations) action.getAction(), cells, builder, actionBuilder,
mutationBuilder); mutationBuilder);
@ -620,17 +618,19 @@ public final class RequestConverter {
for (Action action : checkAndMutates) { for (Action action : checkAndMutates) {
builder.clear(); builder.clear();
getRegionActionBuilderWithRegion(builder, regionName); getRegionActionBuilderWithRegion(builder, regionName);
actionBuilder.clear();
mutationBuilder.clear();
CheckAndMutate cam = (CheckAndMutate) action.getAction(); CheckAndMutate cam = (CheckAndMutate) action.getAction();
builder.setCondition(buildCondition(cam.getRow(), cam.getFamily(), cam.getQualifier(), builder.setCondition(buildCondition(cam.getRow(), cam.getFamily(), cam.getQualifier(),
cam.getCompareOp(), cam.getValue(), cam.getFilter(), cam.getTimeRange())); cam.getCompareOp(), cam.getValue(), cam.getFilter(), cam.getTimeRange()));
if (cam.getAction() instanceof Put) { if (cam.getAction() instanceof Put) {
actionBuilder.clear();
mutationBuilder.clear();
buildNoDataRegionAction((Put) cam.getAction(), cells, builder, actionBuilder, buildNoDataRegionAction((Put) cam.getAction(), cells, builder, actionBuilder,
mutationBuilder); mutationBuilder);
} else if (cam.getAction() instanceof Delete) { } else if (cam.getAction() instanceof Delete) {
actionBuilder.clear();
mutationBuilder.clear();
buildNoDataRegionAction((Delete) cam.getAction(), cells, builder, actionBuilder, buildNoDataRegionAction((Delete) cam.getAction(), cells, builder, actionBuilder,
mutationBuilder); mutationBuilder);
} else if (cam.getAction() instanceof RowMutations) { } else if (cam.getAction() instanceof RowMutations) {
@ -693,8 +693,10 @@ public final class RequestConverter {
throw new DoNotRetryIOException("RowMutations supports only put and delete, not " + throw new DoNotRetryIOException("RowMutations supports only put and delete, not " +
mutation.getClass().getName()); mutation.getClass().getName());
} }
mutationBuilder.clear();
MutationProto mp = ProtobufUtil.toMutationNoData(type, mutation, mutationBuilder); MutationProto mp = ProtobufUtil.toMutationNoData(type, mutation, mutationBuilder);
cells.add(mutation); cells.add(mutation);
actionBuilder.clear();
regionActionBuilder.addAction(actionBuilder.setMutation(mp).build()); regionActionBuilder.addAction(actionBuilder.setMutation(mp).build());
} }
} }