diff --git a/server/cluster/unsafe_recovery_controller.go b/server/cluster/unsafe_recovery_controller.go index 6c2d5101928..578ab0f6976 100644 --- a/server/cluster/unsafe_recovery_controller.go +++ b/server/cluster/unsafe_recovery_controller.go @@ -385,7 +385,7 @@ func (u *unsafeRecoveryController) generatePlan(newestRegionTree *regionTree, pe } fallthrough case createEmptyRegion: - if hasPlan, err = u.generateCreateEmptyRegionPlan(newestRegionTree, peersMap); hasPlan && err == nil { + if hasPlan, err = u.generateCreateEmptyRegionPlan(newestRegionTree); hasPlan && err == nil { u.changeStage(createEmptyRegion) break } @@ -1104,7 +1104,7 @@ func (u *unsafeRecoveryController) generateDemoteFailedVoterPlan(newestRegionTre return hasPlan } -func (u *unsafeRecoveryController) generateCreateEmptyRegionPlan(newestRegionTree *regionTree, peersMap map[uint64][]*regionItem) (bool, error) { +func (u *unsafeRecoveryController) generateCreateEmptyRegionPlan(newestRegionTree *regionTree) (bool, error) { if u.err != nil { return false, nil } @@ -1159,25 +1159,6 @@ func (u *unsafeRecoveryController) generateCreateEmptyRegionPlan(newestRegionTre err = createRegionErr return false } - // paranoid check: shouldn't overlap with any of the peers - for _, peers := range peersMap { - for _, peer := range peers { - if !peer.IsInitialized() { - continue - } - if (bytes.Compare(newRegion.StartKey, peer.Region().StartKey) <= 0 && - (len(newRegion.EndKey) == 0 || bytes.Compare(peer.Region().StartKey, newRegion.EndKey) < 0)) || - ((len(peer.Region().EndKey) == 0 || bytes.Compare(newRegion.StartKey, peer.Region().EndKey) < 0) && - (len(newRegion.EndKey) == 0 || (len(peer.Region().EndKey) != 0 && bytes.Compare(peer.Region().EndKey, newRegion.EndKey) <= 0))) { - err = errors.Errorf( - "Find overlap peer %v with newly created empty region %v", - logutil.RedactStringer(core.RegionToHexMeta(peer.Region())), - logutil.RedactStringer(core.RegionToHexMeta(newRegion)), - ) - return false - } - } - } storeRecoveryPlan := u.getRecoveryPlan(storeID) storeRecoveryPlan.Creates = append(storeRecoveryPlan.Creates, newRegion) u.recordAffectedRegion(newRegion)