Skip to content

Enable WAL - #25

Closed
glguida wants to merge 1 commit into
masterfrom
gianluca/next
Closed

glguida wants to merge 1 commit into
masterfrom
gianluca/next

Conversation

@glguida

@glguida glguida commented Dec 31, 2025

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 31, 2025 18:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enables SQLite's Write-Ahead Logging (WAL) mode for the vector database to improve concurrency and performance. WAL mode allows multiple readers to access the database while a writer is making changes, which is beneficial for concurrent access scenarios.

Key Changes:

  • Adds PRAGMA journal_mode = WAL statement during database connection initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/vectordb.rs
// Enable foreign keys for the ON DELETE CASCADE behavior
conn.execute("PRAGMA foreign_keys = ON", ()).await?;
// Enable WAL mode for better concurrency and performance
conn.query("PRAGMA journal_mode = WAL", ()).await?;

Copilot AI Dec 31, 2025

Copy link

Choose a reason for hiding this comment

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

The query method is used here, but it should be execute for consistency with the PRAGMA statement on line 116. The query method is typically used when you expect to read results from the database, while execute is for statements that don't return a result set. PRAGMA statements that set values should use execute.

Suggested change
conn.query("PRAGMA journal_mode = WAL", ()).await?;
conn.execute("PRAGMA journal_mode = WAL", ()).await?;

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

this actually returns this error:

Error: Database error: Database operation failed: Execute returned rows

Caused by:
    0: Database operation failed: Execute returned rows
    1: Execute returned rows

Which caused me to use query.

@glguida glguida closed this Jan 3, 2026
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.

2 participants