Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuheng55555 committed Dec 2, 2024
1 parent 8a84787 commit 8cb33c6
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ protected Flow executeFromState(ConfigNodeProcedureEnv env, RemoveDataNodeState
setNextState(RemoveDataNodeState.SUBMIT_REGION_MIGRATE);
break;
case SUBMIT_REGION_MIGRATE:
submitChildRegionMigrate(env);
// Avoid re-submit region-migration when leader change or ConfigNode reboot
if (!isStateDeserialized()) {
submitChildRegionMigrate(env);
}
setNextState(RemoveDataNodeState.STOP_DATA_NODE);
break;
case STOP_DATA_NODE:
Expand Down Expand Up @@ -157,10 +160,10 @@ private void submitChildRegionMigrate(ConfigNodeProcedureEnv env) {
LOG.info(
"Submit RegionMigrateProcedure for regionId {}: removedDataNode={}, destDataNode={}, coordinatorForAddPeer={}, coordinatorForRemovePeer={}",
regionId,
removedDataNode,
destDataNode,
coordinatorForAddPeer,
coordinatorForRemovePeer);
simplifyTDataNodeLocation(removedDataNode),
simplifyTDataNodeLocation(destDataNode),
simplifyTDataNodeLocation(coordinatorForAddPeer),
simplifyTDataNodeLocation(coordinatorForRemovePeer));
} else {
LOG.error(
"{}, Cannot find target DataNode to migrate the region: {}",
Expand All @@ -171,6 +174,12 @@ private void submitChildRegionMigrate(ConfigNodeProcedureEnv env) {
});
}

private String simplifyTDataNodeLocation(TDataNodeLocation dataNodeLocation) {
return String.format(
"DataNode(id:%d, address:%s)",
dataNodeLocation.getDataNodeId(), dataNodeLocation.getInternalEndPoint().getIp());
}

private void checkRegionStatusAndStopDataNode(ConfigNodeProcedureEnv env) {
List<TRegionReplicaSet> replicaSets =
env.getConfigManager().getPartitionManager().getAllReplicaSets();
Expand Down

0 comments on commit 8cb33c6

Please sign in to comment.