From 5ab799822ee7b44e881bc74d94b9527b9806a059 Mon Sep 17 00:00:00 2001 From: nkeywal Date: Thu, 21 Nov 2013 10:08:26 +0000 Subject: [PATCH] HBASE-10014 HRegion#doMiniBatchMutation rollbacks the memstore even if there is nothing to rollback. git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1544080 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/hadoop/hbase/regionserver/HRegion.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 7e575fcb1f7..e1a1af46659 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -2133,7 +2133,7 @@ public class HRegion implements HeapSize { // , Writable{ WALEdit walEdit = new WALEdit(isInReplay); MultiVersionConsistencyControl.WriteEntry w = null; long txid = 0; - boolean walSyncSuccessful = false; + boolean doRollBackMemstore = false; boolean locked = false; /** Keep track of the locks we hold so we can release them in finally clause */ @@ -2294,6 +2294,7 @@ public class HRegion implements HeapSize { // , Writable{ != OperationStatusCode.NOT_RUN) { continue; } + doRollBackMemstore = true; // If we have a failure, we need to clean what we wrote addedSize += applyFamilyMapToMemstore(familyMaps[i], w); } @@ -2372,7 +2373,7 @@ public class HRegion implements HeapSize { // , Writable{ if (hasWalAppends) { syncOrDefer(txid, durability); } - walSyncSuccessful = true; + doRollBackMemstore = false; // calling the post CP hook for batch mutation if (!isInReplay && coprocessorHost != null) { MiniBatchOperationInProgress miniBatchOp = @@ -2414,7 +2415,7 @@ public class HRegion implements HeapSize { // , Writable{ } finally { // if the wal sync was unsuccessful, remove keys from memstore - if (!walSyncSuccessful) { + if (doRollBackMemstore) { rollbackMemstore(batchOp, familyMaps, firstIndex, lastIndexExclusive); } if (w != null) mvcc.completeMemstoreInsert(w);