From 771e04235d9c40d73a41a6c8a4e6f299640e62b1 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 21 Aug 2023 16:53:38 +0800 Subject: [PATCH] *: fix data race in the ReuseChunkPool Signed-off-by: Weizhen Wang --- sessionctx/variable/session.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index 99018080e4c75..c3ac02e5d1f07 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -1605,6 +1605,8 @@ func (s *SessionVars) SetAlloc(alloc chunk.Allocator) { if !s.EnableReuseCheck { return } + s.ChunkPool.mu.Lock() + defer s.ChunkPool.mu.Unlock() s.ChunkPool.Alloc = alloc }