From 96d7194af98f48f74ccce723d7ed80cb932c450a Mon Sep 17 00:00:00 2001 From: Chao Ma Date: Tue, 21 May 2019 16:30:17 +0800 Subject: [PATCH] Check duplicate external labels for all stores included existed store (#1157) When we change the external labels after store has already joined into storesets that will makes the external labels duplicated Check duplicate external labels before checking whether the store is exist or not --- pkg/query/storeset.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/query/storeset.go b/pkg/query/storeset.go index 7f8344116d..237dfde55e 100644 --- a/pkg/query/storeset.go +++ b/pkg/query/storeset.go @@ -236,11 +236,6 @@ func (s *StoreSet) Update(ctx context.Context) { // Add stores that are not yet in s.stores. for addr, store := range healthyStores { - if _, ok := s.stores[addr]; ok { - s.updateStoreStatus(store, nil) - continue - } - // Check if it has some external labels specified. // No external labels means strictly store gateway or ruler and it is fine to have access to multiple instances of them. // @@ -252,6 +247,11 @@ func (s *StoreSet) Update(ctx context.Context) { continue } + if _, ok := s.stores[addr]; ok { + s.updateStoreStatus(store, nil) + continue + } + s.stores[addr] = store s.updateStoreStatus(store, nil) level.Info(s.logger).Log("msg", "adding new store to query storeset", "address", addr)