Commit Graph

8378 Commits

Author SHA1 Message Date
Derek Collison
13dcf319b4 Make sure to not forward a message across a route for dq sub when we are a spoke leaf node.
Mimi same behavior for normal subs.

Signed-off-by: Derek Collison <derek@nats.io>
2023-09-24 13:15:39 -07:00
Waldemar Quevedo
637d8f2921 Skip enabling direct gets if no commits (#4576) 2023-09-22 17:25:35 -07:00
Waldemar Quevedo
89d33d960b Skip enabling direct gets if no commits
Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-09-22 17:08:46 -07:00
Derek Collison
bbe172df8d Bump to 2.10.2-RC.2
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-22 14:34:13 -07:00
Derek Collison
6fdcd1e78c [FIXED] Protect against going upside down on mb.msgs. (#4575)
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-22 14:30:51 -07:00
Derek Collison
2716248b5e Protect against going upside down on mb.msgs.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-22 14:17:45 -07:00
Derek Collison
ece431fc74 Bump to 2.10.2-RC.1
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-22 10:26:50 -07:00
Derek Collison
4bce936cec [IMPROVED] Make install snapshot errors rate limited for when catching up (#4574)
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-22 10:26:22 -07:00
Derek Collison
4824085171 Hold lock here as well
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-22 10:25:58 -07:00
Derek Collison
65e0fbfa51 Make install snapshot errors rate limited for when catching up
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-22 10:23:02 -07:00
Waldemar Quevedo
4cb7acb85e Bump v2.10.2 (#4569) 2023-09-21 19:01:05 -07:00
Derek Collison
24fe082467 [FIXED] We will panic since we unlock the mb in removeMsgBlock (#4571)
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-21 18:57:10 -07:00
Derek Collison
21e81a2961 We will panic since we unlock the mb in removeMsgBlock
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-21 18:34:38 -07:00
Byron Ruth
b36644b229 Bump v2.10.2
Signed-off-by: Byron Ruth <byron@nats.io>
2023-09-20 21:06:42 -04:00
Waldemar Quevedo
d3ef745f25 Release v2.10.1 (#4568) 2023-09-20 10:20:51 -07:00
Byron Ruth
4a1d399a21 Release v2.10.1
Signed-off-by: Byron Ruth <byron@nats.io>
2023-09-20 12:54:02 -04:00
Neil
496ca98c1a Fix consumer limits (#4567)
If Stream has consumer limits set, creating consumer with defaults will
fail in most cases.

Test didn't catch this, as by default, old JS client sets ack policy to
`none`. If the policy is different, it will fail to create consumer with
defaults. We agreed that default Ack Policy should be `explicit`

 Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
2023-09-20 17:07:11 +01:00
Tomasz Pietrek
ac2669a022 Fix consumer limits
Test didn't catch this error, as by default, old JS client
sets ack policy to none. If policy is different, it will fail
to create consumer with defaults.

Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
2023-09-20 17:37:05 +02:00
Neil
0623e4b4ea Remove subject_transform_dest (#4557)
Removes the single subject transform destination field any subject
transformation in StreamSources must now be done using the
SubjectTransforms array instead.
2023-09-20 15:57:56 +01:00
Jean-Noël Moyne
9fc2603263 Removes the single subject transform dest field from StreamSource
Co-authored-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Co-authored-by: Neil Twigg <neil@nats.io>

Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-20 15:28:45 +01:00
Neil
81c0a14193 Use new consumer create subject when single subject filter specified in SubjectFilters (#4564)
This fixes an issue where specifying a single subject filter, i.e. in
`SubjectFilters` or `SubjectTransforms`, instead of using
`SubjectFilter` would result in the old consumer create subject being
incorrectly used.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-20 13:02:53 +01:00
Jean-Noël Moyne
40ce0a9d7e Use filter_subject when calling extended consumer create API
The server consumer creation code is picky and does indeed not accept a request send to the ExT subject if that request specifies the subject filter in the array (even if there is only one entry in the array).

Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Signed-off-by: Neil Twigg <neil@nats.io>

Co-authored-by: Jean-Noël Moyne <jnmoyne@gmail.com>
Co-authored-by: Neil Twigg <neil@nats.io>
2023-09-20 10:51:19 +01:00
Neil Twigg
ad63d702c4 Use new consumer create subject when single subject filter specified in SubjectFilters
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-20 10:51:19 +01:00
Derek Collison
29ba4aa5dc [FIXED] LeafNode: TLS Handshake when remote does not have a tls{} block (#4565)
If a leafnode remote configuration does not have a tls{} block but
connect to a hub that requires TLS, the handshake between the two
servers will fail. A simple workaround is to add in the remote
configuration an empty tls{} block.

This issue was introduced in v2.10.0 due to some refactoring in order to
support compression.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2023-09-19 19:20:27 -07:00
Ivan Kozlovic
579ee3b828 [FIXED] LeafNode: TLS Handshake when remote does not have a tls{} block
If a leafnode remote configuration does not have a tls{} block but
connect to a hub that requires TLS, the handshake between the two
servers will fail. A simple workaround is to add in the remote
configuration an empty tls{} block.

This issue was introduced in v2.10.0 due to some refactoring in
order to support compression.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2023-09-19 19:50:50 -06:00
Neil
07a887bcfc Bump 2.10.1 (#4563) 2023-09-19 21:31:49 +01:00
Byron Ruth
6ba8272034 Bump 2.10.1
Signed-off-by: Byron Ruth <byron@nats.io>
2023-09-19 16:04:35 -04:00
Byron Ruth
77e198333f Release v2.10.0 (#4562) 2023-09-19 16:00:57 -04:00
Byron Ruth
f677536a88 Relase v2.10.0
Signed-off-by: Byron Ruth <byron@nats.io>
2023-09-19 15:26:16 -04:00
Neil
271b648fc7 Fix race condition in clientHasMovedToDifferentAccount (#4561)
Fixes #4560. The client lock needs to be held before accessing the
`c.opts`.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-19 19:22:28 +01:00
Neil Twigg
01872d2aa8 Fix empty string constants
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-19 19:07:17 +01:00
Neil Twigg
8b60131e92 Fix race condition in clientHasMovedToDifferentAccount
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-19 18:52:34 +01:00
Neil
ecbfac862c Ignore subject_transform_dest in stream sourcing (#4558)
This is a safer (less lines of code touched) alternative to #4557 for
now, which simply ignores the `subject_transform_dest` field in the API
and the stream assignments. We'll still look to merge the other PR to
clean up but will do so post-release when we have more time to test it.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-19 18:10:01 +01:00
Neil
f6268fd7c8 Fix data race in setStreamAssignment by ensuring JS lock held (#4559)
`addStreamWithAssignment` did not hold the JS lock at the point of
calling `setStreamAssignment`, which could result in a data race
accessing the Raft group peers from the stream assignment on line 774.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-19 18:09:49 +01:00
Neil Twigg
887b92bfe2 Fix data race in setStreamAssignment by ensuring JS lock held
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-19 17:42:25 +01:00
Neil Twigg
dff12e465e Ignore subject_transform_dest in stream sourcing
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-19 11:35:26 +01:00
Derek Collison
3dc0627811 Bump to 2.10.0-RC.6
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-18 13:53:25 -07:00
Waldemar Quevedo
2d23e9b348 Fix to stop forwarding proposals in consumers after scaling down a stream (#4556)
Sometimes when scaling down a stream, a raft node could continue
forwarding proposals after already being closed, in the debug logs this
can be confirmed by many entries logging 'Direct proposal ignored, not
leader (state: CLOSED)'.
2023-09-18 13:51:44 -07:00
Derek Collison
71b8a33456 Update to not pop directly, just bail when we detect leadership change
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-18 13:27:27 -07:00
Waldemar Quevedo
ea775a80e8 Skip TestJetStreamClusterRestartThenScaleStreamReplicas for now
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2023-09-18 12:46:53 -07:00
Derek Collison
850c89e175 When scaling a consumer down make sure to pop the loopAndForwardProposals go routine
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-18 12:26:25 -07:00
Waldemar Quevedo
27245891f2 Add test for scaling replica with pull consumers
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2023-09-18 12:26:05 -07:00
Derek Collison
de76275d8e Update of dependencies (#4555)
```
-       github.com/klauspost/compress v1.16.7
+       github.com/klauspost/compress v1.17.0
        github.com/minio/highwayhash v1.0.2
-       github.com/nats-io/jwt/v2 v2.5.0
+       github.com/nats-io/jwt/v2 v2.5.2
        github.com/nats-io/nats.go v1.29.0
-       github.com/nats-io/nkeys v0.4.4
+       github.com/nats-io/nkeys v0.4.5
        github.com/nats-io/nuid v1.0.1
        go.uber.org/automaxprocs v1.5.3
-       golang.org/x/crypto v0.12.0
+       golang.org/x/crypto v0.13.0
```
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-18 11:51:07 -07:00
Derek Collison
da70ef27b5 Update of dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-18 11:20:39 -07:00
Derek Collison
22514a033f Add logfile_max_num feature (#4548)
### Changes proposed in this pull request:

NATS Server 2.9 has `logfile_size_limit` option which allows the
operator to set an optional byte limit on the NATS Server log file which
when met causes a "rotation" such that the current log file is renamed
(original file name appended with a time stamp to nanosecond accuracy)
and a new log file is instantiated.

This PR is a new `logfile_max_num` companion option (alias
`log_max_num`) which allows the operator to designate that the server
should prune the **total number of log files** -- the currently active
log file plus backups -- to the maximum setting.

A max value of `0` (the implicit default) or a negative number has
meaning of unlimited log files (no maximum) as this is an opt-in
feature.

A max value of `1` is effectively a truncate-only logging pattern as any
backup made at rotation will subsequently be purged.

A max value of `2` will maintain the active log file plus the latest
backup. And so on...

> The currently active log file is never purged. Only backups are
purged.

When enabled, backup log deletion is evaluated inline after each
successful rotation event. To be considered for log deletion, backup log
files MUST adhere to the file naming format used in log rotation as well
as agree with the current `logfile` name and location. Any other files
or sub-directories in the log directory will be ignored. E.g. if an
operator makes a manual copy of the log file to `logfile.bak` that file
will not be evaluated as a backup.

### Typical use case:

This feature is useful in a constrained hosting environment for NATS
Server, for example an embedded, edge-compute, or IoT device scenario,
in which _more featureful_ platform or operating system log management
features do not exist or the complexity is not required.
2023-09-18 09:02:41 -07:00
Derek Collison
8f0e65fe0d Bump to 2.10.0-RC.5
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-17 21:38:34 -07:00
Derek Collison
216df811ff Various fixes and improvements to tombstone and buffer gaps. (#4553)
We fixed a few bugs in tombstone handling, and formalized support for
holes in the underlying buffers. Due to customer data from the field we
also now use holes during compaction.

Signed-off-by: Derek Collison <derek@nats.io>
2023-09-17 21:36:07 -07:00
Derek Collison
acffa0668a Various fixes and improvements to tombstone and buffer gaps.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-17 19:49:01 -07:00
Waldemar Quevedo
156e1a5b1c Fix for data race when changing retention policy (#4551) 2023-09-17 19:46:22 -07:00
Waldemar Quevedo
0e63608716 Fix for data race when changing retention policy
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2023-09-17 18:15:55 -07:00