Skip to content

Reset composite members' per-tenant progression before a per-tenant rebuild - #5829

Merged
jeremydmiller merged 1 commit into
masterfrom
fix/per-tenant-composite-rebuild-progress
Nov 5, 2026
Merged

jeremydmiller merged 1 commit into
masterfrom
fix/per-tenant-composite-rebuild-progress

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Problem

DeleteProjectionProgressAsync(database, name, tenantId) is the reset a per-tenant rebuild runs first. For a composite, it tore down every member's tenant documents but deleted only the composite's own per-tenant progression row.

Once the members had progressed (any continuous run), the rebuild's first batch inserted every member's progression from the floor and failed on pk_mt_event_progression. The shard paused with nothing rebuilt:

23505: duplicate key value violates unique constraint "pk_mt_event_progression"
Stopping single-pass composite rebuild for split-composite:All:split_0 at 0; agent status is Paused

This is reachable today through RebuildProjectionAsync(composite, tenantId, ...). JasperFx/jasperfx#1128 makes every store-wide rebuild fan out per tenant under UseTenantPartitionedEvents, because the store-global replay was silently dropping events there. With that change, every store-wide composite rebuild on a partitioned store would hit this, so this should land before or with the JasperFx pin bump.

Change

The tenant-scoped reset now deletes the tenant's progression row for every leaf's shards as well as the composite's own, matching what the store-global teardownProjectionStorage already does per leaf.

Tests

Once #1128 ships, the pin bump should also add a store-wide rebuild regression test: a composite with BatchSize = 10 over 6 tenants, which loses events on 2.98.0.

🤖 Generated with Claude Code

…ebuild

DeleteProjectionProgressAsync(database, name, tenantId) tore down every composite member's tenant
documents but deleted only the composite's own per-tenant progression row. Once the members had
progressed (any continuous run), the rebuild's first batch inserted every member's progression from
the floor and failed on pk_mt_event_progression, pausing the shard with nothing rebuilt. The
store-global teardown already drops each leaf's rows; the per-tenant reset now does the same for the
tenant's rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant