Skip to content

Commit

Permalink
PHOENIX-3789 Execute cross region index maintenance calls in postBatc…
Browse files Browse the repository at this point in the history
…hMutateIndispensably
  • Loading branch information
JamesRTaylor committed Apr 17, 2017
1 parent adf5606 commit bcceaf8
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,18 +386,20 @@ public void postDelete(ObserverContext<RegionCoprocessorEnvironment> e, Delete d
}

@Override
public void postBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
public void postBatchMutateIndispensably(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean success) throws IOException {
if (this.disabled) {
super.postBatchMutate(c, miniBatchOp);
super.postBatchMutateIndispensably(c, miniBatchOp, success);
return;
}
this.builder.batchCompleted(miniBatchOp);

//each batch operation, only the first one will have anything useful, so we can just grab that
Mutation mutation = miniBatchOp.getOperation(0);
WALEdit edit = miniBatchOp.getWalEdit(0);
doPost(edit, mutation, mutation.getDurability(), false);

if (success) { // if miniBatchOp was successfully written, write index updates
//each batch operation, only the first one will have anything useful, so we can just grab that
Mutation mutation = miniBatchOp.getOperation(0);
WALEdit edit = miniBatchOp.getWalEdit(0);
doPost(edit, mutation, mutation.getDurability(), false);
}
}

private void doPost(WALEdit edit, Mutation m, final Durability durability, boolean allowLocalUpdates) throws IOException {
Expand Down

0 comments on commit bcceaf8

Please sign in to comment.