Commit Graph

6018 Commits

Author SHA1 Message Date
Derek Collison
6e0d3eaa9d Update compress dependency
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-25 11:31:12 -07:00
Derek Collison
e87a30fdb7 Bump to 2.9.0-beta.10
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-23 19:21:58 -07:00
Derek Collison
f377c41898 Merge pull request #3284 from nats-io/expire_on_recover_reset
[FIXED] Losing stream sequence on multiple restarts and leader changes.
2022-07-23 19:20:30 -07:00
Derek Collison
52f7765322 When msgs were expired on restart recovery we could lose track on subsequent restart of starting sequence with no additional activity.
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-23 17:15:16 -07:00
Ivan Kozlovic
07554e970a Bump version to 2.9.0-beta.9
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-22 11:56:15 -06:00
Matthias Hanel
5a720d4977 down scale consumer before downscale of stream (#3282)
Now monitorStream waits with scaling down the stream until all
monitorConsumer have scaled down their respective consumer

Also update consumer assignment for later use in monitorConsumer
Same for stream assignment in monitorStream

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-22 19:54:13 +02:00
Ivan Kozlovic
3676823e07 Merge pull request #3283 from nats-io/short_idx_write
[FIXED] Short index write could lead to loss of stream sequence for an empty stream
2022-07-22 11:29:50 -06:00
Derek Collison
3a10456e68 Short index write could lead to loss of stream sequence for empty stream
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-22 06:37:19 -07:00
Ivan Kozlovic
a3e62f000c Merge pull request #3265 from abegaj/fix-max-deliver-update
[FIXED] Maximum Deliveries update has no effect
2022-07-21 16:06:41 -06:00
Ardit Begaj
2871dcb235 increase maxDeliver 2022-07-21 23:24:56 +02:00
Ardit Begaj
c04ab08f2a improve tests based on feedback 2022-07-21 23:21:58 +02:00
Matthias Hanel
918ce307af fix and improve unit test (#3281)
reduce number of messages sent
try move+cancel for every server

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-21 22:18:59 +02:00
Ivan Kozlovic
a02a617c05 Merge pull request #3280 from nats-io/fix_3273
[IMPROVED] JetStream: stream already exists error description
2022-07-21 10:53:47 -06:00
Ivan Kozlovic
1da5ecfb96 [IMPROVED] JetStream: stream already exists error description
The `JSStreamNameExistErr` will now include in the description that
the stream exists with a different configuration, because that is
the error clients would get when trying to add a stream with a
different configuration (otherwise this is a no-op and client
don't get an error).

Since that error was used in case of restore, a new error is added
but uses the same description prefix "stream name already in use"
but adds ", cannot restore" to indicate that this is a restore
failure because the stream already exists.

Resolves #3273

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-21 10:20:07 -06:00
Derek Collison
231fdea6c4 Merge pull request #3279 from nats-io/issue_3278
[FIXED] Issue #3278 - Make sure to protect against mset == nil
2022-07-21 09:05:52 -07:00
Derek Collison
f2abdaeb43 Make sure to protect against mset == nil
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-21 06:53:26 -07:00
Matthias Hanel
51b6d5233f Fix raft issue where pindex of follower was off by 1 (#3277)
introduced by 57395bba02

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-21 00:51:26 +02:00
Ivan Kozlovic
45b1490362 Merge pull request #2363 from neilalexander/neilalexander/wasmjs
Stubs for WebAssembly
2022-07-20 13:26:56 -06:00
Ardit Begaj
94d22642d1 move test to appropriate file 2022-07-20 19:49:13 +02:00
Matthias Hanel
62bf8ce7e9 fix jwt unit test by ensuring activation issue time is bigger than expiration (#3275)
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-19 21:38:58 +02:00
Ardit Begaj
3f26dfee25 added cluster test 2022-07-19 20:01:36 +02:00
Todd Beets
302f85dcc2 Merge pull request #3271 from nats-io/repub-fix-srcignored
Fix and test for RePub src ignored at runtime.
2022-07-18 15:02:09 -07:00
Todd Beets
6de64667bc follow convention (_EMPTY_, fwcs). Add special case short-circuit to skip unnecessary tokenization and transform. 2022-07-18 14:20:10 -07:00
Matthias Hanel
e753e897cf Bump version to 2.9.0-beta.8 (#3274)
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-18 19:40:31 +02:00
Matthias Hanel
89b5e872ac Move and cancel fixes (#3270)
The Move/Cancel/Downscale mechanism did not take into account that
the consumer's replica count can be set independently.

This also alters peer selection to have the ability to skip 
unique tag prefix check for server that will be replaced.
Say you have 3 az, and want to add another server to az:1, 
in order to replace a server that is the same zone.
Without this change, uniqueTagPrefix check would filter 
the server to replace with and cause a failure.

The cancel move response could not be received due to 
the wrong account name.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-18 18:42:03 +02:00
Todd Beets
7a47631051 optimize for > or empty src (any subject) 2022-07-17 13:45:05 -07:00
Todd Beets
ae9f872ef5 Fix static code check violation on two unit tests and normalize unit test values to ADR-28. 2022-07-15 21:25:29 -07:00
Ivan Kozlovic
2c7d04f075 Merge pull request #3269 from nats-io/js_reject_stream_mirror_updates
[FIXED] JetStream: stream mirror updates not rejected in standalone
2022-07-15 15:21:22 -06:00
Todd Beets
b145952e78 Fix and test for RePub src ignored at runtime. 2022-07-15 13:50:35 -07:00
Ivan Kozlovic
0887f3d66a Check for mirror configuration
With the previous commit, this should no longer be possible, but
otherwise we got report of a panic when accessing the mirror configuration.
The following test would be able to produce the panic:

```
	s := RunBasicJetStreamServer()
	if config := s.JetStreamConfig(); config != nil {
		defer removeDir(t, config.StoreDir)
	}
	defer s.Shutdown()

	nc, js := jsClientConnect(t, s)
	defer nc.Close()

	_, err := js.AddStream(&nats.StreamConfig{Name: "SOURCE"})
	require_NoError(t, err)

	cfg := &nats.StreamConfig{
		Name:   "M",
		Mirror: &nats.StreamSource{Name: "SOURCE"},
	}
	_, err = js.AddStream(cfg)
	require_NoError(t, err)

	err = js.DeleteStream("SOURCE")
	require_NoError(t, err)

	cfg.Mirror = nil
	_, err = js.UpdateStream(cfg)
	require_NoError(t, err)

	time.Sleep(5 * time.Second)
```

Again, now that we reject the mirror config update, the panic
should no longer happen, but adding preventive code in case we
allow in the future.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-15 11:18:23 -06:00
Ivan Kozlovic
5f0ee2344a [FIXED] JetStream: stream mirror updates not rejected in standalone
Updates to stream mirror config are rejected in cluster mode, but
were not in standalone. This PR adds the check in standalone mode.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-15 10:51:57 -06:00
Ivan Kozlovic
00a38dc98e Merge pull request #3263 from nats-io/update_deps
[UPDATED] Compression library
2022-07-14 10:57:55 -06:00
Ivan Kozlovic
dac8b0959b [UPDATED] Compression library
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-14 10:33:38 -06:00
Ardit Begaj
4d81b8e4a2 Make MaxDeliver update changes take effect 2022-07-14 15:38:59 +02:00
Matthias Hanel
95caa6ba36 bump version to 2.9.0-beta.7 (#3259)
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-12 22:41:52 +02:00
Matthias Hanel
023500e1da add the ability to cancel a move in progress (#3253)
* add the ability to cancel a move in progress

Move to individual subjects for move and cancel_move

New subjects are:
$JS.API.ACCOUNT.STREAM.MOVE.*.*
$JS.API.ACCOUNT.STREAM.CANCEL_MOVE.*.*

last and second to last token are account and stream name

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-12 21:54:18 +02:00
Matthias Hanel
d53d2d0484 [Added] account specific monitoring endpoint(s) (#3250)
Added http monitoring endpoint /accstatz
It responds with a list of statz for all accounts with local connections
the argument "unused=1" can be provided to get statz for all accounts
This endpoint is also exposed as nats request under:

This monitoring endpoint is exposed via the system account.
$SYS.REQ.ACCOUNT.*.STATZ
Each server will respond with connection statistics for the requested
account. The format of the data section is a list (size 1) identical to the event
$SYS.ACCOUNT.%s.SERVER.CONNS which is sent periodically as well as on
connect/disconnect. Unless requested by options, server without the account,
or server where the account has no local connections, will not respond.

A PING endpoint exists as well. The response format is identical to
$SYS.REQ.ACCOUNT.*.STATZ
(however the data section will contain more than one account, if they exist)
In addition to general filter options the request takes a list of accounts and
an argument to include accounts without local connections (disabled by default)
$SYS.REQ.ACCOUNT.PING.STATZ

Each account has a new system account import where the local subject
$SYS.REQ.ACCOUNT.PING.STATZ essentially responds as if
the importing account name was used for $SYS.REQ.ACCOUNT.*.STATZ

The only difference between requesting ACCOUNT.PING.STATZ from within
the system account and an account is that the later can only retrieve
statz for the account the client requests from.

Also exposed the monitoring /healthz via the system account under
$SYS.REQ.SERVER.*.HEALTHZ
$SYS.REQ.SERVER.PING.HEALTHZ
No dedicated options are available for these.
HEALTHZ also accept general filter options.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-12 21:50:32 +02:00
Ivan Kozlovic
520d323ea5 Merge pull request #3258 from nats-io/js_detect_as_orphans
[FIXED] JetStream: servers may be reported as orphaned
2022-07-12 10:26:38 -06:00
Ivan Kozlovic
39a0cfccca [FIXED] JetStream: servers may be reported as orphaned
In some situations, a server may report that a remote server is
detected as orphaned (and the node is marked as offline). This is
because the orphaned detection relies on conns update to be received,
however, servers would suppress the update if an account does not
have any connections attached.

This PR ensures that the update is sent regardless if the account
is JS configured (not necessarily enabled at the moment).

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-11 16:15:01 -06:00
Jean-Noël Moyne
23a9036b9b Improves error handling for subject mapping destination mustache functions (#3255) 2022-07-11 14:56:34 -07:00
Matthias Hanel
988629a1ed enhanced unit test to check for leader post move (#3257)
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-07-11 20:35:04 +02:00
Ivan Kozlovic
f241a92963 Merge pull request #3256 from nats-io/fix_test_causing_flappers
Fixed a test that was causing others to flap
2022-07-11 10:26:50 -06:00
Ivan Kozlovic
50c561a040 Fixed a test that was causing others to flap
The test was lowering the eventsHBInterval to low value but not
restoring its original value. This would cause some servers to
be considered "orphan" and the shutdown event sent causing their
raft node to be considered "offline", which then would result
in some tests failing with "insufficient resources".

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-07-11 10:00:03 -06:00
Derek Collison
da305f2044 Merge pull request #3252 from nats-io/stream_direct_update
Allow stream and mirror direct get to be updated
2022-07-08 07:54:33 -07:00
Derek Collison
7ff534d1da Allow get next for json stream get version
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-08 07:19:15 -07:00
Derek Collison
59a0a3ba5c Allow stream and mirror direct get abilities to be updated.
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-08 07:13:34 -07:00
Derek Collison
61fe6bcffb Bump to 2.9.0-beta.5
Signed-off-by: Derek Collison <derek@nats.io>
2022-07-07 17:54:46 -07:00
Derek Collison
85123861d4 Merge pull request #3249 from nats-io/catchup_eof
Fix for stalled catchup in endless cycle on EOF
2022-07-07 17:54:07 -07:00
Matthias Hanel
9c55e67a35 Merge pull request #3248 from nats-io/fix-uniqe-tag-stream-update
Fix unique_tag issue with stream replica increase
2022-07-08 02:23:59 +02:00
Derek Collison
333e2fc2f1 Fix for stalled catchup in endless cycle on EOF trying to retrieve catchup msg.
A customer experienced and endless failure to have a stream cacthup. The current leader was being asked for a message from a snapshot that was larger then what we had, resulting in EOF which silently failed.
We now detect this and signal end of catchup and redo the bad snapshot if possible.

Signed-off-by: Derek Collison <derek@nats.io>
2022-07-07 13:42:41 -07:00