Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 ba6e7ddd3 -> 382f88ae8


HBASE-16721 Concurrency issue in WAL unflushed seqId tracking - ADDENDUM 2 for 
making sure that MVCC read point is advanced after flush


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/382f88ae
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/382f88ae
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/382f88ae

Branch: refs/heads/branch-1.1
Commit: 382f88ae87490cf0860aa63e104bf7e8273827c4
Parents: ba6e7dd
Author: Enis Soztutar <e...@apache.org>
Authored: Mon Oct 17 14:30:01 2016 -0700
Committer: Enis Soztutar <e...@apache.org>
Committed: Mon Oct 17 14:30:01 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java      | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/382f88ae/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
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 cc89b84..e600ae1 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
@@ -2198,16 +2198,8 @@ public class HRegion implements HeapSize, 
PropagatingConfigurationObserver, Regi
     long trxId = 0;
     try {
       try {
+        mvcc.waitForPreviousTransactionsComplete();
         writeEntry = mvcc.beginMemstoreInsert();
-        // wait for all in-progress transactions to commit to WAL before       
                                                                                
                                               
-        // we can start the flush. This prevents
-        // uncommitted transactions from being written into HFiles.
-        // We have to block before we start the flush, otherwise keys that
-        // were removed via a rollbackMemstore could be written to Hfiles.
-        mvcc.waitForPreviousTransactionsComplete(writeEntry);
-        // set w to null to prevent mvcc.advanceMemstore from being called 
again inside finally block
-        writeEntry = null;
-
         if (wal != null) {
           Long earliestUnflushedSequenceIdForTheRegion =
               wal.startCacheFlush(encodedRegionName, flushedFamilyNames);
@@ -2284,6 +2276,16 @@ public class HRegion implements HeapSize, 
PropagatingConfigurationObserver, Regi
           throw ioe;
         }
       }
+
+      // wait for all in-progress transactions to commit to WAL before
+      // we can start the flush. This prevents
+      // uncommitted transactions from being written into HFiles.
+      // We have to block before we start the flush, otherwise keys that
+      // were removed via a rollbackMemstore could be written to Hfiles.
+      writeEntry.setWriteNumber(flushOpSeqId);
+      mvcc.waitForPreviousTransactionsComplete(writeEntry);
+      // set w to null to prevent mvcc.advanceMemstore from being called again 
inside finally block
+      writeEntry = null;
     } finally {
       if (writeEntry != null) {
         // in case of failure just mark current writeEntry as complete

Reply via email to