Skip to content

colexecjoin: add missing cancellation checking to hash joiner#164879

Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:hj-cancel
Mar 5, 2026
Merged

colexecjoin: add missing cancellation checking to hash joiner#164879
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:hj-cancel

Conversation

@yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Mar 4, 2026

This commit adds the missing cancellation checking to the hash joiner: namely, previously it was possible to build the hash table (i.e. consume the right input) and then fully build the cross product of the batch from the left input before the cancellation was observed. If the right input was large, say 100k rows, then we'd have materialized about 100M rows before we'd observe the cancellation. This commit adds the cancel checking before every batch emitted by the hash joiner.

Fixes: #163263.

Release note (bug fix): Previously, CockroachDB might not have promptly responded to the statement timeout when performing a hash join with ON filter that is mostly false. This is now fixed.

@yuzefovich yuzefovich requested a review from a team as a code owner March 4, 2026 22:12
@yuzefovich yuzefovich requested review from DrewKimball and removed request for a team March 4, 2026 22:12
@trunk-io
Copy link
Contributor

trunk-io bot commented Mar 4, 2026

😎 Merged successfully - details.

@blathers-crl
Copy link

blathers-crl bot commented Mar 4, 2026

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich added the backport-all Flags PRs that need to be backported to all supported release branches label Mar 4, 2026
This commit adds the missing cancellation checking to the hash joiner:
namely, previously it was possible to build the hash table (i.e. consume
the right input) and then fully build the cross product of the batch
from the left input before the cancellation was observed. If the right
input was large, say 100k rows, then we'd have materialized about 100M
rows before we'd observe the cancellation. This commit adds the cancel
checking before every batch emitted by the hash joiner.

Release note (bug fix): Previously, CockroachDB might not have promptly
responded to the statement timeout when performing a hash join with ON
filter that is mostly `false`. This is now fixed.
Copy link
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Nice!

@michae2 reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on DrewKimball).

Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@DrewKimball reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on yuzefovich).

@yuzefovich
Copy link
Member Author

TFTRs!

/trunk merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-all Flags PRs that need to be backported to all supported release branches target-release-26.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roachtest: hash joiner might not respect cancellation for a while

4 participants