Skip to content

release-25.2: colexecjoin: add missing cancellation checking to hash joiner#164889

Merged
yuzefovich merged 1 commit intocockroachdb:release-25.2from
yuzefovich:blathers/backport-release-25.2-164879
Mar 6, 2026
Merged

release-25.2: colexecjoin: add missing cancellation checking to hash joiner#164889
yuzefovich merged 1 commit intocockroachdb:release-25.2from
yuzefovich:blathers/backport-release-25.2-164879

Conversation

@yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Mar 5, 2026

Backport 1/1 commits from #164879 on behalf of @yuzefovich.


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.


Release justification: stability fix - without it, a query might not be cancelable (without CRDB process restart) for a while.

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.
@yuzefovich yuzefovich requested a review from a team as a code owner March 5, 2026 02:19
@yuzefovich yuzefovich requested review from ZhouXing19 and removed request for a team March 5, 2026 02:19
@blathers-crl blathers-crl bot added blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. labels Mar 5, 2026
@blathers-crl blathers-crl bot requested review from DrewKimball and michae2 March 5, 2026 02:20
@blathers-crl
Copy link

blathers-crl bot commented Mar 5, 2026

Thanks for opening a backport.

Before merging, please confirm that it falls into one of the following categories (select one):

  • Non-production code changes OR fixes for serious issues. Non-production includes test-only changes, build system changes, etc. Serious issues are defined in the policy as correctness, stability, or security issues, data corruption/loss, significant performance regressions, breaking working and widely used functionality, or an inability to detect and debug production issues.
  • Other approved changes. These changes must be gated behind a disabled-by-default feature flag unless there is a strong justification not to. Reference the approved ENGREQ ticket in the PR body (e.g., "Fixes ENGREQ-123").

Add a brief release justification to the PR description explaining your selection.

Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy.

All backports must be reviewed by the TL and EM for the owning area.

@blathers-crl blathers-crl bot added backport Label PR's that are backports to older release branches T-sql-queries SQL Queries Team labels Mar 5, 2026
@blathers-crl
Copy link

blathers-crl bot commented Mar 5, 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

@blathers-crl
Copy link

blathers-crl bot commented Mar 5, 2026

✅ PR #164889 is compliant with backport policy

Confidence: high
Critical bug criteria met: [Stability or security issues]
Backward compatible: true
Explanation: The pull request meets the CockroachDB backport policy. It contains a 'Release justification: stability fix - without it, a query might not be cancelable (without CRDB process restart) for a while.' in the body, which exempts it from the standard backport policy requirements. The change addresses a stability issue, further justified by the nature of the bug fix described in the PR. The fix improves the responsiveness of the database to cancellation requests during hash joins, thereby enhancing system stability and behavior under cancellation conditions, such as reaching a statement timeout.

ENGREQ Check Failed: Please check one of the backport category checkboxes.

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

@yuzefovich yuzefovich requested review from mw5h and removed request for DrewKimball, ZhouXing19 and michae2 March 5, 2026 02:25
Copy link
Contributor

@mw5h mw5h left a comment

Choose a reason for hiding this comment

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

:lgtm:

@mw5h made 1 comment.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on yuzefovich).

@yuzefovich yuzefovich merged commit 8dc084f into cockroachdb:release-25.2 Mar 6, 2026
21 of 22 checks passed
@yuzefovich yuzefovich deleted the blathers/backport-release-25.2-164879 branch March 6, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Label PR's that are backports to older release branches blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. T-sql-queries SQL Queries Team target-release-25.2.16

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants