Skip to content

Add file-level user metadata#8740

Draft
mprammer wants to merge 2 commits into
developfrom
mp/file-metadata
Draft

Add file-level user metadata#8740
mprammer wants to merge 2 commits into
developfrom
mp/file-metadata

Conversation

@mprammer

Copy link
Copy Markdown
Contributor

Adds optional file-level metadata to the Vortex file format: a set of string-keyed, opaque byte segments referenced from the postscript, for consumers that need to attach identity or annotation to a file (Iceberg field IDs, an Arrow-metadata round-trip, provenance). Keys and their segment locators live in the postscript and are read at open; the opaque values load only when a reader opts in with include_metadata, resolved one locator at a time through the file's existing segment source — served from the initial footer read when they fall inside it, otherwise a targeted read. A default open never materializes them and makes no metadata-driven read. The DType, its FlatBuffers and protobuf serialization, and the scan path are unchanged; the wire change is a single additive Postscript field, so old readers skip it and the file version stays 1.

This revives #7954 (the original file-metadata-segments work) rebased onto develop, with the read path reshaped so metadata is never folded into the footer's contiguous tail read and never keeps that buffer alive: values are resolved per-locator and copied out. Footer carries only the locators, so a cached footer is identical whether or not the opener asked for metadata, and one file's metadata can't surface for another through the multi-file cache. Parsing a segment alignment from an untrusted postscript now returns an error rather than panicking on an out-of-range exponent (the TUI inspector included). The public read API is additive — VortexFile gains metadata accessors and VortexOpenOptions an include_metadata opt-in — and Footer::new is unchanged; the generated Postscript FlatBuffer gains a field, as any additive schema change does.

🤖 Generated with Claude Code

Adds optional file-level metadata to the Vortex file format: string-keyed,
opaque byte segments referenced from the postscript. Keys and locators live in
the postscript (read at open); values load only on `include_metadata`, resolved
per-locator through the segment source (from the initial footer read when
covered, else a targeted read) and copied out. A default open materializes
nothing. `Footer` carries only locators, so a cached footer is identical
regardless of the opener's flag and one file's metadata can't surface for
another via the multi-file cache. `DType`, its FlatBuffers/protobuf
serialization, and the scan path are untouched; the wire change is a single
additive `Postscript` field (file version stays 1). `Alignment::from_exponent`
on untrusted postscript input now returns an error instead of panicking (the
TUI inspector included).

Revives Nicholas Gates' file-metadata-segments work (#7954), rebased onto
develop and reshaped so metadata never widens the footer read or pins its
backing buffer.

cargo build + fmt + clippy clean; vortex-file 100/100, vortex-buffer 822/822.

Co-Authored-By: Nicholas Gates <nick@nickgates.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: mprammer <martin@spiraldb.com>
@mprammer mprammer requested review from AdamGS, gatesn and robert3005 July 13, 2026 16:10
@codspeed-hq

codspeed-hq Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 1660 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing mp/file-metadata (a9c2230) with develop (1bf87e6)

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

footer: PostscriptSegment;
/// User-defined metadata segments keyed by string. Keys must be unique, non-empty, and at most
/// 32 UTF-8 bytes; readers reject postscripts that violate these limits.
metadata: [PostscriptMetadata];

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 think we cannot put keys into the postscript. Imho this should just be another segment that readers can choose to read. We should likely make it stacked above schema

Move user metadata out of the postscript. Instead of per-key
[PostscriptMetadata] locators embedded in the postscript, the postscript
now carries one optional locator to a FileMetadata segment (keyed opaque
values) that may live anywhere in the file. Keys no longer pressure the
postscript, so the count/length limits are dropped. A default open reads
no metadata; include_metadata resolves the single segment in one read.

Addresses review feedback on the original approach.

Co-Authored-By: Nicholas Gates <nick@nickgates.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: mprammer <martin@spiraldb.com>
@mprammer mprammer added the changelog/feature A new feature label Jul 15, 2026
@mprammer mprammer requested a review from robert3005 July 15, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants