Skip to content

Conversation

@ggevay
Copy link
Contributor

@ggevay ggevay commented Dec 14, 2025

This is a pre-requisite for adding statement logging to the frontend peek sequencing (#34305):
We'll want to log the beginning of statement execution before planning (the mz_sql::plan::plan call). This means that we can't have any bailout points from the frontend peek sequencing to the old peek sequencing after planning, because in that case both the old and the new peek sequencing would log the beginning of statement execution, resulting in a duplicate entry (and one of them getting stuck in an unfinished state forever).

Therefore, this PR attends to all 4 reasons that currently cause us to bail out after planning, see the 4 commit messages.

The relevant tests for pg_cancel_backend are:

  • test_pg_cancel_backend
  • alter-sink.td, cancel-subscribe.td

The relevant tests for waiting_on_startup_appends are:

  • test_mz_sessions, test_pg_cancel_dropped_role
  • test-http-race-condition, test-mz-subscriptions
  • window_funcs.slt

I've ran all of these tests locally with frontend peek sequencing turned both on and off.

@ggevay ggevay added the A-ADAPTER Topics related to the ADAPTER layer label Dec 14, 2025
@ggevay ggevay force-pushed the frontend-peek-plan-bailouts branch 2 times, most recently from af67b6a to fad4008 Compare December 14, 2025 16:31
@ggevay ggevay marked this pull request as ready for review December 14, 2025 17:04
@ggevay ggevay requested a review from a team as a code owner December 14, 2025 17:04
@ggevay ggevay requested review from SangJunBak and aljoscha and removed request for SangJunBak December 14, 2025 17:04
@ggevay ggevay force-pushed the frontend-peek-plan-bailouts branch from f3785cc to 12683a8 Compare December 15, 2025 16:54
_ => {
debug!(
"Bailing out from try_frontend_peek_inner, because EXPLAIN FILTER PUSHDOWN is not for a SELECT query"
"Bailing out from try_frontend_peek_inner, because EXPLAIN FILTER PUSHDOWN is not for a (non-BROKEN) SELECT query"
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe "is for BROKEN SELECT query" instead of is not for a non-broken? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll fix this in my next PR (statement logging: #34305), to avoid some merge conflicts, if that's ok.

tx: oneshot::Sender<Result<ExecuteResponse, AdapterError>>,
},

/// Execute a side-effecting function from the frontend peek path.
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, we don't have to mention here that it's from the frontend peek path, eventually everything will come "from the frontend". But maybe you have plans to clean this up holistically already once the work is done

Copy link
Contributor Author

@ggevay ggevay Dec 16, 2025

Choose a reason for hiding this comment

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

Yes, this is captured in the
"There are lots of refactorings that we could/should do after the old peek sequencing is deleted."
todo item in https://github.com/MaterializeInc/database-issues/issues/9593.

Copy link
Contributor

@aljoscha aljoscha left a comment

Choose a reason for hiding this comment

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

looks good! I had some inline suggestions

@ggevay
Copy link
Contributor Author

ggevay commented Dec 16, 2025

Thank you!

@ggevay ggevay merged commit 4dd76e0 into MaterializeInc:main Dec 16, 2025
131 checks passed
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.

2 participants