Repository navigation
Enable WAL mode in libSQL - #27
Conversation
Co-authored-by: glguida <136059+glguida@users.noreply.github.com>
…lementation Co-authored-by: glguida <136059+glguida@users.noreply.github.com>
Co-authored-by: glguida <136059+glguida@users.noreply.github.com>
| // Note: WAL mode is not available for in-memory databases, which will | ||
| // continue using the default journal mode. This is expected and acceptable. | ||
| // PRAGMA journal_mode returns the mode that was actually set, so we consume | ||
| // the result to ensure the command succeeded. |
There was a problem hiding this comment.
Added documentation links and clarified that PRAGMA journal_mode returns a result row, which is why we must use query() instead of execute() (which expects no result rows). See commit 362cf4c.
Co-authored-by: glguida <136059+glguida@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR enables Write-Ahead Logging (WAL) mode in libSQL to improve database performance and concurrency. WAL mode allows multiple readers to access the database while writes are in progress, provides better crash recovery, and generally improves performance for most workloads.
Key Changes:
- WAL mode is automatically enabled when creating database connections
- Added comprehensive test coverage to verify WAL mode is properly enabled on file-based databases
- Added test-only helper method for verifying journal mode
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/vectordb.rs | Enables WAL mode in VectorDatabaseConnection::new(), adds test helper method get_journal_mode(), and includes test to verify WAL mode enablement |
| Cargo.toml | Adds tempfile as a dev dependency for testing file-based databases |
| Cargo.lock | Updates lock file to include tempfile dependency and its transitive dependencies |
The implementation is well-designed and follows best practices. The code properly documents the behavior with in-memory databases (which cannot use WAL mode), uses appropriate error handling, and includes comprehensive tests. The change is minimal, focused, and backwards-compatible. No issues were identified during the review.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Enable WAL (Write-Ahead Logging) mode in libSQL for better performance and concurrency
Summary
This PR enables Write-Ahead Logging (WAL) mode in libSQL, providing:
Changes Made:
VectorDatabaseConnection::new()tempfileas a dev dependency for testingget_journal_mode()for clean testing without accessing private fieldsNotes:
:memory:), which will continue using the default journal modeOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.