fix(db): force max_connections=1 for in-memory SQLite pools#2491
Merged
fix(db): force max_connections=1 for in-memory SQLite pools#2491
Conversation
Each physical connection to sqlite::memory: is a separate empty database. When the pool size is >1, queries routed to connections other than the one that ran migrations hit a schema-less DB and fail with "no such column: superseded_by". Capping max_connections at 1 for :memory: URLs ensures all queries share the same migrated schema. Fixes 91 failing graph tests introduced after migration 056 (superseded_by column) in PR #2465. Closes #2468
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pool_size > 1, queries routed to non-migration connections hit a schema-less DB and fail withno such column: superseded_bymax_connections = 1for:memory:URLs inDbConfig::connect_sqliteRoot cause
sqlite::memory:in sqlx creates a distinct in-memory database per physical connection. The pool hadmin_connections = 1andmax_connections = 5. Migrations ran on the first connection; subsequent connections opened fresh, schema-less DBs. After migration 056 (superseded_bycolumn ongraph_edges), all graph tests that usedSqliteStore::new(":memory:")began failing withcode: 1, message: "no such column: superseded_by".Test results
Before: 7326 pass / 91 fail
After: 7445 pass / 0 fail
Closes #2468