hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1209367 - /hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
Date Fri, 02 Dec 2011 05:55:26 GMT
Author: stack
Date: Fri Dec  2 05:55:25 2011
New Revision: 1209367

URL: http://svn.apache.org/viewvc?rev=1209367&view=rev
Log:
HBASE-4899 Region would be assigned twice easily with continually killing server and moving
region in testing environment

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java?rev=1209367&r1=1209366&r2=1209367&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java
Fri Dec  2 05:55:25 2011
@@ -286,7 +286,22 @@ public class ServerShutdownHandler exten
           if (processDeadRegion(e.getKey(), e.getValue(),
               this.services.getAssignmentManager(),
               this.server.getCatalogTracker())) {
-            this.services.getAssignmentManager().assign(e.getKey(), true);
+            RegionState rit = this.services.getAssignmentManager().isRegionInTransition(e.getKey());
+            ServerName addressFromAM = this.services.getAssignmentManager()
+                .getRegionServerOfRegion(e.getKey());
+            if (rit != null && !rit.isClosing() && !rit.isPendingClose())
{
+              // Skip regions that were in transition unless CLOSING or
+              // PENDING_CLOSE
+              LOG.info("Skip assigning region " + rit.toString());
+            } else if (addressFromAM != null
+                && !addressFromAM.equals(this.serverName)) {
+              LOG.debug("Skip assigning region "
+                    + e.getKey().getRegionNameAsString()
+                    + " because it has been opened in "
+                    + addressFromAM.getServerName());
+              } else {
+                this.services.getAssignmentManager().assign(e.getKey(), true);
+              }
           }
         }
       }



Mime
View raw message