You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:04:43 UTC

svn commit: r1181391 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java

Author: nspiegelberg
Date: Tue Oct 11 02:04:39 2011
New Revision: 1181391

URL: http://svn.apache.org/viewvc?rev=1181391&view=rev
Log:
Fix a race condition in ReadWriteConsistencyControl#completeMemStoreInsert

Summary:
This bug causes TestReadWriteCinsistencyControl to occasionally hang

Test Plan:
unit test

DiffCamp Revision: 164443
Reviewed By: nspiegelberg
CC: nspiegelberg, hbase@lists
Tasks:
#401792: TestReadWriteConsistencyControl hang

Revert Plan:
OK

Modified:
    hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java

Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java?rev=1181391&r1=1181390&r2=1181391&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java Tue Oct 11 02:04:39 2011
@@ -114,9 +114,8 @@ public class ReadWriteConsistencyControl
       }
 
       if (nextReadValue > 0) {
-        memstoreRead = nextReadValue;
-
         synchronized (readWaiters) {
+          memstoreRead = nextReadValue;
           readWaiters.notifyAll();
         }
 
@@ -124,8 +123,8 @@ public class ReadWriteConsistencyControl
     }
 
     boolean interrupted = false;
-    while (memstoreRead < e.getWriteNumber()) {
-      synchronized (readWaiters) {
+    synchronized (readWaiters) {
+      while (memstoreRead < e.getWriteNumber()) {
         try {
           readWaiters.wait(0);
         } catch (InterruptedException ie) {