Skip to content

adapter: Subscribe on the frontend peek path#35756

Merged
bkirwi merged 13 commits intoMaterializeInc:mainfrom
bkirwi:frontend-subscribe
Mar 30, 2026
Merged

adapter: Subscribe on the frontend peek path#35756
bkirwi merged 13 commits intoMaterializeInc:mainfrom
bkirwi:frontend-subscribe

Conversation

@bkirwi
Copy link
Copy Markdown
Contributor

@bkirwi bkirwi commented Mar 27, 2026

This PR adds subscribes to the list of things that can run on the frontend peek path.

This was largely done to support directing "fast-path" subscribes to use the peek machinery for faster queries, but IIUC it's independently valuable to have support for more things on this more scalable path, so I'm posting it separately.

This involved some refactoring, so I've tried to split up the code movement from the new functionality as much as possible. You may wish to review commit-by-commit.

Motivation

https://linear.app/materializeinc/project/adapt-peek-optimizations-to-subscribes-fde3ad359795

Verification

Clean nightlies: https://buildkite.com/materialize/nightly/builds/15898#019d303a-522d-4bcc-a784-78ccb96fac69

I suspect we want to enable this behind a feature flag. Let me know if that's interesting, and whether it should be on by default.

bkirwi added 5 commits March 27, 2026 12:46
The copy-to and regular paths were interleaved with shared logic, which
complicated the control flow and required a bunch of Either wrapping.
This shifts a bunch of code around to get to a more linear flow with
less branching.
Subscribe statements capture the full select now
@bkirwi bkirwi requested review from a team as code owners March 27, 2026 19:34
@bkirwi bkirwi requested a review from aljoscha March 27, 2026 19:34
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for opening this PR! Here are a few tips to help make the review process smooth for everyone.

PR title guidelines

  • Use imperative mood: "Fix X" not "Fixed X" or "Fixes X"
  • Be specific: "Fix panic in catalog sync when controller restarts" not "Fix bug" or "Update catalog code"
  • Prefix with area if helpful: compute: , storage: , adapter: , sql:

Pre-merge checklist

  • The PR title is descriptive and will make sense in the git log.
  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).

@bkirwi bkirwi force-pushed the frontend-subscribe branch from 5a62336 to ded2162 Compare March 27, 2026 20:44
Copy link
Copy Markdown
Member

@antiguru antiguru left a comment

Choose a reason for hiding this comment

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

Looks fine!

Comment thread src/adapter/src/coord/command_handler.rs Outdated
Comment thread src/adapter/src/frontend_peek.rs Outdated
Comment thread src/adapter/src/frontend_peek.rs Outdated
@bkirwi bkirwi force-pushed the frontend-subscribe branch from ded2162 to 5de031f Compare March 27, 2026 21:54
@bkirwi bkirwi requested a review from ggevay March 27, 2026 21:55
Copy link
Copy Markdown
Contributor

@ggevay ggevay left a comment

Choose a reason for hiding this comment

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

Thank you, looks great! Just some minor comments, especially around transactions.

And I think a feature flag would be great. It could be enabled by default, but it's good to have an escape hatch, at least for a few weeks.

Comment thread src/sql/src/plan/statement/dml.rs Outdated
Comment thread src/adapter/src/frontend_peek.rs Outdated
Comment thread src/adapter/src/frontend_peek.rs Outdated
Comment thread src/adapter/src/frontend_peek.rs Outdated
Comment thread src/adapter/src/frontend_peek.rs Outdated
Comment thread src/adapter/src/optimize/subscribe.rs Outdated
Comment thread src/adapter/src/frontend_peek.rs Outdated
@bkirwi
Copy link
Copy Markdown
Contributor Author

bkirwi commented Mar 30, 2026

Glad this makes sense to you! I'll get some followups up today.

@bkirwi bkirwi force-pushed the frontend-subscribe branch from 1aac6cb to f16bc6d Compare March 30, 2026 17:11
@bkirwi bkirwi force-pushed the frontend-subscribe branch from f16bc6d to a85d992 Compare March 30, 2026 17:26
@bkirwi bkirwi force-pushed the frontend-subscribe branch from c911f91 to 155d321 Compare March 30, 2026 17:30
@bkirwi bkirwi requested a review from a team as a code owner March 30, 2026 17:30
@bkirwi bkirwi merged commit f7c755e into MaterializeInc:main Mar 30, 2026
337 checks passed
@bkirwi
Copy link
Copy Markdown
Contributor Author

bkirwi commented Mar 30, 2026

Thanks for the feedback! Made the suggested changes and added a flag; happy to follow up if needed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants