CBL-8202: Fix expiration logic on SQLITE_BUSY - #2504
Merged
Conversation
Also fix the expiration torture test to not exit early on the same condition
|
This is a release branch and commits are restricted. Please confirm this PR is one of the following:
|
|
Code Coverage Results:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses a failure mode in LiteCore’s background document expiration where a transient SQLITE_BUSY during the purge could prevent future expirations from being scheduled, and updates the associated “expiration torture” test to tolerate transient busy failures under artificial contention.
Changes:
- Wrap
Housekeeper::_doExpiration()in atry/catchto detectLiteCore/Busyand reschedule a near-term retry instead of letting the actor swallow the exception and skipping future scheduling. - Add a short retry delay constant for busy-induced expiration retries.
- Update the C API torture test to retry
c4coll_setDocExpirationon transientkC4ErrorBusyinstead of aborting early.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| LiteCore/Database/Housekeeper.cc | Catch-and-retry expiration purge on Busy to keep expiration scheduling alive under transient lock contention. |
| C/tests/c4DatabaseTest.cc | Make the expiration torture test retry setDocExpiration when it transiently returns Busy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
pasin
approved these changes
Jun 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.
Also fix the expiration torture test to not exit early on the same condition