Repository navigation
Add a Neo4j plugin, and fix what syncing 157k nodes found in the merger - #59
Merged
Merged
Conversation
Syncing a Neo4j copy of 157k nodes found problems in the merger that every plugin goes through: - A sync with nothing changed took 29 minutes and grew the graph. Nodes now store khonsu_hash, like relationships, and an unchanged one is not written again. - Updating an existing node with MERGE sometimes added a second node with the same key. Known nodes are now updated by internal ID. We haven't found what triggers the MERGE duplicate, and new nodes still use it. - Deleting from a label over 100k rows failed on max_mutation_affected_rows, leaving the delete half done. Deletes now go by internal ID. - Adding a source again doubled its relationships, because schema statistics return no patterns on large graphs. Without patterns, relationships are read by type. - After a large write, the next edge read took 14 minutes with no checkpoint. A write of 10,000 records or more now checkpoints. A failure there only warns. khonsu_hash stays out of saved investigations, so their fingerprints don't change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copies the nodes and relationships of a Neo4j database into a graph over its HTTP API, with read-only queries in read access mode. Its main use is Cartography, but it knows nothing about Cartography's labels. Tested on Neo4j 5.26 Community with a graph built to follow Cartography's AWS model, not on real Cartography output. The README lists what comes across differently and how to rewrite queries written for Neo4j. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds a built-in
neo4jplugin that copies a Neo4j database into a graph over its HTTP API, using read-only queries. Its main use is Cartography, but it knows nothing about Cartography's labels.Testing it at scale found problems in the merger, which every plugin goes through, so this also changes how all syncs write.
Merger changes
khonsu_hash, and unchanged ones aren't writtenMERGEsometimes added a second node with the same keymax_mutation_affected_rows, leaving the delete half doneVisible changes:
unchanged_nodes.nodes_writtennow counts only nodes actually written.khonsu_hashproperty. It stays out of saved investigations, so their fingerprints don't change.khonsu_synced_aton a node can now be older than the last sync that saw it, as was already true of relationships.Scale test
Release build, Neo4j in Docker on the same Windows desktop, 157,003 nodes and 247,502 relationships. Node and relationship counts matched Neo4j after every sync.
Not verified
MERGE. It happened twice in the 157k run, but a 100k probe without Neo4j didn't reproduce it, and it hasn't been reported to HawDB. Updates no longer go throughMERGE, and six consecutive updates produced no duplicate, but new nodes still use it.Tests
cargo test --workspace: 385 passed, 1 ignored.cargo clippy --locked --workspace --all-targets -- -D warningspasses. Only documentation changed after these runs.🤖 Generated with Claude Code