O(1) external manifest latest pointer
Issue: #41
Outcome
Opening a dataset reads one fixed latest key instead of scanning immutable manifest history. Existing deployments migrate lazily, and exact historical version reads remain available.
Protocol
- Latest is a fixed
{version, path}record and the atomic claim for the current version. - To claim the next version, CAS-create an immutable archive of current latest (or verify the existing identical archive), then CAS latest from exact old bytes to the new staging pointer.
- Lance writes the staging manifest before calling this protocol, preserving
manifest-before-pointer.
put_if_existsexact-CASes staging to final. - Explicit reads first check immutable history, then exact-match fixed latest.
- A missing fixed pointer triggers one legacy max scan and CAS migration.
- Delete fences fixed latest as
deleting, removes immutable history, and leaves a durabledeletedmarker that recreate replaces. This prevents stale legacy migration from reviving a pointer through an ABANoneCAS. - Every history create is atomically guarded by the exact latest bytes read by the writer, preventing pre-fence writers from publishing after drop.
- Latest pointers and delete markers carry an incarnation preserved within a dataset lifetime and regenerated by recreate, eliminating cross-cycle ABA.
- History records carry that incarnation too; legacy path-only history is upgraded lazily, and finalize convergence compares path plus incarnation.
Rollout
Pre-#41 binaries write only per-version records and therefore cannot coexist as committers after a fixed pointer becomes authoritative. Drain writes, upgrade every metadata node that may become leader, and only then resume commits. This is a protocol rollout fence, not a data migration window: existing datasets remain readable and install their pointer lazily on first open.
Verification
mise run spec-lifecycle specs/issue-41-manifest-latest-pointer.spec.mdcargo test -p lake-engine-lance manifest_storecargo clippy -p lake-engine-lance --all-targets -- -D warningsmise run gate