Skip to content

VectorSessionFunctions Cleanup#1886

Draft
kevin-montrose wants to merge 12 commits into
mainfrom
users/kmontrose/vectorSessionFunctionsCleanup
Draft

VectorSessionFunctions Cleanup#1886
kevin-montrose wants to merge 12 commits into
mainfrom
users/kmontrose/vectorSessionFunctionsCleanup

Conversation

@kevin-montrose

Copy link
Copy Markdown
Contributor

Removes two hacks from VectorSessionFunctions

  • All the alignment stuff, Tsavorite guarantees value alignment now
  • Mutating VectorInput, VectorOutput now receives updated values and VectorInput is readonly

Copilot AI review requested due to automatic review settings June 17, 2026 20:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the vector-store session function plumbing to remove legacy alignment workarounds and to stop mutating VectorInput/VectorOutput as a side-channel for communicating updated sizes, replacing that with a new “updated desired size” value on VectorOutput.

Changes:

  • Removed the alignment/pinning “hack” code path from VectorSessionFunctions and adjusted record sizing calculations accordingly.
  • Made VectorInput a readonly struct with init-only properties, and added VectorOutput.UpdatedReadDesiredSize to propagate unknown-size reads across pending completion paths.
  • Updated vector migration, DiskANN callbacks, and vector set tests to use the new initialization/propagation patterns.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/standalone/Garnet.test.vectorset/RespVectorSetTests.cs Updates tests to build VectorInput via object initializers (compatible with init-only fields).
libs/server/VectorOutput.cs Adds UpdatedReadDesiredSize to carry back size requirements for unknown-size reads.
libs/server/Storage/Functions/VectorStore/VectorSessionFunctions.cs Removes alignment-related logic and switches unknown-size read propagation from mutating VectorInput to setting VectorOutput.UpdatedReadDesiredSize.
libs/server/Resp/Vector/VectorManager.Migration.cs Removes AlignmentExpected usage for migration reads.
libs/server/Resp/Vector/VectorManager.cs Removes the CompletePending overload that previously propagated mutated VectorInput.
libs/server/Resp/Vector/VectorManager.ContextMetadata.cs Updates metadata write path to construct VectorInput with init-only properties.
libs/server/Resp/Vector/VectorManager.Callbacks.cs Updates DiskANN callback paths to use the new VectorInput initialization and UpdatedReadDesiredSize retry mechanism.
libs/server/InputHeader.cs Makes VectorInput readonly with init-only properties and removes AlignmentExpected.
libs/cluster/Server/Migration/MigrateOperation.cs Removes AlignmentExpected when migrating vector set element data.

Comment thread libs/server/Storage/Functions/VectorStore/VectorSessionFunctions.cs Outdated
Comment thread libs/server/Resp/Vector/VectorManager.Callbacks.cs
@kevin-montrose kevin-montrose marked this pull request as draft June 18, 2026 14:55
@kevin-montrose kevin-montrose marked this pull request as ready for review June 18, 2026 15:09
@kevin-montrose kevin-montrose requested a review from Copilot June 18, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

libs/server/InputHeader.cs:632

  • VectorInput is now a readonly struct with auto-properties, but the explicit parameterless ctor body is empty. In C#, an explicit struct ctor must definitely assign all instance fields; with auto-properties this typically fails compilation unless you delegate to the default initializer. Either remove this ctor or delegate to : this() / this = default so all backing fields are initialized.
        public VectorInput()
        {
        }

Comment thread libs/server/Storage/Functions/VectorStore/VectorSessionFunctions.cs
Comment thread libs/server/Storage/Functions/VectorStore/VectorSessionFunctions.cs Outdated
Comment thread libs/server/Storage/Functions/VectorStore/VectorSessionFunctions.cs
Comment thread libs/server/Storage/Functions/VectorStore/VectorSessionFunctions.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread libs/server/Storage/Functions/VectorStore/VectorSessionFunctions.cs
Comment thread libs/server/VectorOutput.cs
@kevin-montrose kevin-montrose requested a review from TedHartMS June 18, 2026 18:06
Comment thread libs/server/Resp/Vector/VectorManager.Callbacks.cs Outdated
Comment thread libs/server/InputHeader.cs Outdated

var value = AlignOrPin(in srcLogRecord, ref input, out var pin);
try
var value = srcLogRecord.ValueSpan;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not clear whether we're ensuring Key size is aligned to (now removed) ValueAlignmentBytes or if when we support ExtendedNamespace we'll be guaranteeing ExtendedNS+Key lengths are aligned to ValueAlignmentBytes; if not then we may still need to align the value start

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a good point - today we'd get away with alignment because DiskANN provided keys are (generally) all 4-bytes. But this would make that contractual.

I'll discuss and come back with a plan.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We'll update DiskANN to guarantee keys are always of alignment friendly sizes.

I'll set this back on draft until we've got a version to bump to that does that.

@kevin-montrose kevin-montrose marked this pull request as draft June 19, 2026 20:42
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.

3 participants