hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1040295 - in /hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase: HRegionInfo.java master/AssignmentManager.java
Date Mon, 29 Nov 2010 21:05:30 GMT
Author: stack
Date: Mon Nov 29 21:05:30 2010
New Revision: 1040295

URL: http://svn.apache.org/viewvc?rev=1040295&view=rev
Log:
HBASE-3243 Disable Table closed region on wrong host

Modified:
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java?rev=1040295&r1=1040294&r2=1040295&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HRegionInfo.java Mon Nov 29
21:05:30 2010
@@ -644,7 +644,7 @@ public class HRegionInfo extends Version
     }
 
     // Are regions of same table?
-    int result = this.tableDesc.compareTo(o.tableDesc);
+    int result = Bytes.compareTo(this.tableDesc.getName(), o.tableDesc.getName());
     if (result != 0) {
       return result;
     }

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=1040295&r1=1040294&r2=1040295&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
Mon Nov 29 21:05:30 2010
@@ -974,12 +974,14 @@ public class AssignmentManager extends Z
   public void unassign(HRegionInfo region, boolean force) {
     LOG.debug("Starting unassignment of region " +
       region.getRegionNameAsString() + " (offlining)");
-    // Check if this region is currently assigned
-    if (!regions.containsKey(region)) {
-      LOG.debug("Attempted to unassign region " +
-        region.getRegionNameAsString() + " but it is not " +
-        "currently assigned anywhere");
-      return;
+    synchronized (this.regions) { 
+      // Check if this region is currently assigned
+      if (!regions.containsKey(region)) {
+        LOG.debug("Attempted to unassign region " +
+          region.getRegionNameAsString() + " but it is not " +
+          "currently assigned anywhere");
+        return;
+      }
     }
     String encodedName = region.getEncodedName();
     // Grab the state of this region and synchronize on it
@@ -1359,9 +1361,6 @@ public class AssignmentManager extends Z
     }
     synchronized (this.regions) {
       this.regions.remove(hri);
-    }
-    clearRegionPlan(hri.getEncodedName());
-    synchronized (this.servers) {
       for (List<HRegionInfo> regions : this.servers.values()) {
         for (int i=0;i<regions.size();i++) {
           if (regions.get(i).equals(hri)) {
@@ -1371,6 +1370,7 @@ public class AssignmentManager extends Z
         }
       }
     }
+    clearRegionPlan(hri.getEncodedName());
   }
 
   /**
@@ -1418,11 +1418,13 @@ public class AssignmentManager extends Z
     List<HRegionInfo> tableRegions = new ArrayList<HRegionInfo>();
     HRegionInfo boundary =
       new HRegionInfo(new HTableDescriptor(tableName), null, null);
-    for (HRegionInfo regionInfo: this.regions.tailMap(boundary).keySet()) {
-      if(Bytes.equals(regionInfo.getTableDesc().getName(), tableName)) {
-        tableRegions.add(regionInfo);
-      } else {
-        break;
+    synchronized (this.regions) {
+      for (HRegionInfo regionInfo: this.regions.tailMap(boundary).keySet()) {
+        if(Bytes.equals(regionInfo.getTableDesc().getName(), tableName)) {
+          tableRegions.add(regionInfo);
+        } else {
+          break;
+        }
       }
     }
     return tableRegions;



Mime
View raw message