Skip to content

Commit 1b0a291

Browse files
committed
colexecjoin: add cancel check when consuming right input in cross join
We just saw a test failure where the query wasn't cancelled within 1 minute even though 0.1s statement timeout is set. In the goroutine dump we see the cross joiner building from the left input. We already check for cancellation every time Next is called on the cross joiner, at the beginning, but on the very first call there could be a long process to consume the right input. This commit adds the cancel checking before fetching the next batch from the right input (except for the first batch that might have already been fetched). I was unable to reproduce the timeout, but this shouldn't hurt. Release note: None
1 parent 3b2811c commit 1b0a291

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/sql/colexec/colexecjoin/crossjoiner.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func (c *crossJoiner) consumeRightInput(ctx context.Context) {
175175
// Consume the right input if necessary.
176176
if needRightTuples || needOnlyNumRightTuples {
177177
for {
178+
c.cancelChecker.CheckEveryCall()
178179
batch := c.InputTwo.Next()
179180
if needRightTuples {
180181
c.rightTuples.Enqueue(ctx, batch)

0 commit comments

Comments
 (0)