Repository navigation
[MOD-17606] Pass the vector field's schema index to the disk storage layer - #10933
Conversation
…layer The disk storage layer can keep several of an index's vector fields in one physical store, in which case it needs a fixed-width identifier per field to keep their keys apart. The field name it already receives is variable-width, so it is a poor fit for that. `VecSimDiskContext` gains an opaque `userData` slot for exactly this kind of pass-through (see the VectorSimilarity bump), and both places that build a field's disk context fill it with `fs->index`. That is the natural choice: the field index is unique per field regardless of type, sequential from 0, and restored in the same order on RDB load, so it is stable across a restart — which is also why the disk layer already keys its TAG and NUMERIC storage by it.
Review on VectorSimilarity#1013 narrowed userData to uint32_t and moved it ahead of rerank so the struct's fields run widest-first, which keeps VecSimDiskContext at 32 bytes. Bump deps/VectorSimilarity to that commit and set userData before rerank here to match: C is indifferent to designated-initializer order, but C++20 is not, and keeping the two in step avoids a trap for the next caller. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
RedisAI/VectorSimilarity#1013 has merged, so the gitlink no longer has to reference a fork branch that CI cannot fetch. Pin the squash commit on main instead; the header content is identical to the fork commit it replaces. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c6e3f6d860
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .indexNameLen = nameLen, | ||
| // The disk storage layer keys this field's data by the value it finds | ||
| // here, so it has to stay stable for the life of the index. | ||
| .userData = fs->index, |
There was a problem hiding this comment.
Add a disk multi-vector isolation and restore test
This change distinguishes disk-backed vector fields through userData, but no real-disk test creates two HNSW fields and verifies their data remains isolated; the existing multiple-vector-field coverage is RAM-only, while _SIMULATE_IN_FLEX leaves diskSpec null and does not exercise this assignment. A regression in either this creation path or IndexSpec_PopulateVectorDiskParams could therefore mix fields or surface only after reload. Add a disk flow test that writes and queries distinct vectors in two fields, performs the supported RDB/SST reload, and queries both again.
AGENTS.md reference: AGENTS.md:L15-L21
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (82.15%) is below the adjusted base coverage (82.16%). You can increase the head coverage or adjust the Removed Code Behavior. Additional details and impacted files@@ Coverage Diff @@
## master #10933 +/- ##
==========================================
- Coverage 83.22% 82.21% -1.02%
==========================================
Files 606 635 +29
Lines 80996 82261 +1265
Branches 36254 37497 +1243
==========================================
+ Hits 67409 67629 +220
- Misses 13240 14285 +1045
Partials 347 347
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|



Describe the changes in the pull request
VecSimDiskContextgains an opaqueuserDataslot (see the VectorSimilarity bump), and both places that build a field's disk context fill it withfs->index.userDatais set beforererankto match the field order inVecSimDiskContext, whose members run widest-first. C is indifferent to designated-initializer order, but C++20 is not, so keeping the two in step avoids a trap for the next caller.Which additional issues this PR fixes
Main objects this PR modified
parseVectorField(src/spec.c) — fillsuserDatawhen building a field'sVecSimDiskContext.IndexSpec_PopulateVectorDiskParams(src/spec.c) — same, on the RDB-load path.deps/VectorSimilarity— gitlink bump for theuserDataslot (Add an opaque userData slot to VecSimDiskContext RedisAI/VectorSimilarity#1013, merged).Mark if applicable
Release Notes