Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor1996 committed Apr 19, 2018
1 parent 17fdf95 commit 562cd4a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/coordinator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c *testClusterInfo) addRegionStore(storeID uint64, regionCount int) {
store.RegionCount = regionCount
store.RegionSize = int64(regionCount) * 10
store.Stats.Capacity = 1000 * (1 << 20)
store.Stats.Available = store.Stats.Capacity - uint64(store.LeaderSize)
store.Stats.Available = store.Stats.Capacity - uint64(store.RegionSize)
c.putStore(store)
}

Expand Down
1 change: 1 addition & 0 deletions server/core/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func (s *StoreInfo) RegionScore(highSpaceRatio, lowSpaceRatio float64, delta int
lowSpaceRatio = highSpaceRatio
}

// because of rocksdb compression, region size is larger than actual used size
amplification := float64(s.RegionSize) / (float64(s.Stats.GetUsedSize()) / (1 << 20))

if available-float64(delta)/amplification >= highSpaceRatio*capacity || lowSpaceRatio < 0 || lowSpaceRatio > 1 {
Expand Down
2 changes: 1 addition & 1 deletion server/schedule/mockcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
log "github.com/sirupsen/logrus"
)

// MockCluster is to mock clusterInfo for test use
// MockCluster is used to mock clusterInfo for test use
type MockCluster struct {
*BasicCluster
id *core.MockIDAllocator
Expand Down

0 comments on commit 562cd4a

Please sign in to comment.