Commit Graph

7101 Commits

Author SHA1 Message Date
Neil
3feb9f73b9 Add op type to panics (#4108)
This updates the `panic` messages on applying meta entries to include
the faulty op type, so that we can better work out what's going on in
these cases.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-27 13:02:28 +01:00
Neil Twigg
e30ea34625 Add op type to panics
Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-27 11:38:52 +01:00
Derek Collison
f584df4b4a [IMPROVED] Clustered consumer improvements (#4107)
Consumer state from Jsz() would not be consistent for a leader vs
follower.

ConsumerFileStore could encode an empty state or update an empty state
on startup.
We needed to make sure at the lowest level that the state was read from
disk and not depend on the upper layer consumer.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-26 17:22:32 -07:00
Derek Collison
9999f63853 ConsumerFileStore could encode an empty state or update an empty state on startup.
We needed to make sure at the lowest level that the state was read from disk and not depend on upper layer consumer.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-26 15:48:10 -07:00
Derek Collison
7f06d6f5a7 When Jsz() was asked for consumer details, would report incorrect data if not a consumer leader.
This is due to the way state is maintained for leaders vs followers for consumers.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-26 15:03:15 -07:00
Derek Collison
aea4a4115d Stream migration update (#4104)
I noticed that stream migration could be delayed due to transferring
leadership while the new leader was still paused for a upper layer
catchup, resulting in downgrading to a normal lost quorum vote. This
allows a leadership transfer to move ahead once the upper layer resumes.
Also check quicker but slow down if the state we need to have is not
there yet.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-26 08:14:46 -07:00
Derek Collison
83293f86ff Reduce threshold for compressing messages during a catchup
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-25 19:01:06 -07:00
Derek Collison
3c964a12d7 Migration could be delayed due to transferring leadership while the new leader was still paused.
Also check quicker but slow down if the state we need to have is not there yet.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-25 18:58:49 -07:00
Neil
08d341801f Restore outbound queue coalescing (#4093)
This PR effectively reverts part of #4084 which removed the coalescing
from the outbound queues as I initially thought it was the source of a
race condition.

Further investigation has proven that not only was that untrue (the race
actually came from the WebSocket code, all coalescing operations happen
under the client lock) but removing the coalescing also worsens
performance.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-25 15:53:00 +01:00
Derek Collison
70b635e337 Test that makes sure that assets can change be scaled after a cluster change. (#4101)
This is specifically when a cluster is reconfigured and the servers are
restarted with a new cluster name.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-25 07:45:46 -07:00
Neil Twigg
2206f9e468 Re-add coalescing to outbound queues
Originally I thought there was a race condition happening here,
but it turns out it is safe after all and the race condition I
was seeing was due to other problems in the WebSocket code.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-25 12:15:11 +01:00
Derek Collison
e25f89dc4d Do not fail healthz in single server mode on failed snapshot restore. (#4100)
In single server mode healthz could mistake a snapshot staging
direct…ory during a restore as an account.
If the restore took a long time, stalled, or was aborted, would cause
healthz to fail.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-24 22:49:55 -07:00
Derek Collison
47c6bfded4 Update server/jetstream_test.go
Fix spelling

Co-authored-by: Tomasz Pietrek <tomasz@nats.io>
2023-04-24 22:29:05 -07:00
Derek Collison
3340179b97 Fix flapper
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-24 22:22:27 -07:00
Derek Collison
c2649beded fix some comments (#4099) 2023-04-24 22:17:30 -07:00
Derek Collison
cae91b8cad In single server mode healthz could mistake a snapshot staging directory during a restore as an account.
If the restore took a long time, stalled, or was aborted, would cause healthz to fail.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-24 22:14:04 -07:00
cui fliter
f1f5a59e9b fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-25 11:28:59 +08:00
Derek Collison
c0f5b71a8f Test that makes sure that assets that have been created under a certain cluster can be upgraded to a new cluster.
This is specifically when a cluster is reconfigured and the servers are restarted with a new cluster name.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-24 20:06:20 -07:00
Derek Collison
b0d98df759 fix formatting of raft debug log (#4090)
Fixes this entry showing up:

```
[36571] 2023/04/22 06:53:37.278744 [DBG] RAFT [2DfzK1X6 - C-R3F-bzb7ShZ0] Stepping down from %!s(uint64=66), detected higher term: 65 vs %!d(string=leader)
```
2023-04-21 22:33:08 -07:00
Waldemar Quevedo
d9cc8b0363 fix formatting of raft debug log
Signed-off-by: Waldemar Quevedo <wally@nats.io>
2023-04-22 07:07:08 +02:00
Derek Collison
0e2eccd188 Update to the compress lib (#4088)
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 14:36:26 -07:00
Derek Collison
acc8e69f23 Update to the compress lib
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 14:18:54 -07:00
Derek Collison
04908962a1 Swap out flate from std library for faster one from compress. (#4087)
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 14:02:43 -07:00
Derek Collison
50522f117d New version of flate needed more payload at best speed to kick in
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 13:18:25 -07:00
Derek Collison
f9f4bf5c40 Run a check for ack floor drift. (#4086)
Also periodically check. If all normal will be very cheap.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 12:56:53 -07:00
Derek Collison
da9a17fd68 Spelling
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 12:40:19 -07:00
Derek Collison
57d06abbc9 Swap out flate from std for faster one
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 12:12:16 -07:00
Derek Collison
8b7c2d12aa Run a check for ack floor drift when taking over as a leader and the ack go routine is spun up.
Also periodically check. If all normal will be very cheap.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-21 11:59:35 -07:00
Derek Collison
01041ca1a6 Outbound queue improvements (#4084)
This extends the previous work in #3733 with the following:

1. Remove buffer coalescing, as this could result in a race condition
during the `writev` syscall in rare circumstances
2. Add a third buffer size, to ensure that we aren't allocating more
than we need to without coalescing
3. Refactor buffer handling in the WebSocket code to reduce allocations
and ensure owned buffers aren't incorrectly being pooled resulting in
further race conditions

Fixes nats-io/nats.ws#194.

Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-21 10:06:39 -07:00
Neil Twigg
5f884349db Remove TestClientOutboundQueueCoalesce as no longer needed
Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-21 15:40:49 +01:00
Neil Twigg
2ece00b08f Buffer re-use in WebSocket code, fix race conditions
Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-21 15:33:48 +01:00
Neil Twigg
bf286744dd Remove coalescing as it races with the writev syscall
Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-20 23:29:36 +01:00
Derek Collison
e96ae0bf79 A simpler stream state to detect change for snapshots. (#4074)
A stream could have a complicated state with interior deletes.
This is a simpler way to determine if we need to consider a snapshot
that involves much less time and CPU and memory.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-19 07:16:20 -07:00
Derek Collison
f6195a5ee3 A stream could have a complicated state with interior deletes.
This is a simpler way to determine if we need to consider a snapshot that involves much less time and CPU and memory.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-18 19:11:49 -07:00
Derek Collison
c43c216415 Bump to 2.9.17-beta.1
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-18 18:55:13 -07:00
Waldemar Quevedo
f84ca24fcc 2.9.16 release (#4065)
Don't mind the "bullet" character changes.. that was my Prettier
auto-formatting.
2023-04-17 07:50:08 -07:00
Byron Ruth
202d49d069 2.9.16 release
Signed-off-by: Byron Ruth <byron@nats.io>
2023-04-17 10:05:18 -04:00
Derek Collison
d8389ec4d3 [FIX] Data race when setting up service import subscriptions. (#4068)
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-17 06:57:27 -07:00
Derek Collison
9a3e0b783c Fix for a data race when setting up service import subscriptions.
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-17 06:40:09 -07:00
Neil
7709780987 Bump version to 2.9.16-RC.9 (#4067)
Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-17 13:54:06 +01:00
Neil Twigg
a9aa280d06 Bump version to 2.9.16-RC.9
Signed-off-by: Neil Twigg <neil@nats.io>
2023-04-17 13:38:25 +01:00
Waldemar Quevedo
d62ccc7737 Fix nsc in nightly (#4063)
Pin to the v2 version from nsc instead.
2023-04-17 00:59:56 -07:00
Waldemar Quevedo
dea7fc04f3 Fix nsc in nightly 2023-04-17 00:07:01 -07:00
Derek Collison
33f23be103 Update package dependencies (#4060)
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-16 16:54:11 -07:00
Derek Collison
a6029a090c Update pkg dependencies
Signed-off-by: Derek Collison <derek@nats.io>
2023-04-16 14:25:33 -07:00
Derek Collison
6215ed9bc3 Update to Go 1.19.8 (#4059) 2023-04-16 13:08:44 -07:00
Byron Ruth
dea68595fd Update to Go 1.19.8
Signed-off-by: Byron Ruth <byron@nats.io>
2023-04-16 15:33:13 -04:00
Derek Collison
670da9f7a3 [IMPROVED] Recover on boundary conditions that could cause RAFT layer to spin. (#4058)
Reset our WAL on edge conditions instead of trying to recover.
Also if we are timing out and trying to become a candidate but are doing
a catchup check if we are stalled.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-15 14:19:59 -07:00
Derek Collison
a5f5603645 Reset our WAL on edge conditions instead of trying to recover.
Also if we are timing out and trying to become a candidate but are doing a catchup check if we are stalled.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-15 12:23:44 -07:00
Derek Collison
2ee73f8a38 [FIXED] Fix for a regression in behavior. (#4057)
When tracking information per subject went from >1 back to only 1 we
needed to make sure we cleared firstNeedsUpdate.

Thanks to @scottf for finding it.

Signed-off-by: Derek Collison <derek@nats.io>
2023-04-15 10:47:13 -07:00