From 18a02ae64af33fe208957de6ce286b91ac1bf067 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Tue, 20 Feb 2024 18:19:58 +0800 Subject: [PATCH] executor: fix negative consumedbyte for hashRowcontainer (#50843) (#51189) close pingcap/tidb#50841 --- executor/hash_table.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/executor/hash_table.go b/executor/hash_table.go index 7800d3ab46b97..186b68a256294 100644 --- a/executor/hash_table.go +++ b/executor/hash_table.go @@ -248,9 +248,10 @@ func (c *hashRowContainer) GetMatchedRowsAndPtrs(probeKey uint64, probeRow chunk needTrackMemUsage = cap(innerPtrs) > signalCheckpointForJoinMask ) c.memTracker.Consume(-c.chkBufSizeForOneProbe) + defer func() { c.memTracker.Consume(memDelta) }() if needTrackMemUsage { c.memTracker.Consume(int64(cap(innerPtrs)) * rowPtrSize) - defer c.memTracker.Consume(-int64(cap(innerPtrs))*rowPtrSize + memDelta) + defer c.memTracker.Consume(-int64(cap(innerPtrs)) * rowPtrSize) } c.chkBufSizeForOneProbe = 0