Repository navigation
fix(index): require explicit opt-in for v1 zone write seeds and keep v0 writes by default - #11433
Merged
Merged
Conversation
…v0 writes by default
Previously, any commit on a table carrying a ZoneMap index with use_seeds=true automatically activated FLAG_ZONE_WRITE_SEEDS (1 << 16) in both reader_feature_flags and writer_feature_flags. Because string, binary, decimal, and nested ZoneMap indices default to use_seeds=true since Lance v10, upgrading a single writer to v15 immediately locked out all Lance < 15 readers without a rolling-upgrade window.
This change:
- Removes automatic FLAG_ZONE_WRITE_SEEDS activation during manifest commits.
- Adds dataset config key `lance.zone_write_seeds.version` ("0" or "1") to explicitly opt a table into v1 zone write seeds and atomically set the sticky FLAG_ZONE_WRITE_SEEDS bits across legacy and composite transaction paths.
- Keeps ZoneMapSeedWriter emitting v0 seeds by default when FLAG_ZONE_WRITE_SEEDS is not active (or when explicitly pinned to "0"), avoiding optimize_indices regressions while preserving full Lance < 15 compatibility.
- Drops v0 seeds cleanly during binary-copy compaction without setting FLAG_ZONE_WRITE_SEEDS, and carries v1 seeds when v1 is active.
- Extends ZonemapBloomfilterIndex compat test with a string column (use_seeds=true by default) alongside Rust unit/integration coverage.
There was a problem hiding this comment.
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.
BubbleCal
approved these changes
Nov 24, 2026
A v14 writer can persist `lance.zone_write_seeds.version = "1"` through its generic `update_config` without knowing `FLAG_ZONE_WRITE_SEEDS`. Inferring activation from the resulting config let an ordinary v15 Append, Overwrite, or unrelated composite commit set bit 16 for such a table, locking v14 out before any v1 seed was written. Track whether this operation actually writes or deletes the key in both the legacy manifest builder and the action path. Only that explicit write validates the value and can activate the flag: writing "1" even when it already says "1" is an opt-in, while "0" or deletion leaves the sticky flag alone. Inherited values, including invalid ones, no longer activate or block unrelated commits; explicitly rewriting an inherited invalid value is still rejected. Strengthen the ZONEMAP compat test so the previous version owns the index update over a candidate append, and assert exact indexed and unindexed IS NULL counts instead of accepting any non-empty result.
LuQQiu
added a commit
to LuQQiu/lance
that referenced
this pull request
Nov 30, 2026
Resolve conflicts with the explicit opt-in for version 1 zone write seeds (lance-format#11433) and the move of binary copy and the write seed collector to lance-table-runtime, and keep zone write seed collection independent of the seed format version: - `lance.zone_write_seeds.enabled` no longer sets FLAG_ZONE_WRITE_SEEDS. Configured seeds use the same seed version as index-requested seeds: version 1 only when `write_v1_zone_write_seeds` holds, else version 0. `store_null_bitmap` applies at either version. - The `lance.zone_write_seeds.` prefix validation accepts the `version` key and checks it with `validate_zone_write_seeds_version_config`; unknown keys under the prefix stay rejected. - Binary copy carries configured seeds only inside the version 1 gate. The zone size declared for columns without a seeded index comes from the new `WriteSeedHook::unindexed_rows_per_zone`, and `index_rows_per_zone` only counts seeded ZoneMap indices, taking the finest. Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a cross-version compatibility break introduced by #10102 before releasing Lance v15.0.0.
Problem
Since Lance v10 (#7427),
ZoneMapindices on string, binary, decimal, fixed-size binary (>8 bytes), and nested columns default touse_seeds = true. In #10102, any commit on a dataset carrying ause_seeds = trueZoneMap index automatically setFLAG_ZONE_WRITE_SEEDS(1 << 16) in bothreader_feature_flagsandwriter_feature_flags.Because
v14.0.0reserves bit 16 as unsupported andv15.0.0is the first stable release able to read it, automatic activation breaks rolling upgrades: a single v15 writer performing any normal commit (Append,Update,Delete,DataReplacement,Compact, etc.) permanently (sticky bit) locks out all Lance< 15readers with no rollout window. This also diverged from the zone write seeds format spec (#9564,docs/src/format/index/scalar/zone_write_seeds.md, "Activation is explicit, not triggered by opening a table") and from every other v15 reader feature flag (FLAG_MANAGED_BLOBS,FLAG_SPILLED_ROW_LINEAGE,FLAG_INLINE_DELETIONS), all of which require explicit opt-in.Changes
apply_seed_feature_flagsfrom the commit path (rust/lance/src/io/commit.rs,rust/lance/src/dataset/write/seeds.rs). Normal commits andCreateIndexno longer setFLAG_ZONE_WRITE_SEEDS.lance.zone_write_seeds.version(valid values"0"and"1") validated when modified on both legacy (UpdateConfig,Overwrite) and composite transaction paths (rust/lance-table/src/feature_flags.rs,rust/lance-table/src/transaction/)."0":FLAG_ZONE_WRITE_SEEDSstays unset; writers emit v0 seeds."1": Atomically setsFLAG_ZONE_WRITE_SEEDSin bothreader_feature_flagsandwriter_feature_flags. Once set, the flag remains sticky across subsequent commits, index drops, restores, and clones; setting"0"pins future writes back to v0 while keeping the flag sticky.lance.zone_write_seeds.*namespace as feat: collect zone map write seeds for unindexed columns from dataset config #11373.ZoneMapSeedVersion::{V0, V1}toZoneMapSeedWriter(rust/lance-index/src/scalar/zonemap.rs). Tables that have not activatedFLAG_ZONE_WRITE_SEEDS(or are pinned to"0") emit v0 seeds (noversionmetadata, nonegative_nan_count,max = +NaNwhennan_count > 0,required_feature_flags() == 0). This preserves Lance< 15read/write compatibility without regressingoptimize_indicesperformance (since feat(index): reuse zone map write seeds across zone sizes and make the null bitmap optional #10165 already reuses v0 seeds withnan_count == 0, covering all non-float and NaN-free float zones).write_v1_zone_write_seedsis true; otherwise drop v0 seeds cleanly without activatingFLAG_ZONE_WRITE_SEEDS(rust/lance/src/dataset/optimize/binary_copy.rs).lance-table,lance-index, andlancecovering v0 default writes, explicit v1 opt-in, sticky flag behavior, config validation, binary-copy compaction, and external scalar plugins.ZonemapBloomfilterIndexinpython/python/tests/compat/test_scalar_indices.pywith a string column (which defaults touse_seeds=Trueon Lance >= 10) so the compat matrix catches write-seed regressions going forward.Verification
cargo test --profile ci -p lance-table --lib --doccargo test --profile ci -p lance-index --lib zonemapcargo test --profile ci -p lance --lib -- seed/binary_copy/zone_mapcargo test --profile ci -p lance --test external_scalar_plugincargo fmt --all -- --check&cargo clippy --profile ci --all --tests --benches -- -D warningscd python && uv run make lint(ruff, pyright, cargo fmt, cargo clippy)ZonemapBloomfilterIndexlocally against the builtpylancewheel