Repository navigation
fix(cleanup): do not reserve a full delete batch up front - #11081
Merged
Xuanwo merged 3 commits intoNov 18, 2026
Merged
Conversation
Cleanup groups candidates with try_chunks(delete_concurrency * 1000), which reserves the whole batch before reading a single file. Any delete_concurrency up to Semaphore::MAX_PERMITS passes validation, so a large value overflows the capacity or aborts the process on allocation failure, including from the lance.auto_cleanup.delete_concurrency config. Grow each batch with the files actually read instead.
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Xuanwo
approved these changes
Nov 18, 2026
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.
#10787 started grouping cleanup candidates with
try_chunks(delete_concurrency * 1000).try_chunksreserves its full capacity up front, for the first chunk and again after every chunk it yields, so the reservation grows withdelete_concurrencyand not with the number of files to delete.validate_delete_concurrencyaccepts any value up toSemaphore::MAX_PERMITS. At that bound the multiplication saturates tousize::MAXand cleanup panics with "capacity overflow". A value like 1,000,000 asks for tens of gigabytes per chunk, which usually aborts the process on allocation failure. Before #10787 every accepted value worked, sincebuffer_unordereddoes not preallocate. The value can also come from thelance.auto_cleanup.delete_concurrencytable config, so an auto cleanup after a commit can abort the writer.This change collects each chunk into a
Vecthat grows with the files actually read, keeping the same chunk size and the same per-chunk deletes.How was this patch tested
test_cleanup_with_large_delete_concurrencyruns a cleanup withdelete_concurrencyset to 1,000,000 and toSemaphore::MAX_PERMITSand checks that the old version is removed without failed deletes. On main the test process aborts withmemory allocation of 40000000000 bytes failed. With this change both cases pass, as do the existingdataset::cleanuptests.