Repository navigation
Hold one WriteLockedGraph for the whole bulk load (pometry-storage#424) - #2860
Merged
Merged
Conversation
Each bulk loader (nodes, node properties, edges/deletions, edge metadata) now takes its WriteLockedGraph once before the chunk loop and picks up segments created by node/edge resolution with lock_new_segments, instead of re-taking every segment lock per chunk. The existing-node type check during node resolution now reads through the held node pages (WriteLockedNodePages::node_metadata): going through the graph's read path deadlocked against the held write lock. Part of Pometry/pometry-storage#423. Fixes Pometry/pometry-storage#424 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.
| Benchmark suite | Current: 048c334 | Previous: b81cffb | Ratio |
|---|---|---|---|
lotr_graph_subgraph_10pc/num_nodes |
11 ns/iter (± 0) |
4 ns/iter (± 0) |
2.75 |
This comment was automatically generated by workflow using github-action-benchmark.
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.
Part of Pometry/pometry-storage#423. Closes Pometry/pometry-storage#424.
Summary
Each bulk load now takes one
WriteLockedGraphbefore its chunk loop and holds it until the load finishes. This is the scope the bulk loader lock (#425) will cover. Segments created by node/edge resolution are picked up withlock_new_segments.Node resolution read the stored type of nodes that already exist through the graph's read path. That takes a segment read lock, which deadlocks against the write lock we now hold. It now reads through the held pages:
resolve_node_vids_and_types_with_cache bulk_load_resolve_node(gid) Existing(vid) => - graph.node_metadata(vid, NODE_TYPE_PROP_ID) + locked_nodes.node_metadata(vid, STATIC_GRAPH_LAYER_ID, NODE_TYPE_PROP_ID)An existing vid always lives in a segment that is already held. The other calls the loaders make between chunks (property, layer and node-type resolution,
validate,bulk_load_resolve_node,reserve_free_pos,internalise_node, event ids) only touch Meta, the GID resolver, atomics or the segment vector, never segment locks.Evidence
test_reload_existing_typed_nodesandtest_load_typed_nodes_after_edgeshit the 60s guard withbulk load did not finish (deadlock?).After: both pass, along with
test_reload_existing_node_with_conflicting_type_fails, which checks that the conflicting-type error is still raised.test_io: 65 passed, 6 ignored.test_lib: 113 passed, 3 ignored.cargo check --workspace --testsin pometry-storage, including the disk storage members, is clean.Merge Danger
Door: two-way
Blast Radius: bulk loads and readers
Readers are now blocked on existing segments for the whole bulk load rather than one chunk at a time. Regular updates that touch an existing segment wait for the whole load too, until #425 makes that explicit.
🤖 Generated with Claude Code