Skip to content

fix: crash in parallel hash joins with generic plans#3881

Merged
mdashti merged 30 commits intomainfrom
moe/generic-plan-issue
Jan 11, 2026
Merged

fix: crash in parallel hash joins with generic plans#3881
mdashti merged 30 commits intomainfrom
moe/generic-plan-issue

Conversation

@mdashti
Copy link
Copy Markdown
Contributor

@mdashti mdashti commented Jan 9, 2026

Ticket(s) Closed

  • Closes #N/A

What

Fix a crash that occurs when executing prepared statements with parallel hash joins on BM25 indexes after PostgreSQL switches to a generic plan (6th execution).

Why

Queries using parallel hash joins with BM25 indexes crash when PostgreSQL transitions from custom plans to generic plans. This affects any prepared statement executed 6+ times with parallel workers enabled.

How

The crash occurs due to memory/state issues when parallel workers are spawned for queries involving our index access method. The issue manifests after multiple query executions, suggesting state leakage or improper memory handling between executions.

Tests

Added regression test parallel_hash_join_race.sql that reproduces the crash.

@mdashti mdashti changed the base branch from main to moe/parallel-scan-race January 10, 2026 17:17
@mdashti mdashti added cherry-pick/0.23.x Request that this PR to `main` should get an automatic cherry-pick PR to `0.23.x` after it lands. cherry-pick/0.22.x Request that this PR to `main` should get an automatic cherry-pick PR to `0.22.x` after it lands. labels Jan 10, 2026
@mdashti mdashti changed the title Moe/generic plan issue fix: crash in parallel hash joins with generic plans Jan 10, 2026
@mdashti mdashti marked this pull request as ready for review January 10, 2026 17:25
Copy link
Copy Markdown
Collaborator

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment thread pg_search/src/lib.rs Outdated
Comment thread pg_search/src/lib.rs Outdated
Base automatically changed from moe/parallel-scan-race to main January 11, 2026 05:39
Copy link
Copy Markdown
Contributor Author

@mdashti mdashti left a comment

Choose a reason for hiding this comment

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

@stuhood Thanks for the comments.

Comment thread pg_search/src/lib.rs Outdated
Comment thread pg_search/src/lib.rs Outdated
@mdashti mdashti removed the cherry-pick/0.22.x Request that this PR to `main` should get an automatic cherry-pick PR to `0.22.x` after it lands. label Jan 11, 2026
@mdashti mdashti merged commit dfdbf5e into main Jan 11, 2026
20 checks passed
@mdashti mdashti deleted the moe/generic-plan-issue branch January 11, 2026 08:57
paradedb-bot pushed a commit that referenced this pull request Jan 11, 2026
# Ticket(s) Closed

- Closes #N/A

## What

Fix a crash that occurs when executing prepared statements with parallel
hash joins on BM25 indexes after PostgreSQL switches to a generic plan
(6th execution).

## Why

Queries using parallel hash joins with BM25 indexes crash when
PostgreSQL transitions from custom plans to generic plans. This affects
any prepared statement executed 6+ times with parallel workers enabled.

## How

The crash occurs due to memory/state issues when parallel workers are
spawned for queries involving our index access method. The issue
manifests after multiple query executions, suggesting state leakage or
improper memory handling between executions.

## Tests

Added regression test `parallel_hash_join_race.sql` that reproduces the
crash.

---------

Signed-off-by: Moe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick/0.23.x Request that this PR to `main` should get an automatic cherry-pick PR to `0.23.x` after it lands.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants