HBASE-3283 NPE in AssignmentManager if processing shutdown of RS who doesn't have any regions assigned to it

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1040302 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-11-29 21:18:41 +00:00
parent 2778fced75
commit 8b693bf547
2 changed files with 9 additions and 2 deletions

View File

@ -9,6 +9,8 @@ Release 0.91.0 - Unreleased
HBASE-3280 YouAreDeadException being swallowed in HRS getMaster HBASE-3280 YouAreDeadException being swallowed in HRS getMaster
HBASE-3282 Need to retain DeadServers to ensure we don't allow HBASE-3282 Need to retain DeadServers to ensure we don't allow
previously expired RS instances to rejoin cluster previously expired RS instances to rejoin cluster
HBASE-3283 NPE in AssignmentManager if processing shutdown of RS who
doesn't have any regions assigned to it
IMPROVEMENTS IMPROVEMENTS
HBASE-2001 Coprocessors: Colocate user code with regions (Mingjie Lai via HBASE-2001 Coprocessors: Colocate user code with regions (Mingjie Lai via

View File

@ -1597,8 +1597,14 @@ public class AssignmentManager extends ZooKeeperListener {
// Remove this server from map of servers to regions, and remove all regions // Remove this server from map of servers to regions, and remove all regions
// of this server from online map of regions. // of this server from online map of regions.
Set<HRegionInfo> deadRegions = null; Set<HRegionInfo> deadRegions = null;
List<HRegionInfo> rits = new ArrayList<HRegionInfo>();
synchronized (this.regions) { synchronized (this.regions) {
deadRegions = new TreeSet<HRegionInfo>(this.servers.remove(hsi)); List<HRegionInfo> assignedRegions = this.servers.remove(hsi);
if (assignedRegions == null || assignedRegions.isEmpty()) {
// No regions on this server, we are done, return empty list of RITs
return rits;
}
deadRegions = new TreeSet<HRegionInfo>(assignedRegions);
for (HRegionInfo region : deadRegions) { for (HRegionInfo region : deadRegions) {
this.regions.remove(region); this.regions.remove(region);
} }
@ -1606,7 +1612,6 @@ public class AssignmentManager extends ZooKeeperListener {
// See if any of the regions that were online on this server were in RIT // See if any of the regions that were online on this server were in RIT
// If they are, normal timeouts will deal with them appropriately so // If they are, normal timeouts will deal with them appropriately so
// let's skip a manual re-assignment. // let's skip a manual re-assignment.
List<HRegionInfo> rits = new ArrayList<HRegionInfo>();
synchronized (regionsInTransition) { synchronized (regionsInTransition) {
for (RegionState region : this.regionsInTransition.values()) { for (RegionState region : this.regionsInTransition.values()) {
if (deadRegions.remove(region.getRegion())) { if (deadRegions.remove(region.getRegion())) {