From ef1b724d22dd9386a68084bdabe0a97ed74aafdd Mon Sep 17 00:00:00 2001 From: Yifan Xu <30385241+xuyifangreeneyes@users.noreply.github.com> Date: Thu, 8 Jun 2023 13:35:41 +0800 Subject: [PATCH] statistics: remove h.mu.Lock when creating NewSessionStatsCollector (#44510) close pingcap/tidb#44502 --- statistics/handle/update.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/statistics/handle/update.go b/statistics/handle/update.go index 95ca2a959bac3..1944680728fe7 100644 --- a/statistics/handle/update.go +++ b/statistics/handle/update.go @@ -234,9 +234,6 @@ func (s *SessionStatsCollector) UpdateColStatsUsage(colMap colStatsUsageMap) { // NewSessionStatsCollector allocates a stats collector for a session. func (h *Handle) NewSessionStatsCollector() *SessionStatsCollector { - h.mu.Lock() - defer h.mu.Unlock() - h.listHead.Lock() defer h.listHead.Unlock() newCollector := &SessionStatsCollector{ @@ -315,8 +312,6 @@ func (s *SessionIndexUsageCollector) Delete() { // idxUsageListHead always points to an empty SessionIndexUsageCollector as a sentinel node. So we let idxUsageListHead.next // points to new item. It's helpful to sweepIdxUsageList. func (h *Handle) NewSessionIndexUsageCollector() *SessionIndexUsageCollector { - h.mu.Lock() - defer h.mu.Unlock() h.idxUsageListHead.Lock() defer h.idxUsageListHead.Unlock() newCollector := &SessionIndexUsageCollector{