Skip to content

refactor(dataset): unify ManifestWriteConfig into ManifestBuildConfig - #11391

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/unify-manifest-build-config
Nov 23, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/unify-manifest-build-config

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

lance::dataset::ManifestWriteConfig mirrored lance_table::format::ManifestBuildConfig field-for-field, while CommitBuilder duplicated several of the same fields again and carried a dead use_legacy_format option alongside a commit-loop-only tagged_frag_reuse_trim flag.

This change removes ManifestWriteConfig and passes lance_table::format::ManifestBuildConfig directly through CommitBuilder, Dataset, and io::commit:

  • Single manifest build configuration: ManifestBuildConfig is now encapsulated behind builder and getter methods, drops the unused use_legacy_format field, and encodes stable row ID / migration activation as a single internal state so migration activation always implies stable row IDs.
  • Preserved mockable commit clock: ManifestBuildConfig::timestamp_nanos is optional (Option<u128>) so lance-table stays independent of lance's mockable clock; each commit attempt resolves the timestamp once in lance::io::commit and shares it across manifest construction and write_manifest_file.
  • Separated commit-loop options: commit_transaction takes a crate-internal CommitTransactionOptions instead of 10 positional arguments, and tagged_frag_reuse_trim moves out of manifest configuration onto CommitTransactionOptions / Dataset::apply_tagged_frag_reuse_trim because it only affects transaction-rebase handling during commit attempts.
  • Trimmed CommitBuilder state: CommitBuilder stores a ManifestBuildConfig directly while keeping use_stable_row_ids: Option<bool> separate so existing datasets continue to inherit their manifest setting unless migration activation overrides it.

Migration for Rust callers

ManifestBuildConfig fields are now private. Construct it with ManifestBuildConfig::new() (or Default) and the with_* methods. The defaults are unchanged: auto_set_feature_flags = true, no timestamp, stable row IDs inherited, and transaction files enabled.

Previous field value Replacement
auto_set_feature_flags: false .with_auto_set_feature_flags(false)
timestamp_nanos: nanos .with_timestamp_nanos(nanos)
use_stable_row_ids: true .with_use_stable_row_ids(true)
migration_next_row_id: Some(n) .with_migration_next_row_id(n)
storage_format: Some(format) .with_storage_format(format)
disable_transaction_file: true .with_disable_transaction_file(true)
activate_non_reusable_field_ids: true .with_activate_non_reusable_field_ids(true)
clustering_definitions: Some(list) .with_clustering_definitions(list)
spilled_row_lineage: lineage .with_spilled_row_lineage(lineage)

timestamp_nanos() now returns Option<u128>. Set a caller-owned timestamp with .with_timestamp_nanos(nanos); the lance commit paths resolve it per attempt. An unset value in build_manifest or restore_old_manifest has the same result as the old explicit 0 and is not a new regression, but direct lance-table callers that persist the manifest themselves should set it if they need a version timestamp.

use_legacy_format is removed. Its branches only applied when storage_format was None, and storage_format took precedence; the replacement for explicit selection is:

use lance_file::version::ConcreteFileVersion;
use lance_table::format::{DataStorageFormat, ManifestBuildConfig};

let config = ManifestBuildConfig::new()
    .with_storage_format(DataStorageFormat::new(ConcreteFileVersion::V1));

The former use_legacy_format values map to ConcreteFileVersion::V1 for Some(true), ConcreteFileVersion::V2_0 for Some(false), and to omitting with_storage_format for None. storage_format still takes precedence.

BREAKING CHANGE: ManifestBuildConfig fields are private and use_legacy_format is removed; migrate to ManifestBuildConfig::new() and the with_* methods above. Direct lance-table callers that need a version timestamp should set .with_timestamp_nanos(...).

Remove the redundant lance::dataset::ManifestWriteConfig mirror and pass lance_table::format::ManifestBuildConfig directly through commit and manifest-building paths.

Key changes:
- Encapsulate ManifestBuildConfig with builder methods, remove dead use_legacy_format, and model stable row ID / migration activation as a single coherent state so migration activation always implies stable row IDs.
- Keep manifest build timestamps optional until resolved once per commit attempt in lance's mockable clock path, sharing the resolved timestamp between build_manifest and write_manifest_file.
- Replace commit_transaction's 10 positional arguments with crate-internal CommitTransactionOptions and move tagged_frag_reuse_trim out of manifest build config onto Dataset::apply_tagged_frag_reuse_trim.
- Embed ManifestBuildConfig inside CommitBuilder instead of mirroring its fields.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@lance-gatekeeper lance-gatekeeper Bot 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.

✅ Gate recommendation: approve.

The shared configuration preserves manifest defaults, stable-row-ID migration invariants, and commit retry behavior.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 23, 2026
@Xuanwo
Xuanwo merged commit 25013bd into main Nov 23, 2026
46 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/unify-manifest-build-config branch November 23, 2026 07:18
Xuanwo added a commit that referenced this pull request Nov 24, 2026
## Problem

Every scalar index merge repeated the same field and declaration
validation, row-domain guard, per-segment filters, destination store
allocation, source opening/downcast, and `IndexMetadata` assembly.
Bitmap also depended on btree for its empty new-data stream, and
append's merge dispatch rebuilt the same filters per arm.

## Change

Add `scalar/segment_merge.rs` to own the shared merge inputs and output:

- empty groups, keyed field/path and same-declaration checks
- per-type stable-row-id legacy guard, preserving
Bitmap/BTree/LabelList/MinHash bottom-level mixed-domain errors;
RTree/NGram keep the shared-domain guard
- per-segment filters and coverage unions
- typed source opening/downcast
- UUID/store allocation and one metadata constructor
- the empty value/address stream used by pure consolidation

All scalar merge modules now use it; Bitmap no longer reaches into
btree. `append.rs` constructs filters once for the simple merge
primitives. MinHash keeps its historical admission rule: non-stable
tables can merge disjoint v0 and v1 segments into v1, while stable
tables still reject legacy input.

No public API, persisted format, or Python wrapper changes. #11273,
#11231 and #11280 are complementary and not dependencies; their
behaviors are not pulled in here. Overlap is mechanical in the same
scalar modules and append dispatch. Current main's #11290 only changes
tagged FRI retention bookkeeping and #11391 changes commit
configuration; neither changes a caller contract used by this change.

## Validation

- `cargo fmt --all -- --check`: pass
- `cargo clippy --all --tests --benches --profile ci -j 4 -- -D
warnings`: pass (only existing lance-linalg build-script notices)
- Runtime on head `d23cbafd5`, one test executable, 49 unique tests:
- scalar MinHash module: 16 passed, including mixed v0-layout/v1
disjoint merge, commit, reopen and `fast_search` for both stable and
non-stable datasets, plus the historical-layout legacy regression
  - `index::tests::merge`: 8 passed
- append/optimize: BTree 9, Bitmap 7, NGram 1, BloomFilter 4, FTS 3,
scalar stale-row 1

No released MinHash v0 fixture exists; the v0 layout is reconstructed
from a current segment (`_rowid`, version 0) by the test helper. The
test exercises real merge, commit, reopen and search rather than mocked
metadata.

Remaining coverage: the full workspace test matrix and a Python wheel
were not run. The Python wrapper is unchanged, and the mixed historical
layout is not constructible through it.

Clean merge tree with current main
`e90fe4b8e7c8c819bb51171a43fc94d01b40e2c7`:
`bdbb1029cd3e7ab3a54ac3036d258cd4e6dcbcaa`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants