Repository navigation
test: a seeded SQLite database answers one query at a time - #150
Merged
Merged
Conversation
QueryTranslationVariantTests caches one open in-memory SqliteConnection per model. Since #142, SqlServerQueryVariantTests reads the same cache from its own collection, in parallel with this class. A connection is not thread-safe, so two commands at once failed with "database is locked" on the Linux leg, the only leg that runs the Docker classes: twice on #141's run 40889709782. Each read now holds the connection's lock. A_seeded_database_read_by_many_cases_at_once_answers_each_alike runs 400 reads of one database in parallel. With the lock taken out it fails with "database is locked"; with it, it passes, and the class's 9,610 cases pass in 52 s. Closes #148 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #148
Problem
QueryTranslationVariantTestscaches one open in-memorySqliteConnectionper model, which is seeded once and then only read. Since #142,SqlServerQueryVariantTestsreads that same cache throughQueryTranslationVariantTests.Runfrom its own collection (SQL Server), in parallel with the SQLite class. ASqliteConnectionisn't thread-safe, so two commands at once on one connection fail withSQLite Error 5: 'database is locked'.This only fails on the Linux leg, the only one that runs the
Needs=Dockerclasses. It failed twice on #141's run 40889709782, with a different case each time. Windows passed both times.Change
QueryTranslationVariantTests.Runholds the cached connection's lock while it builds and runs a case's query. Within the SQLite class the cases already ran one after another, so the lock only orders this class's reads against the SQL Server class's.Databases' summary says why.Tests
A_seeded_database_read_by_many_cases_at_once_answers_each_alike: 400 reads of one seeded database in parallel, each holding the same rows.lock (new object())): fails withdatabase is locked. Restored: passes.QueryTranslationVariantTestslocally: 9,610 passed, 462 skipped, in 52 s.🤖 Generated with Claude Code