Repository: tikv/pd
Pull request #5209 (2022-06-21 17:26:32)

*: replace `Id` with `ID`
Signed-off-by: lhy1024 <admin@liudos.us>

<!--
Thank you for working on PD! Please read PD's [CONTRIBUTING](https://github.com/tikv/pd/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.
PR Title Format:
1. pkg [, pkg2, pkg3]: what's changed
2. *: what's changed
-->

### What problem does this PR solve?

<!--

Please create an issue first to describe the problem.
There MUST be one line starting with "Issue Number:  " and 
linking the relevant issues via the "close" or "ref".
For more info, check https://github.com/tikv/pd/blob/master/CONTRIBUTING.md#linking-issues.

-->
Issue Number: Ref #4399

### What is changed and how does it work?

<!--

You could use the "commit message" code block to add more description to the final commit message.
For more info, check https://github.com/tikv/pd/blob/master/CONTRIBUTING.md#format-of-the-commit-message.

-->

```commit-message
```

### Check List

<!-- Remove the items that are not applicable. -->

Tests

<!-- At least one of these tests must be included. -->

- Unit test

### Release note

<!-- A bugfix or a new feature needs a release note. If there is no need release note, just uncomment the below line. -->

```release-note
None.
```


ti-chi-bot: [REVIEW NOTIFICATION]

This pull request has not been approved.


To complete the [pull request process](https://book.prow.tidb.io/#/en/workflows/pr), please ask the reviewers in the [list](https://prow.tidb.io/tichi/repos/tikv/pd/pulls/5209/owners) to review by filling `/cc @reviewer` in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the [list](https://prow.tidb.io/tichi/repos/tikv/pd/pulls/5209/owners) by filling  `/assign @committer` in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found [here](https://prow.tidb.io/command-help?repo=tikv%2Fpd).

<details>

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.
</details>

<!--Review Notification Identifier-->
codecov[bot]: # [Codecov](https://codecov.io/gh/tikv/pd/pull/5209?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv) Report
> Merging [#5209](https://codecov.io/gh/tikv/pd/pull/5209?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv) (b52960a) into [master](https://codecov.io/gh/tikv/pd/commit/b100049b4548ac84c8da2566cb65b1f204c59a10?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv) (b100049) will **increase** coverage by `0.15%`.
> The diff coverage is `66.66%`.

```diff
@@            Coverage Diff             @@
##           master    #5209      +/-   ##
==========================================
+ Coverage   75.65%   75.81%   +0.15%     
==========================================
  Files         310      310              
  Lines       30675    30675              
==========================================
+ Hits        23208    23256      +48     
+ Misses       5463     5432      -31     
+ Partials     2004     1987      -17     
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `75.81% <66.66%> (+0.15%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/tikv/pd/pull/5209?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv) | Coverage Δ | |
|---|---|---|
| [server/core/basic\_cluster.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL2NvcmUvYmFzaWNfY2x1c3Rlci5nbw==) | `91.28% <ø> (ø)` | |
| [server/core/region.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL2NvcmUvcmVnaW9uLmdv) | `91.27% <ø> (ø)` | |
| [server/core/region\_option.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL2NvcmUvcmVnaW9uX29wdGlvbi5nbw==) | `83.17% <0.00%> (ø)` | |
| [server/schedule/test\_util.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL3NjaGVkdWxlL3Rlc3RfdXRpbC5nbw==) | `71.42% <ø> (ø)` | |
| [server/schedulers/grant\_hot\_region.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL3NjaGVkdWxlcnMvZ3JhbnRfaG90X3JlZ2lvbi5nbw==) | `58.97% <0.00%> (ø)` | |
| [server/schedule/checker/merge\_checker.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL3NjaGVkdWxlL2NoZWNrZXIvbWVyZ2VfY2hlY2tlci5nbw==) | `69.69% <100.00%> (ø)` | |
| [server/schedule/checker/replica\_strategy.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL3NjaGVkdWxlL2NoZWNrZXIvcmVwbGljYV9zdHJhdGVneS5nbw==) | `88.63% <100.00%> (ø)` | |
| [server/schedulers/balance\_region.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL3NjaGVkdWxlcnMvYmFsYW5jZV9yZWdpb24uZ28=) | `89.34% <100.00%> (ø)` | |
| [server/schedulers/hot\_region.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL3NjaGVkdWxlcnMvaG90X3JlZ2lvbi5nbw==) | `83.52% <100.00%> (-0.29%)` | :arrow_down: |
| [server/schedulers/shuffle\_hot\_region.go](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv#diff-c2VydmVyL3NjaGVkdWxlcnMvc2h1ZmZsZV9ob3RfcmVnaW9uLmdv) | `55.55% <100.00%> (ø)` | |
| ... and [26 more](https://codecov.io/gh/tikv/pd/pull/5209/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/tikv/pd/pull/5209?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/tikv/pd/pull/5209?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv). Last update [b100049...b52960a](https://codecov.io/gh/tikv/pd/pull/5209?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tikv).

rleungx: /merge
ti-chi-bot: @rleungx: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests


<details>

Instructions for interacting with me using PR comments are available [here](https://prow.tidb.io/command-help).  If you have questions or suggestions related to my behavior, please file an issue against the [ti-community-infra/tichi](https://github.com/ti-community-infra/tichi/issues/new?title=Prow%20issue:) repository.
</details>
ti-chi-bot: This pull request has been accepted and is ready to merge. <details>Commit hash: b52960a0bb0e7d9e0285bc057479fd5eae9f521b</details>

Patch:
diff --git a/server/core/basic_cluster.go b/server/core/basic_cluster.go
index 9100636d3..650985739 100644
--- a/server/core/basic_cluster.go
+++ b/server/core/basic_cluster.go
@@ -95,7 +95,7 @@ func (bc *BasicCluster) GetRegionStores(region *RegionInfo) []*StoreInfo {
 	bc.RLock()
 	defer bc.RUnlock()
 	var Stores []*StoreInfo
-	for id := range region.GetStoreIds() {
+	for id := range region.GetStoreIDs() {
 		if store := bc.Stores.GetStore(id); store != nil {
 			Stores = append(Stores, store)
 		}
diff --git a/server/core/region.go b/server/core/region.go
index cc688712a..8114a0e41 100644
--- a/server/core/region.go
+++ b/server/core/region.go
@@ -349,8 +349,8 @@ func (r *RegionInfo) GetStoreLearner(storeID uint64) *metapb.Peer {
 	return nil
 }
 
-// GetStoreIds returns a map indicate the region distributed.
-func (r *RegionInfo) GetStoreIds() map[uint64]struct{} {
+// GetStoreIDs returns a map indicate the region distributed.
+func (r *RegionInfo) GetStoreIDs() map[uint64]struct{} {
 	peers := r.meta.GetPeers()
 	stores := make(map[uint64]struct{}, len(peers))
 	for _, peer := range peers {
diff --git a/server/core/region_option.go b/server/core/region_option.go
index b06c784c0..c0d2204de 100644
--- a/server/core/region_option.go
+++ b/server/core/region_option.go
@@ -96,14 +96,14 @@ func WithNewRegionID(id uint64) RegionCreateOption {
 	}
 }
 
-// WithNewPeerIds sets new ids for peers.
-func WithNewPeerIds(peerIds ...uint64) RegionCreateOption {
+// WithNewPeerIDs sets new ids for peers.
+func WithNewPeerIDs(peerIDs ...uint64) RegionCreateOption {
 	return func(region *RegionInfo) {
-		if len(peerIds) != len(region.meta.GetPeers()) {
+		if len(peerIDs) != len(region.meta.GetPeers()) {
 			return
 		}
 		for i, p := range region.meta.GetPeers() {
-			p.Id = peerIds[i]
+			p.Id = peerIDs[i]
 		}
 	}
 }
diff --git a/server/schedule/checker/merge_checker.go b/server/schedule/checker/merge_checker.go
index e5624d48d..fcfc087a3 100644
--- a/server/schedule/checker/merge_checker.go
+++ b/server/schedule/checker/merge_checker.go
@@ -282,7 +282,7 @@ func isTableIDSame(region, adjacent *core.RegionInfo) bool {
 // while the source region has no peer on it. This is to prevent from bringing
 // any other peer into an offline store to slow down the offline process.
 func checkPeerStore(cluster schedule.Cluster, region, adjacent *core.RegionInfo) bool {
-	regionStoreIDs := region.GetStoreIds()
+	regionStoreIDs := region.GetStoreIDs()
 	for _, peer := range adjacent.GetPeers() {
 		storeID := peer.GetStoreId()
 		store := cluster.GetStore(storeID)
diff --git a/server/schedule/checker/replica_strategy.go b/server/schedule/checker/replica_strategy.go
index 6ccad30a3..4fb9d8741 100644
--- a/server/schedule/checker/replica_strategy.go
+++ b/server/schedule/checker/replica_strategy.go
@@ -53,7 +53,7 @@ func (s *ReplicaStrategy) SelectStoreToAdd(coLocationStores []*core.StoreInfo, e
 	// The reason for it is to prevent the non-optimal replica placement due
 	// to the short-term state, resulting in redundant scheduling.
 	filters := []filter.Filter{
-		filter.NewExcludedFilter(s.checkerName, nil, s.region.GetStoreIds()),
+		filter.NewExcludedFilter(s.checkerName, nil, s.region.GetStoreIDs()),
 		filter.NewStorageThresholdFilter(s.checkerName),
 		filter.NewSpecialUseFilter(s.checkerName),
 		&filter.StoreStateFilter{ActionScope: s.checkerName, MoveRegion: true, AllowTemporaryStates: true},
diff --git a/server/schedulers/balance_region.go b/server/schedulers/balance_region.go
index f8d4679ac..033446ae3 100644
--- a/server/schedulers/balance_region.go
+++ b/server/schedulers/balance_region.go
@@ -216,7 +216,7 @@ func (s *balanceRegionScheduler) Schedule(cluster schedule.Cluster) []*operator.
 // transferPeer selects the best store to create a new peer to replace the old peer.
 func (s *balanceRegionScheduler) transferPeer(plan *balancePlan) *operator.Operator {
 	filters := []filter.Filter{
-		filter.NewExcludedFilter(s.GetName(), nil, plan.region.GetStoreIds()),
+		filter.NewExcludedFilter(s.GetName(), nil, plan.region.GetStoreIDs()),
 		filter.NewPlacementSafeguard(s.GetName(), plan.GetOpts(), plan.GetBasicCluster(), plan.GetRuleManager(), plan.region, plan.source),
 		filter.NewRegionScoreFilter(s.GetName(), plan.source, plan.GetOpts()),
 		filter.NewSpecialUseFilter(s.GetName()),
diff --git a/server/schedulers/grant_hot_region.go b/server/schedulers/grant_hot_region.go
index 4decd1b13..086bd7e26 100644
--- a/server/schedulers/grant_hot_region.go
+++ b/server/schedulers/grant_hot_region.go
@@ -361,7 +361,7 @@ func (s *grantHotRegionScheduler) transfer(cluster schedule.Cluster, regionID ui
 		candidate = []uint64{s.conf.GetStoreLeaderID()}
 	} else {
 		filters = append(filters, &filter.StoreStateFilter{ActionScope: s.GetName(), MoveRegion: true},
-			filter.NewExcludedFilter(s.GetName(), srcRegion.GetStoreIds(), srcRegion.GetStoreIds()))
+			filter.NewExcludedFilter(s.GetName(), srcRegion.GetStoreIDs(), srcRegion.GetStoreIDs()))
 		candidate = s.conf.StoreIDs
 	}
 	for _, storeID := range candidate {
diff --git a/server/schedulers/hot_region.go b/server/schedulers/hot_region.go
index 3ca40a713..f6a38e8ec 100644
--- a/server/schedulers/hot_region.go
+++ b/server/schedulers/hot_region.go
@@ -728,7 +728,7 @@ func (bs *balanceSolver) filterDstStores() map[uint64]*statistics.StoreLoadDetai
 	case movePeer:
 		filters = []filter.Filter{
 			&filter.StoreStateFilter{ActionScope: bs.sche.GetName(), MoveRegion: true},
-			filter.NewExcludedFilter(bs.sche.GetName(), bs.cur.region.GetStoreIds(), bs.cur.region.GetStoreIds()),
+			filter.NewExcludedFilter(bs.sche.GetName(), bs.cur.region.GetStoreIDs(), bs.cur.region.GetStoreIDs()),
 			filter.NewSpecialUseFilter(bs.sche.GetName(), filter.SpecialUseHotRegion),
 			filter.NewPlacementSafeguard(bs.sche.GetName(), bs.GetOpts(), bs.GetBasicCluster(), bs.GetRuleManager(), bs.cur.region, srcStore),
 		}
diff --git a/server/schedulers/shuffle_hot_region.go b/server/schedulers/shuffle_hot_region.go
index 55a894f3c..d33f3a515 100644
--- a/server/schedulers/shuffle_hot_region.go
+++ b/server/schedulers/shuffle_hot_region.go
@@ -179,7 +179,7 @@ func (s *shuffleHotRegionScheduler) randomSchedule(cluster schedule.Cluster, loa
 
 		filters := []filter.Filter{
 			&filter.StoreStateFilter{ActionScope: s.GetName(), MoveRegion: true},
-			filter.NewExcludedFilter(s.GetName(), srcRegion.GetStoreIds(), srcRegion.GetStoreIds()),
+			filter.NewExcludedFilter(s.GetName(), srcRegion.GetStoreIDs(), srcRegion.GetStoreIDs()),
 			filter.NewPlacementSafeguard(s.GetName(), cluster.GetOpts(), cluster.GetBasicCluster(), cluster.GetRuleManager(), srcRegion, srcStore),
 		}
 		stores := cluster.GetStores()
diff --git a/server/schedulers/shuffle_region.go b/server/schedulers/shuffle_region.go
index b0a6286ce..f947ca79a 100644
--- a/server/schedulers/shuffle_region.go
+++ b/server/schedulers/shuffle_region.go
@@ -159,7 +159,7 @@ func (s *shuffleRegionScheduler) scheduleAddPeer(cluster schedule.Cluster, regio
 		return nil
 	}
 	scoreGuard := filter.NewPlacementSafeguard(s.GetName(), cluster.GetOpts(), cluster.GetBasicCluster(), cluster.GetRuleManager(), region, store)
-	excludedFilter := filter.NewExcludedFilter(s.GetName(), nil, region.GetStoreIds())
+	excludedFilter := filter.NewExcludedFilter(s.GetName(), nil, region.GetStoreIDs())
 
 	target := filter.NewCandidates(cluster.GetStores()).
 		FilterTarget(cluster.GetOpts(), s.filters...).
diff --git a/tools/pd-simulator/simulator/event.go b/tools/pd-simulator/simulator/event.go
index 13032e45d..f2504de90 100644
--- a/tools/pd-simulator/simulator/event.go
+++ b/tools/pd-simulator/simulator/event.go
@@ -187,7 +187,7 @@ func (e *DeleteNodes) Run(raft *RaftEngine, tickCount int64) bool {
 
 	regions := raft.GetRegions()
 	for _, region := range regions {
-		storeIDs := region.GetStoreIds()
+		storeIDs := region.GetStoreIDs()
 		if _, ok := storeIDs[id]; ok {
 			downPeer := &pdpb.PeerStats{
 				Peer:        region.GetStorePeer(id),
diff --git a/tools/pd-simulator/simulator/raft.go b/tools/pd-simulator/simulator/raft.go
index c31940718..644a86ef7 100644
--- a/tools/pd-simulator/simulator/raft.go
+++ b/tools/pd-simulator/simulator/raft.go
@@ -146,7 +146,7 @@ func (r *RaftEngine) stepSplit(region *core.RegionInfo) {
 	}
 	left := region.Clone(
 		core.WithNewRegionID(ids[len(ids)-1]),
-		core.WithNewPeerIds(ids[0:len(ids)-1]...),
+		core.WithNewPeerIDs(ids[0:len(ids)-1]...),
 		core.WithIncVersion(),
 		core.SetApproximateKeys(region.GetApproximateKeys()/2),
 		core.SetApproximateSize(region.GetApproximateSize()/2),
@@ -196,7 +196,7 @@ func (r *RaftEngine) updateRegionStore(region *core.RegionInfo, size int64) {
 		core.SetApproximateSize(region.GetApproximateSize()+size),
 		core.SetWrittenBytes(uint64(size)),
 	)
-	storeIDs := region.GetStoreIds()
+	storeIDs := region.GetStoreIDs()
 	for storeID := range storeIDs {
 		r.conn.Nodes[storeID].incUsedSize(uint64(size))
 	}
@@ -220,7 +220,7 @@ func (r *RaftEngine) electNewLeader(region *core.RegionInfo) *metapb.Peer {
 		unhealthy        int
 		newLeaderStoreID uint64
 	)
-	ids := region.GetStoreIds()
+	ids := region.GetStoreIDs()
 	for id := range ids {
 		if r.conn.nodeHealth(id) {
 			newLeaderStoreID = id


Test patch:
diff --git a/server/api/region_test.go b/server/api/region_test.go
index 7fc802541..816fefcc0 100644
--- a/server/api/region_test.go
+++ b/server/api/region_test.go
@@ -456,57 +456,57 @@ func (s *testGetRegionSuite) TestScanRegionByKeys(c *C) {
 	mustRegionHeartbeat(c, s.svr, r)
 
 	url := fmt.Sprintf("%s/regions/key?key=%s", s.urlPrefix, "b")
-	regionIds := []uint64{3, 4, 5, 99}
+	regionIDs := []uint64{3, 4, 5, 99}
 	regions := &RegionsInfo{}
 	err := tu.ReadGetJSON(c, testDialClient, url, regions)
 	c.Assert(err, IsNil)
-	c.Assert(regionIds, HasLen, regions.Count)
-	for i, v := range regionIds {
+	c.Assert(regionIDs, HasLen, regions.Count)
+	for i, v := range regionIDs {
 		c.Assert(v, Equals, regions.Regions[i].ID)
 	}
 	url = fmt.Sprintf("%s/regions/key?key=%s", s.urlPrefix, "d")
-	regionIds = []uint64{4, 5, 99}
+	regionIDs = []uint64{4, 5, 99}
 	regions = &RegionsInfo{}
 	err = tu.ReadGetJSON(c, testDialClient, url, regions)
 	c.Assert(err, IsNil)
-	c.Assert(regionIds, HasLen, regions.Count)
-	for i, v := range regionIds {
+	c.Assert(regionIDs, HasLen, regions.Count)
+	for i, v := range regionIDs {
 		c.Assert(v, Equals, regions.Regions[i].ID)
 	}
 	url = fmt.Sprintf("%s/regions/key?key=%s", s.urlPrefix, "g")
-	regionIds = []uint64{5, 99}
+	regionIDs = []uint64{5, 99}
 	regions = &RegionsInfo{}
 	err = tu.ReadGetJSON(c, testDialClient, url, regions)
 	c.Assert(err, IsNil)
-	c.Assert(regionIds, HasLen, regions.Count)
-	for i, v := range regionIds {
+	c.Assert(regionIDs, HasLen, regions.Count)
+	for i, v := range regionIDs {
 		c.Assert(v, Equals, regions.Regions[i].ID)
 	}
 	url = fmt.Sprintf("%s/regions/key?end_key=%s", s.urlPrefix, "e")
-	regionIds = []uint64{2, 3, 4}
+	regionIDs = []uint64{2, 3, 4}
 	regions = &RegionsInfo{}
 	err = tu.ReadGetJSON(c, testDialClient, url, regions)
 	c.Assert(err, IsNil)
-	c.Assert(len(regionIds), Equals, regions.Count)
-	for i, v := range regionIds {
+	c.Assert(len(regionIDs), Equals, regions.Count)
+	for i, v := range regionIDs {
 		c.Assert(v, Equals, regions.Regions[i].ID)
 	}
 	url = fmt.Sprintf("%s/regions/key?key=%s&end_key=%s", s.urlPrefix, "b", "g")
-	regionIds = []uint64{3, 4}
+	regionIDs = []uint64{3, 4}
 	regions = &RegionsInfo{}
 	err = tu.ReadGetJSON(c, testDialClient, url, regions)
 	c.Assert(err, IsNil)
-	c.Assert(len(regionIds), Equals, regions.Count)
-	for i, v := range regionIds {
+	c.Assert(len(regionIDs), Equals, regions.Count)
+	for i, v := range regionIDs {
 		c.Assert(v, Equals, regions.Regions[i].ID)
 	}
 	url = fmt.Sprintf("%s/regions/key?key=%s&end_key=%s", s.urlPrefix, "b", []byte{0xFF, 0xFF, 0xCC})
-	regionIds = []uint64{3, 4, 5, 99}
+	regionIDs = []uint64{3, 4, 5, 99}
 	regions = &RegionsInfo{}
 	err = tu.ReadGetJSON(c, testDialClient, url, regions)
 	c.Assert(err, IsNil)
-	c.Assert(len(regionIds), Equals, regions.Count)
-	for i, v := range regionIds {
+	c.Assert(len(regionIDs), Equals, regions.Count)
+	for i, v := range regionIDs {
 		c.Assert(v, Equals, regions.Regions[i].ID)
 	}
 }
diff --git a/server/core/region_tree_test.go b/server/core/region_tree_test.go
index 0f813717f..7538f04dd 100644
--- a/server/core/region_tree_test.go
+++ b/server/core/region_tree_test.go
@@ -80,7 +80,7 @@ func TestRegionInfo(t *testing.T) {
 	r = r.Clone(WithEndKey([]byte{1}))
 	re.Regexp(".*EndKey Changed.*", DiffRegionKeyInfo(r, info))
 
-	stores := r.GetStoreIds()
+	stores := r.GetStoreIDs()
 	re.Len(stores, int(n))
 	for i := uint64(0); i < n; i++ {
 		_, ok := stores[i]
diff --git a/server/schedule/test_util.go b/server/schedule/test_util.go
index b6484042d..67b6f8914 100644
--- a/server/schedule/test_util.go
+++ b/server/schedule/test_util.go
@@ -79,10 +79,10 @@ func ApplyOperator(mc *mockcluster.Cluster, op *operator.Operator) {
 		region = ApplyOperatorStep(region, op)
 	}
 	mc.PutRegion(region)
-	for id := range region.GetStoreIds() {
+	for id := range region.GetStoreIDs() {
 		mc.UpdateStoreStatus(id)
 	}
-	for id := range origin.GetStoreIds() {
+	for id := range origin.GetStoreIDs() {
 		mc.UpdateStoreStatus(id)
 	}
 }