HBASE-17044 Fix merge failed before creating merged region leaves meta inconsistent
This commit is contained in:
parent
e01ee2fd1d
commit
e54826434e
|
@ -3908,21 +3908,35 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
LOG.info("Failed to record merged region " + p.getShortNameToLog());
|
||||
return "Failed to record the merging in meta";
|
||||
}
|
||||
} else {
|
||||
mergingRegions.remove(encodedName);
|
||||
regionOnline(a, sn);
|
||||
regionOnline(b, sn);
|
||||
regionOffline(p);
|
||||
|
||||
if (getTableStateManager().isTableState(p.getTable(),
|
||||
ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
|
||||
invokeUnAssign(a);
|
||||
invokeUnAssign(b);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String onRegionMergeReverted(ServerName sn, TransitionCode code,
|
||||
final HRegionInfo p, final HRegionInfo a, final HRegionInfo b) {
|
||||
RegionState rs_p = regionStates.getRegionState(p);
|
||||
String encodedName = p.getEncodedName();
|
||||
mergingRegions.remove(encodedName);
|
||||
|
||||
// Always bring the children back online. Even if they are not offline
|
||||
// there's no harm in making them online again.
|
||||
regionOnline(a, sn);
|
||||
regionOnline(b, sn);
|
||||
|
||||
// Only offline the merging region if it is known to exist.
|
||||
if (rs_p != null) {
|
||||
regionOffline(p);
|
||||
}
|
||||
|
||||
if (getTableStateManager().isTableState(p.getTable(),
|
||||
ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
|
||||
invokeUnAssign(a);
|
||||
invokeUnAssign(b);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper to handle region merging transition event.
|
||||
* It transitions merging regions to MERGING state.
|
||||
|
@ -4458,7 +4472,6 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
break;
|
||||
case MERGE_PONR:
|
||||
case MERGED:
|
||||
case MERGE_REVERTED:
|
||||
errorMsg = onRegionMerge(serverName, code, hri,
|
||||
HRegionInfo.convert(transition.getRegionInfo(1)),
|
||||
HRegionInfo.convert(transition.getRegionInfo(2)));
|
||||
|
@ -4470,6 +4483,11 @@ public class AssignmentManager extends ZooKeeperListener {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case MERGE_REVERTED:
|
||||
errorMsg = onRegionMergeReverted(serverName, code, hri,
|
||||
HRegionInfo.convert(transition.getRegionInfo(1)),
|
||||
HRegionInfo.convert(transition.getRegionInfo(2)));
|
||||
break;
|
||||
|
||||
default:
|
||||
errorMsg = "Unexpected transition code " + code;
|
||||
|
|
Loading…
Reference in New Issue