Skip to content

[tx] Use WAL mode for sqlite#1054

Merged
pcmoritz merged 2 commits intoNovaSky-AI:mainfrom
pcmoritz:tx-sqlite-wal
Feb 8, 2026
Merged

[tx] Use WAL mode for sqlite#1054
pcmoritz merged 2 commits intoNovaSky-AI:mainfrom
pcmoritz:tx-sqlite-wal

Conversation

@pcmoritz
Copy link
Collaborator

@pcmoritz pcmoritz commented Feb 8, 2026

This PR enable WAL mode to allow reading the database while it is being written to (by a single writer). We also activate busy_timeout so multiple writers will retry to avoid 'database is locked' errors.


Open with Devin

@pcmoritz pcmoritz added the tx label Feb 8, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables WAL mode for SQLite databases, which is a great improvement for allowing concurrent reads and writes. The implementation correctly uses SQLAlchemy events to set the necessary PRAGMAs for new connections. I've added one suggestion to improve the new function's maintainability by adding a type hint and removing a magic number. Overall, this is a solid change.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@pcmoritz pcmoritz merged commit fe0cf2b into NovaSky-AI:main Feb 8, 2026
4 of 5 checks passed
pcmoritz added a commit that referenced this pull request Feb 13, 2026
…1105)

This PR increases the busy timeout introduced in
#1054 from 5s to 30s. If two
writers to the database are active at the same time, the second writer
will wait up to busy_timeout milliseconds and give an error `database is
locked` if it cannot get a lock during that time.

In a separate PR, I will also go through all the write transaction and
make sure they are short lived (e.g. the transactions shouldn't be open
while a checkpoint is written).
<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/novasky-ai/skyrl/pull/1105"
target="_blank">
  <picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
  </picture>
</a>
<!-- devin-review-badge-end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant