Skip to content

Commit

Permalink
region_cache: filter peers on tombstone or dropped stores (#24726) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
youjiali1995 authored Jun 30, 2021
1 parent e1388a2 commit ac6d86b
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 102 deletions.
8 changes: 8 additions & 0 deletions store/mockstore/mocktikv/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package mocktikv

import (
"context"
"fmt"
"math"
"sync"
"time"
Expand Down Expand Up @@ -126,6 +127,13 @@ func (c *pdClient) GetStore(ctx context.Context, storeID uint64) (*metapb.Store,
default:
}
store := c.cluster.GetStore(storeID)
// It's same as PD's implementation.
if store == nil {
return nil, fmt.Errorf("invalid store ID %d, not found", storeID)
}
if store.GetState() == metapb.StoreState_Tombstone {
return nil, nil
}
return store, nil
}

Expand Down
Loading

0 comments on commit ac6d86b

Please sign in to comment.