lance-format / lance-format/lance
Auto conflict resolution for `compact` then `update/delete`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.1k
- Forks
- 852
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 272
Description
Scope
compactthenupdate/delete
compact-compact conflicts are out of scope, as they are pretty rare.
Design
When compaction happens, the row addresses change. To be able to handle row-level conflicts, we will need compaction to emit a change_of_address mapping.
Update and delete transactions generate an affected_rows bitmap that tell them which row addresses need to be masked from the table. When they rebase on top of a compaction, they need run their affected_rows bitmap through the change_of_address mapping.
When compaction rebases on top of update/delete transactions, it needs to run the new deletion files through it's change_of_address mapping to generate new deletion files for the compacted data. Rows that were originally deleted and compacted out of the data will not appear in the mapping and will be dropped. But rows that have been deleted after will be mapped to an actual location.
TODO: compact then update/delete
- Serialize the change of address somewhere, likely the transaction file
- Investigate whether we should instead use
FragmentReuseIndex
- Investigate whether we should instead use
- Modify
TransactionRebaseto read the change of address when other committers create that - Make sure the change of address is added to metadata cache when possible
- Add a test validating if we commit compaction and then update, we the update can successfully rebase the compaction:
- Start an upsert with
MergeInsertJob::execute_uncommitted() - Run compaction, (parameterize test on doing this without and without same
Session) - Commit Compaction using
CommitBuilder, passing alongaffected_rowsto make sure conflict resolution can happen. - Validate expected updates happen, and no extra rows were added.
- Start an upsert with
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading TransactionRebase and the existing CommitBuilder and MergeInsertJob::execute_uncommitted() flows, then investigate how transaction files and the metadata cache represent commit information. Compare serializing the change_of_address mapping with using FragmentReuseIndex. Done means compaction and a subsequent update/delete rebase successfully, including the parameterized session case, with expected updates and no extra rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100