Skip to content

Marten#4493 regression test on master (no code fix needed)#4497

Merged
jeremydmiller merged 1 commit into
masterfrom
fix/4493-optimistic-partitioning-master
May 19, 2026
Merged

Marten#4493 regression test on master (no code fix needed)#4497
jeremydmiller merged 1 commit into
masterfrom
fix/4493-optimistic-partitioning-master

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Closes #4493. Companion to the 8.0-line fix in #4496.

The bug — NullReferenceException when combining .UseOptimisticConcurrency(true) with AllDocumentsAreMultiTenantedWithPartitioning(...) — was in Marten/Storage/UpsertFunction.cs. That file was retired entirely on master by #4461's closed-shape storage rewrite ("Boom"), so the bug doesn't reproduce here. The cherry-pick of the 8.0 patch therefore omits the UpsertFunction.cs edit (file no longer exists on master) and lands only the regression test.

Why land just the test

  • The reporter's repro is a real configuration shape — partitioned tenant tables + optimistic concurrency is a supported combination — and worth pinning end-to-end on master.
  • Any future code path that walks partition columns + UpsertArguments could re-introduce a similar null-traversal pattern. The test acts as a regression-prevention guard.
  • The 8.0-line fix in Fix #4493: NullReferenceException combining optimistic concurrency and partitioning #4496 carries the actual code change for users on the 8.x release.

Test plan

  • CoreTests/Partitioning/Bug_4493_optimistic_partitioning.cs exercises the exact configuration shape from the reporter's repro: .UseOptimisticConcurrency(true) on a document plus AllDocumentsAreMultiTenantedWithPartitioning with two list partitions, then applies the schema and round-trips a document through one of the partitions.
  • Passes on net9.0 and net10.0 on master with no code change.
  • On the 8.0 line the same test fails with the reporter's exact NullReferenceException without the UpsertFunction.cs fix — confirmed in Fix #4493: NullReferenceException combining optimistic concurrency and partitioning #4496.

🤖 Generated with Claude Code

Companion to the 8.0-line fix in #4496. The bug — NullReferenceException
when combining .UseOptimisticConcurrency(true) with
AllDocumentsAreMultiTenantedWithPartitioning(...) — doesn't reproduce
on master because the offending code path
(Marten/Storage/UpsertFunction.cs) was retired in #4461's closed-shape
storage rewrite. The cherry-pick of the 8.0 patch therefore omits
the UpsertFunction.cs edit (file no longer exists) and lands only
the regression test.

Test exercises the exact configuration shape from the reporter's
repro: .UseOptimisticConcurrency(true) on a document plus
AllDocumentsAreMultiTenantedWithPartitioning with two list
partitions, then applies the schema and round-trips a document
through one of the partitions. Acts as a regression-prevention
guard against any future change that re-introduces a similar
null-traversal in the partition-aware DDL generation.

Passes on net9.0 / net10.0.

Closes #4493.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit 86720e8 into master May 19, 2026
6 checks passed
@jeremydmiller jeremydmiller deleted the fix/4493-optimistic-partitioning-master branch May 19, 2026 15:36
@jeremydmiller jeremydmiller mentioned this pull request May 19, 2026
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimistic Concurrency and Partitioning causes Marten to fail when creating an Upsert function

1 participant