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:
parent
c3d25923a2
commit
8b8d6b9b50
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -974,12 +974,14 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
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 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,11 +1418,13 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue