Repository navigation
PgOutput2Json.Sqlite 2.2.0 and .NET 11 - #7
Merged
Merged
Conversation
…he schema 2.2.0 requires SqlitePublisherOptions.SubscriptionName: it is the replication slot name, a cache having one source and one slot. A saved position of an existing file cache moves to its new key on the first start. 2.2.0 names a table of another schema than public "schema_table" by default. The cache tables are created from the DbContext model, and EF Core's SQLite provider ignores schemas, so the rows of sales.orders must go to "orders": GetTableName keeps the table name alone, as before. Two published tables with the same name are now an error of PgOutput2Json instead of mixed rows. Version 2.1.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHH4BGgzxkjMweveSF9mKD
.NET 11 and EF Core 11 are released, and EF Core 11 targets net11.0 only: without a net11.0 build, a .NET 11 application ran the net10.0 one, built against EF Core 10, on the EF Core 11 it uses itself. PgOutput2Json.Sqlite 2.2.0 has a net11.0 build. The tests run on net11.0 too, and CI installs the .NET 11 SDK. A new target framework is a minor release: 2.2.0, with PgOutput2Json.Sqlite 2.2.0. The package README has the note on schemas too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHH4BGgzxkjMweveSF9mKD
The cache DbContext makes every connection it opens read-only (PRAGMA query_only), and returns it to the pool with the setting still on. The worker opened its connections (EnsureCreated, and the one that keeps an in-memory database) with the same connection string, so a query of the cache before the worker started could hand the worker a read-only connection: EnsureCreated failed with "attempt to write a readonly database", on every retry, and the cache never filled. A health check or a request at startup is enough; in CI it was the test polling the cache. The worker's connections are now opened with Pooling=False (PgOutput2Json already opens its own that way): they are never one the cache DbContext used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHH4BGgzxkjMweveSF9mKD
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.
Updates PgOutput2Json.Sqlite from 2.1.1 to 2.2.0, keeping the cache's behavior the same, adds a net11.0 target (EF Core 11), and fixes the worker getting a read-only SQLite connection. PgFreshCache.Lite goes to 2.2.0: a new target framework, with no public API change.
PgOutput2Json.Sqlite 2.2.0
2.2.0 changes the SQLite output in two ways that affect the cache:
SubscriptionNameis required. Without itUseSqlitethrows, and the worker would retry every 10 seconds without ever starting. It is set to the replication slot name: a cache has one source and one slot. An existing file cache's saved position moves to the new key (Position:<slot>) on its first start.sales.ordersbecomessales_orders. The cache tables are created from theDbContextmodel, and EF Core's SQLite provider ignores schemas, so the entity's table isorders: the rows would go to a table EF never reads, and the cache would look empty with no error.GetTableName = (schema, table) => tablekeeps the old names.A publication with two tables of the same name in different schemas used to mix their rows in one SQLite table without any error. Now PgOutput2Json raises an error naming both tables, and both READMEs say so.
.NET 11
EF Core 11 targets net11.0 only. Without a net11.0 build, a .NET 11 app would run our net10.0 build, compiled against EF Core 10, on EF Core 11. The package now has net8.0/net9.0 (EF Core 9), net10.0 (EF Core 10) and net11.0 (EF Core 11). The test projects target net8.0, net10.0 and net11.0, and CI installs the 11.0.x SDK.
Fix: the worker could get a read-only connection
The cache
DbContextmakes every connection it opens read-only (PRAGMA query_only) and returns it to the SQLite pool with the setting still on. The worker opened its connections (EnsureCreated, and the one that keeps an in-memory database) with the same connection string. A query of the cache before the worker started, such as a health check or a request at startup, could hand the worker one of those connections.EnsureCreatedthen failed with "attempt to write a readonly database" on every retry, and the cache never filled. This was already in 2.1.0. On this PR's first CI run it showed up as the permanent-slot integration test failing twice, with the test's own polling query winning the race. The worker's connections are now opened withPooling=False, as PgOutput2Json already opens its own.ConnectionPoolTestsqueries the cache before starting the worker, and it failed (file cache) before the fix.Tests
SqliteOptionsTests): the subscription name is the slot, and tables are named without their schema.ConnectionPoolTests): the worker creates the tables after the cache was queried, in memory and in a file.sales.ordersentity is filled by the initial copy and by streamed changes. Without theGetTableNameoverride this test fails (the cache stays empty).TZ=Europe/Zagreb. The Release build passes package validation against 2.1.0.After 2.2.0 is on nuget.org, it becomes the package validation baseline (AGENTS.md).
🤖 Generated with Claude Code