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?
|
// 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) {
|
if (result != 0) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -974,12 +974,14 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
public void unassign(HRegionInfo region, boolean force) {
|
public void unassign(HRegionInfo region, boolean force) {
|
||||||
LOG.debug("Starting unassignment of region " +
|
LOG.debug("Starting unassignment of region " +
|
||||||
region.getRegionNameAsString() + " (offlining)");
|
region.getRegionNameAsString() + " (offlining)");
|
||||||
// Check if this region is currently assigned
|
synchronized (this.regions) {
|
||||||
if (!regions.containsKey(region)) {
|
// Check if this region is currently assigned
|
||||||
LOG.debug("Attempted to unassign region " +
|
if (!regions.containsKey(region)) {
|
||||||
region.getRegionNameAsString() + " but it is not " +
|
LOG.debug("Attempted to unassign region " +
|
||||||
"currently assigned anywhere");
|
region.getRegionNameAsString() + " but it is not " +
|
||||||
return;
|
"currently assigned anywhere");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String encodedName = region.getEncodedName();
|
String encodedName = region.getEncodedName();
|
||||||
// Grab the state of this region and synchronize on it
|
// Grab the state of this region and synchronize on it
|
||||||
|
@ -1359,9 +1361,6 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
}
|
}
|
||||||
synchronized (this.regions) {
|
synchronized (this.regions) {
|
||||||
this.regions.remove(hri);
|
this.regions.remove(hri);
|
||||||
}
|
|
||||||
clearRegionPlan(hri.getEncodedName());
|
|
||||||
synchronized (this.servers) {
|
|
||||||
for (List<HRegionInfo> regions : this.servers.values()) {
|
for (List<HRegionInfo> regions : this.servers.values()) {
|
||||||
for (int i=0;i<regions.size();i++) {
|
for (int i=0;i<regions.size();i++) {
|
||||||
if (regions.get(i).equals(hri)) {
|
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>();
|
List<HRegionInfo> tableRegions = new ArrayList<HRegionInfo>();
|
||||||
HRegionInfo boundary =
|
HRegionInfo boundary =
|
||||||
new HRegionInfo(new HTableDescriptor(tableName), null, null);
|
new HRegionInfo(new HTableDescriptor(tableName), null, null);
|
||||||
for (HRegionInfo regionInfo: this.regions.tailMap(boundary).keySet()) {
|
synchronized (this.regions) {
|
||||||
if(Bytes.equals(regionInfo.getTableDesc().getName(), tableName)) {
|
for (HRegionInfo regionInfo: this.regions.tailMap(boundary).keySet()) {
|
||||||
tableRegions.add(regionInfo);
|
if(Bytes.equals(regionInfo.getTableDesc().getName(), tableName)) {
|
||||||
} else {
|
tableRegions.add(regionInfo);
|
||||||
break;
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tableRegions;
|
return tableRegions;
|
||||||
|
|
Loading…
Reference in New Issue