Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: okJiang <[email protected]>
  • Loading branch information
okJiang committed Jan 22, 2025
1 parent 885ae70 commit 6a3c636
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
1 change: 0 additions & 1 deletion pkg/tso/allocator_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ type AllocatorManager struct {
// member is for election use
member ElectionMember
// TSO config
rootPath string
storage endpoint.TSOStorage
saveInterval time.Duration
updatePhysicalInterval time.Duration
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/keypath/absolute_key_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func ExternalTimestampPath() string {
return fmt.Sprintf(externalTimestampPathFormat, ClusterID())
}

// RecoveringMarkPath returns the path to save the recovering mark.
func RecoveringMarkPath() string {
return fmt.Sprintf(recoveringMarkPathFormat, ClusterID())
}
Expand Down
34 changes: 17 additions & 17 deletions tests/server/api/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (suite *scheduleTestSuite) checkOriginAPI(cluster *tests.TestCluster) {

suite.assertSchedulerExists(urlPrefix, "evict-leader-scheduler")
resp := make(map[string]any)
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, "evict-leader-scheduler")
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, "evict-leader-scheduler")
re.NoError(tu.ReadGetJSON(re, tests.TestDialClient, listURL, &resp))
re.Len(resp["store-id-ranges"], 1)
input1 := make(map[string]any)
Expand Down Expand Up @@ -186,15 +186,15 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
name: "balance-leader-scheduler",
createdName: "balance-leader-scheduler",
extraTestFunc: func(name string) {
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
resp := make(map[string]any)
tu.Eventually(re, func() bool {
re.NoError(tu.ReadGetJSON(re, tests.TestDialClient, listURL, &resp))
return resp["batch"] == 4.0
})
dataMap := make(map[string]any)
dataMap["batch"] = 3
updateURL := fmt.Sprintf("%s%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
updateURL := fmt.Sprintf("%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
body, err := json.Marshal(dataMap)
re.NoError(err)
re.NoError(tu.CheckPostJSON(tests.TestDialClient, updateURL, body, tu.StatusOK(re)))
Expand Down Expand Up @@ -244,7 +244,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
createdName: "balance-hot-region-scheduler",
extraTestFunc: func(name string) {
resp := make(map[string]any)
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
expectMap := map[string]any{
"min-hot-byte-rate": 100.0,
"min-hot-key-rate": 10.0,
Expand Down Expand Up @@ -283,7 +283,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
dataMap := make(map[string]any)
dataMap["max-zombie-rounds"] = 5.0
expectMap["max-zombie-rounds"] = 5.0
updateURL := fmt.Sprintf("%s%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
updateURL := fmt.Sprintf("%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
body, err := json.Marshal(dataMap)
re.NoError(err)
re.NoError(tu.CheckPostJSON(tests.TestDialClient, updateURL, body, tu.StatusOK(re)))
Expand Down Expand Up @@ -318,15 +318,15 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
name: "split-bucket-scheduler",
createdName: "split-bucket-scheduler",
extraTestFunc: func(name string) {
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
resp := make(map[string]any)
tu.Eventually(re, func() bool {
re.NoError(tu.ReadGetJSON(re, tests.TestDialClient, listURL, &resp))
return resp["degree"] == 3.0 && resp["split-limit"] == 0.0
})
dataMap := make(map[string]any)
dataMap["degree"] = 4
updateURL := fmt.Sprintf("%s%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
updateURL := fmt.Sprintf("%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
body, err := json.Marshal(dataMap)
re.NoError(err)
re.NoError(tu.CheckPostJSON(tests.TestDialClient, updateURL, body, tu.StatusOK(re)))
Expand Down Expand Up @@ -377,14 +377,14 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
createdName: "balance-witness-scheduler",
extraTestFunc: func(name string) {
resp := make(map[string]any)
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
tu.Eventually(re, func() bool {
re.NoError(tu.ReadGetJSON(re, tests.TestDialClient, listURL, &resp))
return resp["batch"] == 4.0
})
dataMap := make(map[string]any)
dataMap["batch"] = 3
updateURL := fmt.Sprintf("%s%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
updateURL := fmt.Sprintf("%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
body, err := json.Marshal(dataMap)
re.NoError(err)
re.NoError(tu.CheckPostJSON(tests.TestDialClient, updateURL, body, tu.StatusOK(re)))
Expand Down Expand Up @@ -434,7 +434,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
args: []arg{{"store_id", 1}},
extraTestFunc: func(name string) {
resp := make(map[string]any)
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
expectedMap := make(map[string]any)
expectedMap["1"] = []any{map[string]any{"end-key": "", "start-key": ""}}
tu.Eventually(re, func() bool {
Expand All @@ -446,7 +446,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
input := make(map[string]any)
input["name"] = "grant-leader-scheduler"
input["store_id"] = 2
updateURL := fmt.Sprintf("%s%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
updateURL := fmt.Sprintf("%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
body, err := json.Marshal(input)
re.NoError(err)
re.NoError(tu.CheckPostJSON(tests.TestDialClient, updateURL, body, tu.StatusOK(re)))
Expand All @@ -458,7 +458,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
})

// using /pd/v1/schedule-config/grant-leader-scheduler/config to delete exists store from grant-leader-scheduler
deleteURL := fmt.Sprintf("%s%s%s/%s/delete/%s", leaderAddr, server.SchedulerConfigHandlerPath, name, "2")
deleteURL := fmt.Sprintf("%s%s/%s/delete/%s", leaderAddr, server.SchedulerConfigHandlerPath, name, "2")
err = tu.CheckDelete(tests.TestDialClient, deleteURL, tu.StatusOK(re))
re.NoError(err)
delete(expectedMap, "2")
Expand All @@ -478,14 +478,14 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
// Test the scheduler config handler.
extraTestFunc: func(name string) {
resp := make(map[string]any)
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
tu.Eventually(re, func() bool {
re.NoError(tu.ReadGetJSON(re, tests.TestDialClient, listURL, &resp))
return resp["start-key"] == "" && resp["end-key"] == "" && resp["range-name"] == "test"
})
resp["start-key"] = "a_00"
resp["end-key"] = "a_99"
updateURL := fmt.Sprintf("%s%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
updateURL := fmt.Sprintf("%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
body, err := json.Marshal(resp)
re.NoError(err)
re.NoError(tu.CheckPostJSON(tests.TestDialClient, updateURL, body, tu.StatusOK(re)))
Expand All @@ -503,7 +503,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
// Test the scheduler config handler.
extraTestFunc: func(name string) {
resp := make(map[string]any)
listURL := fmt.Sprintf("%s%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
listURL := fmt.Sprintf("%s%s/%s/list", leaderAddr, server.SchedulerConfigHandlerPath, name)
expectedMap := make(map[string]any)
expectedMap["3"] = []any{map[string]any{"end-key": "", "start-key": ""}}
tu.Eventually(re, func() bool {
Expand All @@ -515,7 +515,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
input := make(map[string]any)
input["name"] = "evict-leader-scheduler"
input["store_id"] = 4
updateURL := fmt.Sprintf("%s%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
updateURL := fmt.Sprintf("%s%s/%s/config", leaderAddr, server.SchedulerConfigHandlerPath, name)
body, err := json.Marshal(input)
re.NoError(err)
re.NoError(tu.CheckPostJSON(tests.TestDialClient, updateURL, body, tu.StatusOK(re)))
Expand All @@ -527,7 +527,7 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
})

// using /pd/v1/schedule-config/evict-leader-scheduler/config to delete exist store from evict-leader-scheduler
deleteURL := fmt.Sprintf("%s%s%s/%s/delete/%s", leaderAddr, server.SchedulerConfigHandlerPath, name, "4")
deleteURL := fmt.Sprintf("%s%s/%s/delete/%s", leaderAddr, server.SchedulerConfigHandlerPath, name, "4")
err = tu.CheckDelete(tests.TestDialClient, deleteURL, tu.StatusOK(re))
re.NoError(err)
delete(expectedMap, "4")
Expand Down

0 comments on commit 6a3c636

Please sign in to comment.