A fresh PostgreSQL install starts without logging connection errors #20

Closed
opened 2026-10-31 12:41:50 -04:00 by claude · 0 comments
Owner
  • Draft: REL-12
  • Priority: medium (two fail: lines on a clean first start look like a broken install)
  • Agent: storage-coder
  • Depends on: none
  • Decisions: none

Why

RP-1 saw two Error lines "An error occurred using the connection to database ..." on the first
start against an empty PostgreSQL server, before the migrator creates the database. The first
call that reaches the database is GetAppliedMigrationsAsync
(src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Maintenance/RelationalStartupMigrator.cs:152);
EF Core logs the failed open as RelationalEventId.ConnectionError at Error before the provider
handles the missing database. Lowering that event globally is wrong: at runtime it is a real
error.

What changes

In RelationalStartupMigrator, check first whether the database exists with
IRelationalDatabaseCreator.ExistsAsync (EF opens that connection with errors expected and logs
at Debug) and, when it does not, log one Information line ("The database ... does not exist yet;
creating it and applying N migrations") and skip the history read. Find the exact call that logs
the two lines before changing anything, and say which it was. Check MySQL and SQL Server the same
way.

Acceptance

  • A RequiresDocker test in src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests runs the
    migrator against a server with no database (PostgreSQL, then MySQL and SQL Server) with a
    capturing logger and asserts no entry at Error or above (fails first on PostgreSQL).
  • An unreachable server still fails the start as now (existing tests).
  • dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests with Docker; build 0 warnings.

Source

release-prep.md:21 (RP-1 nits).

- **Draft:** REL-12 - **Priority:** medium (two `fail:` lines on a clean first start look like a broken install) - **Agent:** storage-coder - **Depends on:** none - **Decisions:** none ### Why RP-1 saw two Error lines "An error occurred using the connection to database ..." on the first start against an empty PostgreSQL server, before the migrator creates the database. The first call that reaches the database is `GetAppliedMigrationsAsync` (`src/dotnet/src/Ninlil.Dns.Data.EntityFrameworkCore/Maintenance/RelationalStartupMigrator.cs:152`); EF Core logs the failed open as `RelationalEventId.ConnectionError` at Error before the provider handles the missing database. Lowering that event globally is wrong: at runtime it is a real error. ### What changes In `RelationalStartupMigrator`, check first whether the database exists with `IRelationalDatabaseCreator.ExistsAsync` (EF opens that connection with errors expected and logs at Debug) and, when it does not, log one Information line ("The database ... does not exist yet; creating it and applying N migrations") and skip the history read. Find the exact call that logs the two lines before changing anything, and say which it was. Check MySQL and SQL Server the same way. ### Acceptance - [ ] A `RequiresDocker` test in `src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests` runs the migrator against a server with no database (PostgreSQL, then MySQL and SQL Server) with a capturing logger and asserts no entry at Error or above (fails first on PostgreSQL). - [ ] An unreachable server still fails the start as now (existing tests). - [ ] `dotnet test src/dotnet/tests/Ninlil.Dns.Data.Integration.Tests` with Docker; build 0 warnings. ### Source `release-prep.md:21` (RP-1 nits).
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil#20
No description provided.