Skip to content

Commit

Permalink
tikv: pre-index stores in region-cache for different access pattern (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Jun 18, 2020
1 parent 6dc7e03 commit 0082d04
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 0082d04

Please sign in to comment.