Skip to content

Store message redirects - #5683

Open
johnsimons wants to merge 2 commits into
john/store_commentsfrom
john/message_redirects
Open

Store message redirects#5683
johnsimons wants to merge 2 commits into
john/store_commentsfrom
john/message_redirects

Conversation

@johnsimons

Copy link
Copy Markdown
Member

Message redirect persistence for the SQL Server and PostgreSQL persisters.

Changes

  • MessageRedirects table keyed on FromPhysicalAddress, since MessageRedirectId is a hash of it, with migrations for both providers.
  • IMessageRedirectsDataStore exposes AddRedirect, UpdateRedirect and RemoveRedirect rather Save(collection), since every caller changes a single redirect. GetRedirects still all of them for the API's duplicate and dependents validation.
  • The Raven specific parts move into the Raven project: the stored document type, its tick based and the change vector handling. Storage there is unchanged. The shared model keeps the itself, with lookups as extension methods.
  • IRetryBatchesManager.GetOrCreateMessageRedirectsCollection duplicated the store's read, so it removed and RetryProcessor takes IMessageRedirectsDataStore.

Behaviour changes

  • ETag value are computed deterministically from the payload. But this are is going to be revisited.
  • Concurrency is now per redirect rather than across all of them. RavenDB keeps every redirect in a document, so two admins editing at the same time contend on that document even when they changing different redirects, and one of them fails. With a row per redirect, edits to redirects no longer interfere at all, and two edits to the same redirect are last write instead of a failure.

@rbev rbev Aug 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be doing RavenDB/API refactorings in standalone PRs so that it's easier on anyone doing a SC release.

@johnsimons
johnsimons force-pushed the john/message_redirects branch from cbf2369 to e75d22b Compare August 3, 2026 05:15
@johnsimons
johnsimons force-pushed the john/message_redirects branch from e75d22b to 3d0e3aa Compare August 3, 2026 05:58
Adds a MessageRedirects table for SQL Server and PostgreSQL, keyed on FromPhysicalAddress since MessageRedirectId is a deterministic hash of it.

IMessageRedirectsDataStore now exposes AddRedirect, UpdateRedirect and RemoveRedirect instead of Save(collection), because every caller changes one redirect at a time. Reads still return all of them, which the API needs for its validation.

The Raven specific parts move into the Raven project: the stored document type, its tick based timestamp and the change vector handling. What is left in the shared model is the redirect itself, with the lookups as extension methods.

IRetryBatchesManager.GetOrCreateMessageRedirectsCollection duplicated the store's read, so it is removed and RetryProcessor takes IMessageRedirectsDataStore directly. The redirect GET endpoints compute their ETag from the payload.
@johnsimons
johnsimons force-pushed the john/message_redirects branch from 3d0e3aa to d6a72a1 Compare August 3, 2026 06:51
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.

2 participants