Repository navigation
feat: allow FRI to be used with stable row IDs - #9514
Conversation
c61d2ac to
e62a52d
Compare
ab85561 to
4189d7c
Compare
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The compaction cost raised earlier is fixed: eager stable-row-ID rewrites skip unused address capture, and deferred rewrites build the lookup from only the task's source fragments. The stable-row-ID/FRI guard still rejects row-ID-domain indexes across planning, commit, and concurrent rebase paths. Focused compaction and race tests pass.
Compaction refused `defer_index_remap` on a stable-row-id dataset on the grounds that stable row ids need no remapping. That holds for the row-id-domain indices, but not for the address-domain ones: a zone map or bloom filter is built over `_rowaddr`, and a rewrite moves every address it stores. With nothing to repair those addresses, the rewritten fragments were dropped from such an index's coverage and the scanner fell back to a full scan -- correct answers, but the index stopped earning its keep. Allow the two together so the fragment-reuse index can carry the repair: - Capture row addresses whenever a deferred remap is requested rather than only when row ids are unstable. - Rechunk stable row ids *and* resolve the captured addresses in the rewrite task. These sat in mutually exclusive branches, so capturing addresses would otherwise skip `rechunk_stable_row_ids`. Stable row ids are captured sequence-style, so only the row-id index knows the address each one sat at. - Let an address-domain index follow its data to the new fragments when the commit carries an FRI, instead of dropping the rewritten fragments. Narrow the rejection rather than removing it. An FRI is applied to every index on load, and with stable row ids the two domains diverge: a stable row id is numerically indistinguishable from an address into fragment 0, so an FRI applied to a btree would silently rewrite valid row ids rather than fail. The two therefore cannot coexist on a stable-row-id dataset, and both sides now refuse to create the pair: - Compaction rejects a deferred remap while a row-id-domain index is present, at the plan boundary and again at the commit boundary, since a caller may supply its own planner or commit a plan made before the index existed. - `create_index` rejects a row-id-domain index while a non-empty FRI is present. An unclassifiable type is refused rather than allowed. Both classifiers treat an unknown type as row-id-domain, so a type missing from either list costs a refused operation, never silent corruption. This restriction drops out once every index stores row addresses. Co-Authored-By: Claude Opus 5 <[email protected]>
#9120 added a publication-time check for fragment reuse indices on stable row id datasets that rejects the same row-id-domain index combination. The duplicate gate fired first with a different error and broke its tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KqTXnUMz52CMzSjmDnutf6
4189d7c to
3b936b1
Compare
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The publication validation merged in #9120 safely replaces the removed guard: it checks the final index list after rebase and rejects incompatible indexes. Focused tests pass for both commit orderings, including disjoint coverage, and for indexed query results before and after deferred remapping. Eager stable-row-ID compaction still skips unused address capture, and deferred lookup stays scoped to the rewritten fragments. FRI with stable row IDs remains gated to debug builds.
#9120 already refuses creating a row-id-domain index on a stable row id dataset that carries a fragment reuse index. The test now matches that error's wording. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KqTXnUMz52CMzSjmDnutf6
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The shared compatibility rules merged in #9120 safely replace the removed creation guard. Row-ID indexes remain refused, while focused tests pass for typed and generic ZoneMap requests and BloomFilter creation after deferred compaction. Final-list publication validation still rejects incompatible combinations after rebase. Deferred compaction retains address-index coverage with lookups scoped to source fragments; eager stable-row-ID compaction skips unused address capture. FRI with stable row IDs remains gated to debug builds.
Merge main after lance-format#9514. Preserve its index coverage and conflict checks alongside metadata-based address recording, index-free mappings, and distributed commit handling. Update the race regression for the earlier conflict and adapt the new resolver test to the FRI base field.
…vening changes Rebasing this branch onto the 78 commits main gained in the meantime surfaced test and fixture code that assumed BTree still trains from row ids -- true when that code was written on main, but no longer true once this branch's migration lands on top of it. None of these were textual merge conflicts; they only showed up as test failures. - `BTreeMemIndexPlugin::training_criteria()` (added by #9803's pluggable-mem-wal-index refactor) declared `.with_row_id()`, but `to_training_batches()` already emits `_rowaddr`. The new declared-vs-actual validation `build_scalar_index` gained (also from #9803) now catches that mismatch. Same root cause, two test fixtures: `index::create::tests::test_range_based_btree_index_create` and `index::frag_reuse_reader::tests::fixture_with_index` fed BTree a row-id-declared stream via the generic `preprocessed_data()` helper despite already scanning row addresses; both now call `preprocessed_stream` with the correct criteria directly. - `test_row_id_index_creation_racing_defer_index_remap` (added by #9514, which allows FRI with stable row ids) exercised a row-id-domain BTree index racing a concurrently-committed FRI -- exactly the danger this migration exists to close. BTree can no longer illustrate that race on a stable-row-id dataset, so the test now uses Bitmap, which still stores row ids directly on this branch. - `test_merge_insert_key_only_concurrent_write`'s compaction case updated its expectations: compaction physically rewrites a fragment, and an address-domain index can no longer cover the result (the same invariant `test_addr_domain_index_does_not_cover_rewritten_update_fragment` already covers for ZoneMap/BloomFilter/FM). The in-place patch that used to write zero files now correctly falls back to a real rewrite to keep the "id" BTree index's coverage consistent, which the test now asserts instead of the stale zero-file expectation. Verified with a side-by-side worktree on plain origin/main: every test touched here passes there unmodified, confirming the failures were purely this rebase's interaction with main's intervening work, not pre-existing breakage. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…vening changes Rebasing this branch onto the 78 commits main gained in the meantime surfaced test and fixture code that assumed BTree still trains from row ids -- true when that code was written on main, but no longer true once this branch's migration lands on top of it. None of these were textual merge conflicts; they only showed up as test failures. - `BTreeMemIndexPlugin::training_criteria()` (added by #9803's pluggable-mem-wal-index refactor) declared `.with_row_id()`, but `to_training_batches()` already emits `_rowaddr`. The new declared-vs-actual validation `build_scalar_index` gained (also from #9803) now catches that mismatch. Same root cause, two test fixtures: `index::create::tests::test_range_based_btree_index_create` and `index::frag_reuse_reader::tests::fixture_with_index` fed BTree a row-id-declared stream via the generic `preprocessed_data()` helper despite already scanning row addresses; both now call `preprocessed_stream` with the correct criteria directly. - `test_row_id_index_creation_racing_defer_index_remap` (added by #9514, which allows FRI with stable row ids) exercised a row-id-domain BTree index racing a concurrently-committed FRI -- exactly the danger this migration exists to close. BTree can no longer illustrate that race on a stable-row-id dataset, so the test now uses Bitmap, which still stores row ids directly on this branch. - `test_merge_insert_key_only_concurrent_write`'s compaction case updated its expectations: compaction physically rewrites a fragment, and an address-domain index can no longer cover the result (the same invariant `test_addr_domain_index_does_not_cover_rewritten_update_fragment` already covers for ZoneMap/BloomFilter/FM). The in-place patch that used to write zero files now correctly falls back to a real rewrite to keep the "id" BTree index's coverage consistent, which the test now asserts instead of the stale zero-file expectation. Verified with a side-by-side worktree on plain origin/main: every test touched here passes there unmodified, confirming the failures were purely this rebase's interaction with main's intervening work, not pre-existing breakage. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Enables
defer_index_remapcompaction on stable-row-ID datasets. Compaction captures pre-rewrite addresses and writes a fragment reuse index, and address-domain indexes (ZoneMap, BloomFilter) follow their data instead of losing coverage. Compaction refuses to defer while a row-id-domain index is present; the compatibility rules from #9120 cover index creation and publishing.Stack created with GitHub Stacks CLI • Give Feedback 💬