Skip to content

feat: add automatic conflict resolution support for delete operations#4407

Merged
wjones127 merged 4 commits intolance-format:mainfrom
wjones127:feat/delete-conflict-resolution
Aug 19, 2025
Merged

feat: add automatic conflict resolution support for delete operations#4407
wjones127 merged 4 commits intolance-format:mainfrom
wjones127:feat/delete-conflict-resolution

Conversation

@wjones127
Copy link
Copy Markdown
Contributor

@wjones127 wjones127 commented Aug 7, 2025

Adds retry-based conflict resolution for delete operations, similar to update operations.

Previously, concurrent deletes would fail with commit conflicts. Now they automatically retry.

Fixes #3775

@github-actions github-actions Bot added the enhancement New feature or request label Aug 7, 2025
Add affected_rows tracking to delete operations to enable automatic
conflict resolution similar to update operations. This allows concurrent
delete operations to succeed with proper retry-based conflict resolution.

Changes:
- Add affected_rows field to DeleteData struct
- Capture RowIdTreeMap during delete execution from removed row addresses
- Pass affected_rows to CommitBuilder.with_affected_rows() in commit step
- Add test_delete_concurrency test similar to test_update_concurrency
- Handle edge cases for delete-all and delete-nothing scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@wjones127 wjones127 force-pushed the feat/delete-conflict-resolution branch from 27e697c to 232fba2 Compare August 18, 2025 23:58
@wjones127 wjones127 marked this pull request as ready for review August 19, 2025 00:29
@wjones127 wjones127 marked this pull request as draft August 19, 2025 00:29
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 93.86503% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.24%. Comparing base (5666cd2) to head (1cd9f97).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
rust/lance/src/dataset/write/delete.rs 93.86% 7 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4407      +/-   ##
==========================================
+ Coverage   82.21%   82.24%   +0.02%     
==========================================
  Files         307      307              
  Lines      124969   125188     +219     
  Branches   124969   125188     +219     
==========================================
+ Hits       102739   102956     +217     
- Misses      18387    18394       +7     
+ Partials     3843     3838       -5     
Flag Coverage Δ
unittests 82.24% <93.86%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wjones127 wjones127 marked this pull request as ready for review August 19, 2025 00:38
Copy link
Copy Markdown
Contributor

@jackye1995 jackye1995 left a comment

Choose a reason for hiding this comment

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

looks good to me, just a comment regarding testing

Comment thread rust/lance/src/dataset/write/delete.rs Outdated
(Vec::new(), deleted_fragment_ids)
// When deleting everything, we don't have specific row addresses,
// but we can create an empty RowIdTreeMap since all fragments are deleted
(Vec::new(), deleted_fragment_ids, RowIdTreeMap::new())
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.

I think the logic should be right here based on the conflict_resolver logic, but can we add a test to confirm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Added a test and modified this not to return an affected_rows here.

@wjones127 wjones127 merged commit ca1d9a6 into lance-format:main Aug 19, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto conflict resolution for compact then update/delete

3 participants