HBASE-13083 Master can be dead-locked while assigning META. (Andrey Stepachev)
This commit is contained in:
parent
bb3ca8ed12
commit
540266a7a0
|
@ -613,14 +613,16 @@ public class RegionStates {
|
|||
// Offline all regions on this server not already in transition.
|
||||
List<HRegionInfo> rits = new ArrayList<HRegionInfo>();
|
||||
Set<HRegionInfo> regionsToCleanIfNoMetaEntry = new HashSet<HRegionInfo>();
|
||||
// Offline regions outside the loop and synchronized block to avoid
|
||||
// ConcurrentModificationException and deadlock in case of meta anassigned,
|
||||
// but RegionState a blocked.
|
||||
Set<HRegionInfo> regionsToOffline = new HashSet<HRegionInfo>();
|
||||
synchronized (this) {
|
||||
Set<HRegionInfo> assignedRegions = serverHoldings.get(sn);
|
||||
if (assignedRegions == null) {
|
||||
assignedRegions = new HashSet<HRegionInfo>();
|
||||
}
|
||||
|
||||
// Offline regions outside the loop to avoid ConcurrentModificationException
|
||||
Set<HRegionInfo> regionsToOffline = new HashSet<HRegionInfo>();
|
||||
for (HRegionInfo region : assignedRegions) {
|
||||
// Offline open regions, no need to offline if SPLIT/MERGED/OFFLINE
|
||||
if (isRegionOnline(region)) {
|
||||
|
@ -662,13 +664,13 @@ public class RegionStates {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (HRegionInfo hri : regionsToOffline) {
|
||||
regionOffline(hri);
|
||||
}
|
||||
|
||||
this.notifyAll();
|
||||
}
|
||||
|
||||
for (HRegionInfo hri : regionsToOffline) {
|
||||
regionOffline(hri);
|
||||
}
|
||||
|
||||
cleanIfNoMetaEntry(regionsToCleanIfNoMetaEntry);
|
||||
return rits;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue