hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1181391 - /hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java
Date Tue, 11 Oct 2011 02:04:43 GMT
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) {



Mime
View raw message