diff --git a/pkg/bindinfo/capture.go b/pkg/bindinfo/capture.go index a02d527b4b2ce..f8e0901393f78 100644 --- a/pkg/bindinfo/capture.go +++ b/pkg/bindinfo/capture.go @@ -84,6 +84,8 @@ func ParseCaptureTableFilter(tableFilter string) (f tablefilter.Filter, valid bo } func (h *BindHandle) extractCaptureFilterFromStorage() (filter *captureFilter) { + h.sctx.Lock() + defer h.sctx.Unlock() filter = &captureFilter{ frequency: 1, users: make(map[string]struct{}), diff --git a/pkg/bindinfo/handle.go b/pkg/bindinfo/handle.go index e36021ee476d6..a47a80953d5b9 100644 --- a/pkg/bindinfo/handle.go +++ b/pkg/bindinfo/handle.go @@ -43,7 +43,7 @@ import ( // BindHandle is used to handle all global sql bind operations. type BindHandle struct { - sctx struct { + sctx struct { // TODO: remove this singleton sctx later on, which is not thread-safe. sync.Mutex sessionctx.Context }