Skip to content

CBL-8202: Fix expiration logic on SQLITE_BUSY - #2504

Merged
borrrden merged 3 commits into
release/4.1from
database_expiration_busy
Jun 18, 2026
Merged

CBL-8202: Fix expiration logic on SQLITE_BUSY#2504
borrrden merged 3 commits into
release/4.1from
database_expiration_busy

Conversation

@borrrden

Copy link
Copy Markdown
Member

Also fix the expiration torture test to not exit early on the same condition

Also fix the expiration torture test to not exit early on the same condition
@borrrden
borrrden requested a review from pasin June 17, 2026 06:11
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

This is a release branch and commits are restricted.

Please confirm this PR is one of the following:

  • A response to a customer ask
  • A change per our security policy
  • A non-functional change (i.e. changes needed for building an older version)
  • A change that has been granted an exception (please comment)

@borrrden
borrrden requested a review from snej June 17, 2026 06:12
@borrrden borrrden changed the title CBL-8202: Fix expiration logic on SQLITE_ERROR CBL-8202: Fix expiration logic on SQLITE_BUSY Jun 17, 2026
@couchbase couchbase deleted a comment from github-actions Bot Jun 17, 2026
@cbl-bot

cbl-bot commented Jun 17, 2026

Copy link
Copy Markdown

Code Coverage Results:

Type Percentage
branches 64.71
functions 77.41
instantiations 70.98
lines 76.04
regions 72.3

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 a try/catch to detect LiteCore/Busy and 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_setDocExpiration on transient kC4ErrorBusy instead 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.

Comment thread LiteCore/Database/Housekeeper.cc
Comment thread LiteCore/Database/Housekeeper.cc Outdated
Comment thread LiteCore/Database/Housekeeper.cc Outdated
Comment thread C/tests/c4DatabaseTest.cc
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@couchbase couchbase deleted a comment from github-actions Bot Jun 17, 2026
@borrrden
borrrden merged commit 8bfa745 into release/4.1 Jun 18, 2026
10 checks passed
@borrrden
borrrden deleted the database_expiration_busy branch June 18, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants