hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject hbase git commit: HBASE-12901 Possible deadlock while onlining a region and get region plan for other region run parallel (Rajeshbabu Chintaguntla)
Date Sun, 25 Jan 2015 02:43:44 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 1f0eb701d -> 3efa4370a


HBASE-12901 Possible deadlock while onlining a region and get region plan for other region
run parallel (Rajeshbabu Chintaguntla)


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

Branch: refs/heads/branch-1.0
Commit: 3efa4370ab6c7f9e730df111d3d75ec90ab9b28d
Parents: 1f0eb70
Author: Enis Soztutar <enis@apache.org>
Authored: Sat Jan 24 18:37:35 2015 -0800
Committer: Enis Soztutar <enis@apache.org>
Committed: Sat Jan 24 18:43:32 2015 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  | 32 ++++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3efa4370/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
index 262ffee..98883c1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
@@ -29,7 +29,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.NavigableMap;
 import java.util.Set;
 import java.util.TreeMap;
@@ -2354,8 +2353,17 @@ public class AssignmentManager extends ZooKeeperListener {
           || existingPlan.getDestination() == null
           || !destServers.contains(existingPlan.getDestination())) {
         newPlan = true;
-        randomPlan = new RegionPlan(region, null,
-            balancer.randomAssignment(region, destServers));
+      }
+    }
+
+    if (newPlan) {
+      ServerName destination = balancer.randomAssignment(region, destServers);
+      if (destination == null) {
+        LOG.warn("Can't find a destination for " + encodedName);
+        return null;
+      }
+      synchronized (this.regionPlans) {
+        randomPlan = new RegionPlan(region, null, destination);
         if (!region.isMetaTable() && shouldAssignRegionsWithFavoredNodes) {
           List<HRegionInfo> regions = new ArrayList<HRegionInfo>(1);
           regions.add(region);
@@ -2367,20 +2375,12 @@ public class AssignmentManager extends ZooKeeperListener {
         }
         this.regionPlans.put(encodedName, randomPlan);
       }
+      LOG.debug("No previous transition plan found (or ignoring " + "an existing plan) for
"
+          + region.getRegionNameAsString() + "; generated random plan=" + randomPlan + ";
"
+          + destServers.size() + " (online=" + serverManager.getOnlineServers().size()
+          + ") available servers, forceNewPlan=" + forceNewPlan);
+      return randomPlan;
     }
-
-    if (newPlan) {
-      if (randomPlan.getDestination() == null) {
-        LOG.warn("Can't find a destination for " + encodedName);
-        return null;
-      }
-      LOG.debug("No previous transition plan found (or ignoring " +
-        "an existing plan) for " + region.getRegionNameAsString() +
-        "; generated random plan=" + randomPlan + "; " + destServers.size() +
-        " (online=" + serverManager.getOnlineServers().size() +
-        ") available servers, forceNewPlan=" + forceNewPlan);
-        return randomPlan;
-      }
     LOG.debug("Using pre-existing plan for " +
       region.getRegionNameAsString() + "; plan=" + existingPlan);
     return existingPlan;


Mime
View raw message