Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch committed Apr 11, 2024
1 parent d22d9c4 commit 08f8c58
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions pkg/mcs/scheduling/server/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const (
collectWaitTime = time.Minute

// heartbeat relative const
hbAsyncRunner = "heartbeat-async-task-runner"
hbConcurrentRunner = "heartbeat-concurrent-task-runner"
)

var syncRunner = ratelimit.NewSyncRunner()
Expand Down Expand Up @@ -93,7 +93,7 @@ func NewCluster(parentCtx context.Context, persistConfig *config.PersistConfig,
clusterID: clusterID,
checkMembershipCh: checkMembershipCh,

taskRunner: ratelimit.NewAsyncRunner(hbAsyncRunner, time.Minute),
taskRunner: ratelimit.NewConcurrentRunner(hbConcurrentRunner, time.Minute),
hbConcurrencyLimiter: ratelimit.NewConcurrencyLimiter(uint64(runtime.NumCPU() * 2)),
}
c.coordinator = schedule.NewCoordinator(ctx, c, hbStreams)
Expand Down Expand Up @@ -561,7 +561,7 @@ func (c *Cluster) HandleRegionHeartbeat(region *core.RegionInfo) error {
tracer.Begin()
ctx := context.WithValue(c.ctx, ctxutil.HeartbeatTracerKey, tracer)
ctx = context.WithValue(ctx, ctxutil.LimiterKey, c.hbConcurrencyLimiter)
if c.persistConfig.GetScheduleConfig().EnableHeartbeatAsyncRunner {
if c.persistConfig.GetScheduleConfig().EnableHeartbeatConcurrentRunner {
ctx = context.WithValue(ctx, ctxutil.TaskRunnerKey, c.taskRunner)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/ratelimit/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"github.com/stretchr/testify/require"
)

func TestAsyncRunner(t *testing.T) {
func TestConcurrentRunner(t *testing.T) {
t.Run("RunTask", func(t *testing.T) {
limiter := NewConcurrencyLimiter(1)
runner := NewAsyncRunner("test", time.Second)
runner := NewConcurrentRunner("test", time.Second)
runner.Start()
defer runner.Stop()

Expand All @@ -48,7 +48,7 @@ func TestAsyncRunner(t *testing.T) {

t.Run("MaxPendingDuration", func(t *testing.T) {
limiter := NewConcurrencyLimiter(1)
runner := NewAsyncRunner("test", 2*time.Millisecond)
runner := NewConcurrentRunner("test", 2*time.Millisecond)
runner.Start()
defer runner.Stop()
var wg sync.WaitGroup
Expand Down
10 changes: 5 additions & 5 deletions pkg/schedule/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const (
defaultEnableJointConsensus = true
defaultEnableTiKVSplitRegion = true
defaultEnableHeartbeatBreakdownMetrics = true
defaultEnableHeartbeatAsyncRunner = false
defaultEnableHeartbeatConcurrentRunner = false
defaultEnableCrossTableMerge = true
defaultEnableDiagnostic = true
defaultStrictlyMatchLabel = false
Expand Down Expand Up @@ -268,8 +268,8 @@ type ScheduleConfig struct {
// EnableHeartbeatBreakdownMetrics is the option to enable heartbeat stats metrics.
EnableHeartbeatBreakdownMetrics bool `toml:"enable-heartbeat-breakdown-metrics" json:"enable-heartbeat-breakdown-metrics,string"`

// EnableHeartbeatAsyncRunner is the option to enable heartbeat async runner.
EnableHeartbeatAsyncRunner bool `toml:"enable-heartbeat-async-runner" json:"enable-heartbeat-async-runner,string"`
// EnableHeartbeatConcurrentRunner is the option to enable heartbeat concurrent runner.
EnableHeartbeatConcurrentRunner bool `toml:"enable-heartbeat-concurrent-runner" json:"enable-heartbeat-concurrent-runner,string"`

// Schedulers support for loading customized schedulers
Schedulers SchedulerConfigs `toml:"schedulers" json:"schedulers-v2"` // json v2 is for the sake of compatible upgrade
Expand Down Expand Up @@ -386,8 +386,8 @@ func (c *ScheduleConfig) Adjust(meta *configutil.ConfigMetaData, reloading bool)
c.EnableHeartbeatBreakdownMetrics = defaultEnableHeartbeatBreakdownMetrics
}

if !meta.IsDefined("enable-heartbeat-async-runner") {
c.EnableHeartbeatAsyncRunner = defaultEnableHeartbeatAsyncRunner
if !meta.IsDefined("enable-heartbeat-concurrent-runner") {
c.EnableHeartbeatConcurrentRunner = defaultEnableHeartbeatConcurrentRunner
}

if !meta.IsDefined("enable-cross-table-merge") {
Expand Down
2 changes: 1 addition & 1 deletion tests/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func NewTestAPIServer(ctx context.Context, cfg *config.Config) (*TestServer, err

func createTestServer(ctx context.Context, cfg *config.Config, services []string) (*TestServer, error) {
// disable the heartbeat async runner in test
cfg.Schedule.EnableHeartbeatAsyncRunner = false
cfg.Schedule.EnableHeartbeatConcurrentRunner = false
err := logutil.SetupLogger(cfg.Log, &cfg.Logger, &cfg.LogProps, cfg.Security.RedactInfoLog)
if err != nil {
return nil, err
Expand Down

0 comments on commit 08f8c58

Please sign in to comment.