Repository navigation
[AI] fix: reject empty sparse vector name in CreateVectorName - #11743
Conversation
Collection creation rejects a sparse vector named "" because that is the name of the unnamed dense vector, and both would share one storage directory in a segment (qdrant#8194). Adding a vector to an existing collection did not check this, so CreateVectorName could register a sparse vector "" and report success. Add `CreateNamedVector::validate_vector_name`, which runs the existing name format check plus the empty sparse name check, and call it both before the operation is proposed (`do_create_vector_name`) and when consensus plans it, as collection creation already does with `validate_vector_names`. Fixes qdrant#11722 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…ions Peers before this fix accept and apply a committed CreateNamedVector for a sparse vector named "". If upgraded peers rejected the same entry, a rolling upgrade (or a new peer replaying the log tail) could leave peers with different collection configs. Only reject the empty sparse name in `plan_create_named_vector` once `all_peers_at_version(1.20.3-dev)`; until then keep the format-only check that older peers also run. The API check in `do_create_vector_name` stays unconditional, since it rejects before anything is proposed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
timvisee
left a comment
There was a problem hiding this comment.
I made some change to make this new behavior version specific. We need to do that to make sure the decision remains stable during a rolling upgrade, where nodes run different versions.
Thanks for your contribution!
|
Thanks for the review and for adding the version gate. I hadn't considered rolling upgrades, and I'll keep it in mind for future consensus changes. |
* docs: refocus profile on AI agents, infra and open source Rewrite the intro around AI agents, infra and open source, mark Viettel Solutions as past experience, and add an Open Source section listing merged upstream contributions (qdrant/qdrant#11743). Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: add Projects section featuring Cranial Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: add Python, TypeScript, FastAPI, LangGraph and AWS badges Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Fixes #11722
Motivation
Currently,
CreateVectorNameallows empty sparse vector names even though sparse vectors are required to have a non-empty name. I wanted to fix this inconsistency and prevent invalid operations from reaching the cluster while preserving the existing behavior for unnamed dense vectors.Change
Collection creation rejects a sparse vector named
""(#8194). The empty name belongs to the unnamed dense vector, and both would share one storage directory in a segment. Adding a vector to an existing collection (CreateVectorName) only ran the name format check, so it accepted a sparse"", reportedCompleted, and left a schema that the create API forbids.CreateNamedVector::validate_vector_name()incollection_meta_ops.rs: the existing format check, plus "Sparse vector name cannot be empty" for sparse configs. The error message is the same as collection creation's.do_create_vector_name(src/common/update.rs), the point that both REST and gRPC go through, so a bad request is rejected before anything is proposed to consensus.plan_create_named_vectoras well, in place of the format-only check, so committed entries that don't come through the API are rejected too. This mirrors howplan_create_collectioncallsvalidate_vector_names().A dense vector named
""is still allowed: that's the normal unnamed vector, and the existing checks already handle it.Note for review: like the existing name check in planning, this rejects a committed
CreateNamedVectorfor a sparse""that may already be in a consensus log from before this fix. Such an entry would now become a no-op on replay instead of registering the vector. I followed the existing pattern; tell me if you'd rather keep the planning check format-only.Testing
create_named_vector_reject_empty_name_sparse. It fails without the fix: the old code returnsOk(Plan { actions: [AddNamedVector { vector_name: "" .. }] }).cargo nextest run -p storage: 382/382 pass.cargo +nightly fmt --allandcargo clippy -p storage -p qdrant --all-targets -- -D warnings: clean.AI disclosure
Prompt used (Claude Code): after asking it to find an unclaimed issue and explain it, the instruction was "comment on 11722 and start the fix", then "run the tests" and "continue" (commit and push). The investigation, the code change and this description were AI-generated. I reviewed the change and can answer questions about it.
🤖 Generated with Claude Code