HBASE-13083 Master can be dead-locked while assigning META. (Andrey Stepachev)
This commit is contained in:
parent
b20675f5af
commit
4a74f5e829
|
@ -576,14 +576,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)) {
|
||||
|
@ -620,13 +622,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