fix(neo4j): cascade delete vectors from Qdrant when deleting memory nodes#1862
Open
AYin-Z wants to merge 1 commit into
Open
fix(neo4j): cascade delete vectors from Qdrant when deleting memory nodes#1862AYin-Z wants to merge 1 commit into
AYin-Z wants to merge 1 commit into
Conversation
…odes delete_node_by_prams only ran DETACH DELETE on Neo4j, leaving orphan vectors in Qdrant. Since add_node/add_nodes_batch write to both stores symmetrically, the delete path should also clean up Qdrant. This collects matching node IDs before Neo4j deletion, then calls vec_db.delete() with the collected IDs. Falls back gracefully with a warning if Qdrant cleanup fails.
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.
Description
delete_node_by_prams()only ranDETACH DELETEon Neo4j, leaving orphan vectors behind in Qdrant. Every memory deletion via the API created a leaked vector in Qdrant with no corresponding Neo4j node.Root Cause
The write path (
add_node/add_nodes_batch) is symmetric — it writes to both Neo4j and Qdrant in the same method. But the delete path only touched Neo4j:Note that
clear()and the newerdelete_node_by_mem_cube_id()both correctly callvec_db.delete()— this was simply an omission indelete_node_by_prams.Fix
count_querywith anids_querythat collects node IDsself.vec_db.delete(deleted_ids)after successful Neo4j deletionVerification
BaseVecDB.delete(ids)is an abstract method with working implementations in both QdrantVecDB and MilvusVecDBself.vec_dbis initialized in the constructor and used elsewhere in the same class