Closed
Conversation
… / marten#4268)
Wolverine's Envelope outbox document was silently picking up blanket
document policies applied to a store — most painfully
options.Policies.AllDocumentsAreMultiTenantedWithPartitioning. That
turned mt_doc_envelope into a hash-partitioned, conjoined-tenant table.
When a second store sharing the same schema described Envelope as
single-tenant (its normal default, since Wolverine never asks for
multi-tenancy on its own operational table), Marten's schema diff
emitted an impossible delta:
drop constraint pkey_mt_doc_envelope_id_tenant_id CASCADE;
add CONSTRAINT pkey_mt_doc_envelope_id PRIMARY KEY (id); -- 0A000
drop column tenant_id;
Postgres rejects the ADD PRIMARY KEY on a still-partitioned table with
"unique constraint on partitioned table must include all partitioning
columns". Async projections hid the conflict; inline projections surface
it on the first SaveChanges.
MartenOverrides.Configure now pins Envelope as single-tenant /
unpartitioned via Schema.For<Envelope>().SingleTenanted().DoNotPartition().
Those alterations land on the DocumentMappingBuilder<T> _alterations
list, which fires AFTER applyPolicies + applyPostPolicies during
DocumentMapping construction, so blanket ForAllDocuments policies can't
override them.
Updated the reproducer from JasperFx#2566 to assert the new guarantee: Envelope
is NOT tenant-partitioned after the async-projection store runs, and the
subsequent inline-side-effects store does not throw
MartenSchemaException on its first SaveChanges.
Verification:
- Bug_4268 reproducer: 1/1 pass (was failing pre-fix)
- MartenTests subset (Bugs + MartenOutbox + publish_messages + AncillaryStores): 52/52 pass
- Wolverine CoreTests: 1346/1346 pass
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
|
Superseded by #2570 — same change set against the JasperFx fork so it can be merged directly. Your reproducer commit is preserved with full authorship attribution. Thanks for the targeted repro! |
jeremydmiller
added a commit
that referenced
this pull request
Apr 22, 2026
…t-pin Exempt Wolverine's Envelope from blanket multi-tenant doc policies (supersedes #2566 / marten#4268)
erikshafer
pushed a commit
to erikshafer/wolverine
that referenced
this pull request
Apr 23, 2026
… / marten#4268)
Wolverine's Envelope outbox document was silently picking up blanket
document policies applied to a store — most painfully
options.Policies.AllDocumentsAreMultiTenantedWithPartitioning. That
turned mt_doc_envelope into a hash-partitioned, conjoined-tenant table.
When a second store sharing the same schema described Envelope as
single-tenant (its normal default, since Wolverine never asks for
multi-tenancy on its own operational table), Marten's schema diff
emitted an impossible delta:
drop constraint pkey_mt_doc_envelope_id_tenant_id CASCADE;
add CONSTRAINT pkey_mt_doc_envelope_id PRIMARY KEY (id); -- 0A000
drop column tenant_id;
Postgres rejects the ADD PRIMARY KEY on a still-partitioned table with
"unique constraint on partitioned table must include all partitioning
columns". Async projections hid the conflict; inline projections surface
it on the first SaveChanges.
MartenOverrides.Configure now pins Envelope as single-tenant /
unpartitioned via Schema.For<Envelope>().SingleTenanted().DoNotPartition().
Those alterations land on the DocumentMappingBuilder<T> _alterations
list, which fires AFTER applyPolicies + applyPostPolicies during
DocumentMapping construction, so blanket ForAllDocuments policies can't
override them.
Updated the reproducer from JasperFx#2566 to assert the new guarantee: Envelope
is NOT tenant-partitioned after the async-projection store runs, and the
subsequent inline-side-effects store does not throw
MartenSchemaException on its first SaveChanges.
Verification:
- Bug_4268 reproducer: 1/1 pass (was failing pre-fix)
- MartenTests subset (Bugs + MartenOutbox + publish_messages + AncillaryStores): 52/52 pass
- Wolverine CoreTests: 1346/1346 pass
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Reproduction of JasperFx/marten#4268