Skip to content

(2.12) Atomic batch: support Nats-Expected-Last-Sequence, Nats-Rollup, DiscardNew #7119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 5, 2025

Conversation

MauriceVanVeen
Copy link
Member

Add support for the Nats-Expected-Last-Sequence and Nats-Rollup headers for batching, as well as DiscardNew support.

To do this we need to be able to fully rely on clustered-level consistency checks, such that followers will always apply them and never call bumpCLFS(). Just a few cases remain, but these should not be problematic. Now we can rely on mset.clseq - mset.clfs to be what the highest last sequence is going to be, which can then be compared in consistency checks.

Nats-Rollup additionally has some batch-specific consistency checks:

  • Nats-Rollup: all is allowed only on the first message. Using it on any later message would mean you'd be purging data at the start of the batch.
  • Nats-Rollup: sub is only allowed on the first message of a specific subject. If allowed on a later message with the same subject, that would mean you'd be purging data at the start of the batch. This means we can allow rolling up multiple subjects in the batch at once.

Resolves #6975

Signed-off-by: Maurice van Veen [email protected]

@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner July 30, 2025 14:31
@MauriceVanVeen MauriceVanVeen force-pushed the maurice/batch-last-seq branch 3 times, most recently from 8829037 to ad44816 Compare August 4, 2025 08:32
@MauriceVanVeen MauriceVanVeen force-pushed the maurice/batch-last-seq branch from ad44816 to ffce154 Compare August 5, 2025 09:24
Copy link
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM

@neilalexander neilalexander merged commit 4a8e584 into main Aug 5, 2025
90 of 92 checks passed
@neilalexander neilalexander deleted the maurice/batch-last-seq branch August 5, 2025 10:22
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.

Batch publish - Nats-Expected-Last-Sequence and Nats-Rollup header support
2 participants