Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite: when connecting to an in-memory database, limit to 1 concurrent connection #3255

Merged
merged 1 commit into from Dec 6, 2023

Conversation

ItalyPaleAle
Copy link
Contributor

By default the Go database/sql package opens multiple connections to a database.

However, when using SQLite with an in-memory database, this can cause conflicts if two transactions are executed at the same time.

When the SQLite database is stored on disk, the WAL allows multiple operations in parallel and keeps them pending for up to "busyTimeout". However when the database is in-memory, based on some real-world data, a transaction blocks the database and busyTimeout isn't respected.

Using a single connection makes it so Go never tries to create 2 transactions in parallel.

…nt connection

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
@ItalyPaleAle ItalyPaleAle requested review from a team as code owners December 6, 2023 06:01
@berndverst berndverst merged commit 87aea87 into dapr:main Dec 6, 2023
86 checks passed
@ItalyPaleAle ItalyPaleAle added this to the v1.13 milestone Dec 22, 2023
@ItalyPaleAle ItalyPaleAle deleted the sqlite-maxconns branch December 22, 2023 17:33
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.

None yet

2 participants