Repository navigation
docs: specify Blob v2 input, storage, and lifecycle contracts - #9193
Conversation
|
Important Format specification voteThis PR modifies the Lance format specification, so it requires 3 binding +1 votes from PMC members (excluding the proposer), at least one of them on the latest commit, and a minimum 72-hour voting period, weekends excluded, before it can merge. Vote by approving this PR (+1) or requesting changes (−1, a veto). See the voting process. Approvals carry over across pushes, so a rebase or a typo fix does not send everyone back to re-vote. Whoever approves the latest commit is vouching that nothing substantive has changed since the earlier approvals; if something has, ask for fresh votes. Status: ❌ Blocked — 3 approvals, but none on the latest commit; one PMC member must approve it
Updated automatically by the format-spec vote gate, which re-checks every 15 minutes — just voted? Re-check now (press Run workflow; leave the input blank to re-check every open format PR). A PMC member may apply the |
Blob v2 compaction currently copies Packed and Dedicated payloads because their descriptors address sidecars through the containing data file. Managed descriptors carry a relative URI, byte range, and optional registered base ID, allowing compaction to preserve payload objects when replacing data files. New payload objects use `_blobs/<uuid>.blob`. Existing Packed and Dedicated objects can be adopted at their original paths without copying bytes, including when their original data files are later removed. Cleanup follows references from protected table versions. The default table base stays implicit, so moving the complete dataset does not retain its old URI. Shallow clone preserves the source base through existing data-file metadata. Deep clone copies local objects at the same relative paths without rewriting their descriptors; references to registered bases are copied and rebound into the destination. Managed uses the existing five descriptor fields in both file formats 2.2 and 2.3. Kind 4 uses the implicit table base; kind 5 carries an exact registered base ID, preserving IDs such as zero in existing shallow clones without changing descriptor nullability. Writer-side `base_id=None` selects the implicit base. Explicit IDs must already exist; writes do not register bases automatically. New Blob data-file commits publish paired reader/writer table capability bits. The capability survives restore; metadata-only updates to an old table do not activate it. Existing kinds retain their read semantics. This adds no user configuration or repack API. Compatibility validation uses a checked-in v11.0.0 Packed/Dedicated fixture. The released v11.0.0 client refuses normal opens of flagged snapshots. A real cached-handle experiment also confirms the boundary: after new-client compaction and cleanup remove the original data files, old-client GC with `delete_unverified=True` can still delete adopted sidecars, while leaving `_blobs` objects alone. Before activation, upgrade all maintenance clients to a Managed-aware version or stop their maintenance tasks. All maintenance after activation must use a Managed-aware client; the flag blocks normal opens of flagged snapshots but cannot revoke pre-existing handles or retrofit old binaries' historical maintenance paths. Cleanup still rescans descriptors shared across metadata-only versions. Scan deduplication is deferred to #9435 for separate design review. Regression coverage moves complete tables containing both new Managed objects and adopted released sidecars, removes the original location, then scans, reads, and runs cleanup at the new location. Clone coverage checks source retention after compaction, registered-base rebinding, and byte-for-byte preservation of local data files during deep clone. Prepared writes reject unknown bases, including nested Blob columns. The format-spec proposal remains separate, as required by the repository's spec/implementation workflow. Related: #8899 addresses the compaction problem through a Blob Reuse Index; #9193 documents the existing Blob v2 contract. ## Benchmark At the benchmarked revision, Managed kept total write amplification close to 1x through ten compactions, with approximately unchanged full-scan and random-read performance on the tested workloads. Benchmarked revision: `f7dec16f659f758d2b7b302513501975767fda78`; historical baseline: `400408ffb7ee6b7bbf7c240962b5a94fb5fef879`. Runs used one dedicated EC2 **c7i.24xlarge** (96 vCPUs, 192 GiB RAM) and same-region S3 in **us-east-2**, Rust 1.97.0, `release-with-debug` with thin LTO, and 48 CPU/runtime threads. Both builds used identical dependency locks and CPU flags (`haswell`, `+avx2,+fma,+f16c`). Data uses deterministic high-entropy payloads in format 2.2. An explicit 8 KiB inline threshold and 512 KiB Dedicated threshold select the requested layouts; the production Dedicated default is 4 MiB. These measurements apply only to the pinned revision above. Subsequent changes include upstream BlobFile buffering/read changes, dependency updates, and portable Managed base resolution. The numbers have not been revalidated for the current head and are retained as historical evidence, not a current-head performance claim. Cleanup scan deduplication remains in draft follow-up #9435 and is outside these measurements. ### Write amplification For each payload size, append **10,000 rows** at a time to **1,000,000 rows**, compacting the accumulated table into one fragment after every additional **100,000 rows**. No garbage collection runs. Total written bytes include appends, all ten compactions, descriptors and metadata; submitted write bytes were cross-checked against the retained S3 inventory. GB below is decimal. | Payload/layout | Logical input | Total written by this PR | Write amplification | |---|---:|---:|---:| | 100 KiB packed | 102.400 GB | 102.672 GB | 1.002653x | | 1 MiB Dedicated | 1,048.576 GB | 1,048.948 GB | 1.000355x | Retained payload bytes equal logical input bytes for both cases: compaction did not rewrite the payloads. The historical full ingestion/compaction workflow was not measured, so these are candidate measurements, not a measured old/new write-amplification ratio. ### Full-column scans Read the entire blob column, including every payload and its checksum. Use 16 MiB logical batches, batch/fragment readahead 16, fresh processes, one excluded warmup per version, and **three alternating old/new pairs**, with no concurrent writes or other scans. Both versions read identical 1M-row contents. The candidate uses its actual final compacted tables. Baseline final tables were generated directly with the old compaction writer's batch/row-group settings; a small preflight checked payload sizes, layout kinds and full contents against real old compaction output. This compares final-table reads and does not replay the old write workflow. Packed has 96 old versus 100 new payload objects; Dedicated has 1M in each version. | Payload/layout | Old median GB/s (range) | New median GB/s (range) | Median paired throughput change | |---|---:|---:|---:| | 100 KiB packed | 0.836 (0.832–0.875) | 0.834 (0.826–0.841) | -1.22% | | 1 MiB Dedicated | 0.620 (0.580–0.644) | 0.626 (0.597–0.643) | +0.88% | ### Random access: take 10 complete blobs Reuse those same final tables. Each request selects ten distinct random row indices, calls `take_blobs_by_indices`, and concurrently reads all ten `BlobFile` payloads. Request batches are serial. Timing includes descriptor lookup, payload reads and checksum hashing; dataset open and expected-content generation are excluded. Each process reuses its dataset session, excludes ten warmup requests, then measures 100 requests. **Five alternating pairs** give **500 measured requests per version/layout**, with matching random indices within each pair. Every returned payload and its row order were validated. This measures reused sessions; payload caches were not explicitly flushed. | Payload/layout | Old P50 / P95 latency | New P50 / P95 latency | Median paired P50 latency change | |---|---:|---:|---:| | 100 KiB packed | 157.03 / 220.27 ms | 157.81 / 212.53 ms | +0.05% | | 1 MiB Dedicated | 149.97 / 193.99 ms | 149.59 / 187.05 ms | +0.61% | Latency percentiles use nearest-rank over the 500 requests. Paired changes use the median of within-pair new/old ratios (round P50s for random reads), not ratios of the aggregate table medians. Lower latency is better. These small differences do not establish a sustained read improvement or regression; results describe this configuration rather than a hardware throughput ceiling. Raw commands, checksums, timings, binary hashes and exact dependency locks are retained in the private benchmark project.
#9777) Managed Blob capability transitions and cleanup scan reuse need durable regression coverage after #9293 and #9435. These tests cover activation on new Blob files, preservation after removing Blob columns, coexistence with base-path and mixed-version flags, and cleanup retention across deletions, projections, tags, and branches. Concurrent scan requests must share one scan per retention class; failed descriptor reads must not publish successful completion or permit unsafe deletion. The cross-version tests use released v11.0.0 and v13.0.0 clients to create Packed/Dedicated data, verify metadata-only updates remain readable, and check that adoption and subsequent restore fence old opens and appends. Historical unflagged reads remain allowed; this does not promise safety for old cached-handle maintenance. Both release checks passed locally through the existing subprocess runner using ordinary CPython 3.14 for the released abi3 wheels. No production behavior changes. The larger Blob v2 specification remains in #9193.
The feature flag table still treats the Managed Blob bit as unknown, although #9293 assigned it. Express all bit masks as powers of two and document the Managed Blob capability at `2^14`, the unknown boundary at `2^15`, paired reader/writer bits, and activation and restore behavior, including the old-maintenance limitation. This corrects the flag reference for the implementation already on main. The full Blob v2 specification remains in #9193; this change does not add descriptor encodings or runtime behavior.
# Conflicts: # docs/src/format/table/versioning.md
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The revised contract matches the implementation now in the base branch. As clarified in the author’s reply, merged #9891 makes Managed storage an explicit opt-in: ordinary writes and compaction keep their existing placement, and all old maintenance clients must be upgraded or stopped before activation. I withdraw the earlier copy-or-anchor requirement for this documentation PR; the old-client cleanup limitation remains accurately documented.
wjones127
left a comment
There was a problem hiding this comment.
This looks a lot better. Thanks for making those updates. Looks good. Eventually I'd like to get pyarrow mentions out of the spec, but don't feel like you have to do that here.
westonpace
left a comment
There was a problem hiding this comment.
Approving so we can move forwards. I might do some more cleanup suggestions later.
This is really comprehensive and helpful. Thank you so much for creating it!
| External descriptors store no ETag, content hash, or object version to detect | ||
| mutation. Owners should use immutable object locations when reproducible reads |
There was a problem hiding this comment.
Thanks for raising this. I'd keep the current convention for this spec, which documents the existing descriptor without ETag, hash, or version metadata. We can discuss external-modification detection separately; I'm happy to open a follow-up issue for that.
Move Logical Input Values before Schema so the Blob v2 specification introduces accepted inputs before their logical and physical representations, following [Weston's suggestion](#9193 (comment)).
Blob v2's logical input, physical descriptors, object resolution, and lifetime rules are spread across the implementation and user guide. This spec brings those contracts together, distinguishing the table's logical schema from the data file's descriptor schema and defining ownership through rewrites, cleanup, and cloning.
The spec reflects the Managed implementation merged in #9293 and the explicit opt-in added in #9891. Kind 4 uses the data file's implicit base; kind 5 carries a registered base ID. Ordinary writes retain Inline/Packed/Dedicated placement. Enabling
lance.blob.managed=trueactivates the paired sticky capability flags and requires all maintenance clients to support Managed storage, including clients using cached or historical handles.This PR documents existing behavior and adds documentation links; it contains no runtime implementation changes.
Closes #9014