PHOENIX-3789 Execute cross region index maintenance calls in postBatchMutateIndispensably
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bcceaf80 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bcceaf80 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bcceaf80 Branch: refs/heads/omid Commit: bcceaf80270b75a34a442f3ad1e7490bb88d58d5 Parents: adf5606 Author: James Taylor <[email protected]> Authored: Mon Apr 17 10:16:36 2017 -0700 Committer: James Taylor <[email protected]> Committed: Mon Apr 17 10:17:01 2017 -0700 ---------------------------------------------------------------------- .../org/apache/phoenix/hbase/index/Indexer.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bcceaf80/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java index c482cbd..f485bdf 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java @@ -386,18 +386,20 @@ public class Indexer extends BaseRegionObserver { } @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 {
