fix(qdrant): actually clear points on reset() for local Qdrant (#6412)

Co-authored-by: freya0926 <299410795+freya0926@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
This commit is contained in:
freya0926
2026-07-21 13:04:47 +05:30
committed by GitHub
co-authored by freya0926 Claude Opus 4.8 kartik-mem0
parent 39551145b8
commit 8005e18aec
2 changed files with 32 additions and 0 deletions
+24
View File
@@ -54,6 +54,30 @@ class TestQdrant(unittest.TestCase):
)
self.assertTrue(os.path.isfile(sentinel))
def test_reset_clears_points_on_local_qdrant(self):
"""#6411: reset() must drop points even when the collection dir survives delete_col()."""
with tempfile.TemporaryDirectory() as tmp:
store = Qdrant(collection_name="reset_me", embedding_model_dims=4, path=os.path.join(tmp, "qdrant"))
try:
self.assertTrue(store.is_local)
store.insert(
vectors=[[0.1, 0.2, 0.3, 0.4]],
payloads=[{"data": "remember me"}],
ids=[str(uuid.uuid4())],
)
self.assertEqual(len(store.list(top_k=10)[0]), 1)
# Simulate Windows/NFS, where rmtree(ignore_errors=True) silently fails
# on the open sqlite handle and the collection dir survives delete_col().
with patch("qdrant_client.local.qdrant_local.shutil.rmtree"):
store.reset()
self.assertEqual(len(store.list(top_k=10)[0]), 0)
sparse = store.client.get_collection("reset_me").config.params.sparse_vectors
self.assertIn("bm25", sparse or {})
finally:
store.client.close()
def test_create_col(self):
self.client_mock.get_collections.return_value = MagicMock(collections=[])