Commit Graph

5537 Commits

Author SHA1 Message Date
Derek Collison
11f0ea99a4 Merge branch 'main' into dev
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-06 13:33:47 -07:00
Waldemar Quevedo
e1574eca3e Revert "Enables 0s deduplication window duration when the stream has sources (#4476)"
This reverts commit db96238ad9.
2023-09-06 11:51:38 -07:00
Neil
628a54447c flake: Fixes TestAccountReqMonitoring (#4493)
Also fixes some tests using default JS dir instead of TempDir
2023-09-06 13:53:09 +01:00
Waldemar Quevedo
579968b60b flake: Fixes TestAccountReqMonitoring
Also fixes some tests using default JS dir instead of TempDir

Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-09-06 03:43:11 -07:00
Neil Twigg
25564087f9 Fix race condition in hashing stream snapshots
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-06 11:32:43 +01:00
Neil
7781407618 v2.10: Use Go 1.21 in nightlies, update rand usage (#4490)
- Use Go 1.21 in nightlies
- Both rand.Seed and rand.Read are both deprecated, remove its use to
fix staticcheck errors

```go
server/client.go:95:2: SA1019: rand.Seed has been deprecated since Go 1.20 and an alternative 
  has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. 
  Programs that call Seed with a known value to get a specific sequence of results should use 
  New(NewSource(seed)) to obtain a local random generator. (staticcheck)

server/jetstream_test.go:20399:2: SA1019: rand.Read has been deprecated since Go 1.20 
  because it shouldn't be used: For almost all use cases, crypto/rand.Read is more appropriate. (staticcheck)
```
2023-09-06 10:22:25 +01:00
Waldemar Quevedo
d144eaaed8 Replace rand.Rand with crypto/rand.Read in Go +1.20
Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-09-05 16:57:49 -07:00
Waldemar Quevedo
d5d8f29575 Remove rand.Seed use, not needed in Go +1.20
Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-09-05 16:55:04 -07:00
Lev Brouk
759715a2ba [FIXED] MQTT: panic in an error log 2023-09-05 14:39:28 -07:00
Neil Twigg
c539fb7e9a De-flake TestJetStreamClusterConsumerMaxDeliveryNumAckPendingBug by ignoring PushBound
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-05 15:11:21 +01:00
Waldemar Quevedo
d8bdbc34c4 Fix resetting TLS name from solicited remotes
In +Go 1.20, the x509.HostnameError changed to be wrapped in a
tls.CertificateVerificationError so sometimes the name would not
be reset.

This would make the `TestGatewayTLSMixedIPAndDNS` test flake sometimes.

Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-09-04 11:50:55 -07:00
Derek Collison
002446a51d Bump to 2.10.0-beta.55
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-04 11:34:12 -07:00
Derek Collison
e7e8a330d4 Allow sync intervals to be set and the ability to have all data writes synchronous.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-04 11:05:13 -07:00
Derek Collison
60e41aa8dc [FIXED] MQTT: more generic names for outgoing stream, etc. (#4484)
- [x] Branch rebased on top of current main (`git pull --rebase origin
dev`)
- [x] Changes squashed to a single commit (described
[here](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
 - [ ] Build is green in Travis CI

### Changes proposed in this pull request:

Removed `qos2` reference from the MQTT outgoing stream name and
subjects.

Rationale: As I was reviewing the documentation and thinking how to move
forward with MQTT, I am inclined to use the `$MQTT_out` stream and
session-specific consumers (as opposed to subscription-specific) for all
QOS-related packet delivery and PI persistence. I think I will be able
to repurpose it "as is", so proposing the generic name change.

Since these (stream, consumer, subscriptions) are newly introduced in
https://github.com/nats-io/nats-server/pull/4349 and have not yet been
released, this is a safe change.
2023-09-04 10:18:07 -07:00
Derek Collison
72dede6f84 [ADDED] README-MQTT.md: MQTT implementation notes (#4485)
### Changes proposed in this pull request:

- Adds MQTT implementation notes
2023-09-04 10:17:53 -07:00
Neil
bbbd2f939f Use TempDir in more tests (#4486)
This uses `TempDir` in more tests. Some were trying to manage the
directory manually, others were just not managing a directory at all.
There may be more that need doing.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-04 17:27:48 +01:00
Neil Twigg
8de83bc2ef Use TempDir in more tests
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-04 16:54:36 +01:00
Lev Brouk
885f88a9cd [ADDED] README-MQTT.md: MQTT implementation notes 2023-09-04 06:46:16 -07:00
Lev Brouk
b24941e6c6 [FIXED] MQTT: more generic names for outgoing stream, etc. 2023-09-04 05:32:58 -07:00
Derek Collison
1768f9c770 Always check for orphaned fss and idx files
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-03 14:31:55 -07:00
Derek Collison
ba5d9089b1 Tweak for flapper
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-03 14:31:28 -07:00
Derek Collison
2d2bb77f6e Optimize for restore time.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-03 14:14:00 -07:00
Derek Collison
4a5b76b0e8 Print out restore time for streams to nearest millisecond.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-03 13:28:18 -07:00
Derek Collison
e11ddb8bfe Merge branch 'main' into dev
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-02 14:22:57 -07:00
Derek Collison
34ae2bf4cb Fix for a bug that would make normal streams use the wrong block size.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-02 13:56:34 -07:00
Derek Collison
1bb4a71a4d Merge branch 'main' into dev
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-02 12:15:40 -07:00
Derek Collison
b63318c0c9 Bump to 2.9.22-RC.5
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-02 12:00:39 -07:00
Derek Collison
2c81224262 Fixed interface conversion for ipQueue in monitor which caused panics.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-02 11:43:08 -07:00
Marco Primi
e61e40e3fe Add benchmark for TLS content encryption overhead 2023-09-01 12:58:52 -07:00
Marco Primi
4eedfe8d0c Simplify core request/response benchmark
- Remove TLS, impact is negligible for the amount of data pushed
through
 - Rename benchmark
2023-09-01 12:58:52 -07:00
Marco Primi
bbf42c1f57 Use dynamic port number in benchmark 2023-09-01 12:58:52 -07:00
Jean-Noël Moyne
db96238ad9 Enables 0s deduplication window duration when the stream has sources (#4476)
- [X] Link to issue, e.g. `Resolves #NNN`
- [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 #4459

Allows the user to set the deduplication window duration to 0s when the
stream has sources defined. Remember that if the stream in question is
also listening on subjects as well as sourcing the deduplication window
is the same for sourced and listened messages.

---------

Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
2023-09-01 12:47:14 -07:00
Derek Collison
ad380d48f2 Merge branch 'main' into dev
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-01 11:19:33 -07:00
Derek Collison
aca74d0b27 Bump to 2.9.22-RC.4
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-01 09:44:53 -07:00
Waldemar Quevedo
ed8b50d943 Fix monitoring server connz idle time sorting (#4463)
- Changed how [`byIdle`](887a4ae692/server/monitor_sort_opts.go (L97))
struct compares the idle times (was subtracting the start time from the last activity time).

 - Added tests for `byIdle`.

- Changed and simplified the test
[`TestConnzSortedByIdle`](8a9f441c40/server/monitor_test.go (L1185))
(No need for the clients to publish and subscribe if we are manually
changing the client's `last` time, and we only need to test the sorting
order). Also the test was not catching the problem because the clients
`start` time was the same, now every client has a different start time.

Resolves #4462
2023-09-01 09:44:19 -07:00
Derek Collison
4422a95a8e We should update accounting before clearing ebit
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-01 09:31:12 -07:00
Derek Collison
c679f9d7f6 Added in detail info when failing to load in a message for a consumer.
E.g. `Unexpected partial cache error looking up message for consumer '$G > TEST > dlc'`

Signed-off-by: Derek Collison <derek@nats.io>
2023-09-01 09:06:29 -07:00
Derek Collison
3a39786972 When we fail to deliver a message for a consumer, either through didNotDeliver() or LoadMsg() failure re-adjust delivered count and waitingRequest accounting.
Signed-off-by: Derek Collison <derek@nats.io>
2023-09-01 08:48:28 -07:00
Pierre Mdawar
d24d51292f Fix monitoring server connz idle time sorting 2023-09-01 14:32:08 +03:00
Neil Twigg
487f58f16e Consumers inherit limits for max_ack_pending and inactive_threshold from stream
Signed-off-by: Neil Twigg <neil@nats.io>
2023-09-01 10:54:11 +01:00
Derek Collison
4df5f515ca Fix for filestore data race on hash during snapshots
Signed-off-by: Derek Collison <derek@nats.io>
2023-08-31 19:38:09 -07:00
Derek Collison
cb8b94a9e9 Fixes to /healthz response (v2.10) (#4467)
Follow up from #4437 content-type fix for v2.9.22, some fixes to the
response from `/healthz` for dev:

- In #[3326](https://github.com/nats-io/nats-server/pull/4097) it was
changed to return 500 status when before we used to return 503 so this
changes it back.
- Also as part of #3326 we started to return `status_code` in the
healthz response (e.g `{"status":"ok","status_code":200}`) so this
removes it for http responses just relying on the http header.
2023-08-31 19:26:33 -07:00
Derek Collison
83fab5c9a7 [FIXED] Unlock panic on start when filestore needs to remove msgs for enforcement. (#4469)
Signed-off-by: Derek Collison <derek@nats.io>
2023-08-31 19:26:03 -07:00
Derek Collison
0ec42f85f0 Fix for merge issue that duplicated the index increment, causing snapshot tests to fail
Signed-off-by: Derek Collison <derek@nats.io>
2023-08-31 18:51:34 -07:00
Derek Collison
411ac175fc Fixed: MQTT: more consistent name for PUBREL durable (#4466)
Resolves: no ticket

### Changes proposed in this pull request:

- rename PUBREL durable consumer from `<idhash>_pubrel` to
`$MQTT_PUBREL_<idhash>` for consistency with other durable consumer
names.
2023-08-31 17:15:00 -07:00
Derek Collison
60fa2d8781 Only have removeMsg release lock if it really has a callback.
Signed-off-by: Derek Collison <derek@nats.io>
2023-08-31 16:56:40 -07:00
Derek Collison
9ff3261af2 On startup make sure to hold lock for enforcing limits due to removeMsg() needing to remove msgs possibly.
Signed-off-by: Derek Collison <derek@nats.io>
2023-08-31 16:56:35 -07:00
Waldemar Quevedo
1f2d56a554 Fixes to http healthz monitoring response
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2023-08-31 16:05:09 -07:00
Derek Collison
b1a59a35e2 Bump to 2.10.0-beta.54
Signed-off-by: Derek Collison <derek@nats.io>
2023-08-31 15:52:58 -07:00
Derek Collison
2bfa14d9bd Fix from main merge
Signed-off-by: Derek Collison <derek@nats.io>
2023-08-31 15:52:36 -07:00