Skip to content

Clean temporary segments if optimization is cancelled - #5090

Merged
generall merged 1 commit into
qdrant:devfrom
dkellner:fix-2978
Sep 16, 2024
Merged

generall merged 1 commit into
qdrant:devfrom
dkellner:fix-2978

Conversation

@dkellner

Copy link
Copy Markdown
Contributor

This uses TempDir and comes with its caveats, e.g. the temporary segment directory will not be deleted if the process exits (see https://docs.rs/tempfile/latest/tempfile/struct.TempDir.html#resource-leaking). This should not be a problem in practice, as all temporary segments get deleted when the shard is loaded (see PR #2319).

To reproduce the issue I've created a collection with a sample dataset and repeatedly changed the HNSW configuration:

curl -X PATCH "$qdrant_url/collections/test" \
     -d '{"hnsw_config":{"m": 24}}'
curl -X PATCH "$qdrant_url/collections/test" \
     -d '{"hnsw_config":{"m": 32}}'
curl -X PATCH "$qdrant_url/collections/test" \
     -d '{"hnsw_config":{"m": 8}}'

Before applying this fix, this results in segment directories in storage/collections/test/0/temp_segments that will not get deleted until qdrant is restarted/the shard gets loaded again. After this fix, temp_segments is empty as expected.

Fixes #2978.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

This uses `TempDir` and comes with its caveats, e.g. the temporary segment
directory will not be deleted if the process exits. This should not be a
problem in practice, as all temporary segments get deleted when the shard is
loaded (see PR qdrant#2319).

Fixes qdrant#2978.
@generall

Copy link
Copy Markdown
Member

Great improvement, thanks @dkellner 🙏 !

@generall
generall merged commit 60d4ddd into qdrant:dev Sep 16, 2024
timvisee pushed a commit that referenced this pull request Sep 17, 2024
This uses `TempDir` and comes with its caveats, e.g. the temporary segment
directory will not be deleted if the process exits. This should not be a
problem in practice, as all temporary segments get deleted when the shard is
loaded (see PR #2319).

Fixes #2978.
@timvisee timvisee mentioned this pull request Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants