Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Dec 4, 2024
1 parent 22236c5 commit 6c2c7fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/schedule/core/prepare_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func (checker *PrepareChecker) Check(c *core.BasicCluster) bool {
}
notLoadedFromRegionsCnt := c.GetClusterNotFromStorageRegionsCnt()
totalRegionsCnt := c.GetTotalRegionCount()
if totalRegionsCnt == 0 {
return false
}
// The number of active regions should be more than total region of all stores * core.CollectFactor
if float64(totalRegionsCnt)*core.CollectFactor > float64(notLoadedFromRegionsCnt) {
return false
Expand Down
3 changes: 2 additions & 1 deletion tests/server/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1159,11 +1159,12 @@ func TestDeleteAllRegionCacheScheduling(t *testing.T) {
count := rc.GetOperatorController().OperatorCount(operator.OpSplit)
return count > 0
})
rc.GetOperatorController().RemoveOperators()

// Call the delete API and verify
addr := leaderServer.GetAddr() + "/pd/api/v1/admin/cache/regions"
output := sendRequest(re, addr, http.MethodDelete, http.StatusOK)
re.Contains(string(output), "All regions are removed from server cache")
rc.GetOperatorController().RemoveOperators()
re.Equal(0, int(rc.GetOperatorController().OperatorCount(operator.OpSplit)))

// Simulate continuous heartbeat and verify scheduling recovery
Expand Down

0 comments on commit 6c2c7fb

Please sign in to comment.