hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject git commit: HBASE-11403 Fix race conditions around Object#notify
Date Tue, 24 Jun 2014 11:32:02 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 cee00a720 -> 01d5e7626


HBASE-11403 Fix race conditions around Object#notify


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

Branch: refs/heads/0.98
Commit: 01d5e7626c04315995333cef424cc5ba9cf4be72
Parents: cee00a7
Author: Nicolas Liochon <nkeywal@gmail.com>
Authored: Tue Jun 24 13:29:53 2014 +0200
Committer: Nicolas Liochon <nkeywal@gmail.com>
Committed: Tue Jun 24 13:29:53 2014 +0200

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/AsyncProcess.java  | 14 +++++++-------
 .../java/org/apache/hadoop/hbase/ipc/RpcClient.java   |  1 -
 .../hadoop/hbase/io/hfile/bucket/BucketCache.java     |  3 ++-
 .../org/apache/hadoop/hbase/master/ServerManager.java |  5 +++--
 .../apache/hadoop/hbase/regionserver/LogRoller.java   |  2 +-
 .../hbase/regionserver/handler/OpenRegionHandler.java |  2 +-
 6 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/01d5e762/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java
index 7ad3d7b..61a73c3 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java
@@ -847,15 +847,15 @@ class AsyncProcess<CResult> {
    * @param currentNumberOfTask - the number of task finished when calling the method.
    */
   protected void waitForNextTaskDone(long currentNumberOfTask) throws InterruptedIOException
{
-    while (currentNumberOfTask == tasksDone.get()) {
-      try {
-        synchronized (this.tasksDone) {
+    synchronized (this.tasksDone) {
+      while (currentNumberOfTask == tasksDone.get()) {
+        try {
           this.tasksDone.wait(100);
+        } catch (InterruptedException e) {
+          throw new InterruptedIOException("#" + id + ", interrupted." +
+              " currentNumberOfTask=" + currentNumberOfTask +
+              ",  tableName=" + tableName + ", tasksDone=" + tasksDone.get());
         }
-      } catch (InterruptedException e) {
-        throw new InterruptedIOException("#" + id + ", interrupted." +
-            " currentNumberOfTask=" + currentNumberOfTask +
-            ",  tableName=" + tableName + ", tasksDone=" + tasksDone.get());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/01d5e762/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
index 534a3c1..3872367 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java
@@ -26,7 +26,6 @@ import java.io.DataOutputStream;
 import java.io.FilterInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InterruptedIOException;
 import java.io.OutputStream;
 import java.net.ConnectException;
 import java.net.InetSocketAddress;

http://git-wip-us.apache.org/repos/asf/hbase/blob/01d5e762/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
index 4600fac..3614dc4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
@@ -337,7 +337,8 @@ public class BucketCache implements BlockCache, HeapSize {
     if (!successfulAddition && wait) {
       synchronized (cacheWaitSignals[queueNum]) {
         try {
-          cacheWaitSignals[queueNum].wait(DEFAULT_CACHE_WAIT_TIME);
+          successfulAddition = bq.offer(re);
+          if (!successfulAddition) cacheWaitSignals[queueNum].wait(DEFAULT_CACHE_WAIT_TIME);
         } catch (InterruptedException ie) {
           Thread.currentThread().interrupt();
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/01d5e762/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
index 4e4ad15..9ad3dfa 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
@@ -470,7 +470,8 @@ public class ServerManager {
 
   void letRegionServersShutdown() {
     long previousLogTime = 0;
-    while (!onlineServers.isEmpty()) {
+    int onlineServersCt;
+    while ((onlineServersCt = onlineServers.size()) > 0) {
 
       if (System.currentTimeMillis() > (previousLogTime + 1000)) {
         StringBuilder sb = new StringBuilder();
@@ -487,7 +488,7 @@ public class ServerManager {
 
       synchronized (onlineServers) {
         try {
-          onlineServers.wait(100);
+          if (onlineServersCt == onlineServers.size()) onlineServers.wait(100);
         } catch (InterruptedException ignored) {
           // continue
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/01d5e762/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
index 5c7a041..c787e54 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
@@ -75,7 +75,7 @@ class LogRoller extends HasThread implements WALActionsListener {
         if (!periodic) {
           synchronized (rollLog) {
             try {
-              rollLog.wait(this.threadWakeFrequency);
+              if (!rollLog.get()) rollLog.wait(this.threadWakeFrequency);
             } catch (InterruptedException e) {
               // Fall through
             }

http://git-wip-us.apache.org/repos/asf/hbase/blob/01d5e762/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java
index 97ef25d..fb689f9 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRegionHandler.java
@@ -266,7 +266,7 @@ public class OpenRegionHandler extends EventHandler {
       }
       synchronized (signaller) {
         try {
-          signaller.wait(period);
+          if (!signaller.get()) signaller.wait(period);
         } catch (InterruptedException e) {
           // Go to the loop check.
         }


Mime
View raw message