• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats-server / 19918001262
83%

Build:
DEFAULT BRANCH: main
Ran 04 Dec 2025 05:52AM UTC
Jobs 1
Files 61
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Dec 2025 02:14PM UTC coverage: 84.727%. Remained the same
19918001262

push

github

web-flow
[FIXED] Enforce DiscardNewPerSubject as stream leader (#7607)

Replicated streams using `DiscardNewPerSubject` and `MaxMsgsPerSubject`
had a chance of desyncing given a set of conditions:
- A server either needed to restart or be out-of-date such that it
requires stream-level catchup from a snapshot.
- At least one of those messages needs to be deleted, either through the
stream's retention or it being manually deleted, but the message delete
should not be registered in the above snapshot that's used for catchup
(since the delete happened after the snapshot).
- A client would actively try to publish a message on a subject that was
blocked by this discard policy.
- And, that deleted message's subject needs to equal what the client was
repeatedly publishing to.

Given these conditions, a follower that's being caught up could wrongly
decide to not store the original message (since it was deleted in the
meantime) and instead store the first client-retried message for that
subject after it finished catching up from the snapshot. This follower
would then diverge from the other servers in terms of what message data
is stored at what sequence.

This PR fixes that by never allowing followers to individually decide to
block a message based on the discard policy or not, instead enforcing
this at the stream leader. The stream leader can then ensure messages
that would fail due to the discard policy are rejected before being
proposed to the followers.

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>

74067 of 87418 relevant lines covered (84.73%)

335067.82 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
2
93.92
0.08% src/github.com/nats-io/nats-server/server/gateway.go
2
63.16
-10.53% src/github.com/nats-io/nats-server/server/jetstream_events.go
2
98.52
-1.48% src/github.com/nats-io/nats-server/server/jetstream_versioning.go
2
90.19
0.15% src/github.com/nats-io/nats-server/server/server.go
4
86.2
0.09% src/github.com/nats-io/nats-server/server/stream.go
5
90.08
-0.12% src/github.com/nats-io/nats-server/server/leafnode.go
8
73.32
-0.03% src/github.com/nats-io/nats-server/server/jetstream_api.go
9
86.91
-0.26% src/github.com/nats-io/nats-server/server/accounts.go
11
88.6
0.3% src/github.com/nats-io/nats-server/server/consumer.go
11
86.12
-0.52% src/github.com/nats-io/nats-server/server/events.go
14
83.6
0.58% src/github.com/nats-io/nats-server/server/filestore.go
16
79.11
-0.34% src/github.com/nats-io/nats-server/server/opts.go
22
89.56
0.0% src/github.com/nats-io/nats-server/server/mqtt.go
23
83.09
-0.36% src/github.com/nats-io/nats-server/server/memstore.go
32
87.28
-0.36% src/github.com/nats-io/nats-server/server/raft.go
44
82.53
-0.45% src/github.com/nats-io/nats-server/server/jetstream_cluster.go
Jobs
ID Job ID Ran Files Coverage
1 19918001262.1 04 Dec 2025 05:52AM UTC 61
84.73
GitHub Action Run
Source Files on build 19918001262
  • Tree
  • List 61
  • Changed 23
  • Source Changed 2
  • Coverage Changed 23
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #19918001262
  • 9e8381b8 on github
  • Prev Build on main (#19882693086)
  • Next Build on main (#19952967615)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc