HBASE-19365 Guard against a missing table descriptor which crashes master
While we never expect table descriptors to be missing, a corrupt meta can result in the master crashing before regions get assigned. We can guard against that happening with a simple null-check. Signed-off-by: Viraj Jasani <vjasani@apache.org> Closes #1908
This commit is contained in:
parent
4dd59a0635
commit
404c2dd3fe
|
@ -3220,13 +3220,17 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
// maybe because it crashed.
|
||||
PairOfSameType<HRegionInfo> p = MetaTableAccessor.getMergeRegions(result);
|
||||
if (p.getFirst() != null && p.getSecond() != null) {
|
||||
int numReplicas = server.getTableDescriptors().get(p.getFirst().
|
||||
getTable()).getRegionReplication();
|
||||
HTableDescriptor desc = server.getTableDescriptors().get(p.getFirst().getTable());
|
||||
if (desc != null) {
|
||||
int numReplicas = desc.getRegionReplication();
|
||||
for (HRegionInfo merge : p) {
|
||||
for (int i = 1; i < numReplicas; i++) {
|
||||
replicasToClose.add(RegionReplicaUtil.getRegionInfoForReplica(merge, i));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Found no table descriptor on filesystem for " + p.getFirst().getTable());
|
||||
}
|
||||
}
|
||||
RegionLocations rl = MetaTableAccessor.getRegionLocations(result);
|
||||
if (rl == null) continue;
|
||||
|
|
Loading…
Reference in New Issue