Project
vgrep
Description
The SQLite database in src/core/db.rs is opened without enabling WAL (Write-Ahead Logging) mode. This can cause concurrency issues when multiple processes access the database simultaneously (e.g., watcher + search) and reduces write performance.
Error Message
Error: database is locked
or
SQLITE_BUSY
Debug Logs
System Information
- Bounty Version: 0.1.0
- OS: Ubuntu 24.04 LTS
- Rust: 1.75+
Screenshots
No response
Steps to Reproduce
- Start the watcher in one terminal:
vgrep watch
- Run searches in another terminal:
vgrep search "query"
- Modify files while searching
- Observe occasional "database is locked" errors
Expected Behavior
The database should:
- Enable WAL mode for better concurrency
- Set a busy timeout to handle lock contention gracefully
- Potentially set synchronous mode for performance
Actual Behavior
- Uses default DELETE journal mode
- No busy timeout (immediate SQLITE_BUSY on contention)
- Writers block readers and vice versa
- Suboptimal write performance
Additional Context
WAL mode benefits:
- Readers don't block writers
- Writers don't block readers
- Better write performance (commits can overlap)
- Crash recovery is more robust
The issue manifests when:
- File watcher is running while user searches
- Server handles multiple simultaneous requests
- Index operation runs while search occurs
Without WAL mode, SQLite uses rollback journal which requires exclusive locks for writes, causing blocking.
Project
vgrep
Description
The SQLite database in
src/core/db.rsis opened without enabling WAL (Write-Ahead Logging) mode. This can cause concurrency issues when multiple processes access the database simultaneously (e.g., watcher + search) and reduces write performance.Error Message
Debug Logs
System Information
Screenshots
No response
Steps to Reproduce
vgrep watchvgrep search "query"Expected Behavior
The database should:
Actual Behavior
Additional Context
WAL mode benefits:
The issue manifests when:
Without WAL mode, SQLite uses rollback journal which requires exclusive locks for writes, causing blocking.