From dc56b6a3fb4d82ec04258cffd53bcbb0934ba2aa Mon Sep 17 00:00:00 2001 From: xuhuaiyu <391585975@qq.com> Date: Thu, 2 Mar 2023 10:17:21 +0800 Subject: [PATCH] Revert "executore: fix logic error in HashJoin probe (#41320)" This reverts commit 8dd78d5223c4fb10fd3d02d9d1b549181d04bcb5. --- executor/hash_table.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/executor/hash_table.go b/executor/hash_table.go index 50acc4447f4df..2bfdc05c69244 100644 --- a/executor/hash_table.go +++ b/executor/hash_table.go @@ -214,8 +214,8 @@ func (c *hashRowContainer) GetAllMatchedRows(probeHCtx *hashContext, probeSideRo return matched, nil } -// signalCheckpointForJoinMask indicates the times of row probe that a signal detection will be triggered. -const signalCheckpointForJoinMask int = 1<<14 - 1 +// signalCheckpointForJoin indicates the times of row probe that a signal detection will be triggered. +const signalCheckpointForJoin int = 1 << 14 // rowSize is the size of Row. const rowSize = int64(unsafe.Sizeof(chunk.Row{})) @@ -241,7 +241,7 @@ func (c *hashRowContainer) GetMatchedRowsAndPtrs(probeKey uint64, probeRow chunk matchedDataSize = int64(cap(matched))*rowSize + int64(cap(matchedPtrs))*rowPtrSize lastChunkBufPointer *chunk.Chunk = nil memDelta int64 = 0 - needTrackMemUsage = cap(innerPtrs) > signalCheckpointForJoinMask + needTrackMemUsage = cap(innerPtrs) > signalCheckpointForJoin ) c.chkBuf = nil c.memTracker.Consume(-c.chkBufSizeForOneProbe) @@ -267,7 +267,7 @@ func (c *hashRowContainer) GetMatchedRowsAndPtrs(probeKey uint64, probeRow chunk memDelta += lastChunkSize } lastChunkBufPointer = c.chkBuf - if needTrackMemUsage && (i&signalCheckpointForJoinMask == signalCheckpointForJoinMask) { + if needTrackMemUsage && (i&signalCheckpointForJoin == (signalCheckpointForJoin - 1)) { // Trigger Consume for checking the OOM Action signal memDelta += int64(cap(matched))*rowSize + int64(cap(matchedPtrs))*rowPtrSize - matchedDataSize matchedDataSize = int64(cap(matched))*rowSize + int64(cap(matchedPtrs))*rowPtrSize