hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-13083 Master can be dead-locked while assigning META. (Andrey Stepachev)
Date Tue, 24 Feb 2015 05:19:09 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 8ae9ef984 -> 7ec02aaf2


HBASE-13083 Master can be dead-locked while assigning META. (Andrey Stepachev)


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

Branch: refs/heads/branch-1.0
Commit: 7ec02aaf2dbf1216339f69ee5f2a78416da8b848
Parents: 8ae9ef9
Author: stack <stack@apache.org>
Authored: Mon Feb 23 21:17:01 2015 -0800
Committer: stack <stack@apache.org>
Committed: Mon Feb 23 21:17:56 2015 -0800

----------------------------------------------------------------------
 .../apache/hadoop/hbase/master/RegionStates.java    | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7ec02aaf/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
index f03c5f5..03e6ca6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
@@ -590,14 +590,16 @@ public class RegionStates {
     // Offline all regions on this server not already in transition.
     List<HRegionInfo> rits = new ArrayList<HRegionInfo>();
     Set<HRegionInfo> regionsToCleanIfNoMetaEntry = new HashSet<HRegionInfo>();
+    // Offline regions outside the loop and synchronized block to avoid
+    // ConcurrentModificationException and deadlock in case of meta anassigned,
+    // but RegionState a blocked.
+    Set<HRegionInfo> regionsToOffline = new HashSet<HRegionInfo>();
     synchronized (this) {
       Set<HRegionInfo> assignedRegions = serverHoldings.get(sn);
       if (assignedRegions == null) {
         assignedRegions = new HashSet<HRegionInfo>();
       }
 
-      // Offline regions outside the loop to avoid ConcurrentModificationException
-      Set<HRegionInfo> regionsToOffline = new HashSet<HRegionInfo>();
       for (HRegionInfo region : assignedRegions) {
         // Offline open regions, no need to offline if SPLIT/MERGED/OFFLINE
         if (isRegionOnline(region)) {
@@ -639,13 +641,13 @@ public class RegionStates {
           }
         }
       }
-
-      for (HRegionInfo hri : regionsToOffline) {
-        regionOffline(hri);
-      }
-
       this.notifyAll();
     }
+
+    for (HRegionInfo hri : regionsToOffline) {
+      regionOffline(hri);
+    }
+
     cleanIfNoMetaEntry(regionsToCleanIfNoMetaEntry);
     return rits;
   }


Mime
View raw message