Skip to main content

Module placement

Module placement 

Source
Expand description

DETERMINISTIC PLACEMENT (D8 / D9): every worker computes the SAME task→worker map from the topology and the sorted worker set, so no worker is told its placement and there is no control plane that owns it (D9 — “zero control plane; the leader is a worker”). Two properties make that sound:

  • Deterministic and contiguous. A stage’s parallel instances are handed out in contiguous blocks (owner_of, instance i of n → worker ⌊i·w/n⌋), mirroring [crate::dataflow:: vnode_ranges]. A worker therefore owns a contiguous span of a stage’s vnode ranges — fewer cross-worker edges — and the same (topology, sorted members) reproduces the same map on every worker and across a restart.
  • Part of the fingerprint. The member set folds into the checkpoint fingerprint (Members::fingerprint_clause), so a member-set change is a topology change that refuses to restore over the old checkpoint unless STREAM_RESET_STATE=1 (D8 — restart-based rescale first; 4c does the authorised re-assignment). A solo run (no --join) contributes an empty clause, so its fingerprint — and thus every existing checkpoint — is byte-identical to the pre-Phase-4 runtime. No regression.

The single-process runtime is unchanged: Members::solo places every task on the one worker, and the exchange wiring (the remote edge wiring) then has no remote edges at all.

Structs§

Members
The sorted, de-duplicated set of a run’s workers, plus this process’s own index. Sorting makes the assignment independent of the order workers happened to join in — the invariant owner_of relies on.

Functions§

assign
Place a whole graph: task id → worker, deriving each task’s stage from the builder’s roles and stage_of (both indexed by task id, in creation = id order). A stage’s parallel instances are the tasks that share a (role, stage) key, in id order; each is spread by owner_of. Because owner_of depends only on (instance, n, workers), a 1:1 forward chain (upstream and downstream stages of equal width, paired by instance) lands each pair on the same worker — a forward edge stays in-process — while a keyBy/shuffle stage of a different width spreads across workers. A solo run (members.len() == 1) places everything on worker 0, so start and a solo start_worker are identical.
owner_of
The owner of parallel instance i of an n-way stage across w workers. Contiguous blocks, mirroring crate::dataflow::vnode_ranges (instance i → worker ⌊i·w/n⌋), so a worker owns a contiguous vnode span and adjacent instances tend to share a worker (fewer remote edges). Stable under restart with the same w. w and n are clamped to at least 1; i ≥ n is treated as the last instance (defensive — callers pass i < n).

Type Aliases§

WorkerId
A worker’s index within the sorted member set.