Skip to content

Commit

Permalink
cherry pick pingcap#18040 to release-4.0
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
lysu authored and ti-srebot committed Jun 18, 2020
1 parent fe073f2 commit 3a8622c
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 144 deletions.
2 changes: 1 addition & 1 deletion executor/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ func getRegionMeta(tikvStore tikv.Storage, regionMetas []*tikv.Region, uniqueReg
uniqueRegionMap[r.GetID()] = struct{}{}
regions = append(regions, regionMeta{
region: r.GetMeta(),
leaderID: r.GetLeaderID(),
leaderID: r.GetLeaderPeerID(),
storeID: r.GetLeaderStoreID(),
})
}
Expand Down
7 changes: 4 additions & 3 deletions store/mockstore/mocktikv/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ func (c *Cluster) RemoveStore(storeID uint64) {
}

// UpdateStoreAddr updates store address for cluster.
func (c *Cluster) UpdateStoreAddr(storeID uint64, addr string) {
func (c *Cluster) UpdateStoreAddr(storeID uint64, addr string, labels ...*metapb.StoreLabel) {
c.Lock()
defer c.Unlock()
c.stores[storeID] = newStore(storeID, addr)
c.stores[storeID] = newStore(storeID, addr, labels...)
}

// GetRegion returns a Region's meta and leader ID.
Expand Down Expand Up @@ -645,11 +645,12 @@ type Store struct {
tokenCount atomic.Int64
}

func newStore(storeID uint64, addr string) *Store {
func newStore(storeID uint64, addr string, labels ...*metapb.StoreLabel) *Store {
return &Store{
meta: &metapb.Store{
Id: storeID,
Address: addr,
Labels: labels,
},
}
}
Loading

0 comments on commit 3a8622c

Please sign in to comment.