diff --git a/pkg/bindinfo/handle.go b/pkg/bindinfo/handle.go index 5cfa1bf4f78ab..fef76f5bb2858 100644 --- a/pkg/bindinfo/handle.go +++ b/pkg/bindinfo/handle.go @@ -50,7 +50,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 } @@ -842,6 +842,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{}),