Honor MessageStoreRole for tenanted message stores#3351
Merged
jeremydmiller merged 1 commit intoJul 10, 2026
Merged
Conversation
BuildMessageStore() only applied the configured MessageStoreRole on the non-tenanted return path, while buildMainDatabaseSettings() hardcoded Role = Main. A store registered as Ancillary that also registers tenants therefore came back as Main. With two Main stores, MessageStoreCollection leaves Main as a NullMessageStore (no throw, no log), so tryMigrateStorage() skips envelope schema migration while the durability agent still starts -- on PostgreSQL the host then loops forever on 42P01: relation "wolverine.wolverine_nodes" does not exist. Set the role in buildMainDatabaseSettings() so every return path sees it. Same defect and fix in the PostgreSQL, Sql Server, Sqlite, Oracle and MySql providers.
jeremydmiller
added a commit
that referenced
this pull request
Jul 10, 2026
…iders Retrofit MessageStoreRole registration tests to all relational providers (#3351 follow-up)
outofrange-consulting
pushed a commit
to outofrange-consulting/wolverine
that referenced
this pull request
Jul 10, 2026
…Sql, and Oracle (JasperFx#3351 follow-up) PR JasperFx#3351 fixed the same tenanted-store Role defect in all five relational providers but only added regression tests for PostgreSQL. This adds the equivalent three-case test (ancillary single-database, ancillary with static tenants, Main default with static tenants) to the other four providers' test suites. All are configuration-only tests that never touch a database. Mutation-checked on SqlServer: reverting the Role propagation in buildMainDatabaseSettings fails both ancillary tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 10, 2026
This was referenced Jul 17, 2026
Open
Open
This was referenced Jul 24, 2026
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.
The bug
PersistMessagesWithPostgresql(cs, "wolverine", role: MessageStoreRole.Ancillary).RegisterStaticTenants(...)produces a store that reportsMain, notAncillary.BuildMessageStore()applies the configuredRoleonly on the non-tenanted return path:Why it hurts
In a modular monolith where a module registers an ancillary, statically-tenanted store, the host now has two
Mainstores.MessageStoreCollection's constructor takes themains.Length == 1branch, finds two, and leavesMainas the initialNullMessageStore— no exception, no log line.From there:
WolverineRuntime.tryMigrateStorage()returns early onStorage is NullMessageStore, so the envelope schema is never built;startMessagingTransportsAsync()and the durability agent start anyway.On PostgreSQL the app then loops forever on
42P01: relation "wolverine.wolverine_nodes" does not exist. The only workaround today is to reach for the store'sDemoteToAncillary()after the fact.The fix
Set
RoleinbuildMainDatabaseSettings()so every return path sees it, and drop the late assignment.Rolealready defaults toMessageStoreRole.Main, so nothing changes for callers that don't ask forAncillary.The same defect is present verbatim in all five relational providers (PostgreSQL, Sql Server, Sqlite, Oracle, MySql); all are fixed here.
Tests
PostgresqlTests/message_store_role_registration.cs— three cases, no database required: ancillary single-database, ancillary with static tenants, and theMaindefault with static tenants. Mutation-checked: reverting the PostgreSQL fix fails the ancillary-with-tenants test and leaves the other two green.