[sql] Give the streams that leave a recursive circuit ids of their own - #6852
Merged
Conversation
The compiler assigned the same ids to streams inside the recursive fragment and
the same streams exported outside the fragment:
```rust
let (s6, s9) = circuit.recursive(|circuit, (unused_0, s3)| {
...
let s6 = ...join...; s6.set_persistent_id(Some("ed5fc63e…")); // inside the scope
Ok((s6, s9))
}).unwrap();
s6.set_persistent_id(Some("ed5fc63e…")); // exported — same id
```
However these are different streams with different integrals as can be seen
from the circuit:
```
┌───────────────────────────────────────────────────────────────┐
│ │
i │ ┌───┐ |-s6 inside the scope │
────┼──►δ0─────────►│ │ V ┌────────┐ ┌───────────────┐ │ ┌───────────┐ s6 exported
│ │ f ├─────►│distinct├──┬───►│integrate_trace├───┼──►│consolidate├───────►
│ ┌──────►│ │ └────────┘ │ └───────────────┘ │ └───────────┘
│ │ └───┘ │ │
│ │ │ │
│ │ │ │
│ │ ┌────┐ │ │
│ └───────┤z^-1│◄────────────────┘ │
│ └────┘ │
│ │
└───────────────────────────────────────────────────────────────┘
```
Suffix the exported stream's id with '.export', in both the single-file and the
multi-crate writer, mirroring the '.delay' suffix that already distinguishes a
recursive input. The checkpoint then holds <id>.shard.accintegral for the inner
trace and <id>.export.shard.accintegral for the outer one.
Bump RECURSIVE_STATE_VERSION with it: the layout of what a recursive view stores
changes, so the ids in the dataflow graph have to change too, or the pipeline
manager would diff the views as unchanged while the runtime finds their state
missing, and refuse to start with UnexpectedBootstrap. The metadata test's
golden ids move for the same reason.
Signed-off-by: Leonid Ryzhyk <leonid@feldera.com>
(cherry picked from commit cce7456)
mihaibudiu
approved these changes
Aug 13, 2026
| * separate state. Sharing it makes an inner trace and an outer one write | ||
| * the same file, and whichever restores second reads a batch that was | ||
| * written with the other's layout. */ | ||
| void computeExportedHash(DBSPOperator operator) { |
Contributor
There was a problem hiding this comment.
If this function is only used once maybe it can be inlined
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 13, 2026
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.
See commit message.