Skip to content

Avoid sqlite3 lock contention by serializing access through the cache thread.#927

Open
dholth wants to merge 9 commits intomainfrom
cache-insert-queue
Open

Avoid sqlite3 lock contention by serializing access through the cache thread.#927
dholth wants to merge 9 commits intomainfrom
cache-insert-queue

Conversation

@dholth
Copy link
Copy Markdown
Contributor

@dholth dholth commented Apr 30, 2026

Description

Sketch of idea for reduced cache contention.

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

jezdez and others added 2 commits April 30, 2026 13:54
Enable WAL journal mode and a 30s busy timeout on repodata_shards.db so the
cache reader thread no longer races with the network writer thread. Falls back
gracefully on filesystems where WAL is unsupported.
Co-authored-by: Daniel Holth <dholth@anaconda.com>
@github-project-automation github-project-automation Bot moved this to 🆕 New in 🔎 Review Apr 30, 2026
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Apr 30, 2026
@jezdez
Copy link
Copy Markdown
Member

jezdez commented Apr 30, 2026

I'd like to land #926 first as a quick fix since WAL is independently useful for any concurrent access to the cache. This can then build on top as a follow-up to remove the contention at the source. Alternatively, happy to fold this into #926 if you'd prefer shipping both together.

Copy link
Copy Markdown
Member

@jezdez jezdez left a comment

Choose a reason for hiding this comment

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

Nice idea to serialize all SQLite access through the cache thread. One suggestion to avoid the isinstance dance: use a separate insert queue instead of mixing types on the lookup queue.

Comment thread conda_libmamba_solver/shards_subset.py
Comment thread conda_libmamba_solver/shards_subset.py Outdated
@dholth dholth force-pushed the cache-insert-queue branch from fbc8fee to 207d7d6 Compare April 30, 2026 13:35
@dholth dholth marked this pull request as ready for review April 30, 2026 14:48
@dholth dholth requested a review from a team as a code owner April 30, 2026 14:48
@dholth dholth changed the title sketch queue cache idea Avoid sqlite3 lock contention by serializing access through the cache thread. Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

3 participants