Skip to content

fix: bound IVF-Flat serialization allocations - #77

Merged
jerry-024 merged 2 commits into
apache:mainfrom
jerry-024:fix/ivfflat-bounded-serialization
Aug 13, 2026
Merged

fix: bound IVF-Flat serialization allocations#77
jerry-024 merged 2 commits into
apache:mainfrom
jerry-024:fix/ivfflat-bounded-serialization

Conversation

@jerry-024

@jerry-024 jerry-024 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Bound IVF-Flat serialization memory usage by streaming vector payloads through one reusable write buffer instead of materializing full sorted-vector and encoded-byte buffers for each list.

The serialized output remains byte-for-byte compatible with the existing IVFL v1 reader and is independent of write chunk boundaries.

Changes

  • Reuse a private 64 MiB write buffer for centroid and inverted-list vector encoding.
  • Preserve row-ID sorting while encoding referenced vectors in bounded chunks.
  • Split oversized vectors across writes so the reusable buffer and vector payload writes stay within 64 MiB.
  • Add regression coverage for byte stability, ID/vector ordering, multi-chunk writes, and the write-size bound.

Testing

  • cargo fmt --all -- --check
  • cargo +1.94.0 test -p paimon-vindex-core ivfflat_chunked_writer
  • cargo +1.94.0 test -p paimon-vindex-core --lib (446 passed, 1 ignored)

Notes

  • No public API, dependency, index option, or file-format version changes.
  • The index vectors, row-ID sort permutations, and encoded IDs remain resident; this change only removes the two full vector-payload-sized serialization allocations.

@jerry-024 jerry-024 changed the title fix: bound IVF-Flat serialization memory fix: bound IVF-Flat serialization allocations Aug 13, 2026
Comment thread core/src/ivfflat_io.rs Outdated
@shyjsarah

Copy link
Copy Markdown
Contributor

+1

@jerry-024
jerry-024 merged commit b5b4a77 into apache:main Aug 13, 2026
9 checks passed
@jerry-024
jerry-024 deleted the fix/ivfflat-bounded-serialization branch August 13, 2026 09:49
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