From ad232d1bd88db83e93731686f39c33f2739d9e52 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Thu, 7 Dec 2023 14:37:21 +0800 Subject: [PATCH] *: remove the tombstone store metrics (#7504) ref tikv/pd#5839 Signed-off-by: Ryan Leung --- pkg/mcs/scheduling/server/meta/watcher.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/mcs/scheduling/server/meta/watcher.go b/pkg/mcs/scheduling/server/meta/watcher.go index 3a04c261163..6fae537eab9 100644 --- a/pkg/mcs/scheduling/server/meta/watcher.go +++ b/pkg/mcs/scheduling/server/meta/watcher.go @@ -16,12 +16,14 @@ package meta import ( "context" + "strconv" "sync" "github.com/gogo/protobuf/proto" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/log" "github.com/tikv/pd/pkg/core" + "github.com/tikv/pd/pkg/statistics" "github.com/tikv/pd/pkg/storage/endpoint" "github.com/tikv/pd/pkg/utils/etcdutil" "go.etcd.io/etcd/clientv3" @@ -79,9 +81,15 @@ func (w *Watcher) initializeStoreWatcher() error { origin := w.basicCluster.GetStore(store.GetId()) if origin == nil { w.basicCluster.PutStore(core.NewStoreInfo(store)) - return nil + } else { + w.basicCluster.PutStore(origin.Clone(core.SetStoreMeta(store))) } - w.basicCluster.PutStore(origin.Clone(core.SetStoreMeta(store))) + + if store.GetNodeState() == metapb.NodeState_Removed { + statistics.ResetStoreStatistics(store.GetAddress(), strconv.FormatUint(store.GetId(), 10)) + // TODO: remove hot stats + } + return nil } deleteFn := func(kv *mvccpb.KeyValue) error {