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
This commit is contained in:
nkeywal 2013-11-21 10:08:26 +00:00
parent bc7c3c7daa
commit 5ab799822e
1 changed files with 4 additions and 3 deletions

View File

@ -2133,7 +2133,7 @@ public class HRegion implements HeapSize { // , Writable{
WALEdit walEdit = new WALEdit(isInReplay); WALEdit walEdit = new WALEdit(isInReplay);
MultiVersionConsistencyControl.WriteEntry w = null; MultiVersionConsistencyControl.WriteEntry w = null;
long txid = 0; long txid = 0;
boolean walSyncSuccessful = false; boolean doRollBackMemstore = false;
boolean locked = false; boolean locked = false;
/** Keep track of the locks we hold so we can release them in finally clause */ /** 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) { != OperationStatusCode.NOT_RUN) {
continue; continue;
} }
doRollBackMemstore = true; // If we have a failure, we need to clean what we wrote
addedSize += applyFamilyMapToMemstore(familyMaps[i], w); addedSize += applyFamilyMapToMemstore(familyMaps[i], w);
} }
@ -2372,7 +2373,7 @@ public class HRegion implements HeapSize { // , Writable{
if (hasWalAppends) { if (hasWalAppends) {
syncOrDefer(txid, durability); syncOrDefer(txid, durability);
} }
walSyncSuccessful = true; doRollBackMemstore = false;
// calling the post CP hook for batch mutation // calling the post CP hook for batch mutation
if (!isInReplay && coprocessorHost != null) { if (!isInReplay && coprocessorHost != null) {
MiniBatchOperationInProgress<Mutation> miniBatchOp = MiniBatchOperationInProgress<Mutation> miniBatchOp =
@ -2414,7 +2415,7 @@ public class HRegion implements HeapSize { // , Writable{
} finally { } finally {
// if the wal sync was unsuccessful, remove keys from memstore // if the wal sync was unsuccessful, remove keys from memstore
if (!walSyncSuccessful) { if (doRollBackMemstore) {
rollbackMemstore(batchOp, familyMaps, firstIndex, lastIndexExclusive); rollbackMemstore(batchOp, familyMaps, firstIndex, lastIndexExclusive);
} }
if (w != null) mvcc.completeMemstoreInsert(w); if (w != null) mvcc.completeMemstoreInsert(w);