Skip to content

Commit

Permalink
resolve the conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Jan 10, 2023
1 parent 804fcd5 commit ffd4351
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 215 deletions.
25 changes: 21 additions & 4 deletions pkg/core/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ func TestLowSpaceScoreV2(t *testing.T) {
small: newStoreInfoWithAvailable(2, 60*units.GiB, 100*units.GiB, 1),
}, {
// store1's capacity is less than store2's capacity, but store2 has more available space,
bigger: NewStoreInfoWithAvailable(1, 2*units.GiB, 100*units.GiB, 3),
small: NewStoreInfoWithAvailable(2, 100*units.GiB, 10*1000*units.GiB, 3),
bigger: newStoreInfoWithAvailable(1, 2*units.GiB, 100*units.GiB, 3),
small: newStoreInfoWithAvailable(2, 100*units.GiB, 10*1000*units.GiB, 3),
}, {
// store2 has extra file size (70GB), it can balance region from store1 to store2.
// See https://github.com/tikv/pd/issues/5790
small: NewStoreInfoWithDisk(1, 400*units.MiB, 6930*units.GiB, 7000*units.GiB, 400),
bigger: NewStoreInfoWithAvailable(2, 1500*units.GiB, 7000*units.GiB, 1.32),
small: newStoreInfoWithDisk(1, 400*units.MiB, 6930*units.GiB, 7000*units.GiB, 400),
bigger: newStoreInfoWithAvailable(2, 1500*units.GiB, 7000*units.GiB, 1.32),
delta: 37794,
}}
for _, v := range testdata {
Expand All @@ -216,3 +216,20 @@ func newStoreInfoWithAvailable(id, available, capacity uint64, amp float64) *Sto
)
return store
}

// newStoreInfoWithDisk is created with all disk infos.
func newStoreInfoWithDisk(id, used, available, capacity, regionSize uint64) *StoreInfo {
stats := &pdpb.StoreStats{}
stats.Capacity = capacity
stats.Available = available
stats.UsedSize = used
store := NewStoreInfo(
&metapb.Store{
Id: id,
},
SetStoreStats(stats),
SetRegionCount(int(regionSize/96)),
SetRegionSize(int64(regionSize)),
)
return store
}
210 changes: 0 additions & 210 deletions server/core/test_util.go

This file was deleted.

2 changes: 1 addition & 1 deletion server/schedulers/balance_witness.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import (
"github.com/gorilla/mux"
"github.com/pingcap/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/tikv/pd/pkg/core"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/storage/endpoint"
"github.com/tikv/pd/pkg/utils/reflectutil"
"github.com/tikv/pd/pkg/utils/syncutil"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/schedule"
"github.com/tikv/pd/server/schedule/filter"
"github.com/tikv/pd/server/schedule/operator"
Expand Down

0 comments on commit ffd4351

Please sign in to comment.