Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-authored-by: Drew <[email protected]>
Co-authored-by: Drew <[email protected]>
Appends go through the existing insert writer and land as AddFragment and AddDataFile on the reusable ApplyState. A scan pins publication to the base version. Appends that were not scanned can rebase. The uncommitted snapshot uses u64::MAX so commit and maintenance reject it. Co-authored-by: Drew <[email protected]>
…mat#10780) This PR adds `local_fragment_aliases` to IndexMetadata and reserves feature flag `FLAG_LOCAL_FRAGMENT_ALIASES` so index files can keep their stored fragment IDs when a commit assigns different committed fragment IDs. The main use case is committing an append and its index together. If another writer commits first and changes the assigned fragment IDs, the retry can update local_fragment_aliases and fragment_bitmap together instead of rewriting the index files. For example, an index storing (17, 5) can alias 17 -> 42, and a rebase to fragment 43 updates local_fragment_aliases to {17: 43} and fragment_bitmap to {43}. Segments that already store committed fragment IDs omit the map. When present, the map is resolved before the Fragment Reuse Index (FRI). Writers that reuse existing index files must preserve the map, and readers must reject any map they cannot interpret. This PR adds the protobuf definition updates the spec in `index.md`, and adds a read guard that rejects mapped segments until reader support lands. The reader and writer feature flag bit is still unassigned. Writing mapped indexes, applying the map on read, and wiring up index maintenance will follow in separate PRs. Related to lance-format#7954, lance-format#10386, and lance-format#10722. ### Testing - `cargo test -p lance-table --lib` - `cargo clippy --all-targets -- -D warnings` - `cargo run --locked --manifest-path protos/codegen/Cargo.toml -- --check` - `mkdocs build --strict` --------- Co-authored-by: Drew <[email protected]>
…tenance Co-authored-by: Drew <[email protected]>
|
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 — 0 of 3 required approvals
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 |
f45a030 to
58c8205
Compare
Co-authored-by: Drew <[email protected]>
58c8205 to
71fc9bc
Compare
| /// the MemWAL system index, a `covered_fragments` list that mixes | ||
| /// [`Ref::Committed`] and [`Ref::Local`], duplicate [`Ref::Local`] ids, | ||
| /// and [`Ref::Local`] carrying [`RowAddress::TOMBSTONE_FRAG`]. | ||
| pub fn try_new_unchecked(mut parts: AddIndexSegmentParts) -> Result<Self> { |
There was a problem hiding this comment.
review note:
We keep coverage either committed only or local only so we can derive local_fragment_aliases directly from covered_fragments without adding protobuf fields. alternatively we can add that field lmk what you think.
This also avoids collisions when committed and local fragments have the same stored ID.
| /// the index does not exist, is a vector, covering, or system index, or if | ||
| /// staged fragments need indexing and the index type cannot rebase through | ||
| /// `local_fragment_aliases`. | ||
| pub async fn extend_index(&mut self, name: &str) -> Result<()> { |
There was a problem hiding this comment.
review note:
I went with extend_index because we're only indexing fragments that the existing index doesn't cover yet, without rebuilding or merging existing segments.
Alternitely, we can go with the existing optimize_indices call but that would target indices that are outside of the scope or the transactions so I wanted to distinguish. It's worth noting that Spark users call refresh and it seems like both lance db and duckdb call optimize
Co-authored-by: Drew <[email protected]>
Xuanwo
left a comment
There was a problem hiding this comment.
Keeping committed and local fragments in separate segments makes sense because their stored IDs can collide. Please document that requirement on AddIndexSegment.covered_fragments so another writer can produce valid actions.
I found three technical blockers in 71fc9bc1 by source inspection:
extend_indexplans from stored bitmaps. After tagged fragment-reuse compaction, a BTree can already answer for the replacement fragment while its stored bitmap still names the original fragments. Conversely, a missing legacy bitmap makes the planner skip every committed fragment. Please use current coverage and handle unknown coverage explicitly. Test that extending a fully covered compacted BTree stages no step, and that an unknown bitmap cannot silently skip uncovered rows. Planner- Two transactions can start on the same empty base, append different rows, and each create a BTree with the same name and definition. Both check the name during staging. At commit, the two segment claims have disjoint coverage because the conflict check excludes local fragments. Please preserve the create-only name check through commit and test that one create fails while independent extensions can still succeed. Conflict check
- A caller submitting
AddIndexSegmentdirectly can publish a vector segment with a local fragment alias such as0 → 1. The vector reader rejects every nonempty alias map. Please reject this combination before publication and cover the direct transaction entry point. Action · Reader
de69e45 to
7acc64d
Compare
…ector alias guard Co-authored-by: Drew <[email protected]>
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The three issues in the latest review are addressed: extensions use current coverage, create-only names are checked during commit retries, and aliased vector segments are rejected before publication.
Please mark this PR with the breaking-change label: lance_table::format::IndexMetadata gained the required public local_fragment_aliases field, so Rust callers constructing it with struct literals must initialize that field.
Summary
This PR adds
create_indexandextend_indextoStagedTransaction, allowing data and indexes to be committed together.create_indexbuilds a new index over the visible fragments.extend_indexadds coverage for newly appended or otherwise uncovered fragments without rebuilding the existing index. Both can be used aftertx.append(), with everything published in a single commit.Implementation
Index builds are split into separate segments for committed and local fragments.
Local segments use their transaction-local fragment IDs when building the index. At commit time,
AddIndexSegmentresolves those IDs and records the mappings inlocal_fragment_aliases. If another writer commits first, the transaction can retry with new fragment IDs without rebuilding the index files.The mappings are derived from
covered_fragments, so no protobuf changes are needed. A segment cannot mix committed and local fragment references because their stored IDs could overlap.Current limitations
extend_indexsupports scalar and inverted indexes but not vector, covering, or system indexes.NotSupported.Testing
Added coverage for concurrent commits and retries, stable row IDs, index queries, protobuf round-trips, staged scans, and index maintenance. Also tested supported and unsupported index types, including compaction and index optimization after committing aliased segments.
Related to #7954, #10722, #10780, #11203, and #11280.