Skip to content

[MOD-17606] Pass the vector field's schema index to the disk storage layer - #10933

Merged
kei-nan merged 3 commits into
masterfrom
jk-mod-17606-disk-vector-field-index
Aug 16, 2026
Merged

kei-nan merged 3 commits into
masterfrom
jk-mod-17606-disk-vector-field-index

Conversation

@kei-nan

@kei-nan kei-nan commented Aug 16, 2026 •

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

  1. Current: a vector field's disk context carries the field's name. A disk storage backend that keeps several of an index's vector fields in one physical store needs a fixed-width identifier to keep their keys apart, and a variable-width name is a poor fit for a key prefix.
  2. Change: VecSimDiskContext gains an opaque userData slot (see the VectorSimilarity bump), and both places that build a field's disk context fill it with fs->index.
  3. Outcome: internal-only — no user-visible behavior changes. It unblocks the disk layer storing all of an index's vector fields in one column family instead of one per field, which is where the memory saving is.

userData is set before rerank to match the field order in VecSimDiskContext, 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

  1. MOD-17606

Main objects this PR modified

  1. parseVectorField (src/spec.c) — fills userData when building a field's VecSimDiskContext.
  2. IndexSpec_PopulateVectorDiskParams (src/spec.c) — same, on the RDB-load path.
  3. deps/VectorSimilarity — gitlink bump for the userData slot (Add an opaque userData slot to VecSimDiskContext RedisAI/VectorSimilarity#1013, merged).

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

…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.
kei-nan and others added 2 commits August 16, 2026 12:24
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]>
@kei-nan
kei-nan marked this pull request as ready for review August 16, 2026 10:20
@kei-nan kei-nan self-assigned this Aug 16, 2026
@kei-nan
kei-nan requested a review from GuyAv46 August 16, 2026 10:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/spec.c
.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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.21%. Comparing base (1d4c089) to head (c6e3f6d).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
src/spec.c 0.00% 2 Missing ⚠️

❌ 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              
Flag Coverage Δ
flow 84.41% <0.00%> (-0.01%) ⬇️
unit 55.76% <0.00%> (-0.57%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kei-nan
kei-nan added this pull request to the merge queue Aug 16, 2026
@sonarqubecloud

Copy link
Copy Markdown

Merged via the queue into master with commit 54536cc Aug 16, 2026
64 of 70 checks passed
@kei-nan
kei-nan deleted the jk-mod-17606-disk-vector-field-index branch August 16, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants