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 Aug 10, 2023
1 parent ca8679b commit 2a7be67
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 20 deletions.
15 changes: 3 additions & 12 deletions pkg/mcs/scheduling/server/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@ func (c *Cluster) BucketsStats(degree int, regionIDs ...uint64) map[uint64][]*bu
return c.hotStat.BucketsStats(degree, regionIDs...)
}

<<<<<<< HEAD
// TODO: implement the following methods
=======
// GetPersistOptions returns the persist options.
func (c *Cluster) GetPersistOptions() sc.ConfProvider {
return c.persistConfig
}
>>>>>>> remove some store config

// GetStorage returns the storage.
func (c *Cluster) GetStorage() storage.Storage {
return c.storage
Expand All @@ -123,13 +114,13 @@ func (c *Cluster) GetCheckerConfig() sc.CheckerConfigProvider { return c.persist
// GetSchedulerConfig returns the scheduler config.
func (c *Cluster) GetSchedulerConfig() sc.SchedulerConfigProvider { return c.persistConfig }

// GetStoreConfig returns the store config.
func (c *Cluster) GetStoreConfig() sc.StoreConfigProvider { return c.persistConfig }

// TODO: implement the following methods

// UpdateRegionsLabelLevelStats updates the region label level stats.
func (c *Cluster) UpdateRegionsLabelLevelStats(regions []*core.RegionInfo) {}

// AllocID allocates a new ID.
func (c *Cluster) AllocID() (uint64, error) { return 0, nil }

// GetStoreConfig returns the store config.
func (c *Cluster) GetStoreConfig() sc.StoreConfigProvider { return nil }
25 changes: 25 additions & 0 deletions pkg/mcs/scheduling/server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,31 @@ func (o *PersistConfig) SetHaltScheduling(halt bool, source string) {
o.SetScheduleConfig(v)
}

// CheckRegionKeys return error if the smallest region's keys is less than mergeKeys
func (o *PersistConfig) CheckRegionKeys(keys, mergeKeys uint64) error {
return o.GetStoreConfig().CheckRegionKeys(keys, mergeKeys)
}

// CheckRegionSize return error if the smallest region's size is less than mergeSize
func (o *PersistConfig) CheckRegionSize(size, mergeSize uint64) error {
return o.GetStoreConfig().CheckRegionSize(size, mergeSize)
}

// GetRegionMaxSize returns the max region size in MB
func (o *PersistConfig) GetRegionMaxSize() uint64 {
return o.GetStoreConfig().GetRegionMaxSize()
}

// GetRegionMaxKeys returns the region split keys
func (o *PersistConfig) GetRegionMaxKeys() uint64 {
return o.GetStoreConfig().GetRegionMaxKeys()
}

// IsEnableRegionBucket return true if the region bucket is enabled.
func (o *PersistConfig) IsEnableRegionBucket() bool {
return o.GetStoreConfig().IsEnableRegionBucket()
}

// TODO: implement the following methods

// AddSchedulerCfg adds the scheduler configurations.
Expand Down
10 changes: 5 additions & 5 deletions pkg/mock/mockcluster/mockcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ func NewCluster(ctx context.Context, opts *config.PersistOptions) *Cluster {

// GetStoreConfig returns the store config.
func (mc *Cluster) GetStoreConfig() sc.StoreConfigProvider {
return mc
return mc.PersistOptions.GetStoreConfig()
}

// SetRegionBucketEnabled sets the region bucket enabled.
func (mc *Cluster) SetRegionBucketEnabled(enabled bool) {
cfg, ok := mc.GetStoreConfig().(*config.StoreConfig)
cfg, ok := mc.GetStoreConfig().(*sc.StoreConfig)
if !ok || cfg == nil {
return
}
Expand All @@ -99,17 +99,17 @@ func (mc *Cluster) SetRegionBucketEnabled(enabled bool) {

// GetCheckerConfig returns the checker config.
func (mc *Cluster) GetCheckerConfig() sc.CheckerConfigProvider {
return mc
return mc.PersistOptions
}

// GetSchedulerConfig returns the scheduler config.
func (mc *Cluster) GetSchedulerConfig() sc.SchedulerConfigProvider {
return mc
return mc.PersistOptions
}

// GetSharedConfig returns the shared config.
func (mc *Cluster) GetSharedConfig() sc.SharedConfigProvider {
return mc
return mc.PersistOptions
}

// GetStorage returns the storage.
Expand Down
7 changes: 4 additions & 3 deletions tests/integrations/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/tikv/pd/pkg/core"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/mock/mockid"
sc "github.com/tikv/pd/pkg/schedule/config"
"github.com/tikv/pd/pkg/storage/endpoint"
"github.com/tikv/pd/pkg/tso"
"github.com/tikv/pd/pkg/utils/assertutil"
Expand Down Expand Up @@ -804,7 +805,7 @@ func (suite *clientTestSuite) SetupSuite() {
}))
suite.grpcSvr.GetRaftCluster().GetBasicCluster().PutStore(newStore)
}
cluster.GetStoreConfig().(*config.StoreConfig).SetRegionBucketEnabled(true)
cluster.GetStoreConfig().(*sc.StoreConfig).SetRegionBucketEnabled(true)
}

func (suite *clientTestSuite) TearDownSuite() {
Expand Down Expand Up @@ -893,7 +894,7 @@ func (suite *clientTestSuite) TestGetRegion() {
}
return r.Buckets != nil
})
suite.srv.GetRaftCluster().GetStoreConfig().(*config.StoreConfig).SetRegionBucketEnabled(false)
suite.srv.GetRaftCluster().GetStoreConfig().(*sc.StoreConfig).SetRegionBucketEnabled(false)

testutil.Eventually(re, func() bool {
r, err := suite.client.GetRegion(context.Background(), []byte("a"), pd.WithBuckets())
Expand All @@ -903,7 +904,7 @@ func (suite *clientTestSuite) TestGetRegion() {
}
return r.Buckets == nil
})
suite.srv.GetRaftCluster().GetStoreConfig().(*config.StoreConfig).SetRegionBucketEnabled(true)
suite.srv.GetRaftCluster().GetStoreConfig().(*sc.StoreConfig).SetRegionBucketEnabled(true)

suite.NoError(failpoint.Enable("github.com/tikv/pd/server/grpcClientClosed", `return(true)`))
suite.NoError(failpoint.Enable("github.com/tikv/pd/server/useForwardRequest", `return(true)`))
Expand Down

0 comments on commit 2a7be67

Please sign in to comment.