Skip to content

Commit

Permalink
remove some empty line
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Aug 3, 2022
1 parent 21044eb commit 70315e8
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions server/schedulers/hot_region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,6 @@ func TestSkipUniformStore(t *testing.T) {
hb.(*hotScheduler).conf.SetDstToleranceRatio(1)
hb.(*hotScheduler).conf.SetStrictPickingStore(false)
hb.(*hotScheduler).conf.ReadPriorities = []string{BytePriority, KeyPriority}

tc := mockcluster.NewCluster(ctx, opt)
tc.SetHotRegionCacheHitsThreshold(0)
tc.AddRegionStore(1, 20)
Expand All @@ -1302,44 +1301,38 @@ func TestSkipUniformStore(t *testing.T) {
tc.AddRegionStore(5, 20)

// Case1: two dim are both enough uniform

tc.UpdateStorageReadStats(1, 10.05*units.MB*statistics.StoreHeartBeatReportInterval, 10.05*units.MB*statistics.StoreHeartBeatReportInterval)
tc.UpdateStorageReadStats(2, 9.45*units.MB*statistics.StoreHeartBeatReportInterval, 9.45*units.MB*statistics.StoreHeartBeatReportInterval)
tc.UpdateStorageReadStats(3, 10.0*units.MB*statistics.StoreHeartBeatReportInterval, 10.0*units.MB*statistics.StoreHeartBeatReportInterval)
addRegionInfo(tc, statistics.Read, []testRegionInfo{
{1, []uint64{1, 2, 3}, 0.05 * units.MB, 0.05 * units.MB, 0},
})

// when there is no uniform store filter, still schedule although the cluster is enough uniform
stddevThreshold = 0.0
ops, _ := hb.Schedule(tc, false)
re.Len(ops, 1)
testutil.CheckTransferLeader(re, ops[0], operator.OpHotRegion, 1, 2)
clearPendingInfluence(hb.(*hotScheduler))

// when there is uniform store filter, not schedule
stddevThreshold = 0.1
ops, _ = hb.Schedule(tc, false)
re.Len(ops, 0)
clearPendingInfluence(hb.(*hotScheduler))

// Case2: the first dim is enough uniform, we should schedule the second dim

tc.UpdateStorageReadStats(1, 10.15*units.MB*statistics.StoreHeartBeatReportInterval, 10.05*units.MB*statistics.StoreHeartBeatReportInterval)
tc.UpdateStorageReadStats(2, 9.45*units.MB*statistics.StoreHeartBeatReportInterval, 9.85*units.MB*statistics.StoreHeartBeatReportInterval)
tc.UpdateStorageReadStats(3, 9.85*units.MB*statistics.StoreHeartBeatReportInterval, 16.0*units.MB*statistics.StoreHeartBeatReportInterval)
addRegionInfo(tc, statistics.Read, []testRegionInfo{
{1, []uint64{1, 2, 3}, 0.05 * units.MB, 0.05 * units.MB, 0},
{2, []uint64{3, 2, 1}, 0.05 * units.MB, 2 * units.MB, 0},
})

// when there is no uniform store filter, still schedule although the first dim is enough uniform
stddevThreshold = 0.0
ops, _ = hb.Schedule(tc, false)
re.Len(ops, 1)
testutil.CheckTransferLeader(re, ops[0], operator.OpHotRegion, 1, 2)
clearPendingInfluence(hb.(*hotScheduler))

// when there is uniform store filter, schedule the second dim, which is no uniform
stddevThreshold = 0.1
ops, _ = hb.Schedule(tc, false)
Expand All @@ -1348,29 +1341,25 @@ func TestSkipUniformStore(t *testing.T) {
clearPendingInfluence(hb.(*hotScheduler))

// Case3: the second dim is enough uniform, we should schedule the first dim, although its rank is higher than the second dim

tc.UpdateStorageReadStats(1, 10.05*units.MB*statistics.StoreHeartBeatReportInterval, 10.05*units.MB*statistics.StoreHeartBeatReportInterval)
tc.UpdateStorageReadStats(2, 9.85*units.MB*statistics.StoreHeartBeatReportInterval, 9.45*units.MB*statistics.StoreHeartBeatReportInterval)
tc.UpdateStorageReadStats(3, 16*units.MB*statistics.StoreHeartBeatReportInterval, 9.85*units.MB*statistics.StoreHeartBeatReportInterval)
addRegionInfo(tc, statistics.Read, []testRegionInfo{
{1, []uint64{1, 2, 3}, 0.05 * units.MB, 0.05 * units.MB, 0},
{2, []uint64{3, 2, 1}, 2 * units.MB, 0.05 * units.MB, 0},
})

// when there is no uniform store filter, still schedule although the second dim is enough uniform
stddevThreshold = 0.0
ops, _ = hb.Schedule(tc, false)
re.Len(ops, 1)
testutil.CheckTransferLeader(re, ops[0], operator.OpHotRegion, 1, 2)
clearPendingInfluence(hb.(*hotScheduler))

// when there is uniform store filter, schedule the first dim, which is no uniform
stddevThreshold = 0.1
ops, _ = hb.Schedule(tc, false)
re.Len(ops, 1)
testutil.CheckTransferLeader(re, ops[0], operator.OpHotRegion, 3, 2)
clearPendingInfluence(hb.(*hotScheduler))

}

func TestHotCacheUpdateCache(t *testing.T) {
Expand Down

0 comments on commit 70315e8

Please sign in to comment.