hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jg...@apache.org
Subject svn commit: r1049237 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
Date Tue, 14 Dec 2010 20:00:46 GMT
Author: jgray
Date: Tue Dec 14 20:00:45 2010
New Revision: 1049237

URL: http://svn.apache.org/viewvc?rev=1049237&view=rev
Log:
HBASE-3332  Regions stuck in transition after RS failure

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1049237&r1=1049236&r2=1049237&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Tue Dec 14 20:00:45 2010
@@ -744,6 +744,7 @@ Release 0.90.0 - Unreleased
                defaults to false
    HBASE-3337  Restore HBCK fix of unassignment and dupe assignment for new
                master
+   HBASE-3332  Regions stuck in transition after RS failure
 
 
   IMPROVEMENTS

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1049237&r1=1049236&r2=1049237&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
Tue Dec 14 20:00:45 2010
@@ -1654,9 +1654,9 @@ public class AssignmentManager extends Z
   /**
    * Process shutdown server removing any assignments.
    * @param hsi Server that went down.
-   * @return set of regions on this server that are not in transition
+   * @return list of regions in transition on this server
    */
-  public List<HRegionInfo> processServerShutdown(final HServerInfo hsi) {
+  public List<RegionState> processServerShutdown(final HServerInfo hsi) {
     // Clean out any existing assignment plans for this server
     synchronized (this.regionPlans) {
       for (Iterator <Map.Entry<String, RegionPlan>> i =
@@ -1672,7 +1672,7 @@ public class AssignmentManager extends Z
     // Remove this server from map of servers to regions, and remove all regions
     // of this server from online map of regions.
     Set<HRegionInfo> deadRegions = null;
-    List<HRegionInfo> rits = new ArrayList<HRegionInfo>();
+    List<RegionState> rits = new ArrayList<RegionState>();
     synchronized (this.regions) {
       List<HRegionInfo> assignedRegions = this.servers.remove(hsi);
       if (assignedRegions == null || assignedRegions.isEmpty()) {
@@ -1690,7 +1690,7 @@ public class AssignmentManager extends Z
     synchronized (regionsInTransition) {
       for (RegionState region : this.regionsInTransition.values()) {
         if (deadRegions.remove(region.getRegion())) {
-          rits.add(region.getRegion());
+          rits.add(region);
         }
       }
     }

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java?rev=1049237&r1=1049236&r2=1049237&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
Tue Dec 14 20:00:45 2010
@@ -40,6 +40,7 @@ import org.apache.hadoop.hbase.master.As
 import org.apache.hadoop.hbase.master.DeadServer;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.ServerManager;
+import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.Writables;
 import org.apache.zookeeper.KeeperException;
@@ -98,7 +99,7 @@ public class ServerShutdownHandler exten
     // doing after log splitting.  Could do some states before -- OPENING?
     // OFFLINE? -- and then others after like CLOSING that depend on log
     // splitting.
-    List<HRegionInfo> regionsInTransition =
+    List<RegionState> regionsInTransition =
       this.services.getAssignmentManager().processServerShutdown(this.hsi);
 
     // Assign root and meta if we were carrying them.
@@ -133,11 +134,16 @@ public class ServerShutdownHandler exten
       }
     }
 
-    // Remove regions that were in transition
-    for (HRegionInfo rit : regionsInTransition) hris.remove(rit);
-    LOG.info("Reassigning the " + hris.size() + " region(s) that " + serverName
+    // Skip regions that were in transition unless CLOSING or PENDING_CLOSE
+    for (RegionState rit : regionsInTransition) {
+      if (!rit.isClosing() && !rit.isPendingClose()) {
+        hris.remove(rit.getRegion());
+      }
+    }
+
+    LOG.info("Reassigning " + hris.size() + " region(s) that " + serverName
         + " was carrying (skipping " + regionsInTransition.size() +
-        " regions(s) that are in transition)");
+        " regions(s) that are already in transition)");
 
     // Iterate regions that were on this server and assign them
     for (Map.Entry<HRegionInfo, Result> e: hris.entrySet()) {



Mime
View raw message