Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executore: fix logic error in HashJoin probe #41320

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions executor/hash_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ func (c *hashRowContainer) GetAllMatchedRows(probeHCtx *hashContext, probeSideRo
return matched, nil
}

// signalCheckpointForJoin indicates the times of row probe that a signal detection will be triggered.
const signalCheckpointForJoin int = 1 << 14
// signalCheckpointForJoinMask indicates the times of row probe that a signal detection will be triggered.
const signalCheckpointForJoinMask int = 1<<14 - 1

// rowSize is the size of Row.
const rowSize = int64(unsafe.Sizeof(chunk.Row{}))
Expand All @@ -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) > signalCheckpointForJoin
needTrackMemUsage = cap(innerPtrs) > signalCheckpointForJoinMask
)
c.chkBuf = nil
c.memTracker.Consume(-c.chkBufSizeForOneProbe)
Expand All @@ -267,7 +267,7 @@ func (c *hashRowContainer) GetMatchedRowsAndPtrs(probeKey uint64, probeRow chunk
memDelta += lastChunkSize
}
lastChunkBufPointer = c.chkBuf
if needTrackMemUsage && (i&signalCheckpointForJoin == (signalCheckpointForJoin - 1)) {
if needTrackMemUsage && (i&signalCheckpointForJoinMask == signalCheckpointForJoinMask) {
// 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
Expand Down