Preserve storage offsets when replaying nested subquery moves#4699
Open
joshdchang wants to merge 6 commits into
Open
Preserve storage offsets when replaying nested subquery moves#4699joshdchang wants to merge 6 commits into
joshdchang wants to merge 6 commits into
Conversation
…l timeout The per-dependency moves-position is now staged when the move pipeline drains and only committed+persisted once the writer confirms the flush has passed the move's splice (and, at terminate, after the writer has been flushed). This keeps the persisted position from running ahead of durable storage across a restart, which could otherwise leave a subquery shape permanently missing rows. Also raise the oracle-restore test's long_poll_timeout: a very short one trips a separate post-restart long-poll readiness race (bug 3), unrelated to the subquery-restore behaviour under test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
It is called from terminate/2 after terminate_writer/1 has popped :writer off
the state, so the value is no longer typed as %State{} and the %State{} clauses
were flagged as never matching. Match a bare map and read the fields via
Map.get instead.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
robacourt
force-pushed
the
rob/restore-subqueries-bug-5
branch
from
July 14, 2026 08:30
fdf08f4 to
aafa5c1
Compare
joshdchang
force-pushed
the
josh/nested-subquery-replay-offsets
branch
from
July 14, 2026 12:57
fcbdac6 to
a5981ea
Compare
joshdchang
marked this pull request as ready for review
July 15, 2026 02:53
robacourt
force-pushed
the
rob/restore-subqueries-bug-5
branch
4 times, most recently
from
July 16, 2026 09:51
2262fc6 to
2a1a1d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a focused follow-up stacked on #4681. It preserves authoritative shape-log offsets while replaying missed materializer moves, fixing nested subquery dependencies whose generated control messages and spliced move-in rows do not contain
lsn/op_positionJSON headers.Problem
#4681 correctly persists each outer consumer's per-dependency move position and asks the dependency materializer to replay the missing range after restart. The initial decoder reconstructs each replay offset from JSON headers, however:
Nested materializers can therefore emit a replayed move with the wrong position, advance the outer cursor incorrectly, and miss a later move after another restart.
Changes
get_log_stream_with_offsets/3storage capability.get_log_stream/3chunk behavior.The storage format and HTTP Shape API are unchanged.
Tests
Locally passed:
mix format --check-formattedmix compile --force --warnings-as-errorsThis PR is intentionally based on
rob/restore-subqueries-bug-5, so its diff contains only the nested-offset follow-up and can be folded into #4681 independently of Sapien's fork.