Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8738d70
Correctly handle updates to `AllowMsgTTL` on streams
neilalexander May 23, 2025
cf0a2ad
[FIXED] LeafNode: Unable to reply if origin originates from super-clu…
kozlovic May 28, 2025
0fb233b
Don't hold `clsMu` while purging stream consumers
neilalexander May 30, 2025
b6ba44f
Fix lock contention issue when reporting stream ingest warnings
wallyqs Jun 2, 2025
f56523d
Update CI to test Windows Server LTSC2022/2025 builds
neilalexander Jun 3, 2025
4d0a04c
[IMPROVED] NRG: Clarify log when resetting WAL
MauriceVanVeen Jun 3, 2025
0db7160
De-flake `TestPSEmulation`
neilalexander Jun 3, 2025
7f7f139
Correct copyrights in `.go` files
neilalexander Jun 4, 2025
fe1f6e4
[FIXED] Attempt stream snapshot on shutdown
MauriceVanVeen Jun 4, 2025
2e8d4e9
[FIXED] Desync after partial catchup from old leader
MauriceVanVeen Jun 4, 2025
444b392
Added in additional tests and one minor bug fix
derekcollison Jun 5, 2025
b796329
NRG: Don't respond success to catchup messages
MauriceVanVeen Jun 5, 2025
dd92b02
NRG: Ignore track response if not leader anymore
MauriceVanVeen Jun 5, 2025
d361682
De-flake TestNoRaceJetStreamKVReplaceWithServerRestart
MauriceVanVeen Jun 6, 2025
62509a9
Update to Go 1.24.4/1.23.10
neilalexander Jun 6, 2025
11c1d9d
Include leaf node connections in `connz`
neilalexander Jun 6, 2025
a3a3daf
Fix `TestMonitorConnzOperatorAccountNames`
neilalexander Jun 6, 2025
e9a2108
Update dependencies
neilalexander Jun 9, 2025
e1ec2ca
Test replicated consumer with NoWait request
piotrpio Jun 10, 2025
c5cdbd0
[FIXED] Replicated consumer's messages are returned after NoWait's re…
MauriceVanVeen Jun 10, 2025
b7a37f9
[FIXED] Remove expected headers when mirroring
MauriceVanVeen Jun 10, 2025
db670a1
NRG: Only allow highest known term for catchup
MauriceVanVeen Jun 6, 2025
3c48577
Place `lterm` at the end of encoded AE, no longer need headers
neilalexander Jun 9, 2025
25711e8
[FIXED] Hold mset.clMu when reading mset.clfs
MauriceVanVeen Jun 11, 2025
7bb98a4
NRG: Improve docs & fix ae response leak
MauriceVanVeen Jun 12, 2025
1c30fca
Allow our testing proxy to be restarted to simulate network down events
derekcollison Jun 15, 2025
a283066
Speed up the creation of sync consumers for mirrors or sources after …
derekcollison Jun 15, 2025
8ee66aa
[FIXED] Data race on copy stream metadata
MauriceVanVeen Jun 17, 2025
a22300c
[FIXED] Cluster node skew race
MauriceVanVeen Jun 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
os: [windows-2022, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ builds:
env:
# This is the toolchain version we use for releases. To override, set the env var, e.g.:
# GORELEASER_TOOLCHAIN="go1.22.8" TARGET='linux_amd64' goreleaser build --snapshot --clean --single-target
- GOTOOLCHAIN={{ envOrDefault "GORELEASER_TOOLCHAIN" "go1.24.3" }}
- GOTOOLCHAIN={{ envOrDefault "GORELEASER_TOOLCHAIN" "go1.24.4" }}
- GO111MODULE=on
- CGO_ENABLED=0
goos:
Expand Down
2 changes: 1 addition & 1 deletion conf/fuzz.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 The NATS Authors
// Copyright 2020-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion conf/parse.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2013-2024 The NATS Authors
// Copyright 2013-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ module github.com/nats-io/nats-server/v2

go 1.23.0

toolchain go1.23.9
toolchain go1.23.10

require (
github.com/antithesishq/antithesis-sdk-go v0.4.3-default-no-op
github.com/google/go-tpm v0.9.5
github.com/klauspost/compress v1.18.0
github.com/minio/highwayhash v1.0.3
github.com/nats-io/jwt/v2 v2.7.4
github.com/nats-io/nats.go v1.42.0
github.com/nats-io/nats.go v1.43.0
github.com/nats-io/nkeys v0.4.11
github.com/nats-io/nuid v1.0.1
go.uber.org/automaxprocs v1.6.0
golang.org/x/crypto v0.38.0
golang.org/x/crypto v0.39.0
golang.org/x/sys v0.33.0
golang.org/x/time v0.11.0
golang.org/x/time v0.12.0
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD
github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=
github.com/nats-io/jwt/v2 v2.7.4 h1:jXFuDDxs/GQjGDZGhNgH4tXzSUK6WQi2rsj4xmsNOtI=
github.com/nats-io/jwt/v2 v2.7.4/go.mod h1:me11pOkwObtcBNR8AiMrUbtVOUGkqYjMQZ6jnSdVUIA=
github.com/nats-io/nats.go v1.42.0 h1:ynIMupIOvf/ZWH/b2qda6WGKGNSjwOUutTpWRvAmhaM=
github.com/nats-io/nats.go v1.42.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
github.com/nats-io/nats.go v1.43.0 h1:uRFZ2FEoRvP64+UUhaTokyS18XBCR/xM2vQZKO4i8ug=
github.com/nats-io/nats.go v1.43.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
github.com/nats-io/nkeys v0.4.11 h1:q44qGV008kYd9W1b1nEBkNzvnWxtRSQ7A8BoqRrcfa0=
github.com/nats-io/nkeys v0.4.11/go.mod h1:szDimtgmfOi9n25JpfIdGw12tZFYXqhGxjhVxsatHVE=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
Expand All @@ -24,12 +24,12 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion internal/testhelper/logging.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2024 The NATS Authors
// Copyright 2019-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
8 changes: 6 additions & 2 deletions locksordering.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ clearObserverState so that they cannot interleave which would leave Raft nodes i
inconsistent observer states.

jscmMu -> Account -> jsAccount
jscmMu -> stream.clsMu
jscmMu -> RaftNode
jscmMu -> stream.clsMu
jscmMu -> RaftNode

The "clsMu" lock protects the consumer list on a stream, used for signalling consumer activity.

stream -> clsMu
2 changes: 1 addition & 1 deletion logger/log.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion logger/log_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2023 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion logger/syslog.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion logger/syslog_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2021 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion logger/syslog_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion logger/syslog_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
4 changes: 2 additions & 2 deletions scripts/updateCopyrights.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ git ls-files "*.go" | while read -r file; do
current_copyright=$(grep -oE "^// Copyright [0-9]{4}(-[0-9]{4})? The NATS Authors" "$file" || echo "")
[[ -z "$current_copyright" ]] && continue

# Get the last commit year for the file
last_year=$(git log --follow --format="%ad" --date=format:%Y -- "$file" | head -1)
# Get the last commit year for the file, ignore commit messages containing the word "copyright"
last_year=$(git log --follow --format="%ad" --date=format:%Y --grep="(C|c)opyright" --invert-grep -n 1 -- "$file")
existing_years=$(echo "$current_copyright" | grep -oE "[0-9]{4}(-[0-9]{4})?")

# Determine the new copyright range
Expand Down
2 changes: 1 addition & 1 deletion server/auth.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/auth_callout.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2024 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/auth_callout_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2024 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/avl/norace_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023-2024 The NATS Authors
// Copyright 2023-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/avl/seqset.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023-2024 The NATS Authors
// Copyright 2023-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/certstore/certstore.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2024 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/certstore/certstore_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2023 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/certstore/certstore_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2024 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/certstore_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2024 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/ciphersuites.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2020 The NATS Authors
// Copyright 2016-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
12 changes: 10 additions & 2 deletions server/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3494,10 +3494,18 @@ func (c *client) deliverMsg(prodIsMQTT bool, sub *subscription, acc *Account, su

// Check if we are a leafnode and have perms to check.
if client.kind == LEAF && client.perms != nil {
if !client.pubAllowedFullCheck(string(subject), true, true) {
var subjectToCheck []byte
if subject[0] == '_' && bytes.HasPrefix(subject, []byte(gwReplyPrefix)) {
subjectToCheck = subject[gwSubjectOffset:]
} else if subject[0] == '$' && bytes.HasPrefix(subject, []byte(oldGWReplyPrefix)) {
subjectToCheck = subject[oldGWReplyStart:]
} else {
subjectToCheck = subject
}
if !client.pubAllowedFullCheck(string(subjectToCheck), true, true) {
mt.addEgressEvent(client, sub, errMsgTracePubViolation)
client.mu.Unlock()
client.Debugf("Not permitted to deliver to %q", subject)
client.Debugf("Not permitted to deliver to %q", subjectToCheck)
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/closed_conns_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018-2022 The NATS Authors
// Copyright 2018-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/config_check_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018-2024 The NATS Authors
// Copyright 2018-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/const.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
11 changes: 7 additions & 4 deletions server/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4479,6 +4479,7 @@ func (o *consumer) loopAndGatherMsgs(qch chan struct{}) {
delay time.Duration
sz int
wrn, wrb int
wrNoWait bool
)

o.mu.Lock()
Expand Down Expand Up @@ -4557,7 +4558,7 @@ func (o *consumer) loopAndGatherMsgs(qch chan struct{}) {
if o.isPushMode() {
dsubj = o.dsubj
} else if wr := o.nextWaiting(sz); wr != nil {
wrn, wrb = wr.n, wr.b
wrn, wrb, wrNoWait = wr.n, wr.b, wr.noWait
dsubj = wr.reply
if o.cfg.PriorityPolicy == PriorityPinnedClient {
// FIXME(jrm): Can we make this prettier?
Expand Down Expand Up @@ -4632,7 +4633,7 @@ func (o *consumer) loopAndGatherMsgs(qch chan struct{}) {
}

// Do actual delivery.
o.deliverMsg(dsubj, ackReply, pmsg, dc, rp)
o.deliverMsg(dsubj, ackReply, pmsg, dc, rp, wrNoWait)

// If given request fulfilled batch size, but there are still pending bytes, send information about it.
if wrn <= 0 && wrb > 0 {
Expand Down Expand Up @@ -4831,7 +4832,7 @@ func convertToHeadersOnly(pmsg *jsPubMsg) {

// Deliver a msg to the consumer.
// Lock should be held and o.mset validated to be non-nil.
func (o *consumer) deliverMsg(dsubj, ackReply string, pmsg *jsPubMsg, dc uint64, rp RetentionPolicy) {
func (o *consumer) deliverMsg(dsubj, ackReply string, pmsg *jsPubMsg, dc uint64, rp RetentionPolicy, wrNoWait bool) {
if o.mset == nil {
pmsg.returnToPool()
return
Expand Down Expand Up @@ -4867,7 +4868,9 @@ func (o *consumer) deliverMsg(dsubj, ackReply string, pmsg *jsPubMsg, dc uint64,
// If we're replicated we MUST only send the message AFTER we've got quorum for updating
// delivered state. Otherwise, we could be in an invalid state after a leader change.
// We can send immediately if not replicated, not using acks, or using flow control (incompatible).
if o.node == nil || ap == AckNone || o.cfg.FlowControl {
// TODO(mvv): If NoWait we also bypass replicating first.
// Ideally we'd only send the NoWait request timeout after replication and delivery.
if o.node == nil || ap == AckNone || o.cfg.FlowControl || wrNoWait {
o.outq.send(pmsg)
} else {
o.addReplicatedQueuedMsg(pmsg)
Expand Down
2 changes: 1 addition & 1 deletion server/core_benchmarks_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023-2024 The NATS Authors
// Copyright 2023-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/dirstore.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/dirstore_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2022 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/disk_avail.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2022 The NATS Authors
// Copyright 2020-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/disk_avail_netbsd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/disk_avail_openbsd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 The NATS Authors
// Copyright 2021-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/disk_avail_wasm.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022-2021 The NATS Authors
// Copyright 2022-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/disk_avail_windows.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2021 The NATS Authors
// Copyright 2020-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/errors.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2024 The NATS Authors
// Copyright 2012-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion server/errors_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2024 The NATS Authors
// Copyright 2020-2025 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down
9 changes: 8 additions & 1 deletion server/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,13 @@ func (fs *fileStore) UpdateConfig(cfg *StreamConfig) error {
return err
}

// Create or delete the THW if needed.
if cfg.AllowMsgTTL && fs.ttls == nil {
fs.ttls = thw.NewHashWheel()
} else if !cfg.AllowMsgTTL && fs.ttls != nil {
fs.ttls = nil
}

// Limits checks and enforcement.
fs.enforceMsgLimit()
fs.enforceBytesLimit()
Expand All @@ -666,7 +673,7 @@ func (fs *fileStore) UpdateConfig(cfg *StreamConfig) error {
}
fs.mu.Unlock()

if cfg.MaxAge != 0 {
if cfg.MaxAge != 0 || cfg.AllowMsgTTL {
fs.expireMsgs()
}
return nil
Expand Down
Loading
Loading