From ed125533af29f60bc127ffc79b639b5dae062533 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Thu, 7 Mar 2024 14:25:21 +0800 Subject: [PATCH] fix conflict Signed-off-by: lhy1024 --- pkg/schedule/schedulers/hot_region.go | 3 - pkg/schedule/schedulers/hot_region_test.go | 58 ------------------- pkg/schedule/schedulers/shuffle_hot_region.go | 5 -- 3 files changed, 66 deletions(-) diff --git a/pkg/schedule/schedulers/hot_region.go b/pkg/schedule/schedulers/hot_region.go index 3169ece2672..2a38ef399c8 100644 --- a/pkg/schedule/schedulers/hot_region.go +++ b/pkg/schedule/schedulers/hot_region.go @@ -262,8 +262,6 @@ func (h *hotScheduler) EncodeConfig() ([]byte, error) { return h.conf.EncodeConfig() } -<<<<<<< HEAD -======= func (h *hotScheduler) ReloadConfig() error { h.conf.Lock() defer h.conf.Unlock() @@ -304,7 +302,6 @@ func (h *hotScheduler) ReloadConfig() error { return nil } ->>>>>>> bbd3bdb56 (scheduler: make history-sample-interval and history-sample-duration configurable (#7878)) func (h *hotScheduler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.conf.ServeHTTP(w, r) } diff --git a/pkg/schedule/schedulers/hot_region_test.go b/pkg/schedule/schedulers/hot_region_test.go index 6bd70537b45..d6337453a30 100644 --- a/pkg/schedule/schedulers/hot_region_test.go +++ b/pkg/schedule/schedulers/hot_region_test.go @@ -394,64 +394,6 @@ func TestSplitBucketsByLoad(t *testing.T) { } } -<<<<<<< HEAD -======= -func checkHotWriteRegionPlacement(re *require.Assertions, enablePlacementRules bool) { - cancel, _, tc, oc := prepareSchedulersTest() - defer cancel() - tc.SetEnableUseJointConsensus(true) - tc.SetClusterVersion(versioninfo.MinSupportedVersion(versioninfo.ConfChangeV2)) - tc.SetEnablePlacementRules(enablePlacementRules) - labels := []string{"zone", "host"} - tc.SetMaxReplicasWithLabel(enablePlacementRules, 3, labels...) - hb, err := CreateScheduler(utils.Write.String(), oc, storage.NewStorageWithMemoryBackend(), nil) - re.NoError(err) - hb.(*hotScheduler).conf.SetHistorySampleDuration(0) - tc.SetHotRegionCacheHitsThreshold(0) - - tc.AddLabelsStore(1, 2, map[string]string{"zone": "z1", "host": "h1"}) - tc.AddLabelsStore(2, 2, map[string]string{"zone": "z1", "host": "h2"}) - tc.AddLabelsStore(3, 2, map[string]string{"zone": "z2", "host": "h3"}) - tc.AddLabelsStore(4, 2, map[string]string{"zone": "z2", "host": "h4"}) - tc.AddLabelsStore(5, 2, map[string]string{"zone": "z2", "host": "h5"}) - tc.AddLabelsStore(6, 2, map[string]string{"zone": "z2", "host": "h6"}) - tc.RuleManager.SetRule(&placement.Rule{ - GroupID: "pd", ID: "leader", Role: placement.Leader, Count: 1, LabelConstraints: []placement.LabelConstraint{{Key: "zone", Op: "in", Values: []string{"z1"}}}, - }) - tc.RuleManager.SetRule(&placement.Rule{ - GroupID: "pd", ID: "voter", Role: placement.Follower, Count: 2, LabelConstraints: []placement.LabelConstraint{{Key: "zone", Op: "in", Values: []string{"z2"}}}, - }) - tc.RuleManager.DeleteRule("pd", "default") - - tc.UpdateStorageWrittenBytes(1, 10*units.MiB*utils.StoreHeartBeatReportInterval) - tc.UpdateStorageWrittenBytes(2, 0) - tc.UpdateStorageWrittenBytes(3, 6*units.MiB*utils.StoreHeartBeatReportInterval) - tc.UpdateStorageWrittenBytes(4, 3*units.MiB*utils.StoreHeartBeatReportInterval) - tc.UpdateStorageWrittenBytes(5, 3*units.MiB*utils.StoreHeartBeatReportInterval) - tc.UpdateStorageWrittenBytes(6, 6*units.MiB*utils.StoreHeartBeatReportInterval) - - // Region 1, 2 and 3 are hot regions. - addRegionInfo(tc, utils.Write, []testRegionInfo{ - {1, []uint64{1, 3, 5}, 512 * units.KiB, 0, 0}, - {2, []uint64{1, 4, 6}, 512 * units.KiB, 0, 0}, - {3, []uint64{1, 3, 6}, 512 * units.KiB, 0, 0}, - }) - ops, _ := hb.Schedule(tc, false) - re.NotEmpty(ops) - re.NotContains(ops[0].Step(1).String(), "transfer leader") - clearPendingInfluence(hb.(*hotScheduler)) - - tc.RuleManager.SetRule(&placement.Rule{ - GroupID: "pd", ID: "voter", Role: placement.Voter, Count: 2, LabelConstraints: []placement.LabelConstraint{{Key: "zone", Op: "in", Values: []string{"z2"}}}, - }) - tc.RuleManager.DeleteRule("pd", "follower") - ops, _ = hb.Schedule(tc, false) - re.NotEmpty(ops) - // TODO: fix the test - // re.NotContains(ops[0].Step(1).String(), "transfer leader") -} - ->>>>>>> bbd3bdb56 (scheduler: make history-sample-interval and history-sample-duration configurable (#7878)) func checkHotWriteRegionScheduleByteRateOnly(re *require.Assertions, enablePlacementRules bool) { cancel, opt, tc, oc := prepareSchedulersTest() defer cancel() diff --git a/pkg/schedule/schedulers/shuffle_hot_region.go b/pkg/schedule/schedulers/shuffle_hot_region.go index 405df3745c8..ac975eb4e39 100644 --- a/pkg/schedule/schedulers/shuffle_hot_region.go +++ b/pkg/schedule/schedulers/shuffle_hot_region.go @@ -57,13 +57,8 @@ type shuffleHotRegionScheduler struct { // newShuffleHotRegionScheduler creates an admin scheduler that random balance hot regions func newShuffleHotRegionScheduler(opController *operator.Controller, conf *shuffleHotRegionSchedulerConfig) Scheduler { -<<<<<<< HEAD - base := newBaseHotScheduler(opController) -======= base := newBaseHotScheduler(opController, statistics.DefaultHistorySampleDuration, statistics.DefaultHistorySampleInterval) - handler := newShuffleHotRegionHandler(conf) ->>>>>>> bbd3bdb56 (scheduler: make history-sample-interval and history-sample-duration configurable (#7878)) ret := &shuffleHotRegionScheduler{ baseHotScheduler: base, conf: conf,