Skip to content

adapter: fix panic in EXPLAIN FILTER PUSHDOWN FOR MATERIALIZED VIEW#37649

Open
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/sql-519-explain-pushdown-read-holds
Open

adapter: fix panic in EXPLAIN FILTER PUSHDOWN FOR MATERIALIZED VIEW#37649
ggevay wants to merge 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/sql-519-explain-pushdown-read-holds

Conversation

@ggevay

@ggevay ggevay commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes SQL-519

Motivation

EXPLAIN FILTER PUSHDOWN FOR MATERIALIZED VIEW panicked with missing compute collection: CollectionMissing(...) and crashed environmentd when the view's cached physical plan imported an index that was later dropped. This was seen in CI in the Parallel Workload (0dt deploy) job.

This was not a race. Dropping an index that a materialized view was planned against is allowed (the view's dataflow keeps running), but the compute controller removes the index's collection immediately on drop. The view's cached physical plan still imports the dropped index, so once the index was dropped, every EXPLAIN FILTER PUSHDOWN FOR MATERIALIZED VIEW on that view deterministically panicked while acquiring read holds on the plan's imports, until the next restart.

Description

explain_pushdown_materialized_view now acquires read holds only on the plan's storage imports instead of the full import bundle. The pushdown explanation only reads persist part stats of the plan's storage imports, so compute holds served no purpose. Storage imports are catalog dependencies of the view and cannot be dropped while it exists, so acquiring holds on them cannot hit a missing collection on the coordinator task.

User-facing change: EXPLAIN FILTER PUSHDOWN FOR MATERIALIZED VIEW no longer crashes environmentd after an index imported by the view's cached plan was dropped. The statement now succeeds and reports stats for the plan's storage imports (possibly zero rows if the plan reads entirely from the dropped index).

The EXPLAIN FILTER PUSHDOWN FOR SELECT path is unaffected: it goes through the staged peek sequencing, which re-checks plan validity and selects indexes from the current catalog synchronously on the coordinator task.

Verification

  • Deterministic repro before the fix (create table, create index, create materialized view using the index, drop index, EXPLAIN FILTER PUSHDOWN FOR MATERIALIZED VIEW) crashes environmentd with the exact CI panic. After the fix the statement returns cleanly, both for an index-only plan and for a plan with mixed storage and index imports.
  • Added a regression test to test/sqllogictest/explain/pushdown.slt that panics environmentd without the fix and passes with it.
  • Ran test/sqllogictest/explain/pushdown.slt, materialized_views.slt, statement_timeout.slt, and explain/broken_statements.slt, all green.

🤖 Generated with Claude Code

EXPLAIN FILTER PUSHDOWN FOR MATERIALIZED VIEW acquired read holds on all
imports of the view's cached physical plan, including its compute (index)
imports. An index that the view was planned against can be dropped while
the view keeps running. The compute controller removes the dropped index's
collection immediately, so acquiring a read hold on it panicked with
"missing compute collection" and crashed environmentd. This was
deterministic, not a race: any EXPLAIN FILTER PUSHDOWN on such a view
panicked after the index drop.

The pushdown explanation only reads persist part stats of the plan's
storage imports, so compute holds serve no purpose here. Acquire read
holds on the storage imports only. Those are catalog dependencies of the
view and cannot be concurrently dropped while it exists.

Fixes SQL-519.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ggevay ggevay added the A-ADAPTER Topics related to the ADAPTER layer label Jul 14, 2026
@ggevay ggevay marked this pull request as ready for review July 14, 2026 19:00
@ggevay ggevay requested a review from a team as a code owner July 14, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ADAPTER Topics related to the ADAPTER layer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant