Commit Graph

7771 Commits

Author SHA1 Message Date
Lev Brouk
1ce772c1a0 Added: reload server config by sending it a message
gofmt

PR feedback: test that a regular account can not reload

PR feedback: set response.Data to nil on success
2023-07-19 12:04:19 -07:00
Derek Collison
e1a00a883c Fix bug that would race around check for last sequence per subject
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-18 12:39:06 -07:00
Derek Collison
efbfe217f4 Moved to end for merge with other branches, minor changes
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-18 12:39:06 -07:00
Byron Ruth
16a336ead3 Add test case for concurrent expected last subject sequence
Signed-off-by: Byron Ruth <byron@nats.io>
2023-07-18 12:39:06 -07:00
Derek Collison
3173d435b1 Initial support for zOS (#4209)
zOS is an IBM Z (mainframe) operating system. In the days of yore, it
was MVS.

 - [ ] Link to issue, e.g. `Resolves #NNN`
 - [ ] Documentation added (if applicable)
 - [ ] Tests added
- [x] Branch rebased on top of current main (`git pull --rebase origin
main`)
- [x] Changes squashed to a single commit (described
[here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
 - [x] Build is green in Travis CI
- [x] You have certified that the contribution is your original work and
that you license the work to the project under the [Apache 2
license](https://github.com/nats-io/nats-server/blob/main/LICENSE)

Resolves - the inability to build on zOS.

### Changes proposed in this pull request:

 - This PR adds a couple of files to allow building nats-server on zOS.
2023-07-18 12:21:31 -07:00
Derek Collison
ecf0fff411 Merge branch 'main' into dev 2023-07-17 10:41:51 -07:00
Derek Collison
75ad503ddc Limit branch builds to main and dev (#4312) 2023-07-17 10:39:34 -07:00
Byron Ruth
94c1988ed8 Limit branch builds to main and dev
Signed-off-by: Byron Ruth <byron@nats.io>
2023-07-15 07:01:24 -04:00
Waldemar Quevedo
c1750b8a54 De-flake a few tests (#4311)
This should hopefully make a small handful of tests less flakey.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 09:57:23 -07:00
Neil Twigg
2527e11304 Increase threshold in TestNoRaceJetStreamSlowFilteredInititalPendingAndFirstMsg
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 17:05:26 +01:00
Neil Twigg
6cdb0c7838 Wait for current in TestJetStreamClusterStreamUpdateSyncBug so in-flight state changes aren't lost
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 17:03:21 +01:00
Neil Twigg
abb47c9554 Only send one message in TestJetStreamRedeliverCount to prevent out-of-order redeliveries
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 16:56:01 +01:00
Neil Twigg
144abc0dd9 Make TestJetStreamAccountImportJSAdvisoriesAsService insensitive to event order
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 16:51:51 +01:00
Neil Twigg
b58204cff7 Use checkFor in TestJetStreamMsgHeaders
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 16:44:24 +01:00
Neil Twigg
979b265e26 Tweak timing in TestJetStreamClusterDeleteConsumerWhileServerDown
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 16:44:15 +01:00
Neil
6e0c0bc61d Remap ports in leaf node tests to hopefully reduce flakes (#4309)
Multiple tests were using the same port numbers and it seems that the
NATS Servers were not always shutting down quickly enough or the test is
reusing a port that was already assigned ephemerally, resulting in
`listen tcp 127.0.0.1:50554: bind: address already in use` failures.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 15:36:16 +01:00
Neil Twigg
81dd129043 Move assigned ports out of ephemeral range
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 15:08:17 +01:00
Neil Twigg
586717a3c0 Remap ports in leaf node tests to hopefully reduce flakes
Multiple tests were using the same port numbers and it seems that the
NATS Servers were not always shutting down quickly enough, resulting
in `listen tcp 127.0.0.1:50554: bind: address already in use` failures.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 13:49:15 +01:00
Neil
71db34baf7 Bump v2.9.21-beta (#4306) 2023-07-14 13:48:59 +01:00
Neil
40c5770cfc Use crypto/rand.Read instead of math/rand.Read (#4256)
As of Go 1.20, `math/rand.Read` is deprecated. In addition to that, it
also isn't recommended for use in combination with anything
cryptographic.

I haven't replaced all `math/rand` imports with `crypto/rand` imports
because there are still some legitimate uses for the `math/rand` package
in some places.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-14 11:23:45 +01:00
Byron Ruth
63864490a5 Bump v2.9.21-beta
Signed-off-by: Byron Ruth <byron@nats.io>
2023-07-13 16:04:11 -04:00
Waldemar Quevedo
97dd7cb07a Release v2.9.20 (#4305) 2023-07-13 13:00:38 -07:00
Byron Ruth
b055f675ba Release v2.9.20 2023-07-13 15:29:30 -04:00
Derek Collison
ff10e7befe Bump to Go 1.19.11 (#4304) 2023-07-13 11:03:11 -07:00
Byron Ruth
4e6a09400a Bump to Go 1.19.11
Signed-off-by: Byron Ruth <byron@nats.io>
2023-07-13 14:00:38 -04:00
Derek Collison
d5a91f43f3 Merge branch 'main' into dev 2023-07-13 07:29:40 -07:00
Derek Collison
77189b09c7 [FIXED] JetStream republished messages not being received by MQTT QoS0 subscribers (#4303)
Only discard messages from MQTT QoS0 from internal JetStream clients if
really a QoS1 JetStream publish, not just a JetStream client.

Signed-off-by: Derek Collison <derek@nats.io>

Resolves #4291
2023-07-13 07:26:26 -07:00
Neil Twigg
1527000d1f Use crypto/rand.Read instead of math/rand.Read
As of Go 1.20, `math/rand.Read` is deprecated. In addition to that, it also
isn't recommended for use in combination with anything cryptographic.

I haven't replaced all `math/rand` with `crypto/rand` imports because there
are still some legitimate uses for the `math/rand` package in some places.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-13 12:04:58 +01:00
Derek Collison
1f39d744dd Only discard messages from MQTT QoS0 from internal jetstream clients if really a QoS1 jetstream publish.
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-12 16:00:59 -07:00
Derek Collison
0c8552cd34 Evaluate service imports when publishing advisories (#4302)
This should fix #4275 by allowing advisories to be copied into other
accounts via service imports.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-12 12:24:00 -07:00
Neil Twigg
1434ee7da8 More specific check for service imports vs any internal sub
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-12 19:52:31 +01:00
Neil Twigg
fbbbe28278 Evaluate service imports when publishing advisories
Signed-off-by: Neil Twigg <neil@nats.io>
2023-07-12 18:18:57 +01:00
Derek Collison
cda7bcd389 Merge branch 'main' into dev 2023-07-12 09:06:44 -07:00
Derek Collison
9cfe8b8f75 [FIXED] Restore of encrypted filestore with no main key could cause dataloss (#4301)
When restoring a filestore with no key generator but it was encrypted,
fail to restore.

Signed-off-by: Derek Collison <derek@nats.io>
2023-07-12 08:47:42 -07:00
Piotr Piotrowski
e3b132ae34 Test for gathering JS advisories from multiple accounts on a single account
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
2023-07-12 13:26:18 +01:00
Derek Collison
cb1ff10670 Fix to test for new routes
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-11 19:45:39 -07:00
Derek Collison
87c544946b Fix test for new routing
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-11 18:35:45 -07:00
Derek Collison
9e9a9a082b When restoring a filestore with no key generator but it was encrypted, fail to restore.
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-11 16:27:50 -07:00
Derek Collison
bd2753d9f6 Adapt to new server structure for routes
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-11 14:45:29 -07:00
Derek Collison
11e5e049cf Merge branch 'main' into dev 2023-07-11 14:36:10 -07:00
Derek Collison
5390272074 Bump to 2.9.20-beta
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-11 14:29:17 -07:00
Derek Collison
97dbd6b28e [FIXED] Duplicate queue subs over leafnodes with hub stream import/export with possible dataloss (#4299)
When a queue subscriber was updated multiple times over a leafnode
connection we added in more shadow subscriptions which could become
zombies when the connection went away.

In a case where a leafnode server had multiple queue subscribers on the
same queue group, the hub server would add in multiple shadow subs.
These subs would not be properly cleaned up and could lead to stale
connections being associated with them.

Signed-off-by: Derek Collison <derek@nats.io>
2023-07-11 06:52:26 -07:00
Derek Collison
353d543c16 When a queue subscriber was updated multiple times over a leafnode connection we added in more shadow subscriptions which could become zombies when the connection went away.
In a case where a leafnode server had multiple queue subscribers on the same queue group, the hub server would add in multiple shadow subs. These subs would not be properly cleaned up and could lead to stale connections being associated with them.

Signed-off-by: Derek Collison <derek@nats.io>
2023-07-10 21:03:47 -07:00
Jean-Noël Moyne
69e137c3d2 [FIXED] Stream config idempotency (#4292)
- [X] Branch rebased on top of current main (`git pull --rebase origin
main`)
- [X] Changes squashed to a single commit (described
[here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
 - [x] Build is green in Travis CI
- [X] You have certified that the contribution is your original work and
that you license the work to the project under the [Apache 2
license](https://github.com/nats-io/nats-server/blob/main/LICENSE)

Fixes a behavior where idempotency of re-defining the same stream more
than once (with the same attributes) was broken due to the DeepEqual
failing due to the StreamSource struct received from the client app not
having a value for the `iname` structure field (as it's internal) but
the StreamSource struct return from `mset.config()` would have it set.

Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
2023-07-07 11:32:09 -07:00
Derek Collison
20ce582b82 Bump to 2.10.0-beta.44
Signed-off-by: Derek Collison <derek@nats.io>
2023-07-05 09:18:29 -07:00
Derek Collison
a393653944 Add in support for segmented binary stream snapshots. (#4284)
Streams with many interior deletes was causing issues due to the fact
that the interior deletes were represented as a sorted []uint64. This
could cause snapshots for streams R>1 and with lots of interior deletes
to take up more memory and cpu then we want.

This new approach introduces 3 sub types of delete blocks, an avl
bitmask tree, a run length encoding, and the legacy format above. We
also take into account large interior deletes such that on receiving a
snapshot we can skip things we already know about.

Signed-off-by: Derek Collison <derek@nats.io>
2023-07-05 09:17:02 -07:00
Derek Collison
4d7cd26956 Add in support for segmented binary stream snapshots.
Streams with many interior deletes was causing issues due to the fact that the interior deletes were represented as a sorted []uint64.
This approach introduces 3 sub types of delete blocks, avl bitmask tree, a run length encoding, and the legacy format above.
We also take into account large interior deletes such that on receiving a snapshot we can skip things we already know about.

Signed-off-by: Derek Collison <derek@nats.io>
2023-07-03 08:41:33 -07:00
Derek Collison
eb2aa352ec Updated Leafnode Test (#4283)
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-30 11:06:11 -07:00
Derek Collison
b207984a84 Made cloud clusters 5 nodes each
Signed-off-by: Derek Collison <derek@nats.io>
2023-06-30 10:12:39 -07:00
Neil
57015472a9 Add TestRouteNoLeakOnSlowConsumer and TestRouteNoLeakOnAuthTimeout (#4153)
These tests are to help verify that routes aren't leaking when they go
down for write deadlines or auth failures.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-06-30 15:34:07 +01:00