Skip to main content

Module parallel_commit

Module parallel_commit 

Source
Expand description

Parallel commit pipeline for pre-allocated ID ranges.

Replaces the serial commit loop with a four-phase pipeline: Phase 2: Count + range assignment via prefix sums Phase 3: Parallel commit into disjoint pre-allocated ranges Phase 4: String dedup, remap, index build, edge bulk insert

§Phase 3 Architecture

Phase 3 uses split_at_mut to carve disjoint sub-slices from pre-allocated arena and interner ranges, then uses rayon to commit each file’s staging graph in parallel without locks:

NodeArena slots:   [   file0   |   file1   |   file2   ]
StringInterner:    [   file0   |   file1   |   file2   ]
                        ↑            ↑            ↑
                   split_at_mut  split_at_mut  remainder

Each file’s commit_single_file receives its own disjoint slices and operates independently without contention.

Structs§

ChunkCommitPlan
Plan for parallel commit of a single chunk.
FilePlan
Per-file commit plan with pre-assigned ID ranges.
GlobalOffsets
Running offsets carried across chunks for deterministic ID assignment.
Phase3Result
Phase 3 result: per-file edges and total written counts for validation.

Functions§

compute_commit_plan
Compute commit plan from parsed files using prefix-sum range assignment.
pending_edges_to_delta
Convert per-file PendingEdge collections to per-file DeltaEdge collections with monotonically increasing sequence numbers.
phase2_assign_ranges
Execute Phase 2: count + range assignment for a parsed chunk.
phase3_parallel_commit
Execute Phase 3: parallel commit into disjoint pre-allocated ranges.
phase4_apply_global_remap
Apply global string dedup remap to all nodes in the arena and all pending edges.
remap_edge_kind_string_ids
Exhaustive remap of all StringId fields in an EdgeKind.
remap_node_entry_global
Apply global string dedup remap to all StringId fields in a NodeEntry.
remap_option_string_id
Remap an optional StringId using the dedup remap table.
remap_string_id
Remap a required StringId using the dedup remap table.