Skip to content

compute: arrange and reduce into a Materialize-owned shared agent - #40491

Closed
antiguru wants to merge 4 commits into
MaterializeInc:mh/interactive-11-hold-gapfrom
antiguru:mh/interactive-12-vendored-arrange
Closed

antiguru wants to merge 4 commits into
MaterializeInc:mh/interactive-11-hold-gapfrom
antiguru:mh/interactive-12-vendored-arrange

Conversation

@antiguru

@antiguru antiguru commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Arranging operators now return Materialize's own SharedAgent and feed its writer directly. The shared trace no longer wraps every spine in SharedSpine or reaches into differential's TraceBox. Differential's arrange_core and reduce_with_tactic construct a TraceAgent internally, so they cannot return a caller-chosen agent. This PR copies the three operators that build the agent into mz_timely_util::arrange_agent and builds against stock differential-dataflow 0.25.1, with no patch entry and no lockfile change.

The copies keep the signatures proposed upstream in TimelyDataflow/differential-dataflow#959: a Writer and an Agent trait, and an ArrangeContext factory passed to arrange_core_with and reduce_trace_with. If differential adopts that shape, the copies can be deleted and the callers switch back. #39989 is the same port against a patched differential, and serves as the reference for the upstream ask.

  • arrangement.rs copies arrange_core. reduce.rs copies the reduce_with_tactic driver. Both change only where they build the trace and agent.
  • reduce/cursors.rs copies CursorTactic, which 0.25.1 keeps private. In 0.25.1 the ValueHistory::replay_key method it calls is private too, so the copy rebuilds it from the public load_iter with a per-history scratch buffer. Differential master-next exports CursorTactic itself, so the master-next port (deps: update differential-dataflow to 0.26 and timely to 0.32 #38805) can drop this file and the rebuild with it.
  • SharedAgent::import_frontier_core replays the shared agent into another scope on the same worker.
  • clippy.toml disallows the vendored entry points outside the compute wrappers.

Each copied file names its upstream file and revision, so a differential bump can re-derive it by diffing.

Posted by Claude Code.

🤖 Generated with Claude Code

antiguru and others added 4 commits November 4, 2026 17:52
Arranging operators now return `SharedAgent`, a Materialize-owned trace
handle whose trace can be published to readers on other threads, in place
of differential's `TraceAgent` over a `SharedSpine` wrapper. Differential
0.25.1 has no way for a caller to choose the agent an arranging operator
builds, so `mz_timely_util::arrange_agent` carries copies of `arrange_core`
and the `reduce_with_tactic` driver that take an agent factory, plus the
private cursor reduce tactic they need. The copies deviate from upstream
only in agent construction, and in rebuilding the private
`ValueHistory::replay_key` from public API.

Compute's arrange and reduce wrappers, typedefs, the trace manager, and
the shared-trace glue move to the new agent. Storage keeps using
differential's operators and `TraceAgent`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@antiguru

antiguru commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Superseded by the re-ported stack (#40512, #40513, #38386 and up), which builds the shared agent on differential master-next and an owned copy of its agent and writer. Posted by Claude Code.

@antiguru antiguru closed this Nov 5, 2026
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.

1 participant