fix(qdrant): do not remove local path on init (#4473)#4475
Merged
kartik-mem0 merged 3 commits intomem0ai:mainfrom Mar 23, 2026
Merged
fix(qdrant): do not remove local path on init (#4473)#4475kartik-mem0 merged 3 commits intomem0ai:mainfrom
kartik-mem0 merged 3 commits intomem0ai:mainfrom
Conversation
Contributor
|
@Himanshu-Sangshetti please resolve merge conflict. |
mem0/configs/vector_stores/qdrant.py
Outdated
| url: Optional[str] = Field(None, description="Full URL for Qdrant server") | ||
| api_key: Optional[str] = Field(None, description="API key for Qdrant server") | ||
| on_disk: Optional[bool] = Field(False, description="Enables persistent storage") | ||
| on_disk: Optional[bool] = Field(False,description="VectorParams.on_disk; does not delete local path") |
Contributor
There was a problem hiding this comment.
Minor nit. Description string can be better. Does not clearly tell what it does.
Contributor
Author
There was a problem hiding this comment.
done, lmk
mem0/vector_stores/qdrant.py
Outdated
| url (str, optional): Full URL for Qdrant server. Defaults to None. | ||
| api_key (str, optional): API key for Qdrant server. Defaults to None. | ||
| on_disk (bool, optional): Enables persistent storage. Defaults to False. | ||
| on_disk (bool, optional): Qdrant ``VectorParams.on_disk``; does not delete ``path``. Defaults to False. |
Contributor
There was a problem hiding this comment.
Minor nit. Same as before
Contributor
Author
There was a problem hiding this comment.
done, lmk
utkarsh240799
previously approved these changes
Mar 23, 2026
utkarsh240799
approved these changes
Mar 23, 2026
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
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
Local Qdrant uses a filesystem
pathfor embedded storage. Previously, whenon_diskwasfalse(the default in config),Qdrant.__init__calledshutil.rmtree(path)if that directory already existed.:on_diskin Qdrant refers toVectorParams.on_disk(how vectors are stored inside a collection), not “delete the whole database directory.” Tying “wipe folder” toon_disk=falsecaused data loss across process restarts (reported in #4473).This PR removes that
rmtreebehavior. The localpathis opened/reused like a normal database directory;create_colalready skips creating a collection if it already exists.Dependencies
No new runtime dependencies.
Fixes #4473
Type of change
Please delete options that are not relevant.
Note on breaking change: Anyone who relied on the previous undocumented behavior (“every startup clears the local Qdrant folder when
on_diskis false”) will no longer get an automatic wipe. The intended behavior for a stablepathis persistence. To reset, users can delete the directory manually or use a newpath.How Has This Been Tested?
Added
test_local_path_on_disk_false_preserves_existing_directoryintests/vector_stores/test_qdrant.py: it creates a temp folder with a small file, buildsQdrantwith thatpathandon_disk=False(withQdrantClientmocked), and checks the file is still there—so we never wipe the folder again.Ran
pytest tests/vector_stores/test_qdrant.pylocally; all tests passed.Unit Test
Checklist:
Maintainer Checklist
on_diskDefault #4473