diff --git a/kv/local_sender.go b/kv/local_sender.go index 2f591b29b6a0..c2edba063c27 100644 --- a/kv/local_sender.go +++ b/kv/local_sender.go @@ -107,17 +107,6 @@ func (ls *LocalSender) VisitStores(visitor func(s *storage.Store) error) error { return nil } -// GetStoreIDs returns all the current store ids in a random order. -func (ls *LocalSender) GetStoreIDs() []proto.StoreID { - ls.mu.RLock() - defer ls.mu.RUnlock() - storeIDs := make([]proto.StoreID, 0, len(ls.storeMap)) - for storeID := range ls.storeMap { - storeIDs = append(storeIDs, storeID) - } - return storeIDs -} - // SendBatch implements batch.Sender. func (ls *LocalSender) SendBatch(ctx context.Context, ba proto.BatchRequest) (*proto.BatchResponse, error) { trace := tracer.FromCtx(ctx) diff --git a/kv/local_sender_test.go b/kv/local_sender_test.go index e868a3250692..549158a19442 100644 --- a/kv/local_sender_test.go +++ b/kv/local_sender_test.go @@ -44,6 +44,21 @@ func TestLocalSenderAddStore(t *testing.T) { } } +func TestLocalSenderRemoveStore(t *testing.T) { + defer leaktest.AfterTest(t) + ls := NewLocalSender() + + storeID := proto.StoreID(89) + + ls.AddStore(&storage.Store{Ident: proto.StoreIdent{StoreID: storeID}}) + + ls.RemoveStore(&storage.Store{Ident: proto.StoreIdent{StoreID: storeID}}) + + if ls.HasStore(storeID) { + t.Errorf("expted local sender to remove storeID=%d", storeID) + } +} + func TestLocalSenderGetStoreCount(t *testing.T) { defer leaktest.AfterTest(t) ls := NewLocalSender()