Skip to content

Commit

Permalink
region_cache: filter out unresolved stores when GetTiFlashStores
Browse files Browse the repository at this point in the history
Signed-off-by: zyguan <[email protected]>
  • Loading branch information
zyguan committed Apr 3, 2024
1 parent 5a4905d commit 94106ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/locate/region_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ func (c *RegionCache) PDClient() pd.Client {
// GetTiFlashStores returns the information of all tiflash nodes.
func (c *RegionCache) GetTiFlashStores(labelFilter LabelFilter) []*Store {
return c.filterStores(nil, func(s *Store) bool {
return s.storeType == tikvrpc.TiFlash && labelFilter(s.labels)
return s.storeType == tikvrpc.TiFlash && labelFilter(s.labels) && s.getResolveState() == resolved
})
}

Expand Down
2 changes: 1 addition & 1 deletion internal/locate/store_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (s *Store) reResolve(c storeCache) (bool, error) {
if store == nil || store.GetState() == metapb.StoreState_Tombstone {
// store has be removed in PD, we should invalidate all regions using those store.
logutil.BgLogger().Info("invalidate regions in removed store",
zap.Uint64("store", s.storeID), zap.String("add", s.addr))
zap.Uint64("store", s.storeID), zap.String("addr", s.addr))
atomic.AddUint32(&s.epoch, 1)
s.setResolveState(tombstone)
metrics.RegionCacheCounterWithInvalidateStoreRegionsOK.Inc()
Expand Down

0 comments on commit 94106ea

Please sign in to comment.