HBASE-3243 Disable Table closed region on wrong host

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1040296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-11-29 21:06:02 +00:00
parent c3d25923a2
commit 8b8d6b9b50
2 changed files with 17 additions and 15 deletions

View File

@ -644,7 +644,7 @@ public class HRegionInfo extends VersionedWritable implements WritableComparable
}
// 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;
}

View File

@ -974,6 +974,7 @@ public class AssignmentManager extends ZooKeeperListener {
public void unassign(HRegionInfo region, boolean force) {
LOG.debug("Starting unassignment of region " +
region.getRegionNameAsString() + " (offlining)");
synchronized (this.regions) {
// Check if this region is currently assigned
if (!regions.containsKey(region)) {
LOG.debug("Attempted to unassign region " +
@ -981,6 +982,7 @@ public class AssignmentManager extends ZooKeeperListener {
"currently assigned anywhere");
return;
}
}
String encodedName = region.getEncodedName();
// Grab the state of this region and synchronize on it
RegionState state;
@ -1359,9 +1361,6 @@ public class AssignmentManager extends ZooKeeperListener {
}
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 ZooKeeperListener {
}
}
}
clearRegionPlan(hri.getEncodedName());
}
/**
@ -1418,6 +1418,7 @@ public class AssignmentManager extends ZooKeeperListener {
List<HRegionInfo> tableRegions = new ArrayList<HRegionInfo>();
HRegionInfo boundary =
new HRegionInfo(new HTableDescriptor(tableName), null, null);
synchronized (this.regions) {
for (HRegionInfo regionInfo: this.regions.tailMap(boundary).keySet()) {
if(Bytes.equals(regionInfo.getTableDesc().getName(), tableName)) {
tableRegions.add(regionInfo);
@ -1425,6 +1426,7 @@ public class AssignmentManager extends ZooKeeperListener {
break;
}
}
}
return tableRegions;
}