Commit Graph

3829 Commits

Author SHA1 Message Date
Ivan Kozlovic
f20fe2c2d8 Bump version to dev 2.8.3-beta
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-04 13:20:53 -06:00
Ivan Kozlovic
10c020ed44 Release v2.8.2
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-04 11:52:55 -06:00
Ivan Kozlovic
3cdbba16cb Revert "[added] support for jwt operator option DisallowBearerToken" 2022-05-04 11:11:25 -06:00
Ivan Kozlovic
12dd727310 Merge pull request #3091 from nats-io/DisallowBearerToken
[added] support for jwt operator option DisallowBearerToken
2022-05-04 10:57:22 -06:00
Derek Collison
7246edc77d Bump up default block sizes
Signed-off-by: Derek Collison <derek@nats.io>
2022-05-04 09:46:15 -07:00
Derek Collison
7c9a2d921a Bump to 2.8.2-beta.5
Signed-off-by: Derek Collison <derek@nats.io>
2022-05-03 16:08:58 -07:00
Ivan Kozlovic
5d90c8eac7 [IMPROVED] JetStream: check max-per-subject once
There was a case where we may have done a check for max-per-subject
limit twice per message. That would apply to streams that have
max-per-subject and also discard_new, which is what KV configures.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-03 16:57:26 -06:00
Derek Collison
3fef1025fe Merge pull request #3100 from nats-io/rc-improvements
Raft and cluster improvements.
2022-05-03 15:53:06 -07:00
Derek Collison
6f54b032d6 Raft and cluster improvements.
Signed-off-by: Derek Collison <derek@nats.io>
2022-05-03 15:20:46 -07:00
Ivan Kozlovic
cadf921ed1 [FIXED] JetStream: PullConsumer MaxWaiting==1 and Canceled requests
There was an issue with MaxWaiting==1 that was causing a request
with expiration to actually not expire. This was because processWaiting
would not pick it up because wq.rp was actually equal to wq.wp
(that is, the read pointer was equal to write pointer for a slice
of capacity of 1).

The other issue was that when reaching the maximum of waiting pull
requests, a new request would evict an old one with a "408 Request Canceled".

There is no reason for that, instead the server will first try to
find some existing expired requests (since some of the expiration
is lazily done), but if none is expired, and the queue is full,
the server will return a "409 Exceeded MaxWaiting" to the new
request, and not a "408 Request Canceled" to an old one...

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-03 15:17:20 -06:00
Ivan Kozlovic
c9df6374b8 [FIXED] JetStream: possible panic checking for group leader less
Got this stack:
```
goroutine 247945 [running]:
github.com/nats-io/nats-server/v2/server.(*jetStream).isGroupLeaderless(0xc004794e70, 0xc0031b0300)
	/home/runner/work/nats-server/src/github.com/nats-io/nats-server/server/jetstream_cluster.go:661 +0xc2
github.com/nats-io/nats-server/v2/server.(*Server).jsMsgDeleteRequest(0xc001dc9388, 0xc003e6de30, 0xc00222b980, 0xc001454f70, {0xc000668930, 0x24}, {0xc0011dbdb8, 0x11}, {0xc000da93f0, 0xa6, ...})
	/home/runner/work/nats-server/src/github.com/nats-io/nats-server/server/jetstream_api.go:2335 +0x67d
github.com/nats-io/nats-server/v2/server.(*jetStream).apiDispatch.func1()
	/home/runner/work/nats-server/src/github.com/nats-io/nats-server/server/jetstream_api.go:716 +0x85
created by github.com/nats-io/nats-server/v2/server.(*jetStream).apiDispatch
	/home/runner/work/nats-server/src/github.com/nats-io/nats-server/server/jetstream_api.go:715 +0x5c5
```

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-02 13:43:40 -06:00
Ivan Kozlovic
94b9c9b406 Merge pull request #3092 from nats-io/js_lock_inversion
[FIXED] JetStream: possible lock inversion
2022-05-02 11:26:17 -06:00
Ivan Kozlovic
5050092468 [FIXED] JetStream: possible lock inversion
When updating usage, there is a lock inversion in that the jetStream
lock was acquired while under the stream's (mset) lock, which is
not correct. Also, updateUsage was locking the jsAccount lock, which
again, is not really correct since jsAccount contains streams, so
it should be jsAccount->stream, not the other way around.

Removed the locking of jetStream to check for clustered state since
js.clustered is immutable.

Replaced using jsAccount lock to update usage with a dedicated lock.

Originally moved all the update/limit fields in jsAccount to new
structure to make sure that I would see all code that is updating
or reading those fields, and also all functions so that I could
make sure that I use the new lock when calling these. Once that
works was done, and to reduce code changes, I put the fields back
into jsAccount (although I grouped them under the new usageMu mutex
field).

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-05-02 09:50:32 -06:00
Matthias Hanel
c9217bad33 review comments
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-04-29 20:00:37 -04:00
Matthias Hanel
bd2883122e [added] support for jwt operator option DisallowBearerToken
I modified an existing data structure that held a similar attribute already.
Instead this data structure references the claim.

change 3 out of 3. Fixes #3084
corresponds to:
https://github.com/nats-io/jwt/pull/177
https://github.com/nats-io/nsc/pull/495

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-04-29 14:18:11 -04:00
Derek Collison
0bb7abccba Bump to 2.8.2-beta.4
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-29 09:21:45 -07:00
Derek Collison
806877ebaa Merge pull request #3090 from nats-io/qsub-deny
Combined canSubscribe and canQueueSubscribe
2022-04-29 09:20:57 -07:00
Derek Collison
c20b52251b Combined canSubscribe and canQueueSubscribe for consistency in specialized deny clause handling.
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-29 09:18:45 -07:00
Derek Collison
e0f5fcffb8 Fix for subject transforms and JetStream delivery subjects.
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-28 15:50:28 -07:00
Derek Collison
0d928c0338 Merge pull request #3085 from nats-io/small-fss-improvement
Small improvement with fss processing
2022-04-28 13:56:53 -07:00
Ivan Kozlovic
d4d37e67f4 [FIXED] JetStream: file store compact and when to write index
When deciding to compact a file, we need to remove from the raw
bytes the empty records, otherwise, for small messages, we would
end-up calling compact() too many times.

When removing a message from the stream, in FIFO cases we would
write the index every 2 seconds at most when doing it in place,
when when dealing with out of order deletes, we would do it for
every single delete, which can be costly. We are now writing
only every 500ms for non FIFO cases.

Also fixed some unrelated code:
- Decision to install a snapshot was based on incorrect logical
expression
- In checkPending(), protect against the timer being nil which
could happen when consumer is stopped or leadership change.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-28 12:35:19 -06:00
Derek Collison
9a96bef4c7 Small improvement with fss processing
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-28 10:23:30 -07:00
Derek Collison
2b1c3374a5 Bump to 2.8.2-beta.2
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-27 08:35:56 -07:00
Derek Collison
5368b660dc Merge pull request #3081 from nats-io/kv-mem-perf
[IMPROVED] KV memory store performance
2022-04-27 08:35:04 -07:00
Matthias Hanel
d520a27c36 [fixed] step down timing, consumer stream seqno, clear redelivery (#3079)
Step down timing for consumers or streams.
Signals loss of leadership and sleeps before stepping down.
This makes it less likely that messages are being processed during step
down.

When becoming leader, consumer stream seqno got reset,
even though the consumer existed already.

Proper cleanup of redelivery data structures and timer

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-04-27 03:32:08 -04:00
Derek Collison
138034b3a1 For memory store KV with history of 1 we were scanning for our next first when we did not have to.
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-26 19:55:47 -07:00
Derek Collison
f702e279ab Fix for a consumer recovery issue.
Also update healthz to check all assets that are assigned, not just running.

Signed-off-by: Derek Collison <derek@nats.io>
2022-04-26 19:22:19 -07:00
Ivan Kozlovic
06ff4b2b29 Split JS cluster and super clusters tests and compile only on 1.16
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-26 16:24:05 -06:00
Ivan Kozlovic
0e2ab5eeea Changes to tests that run on Travis
- Remove code coverage from Travis and add it to a GitHub Action
that will be run as a nightly.
- Use tag builds to exclude some tests, such as the "norace" or
JS tests. Since "go test" does not support "negative" regexs, there
is no other way.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-26 14:11:31 -06:00
Leander Kohler
966d9d56f4 Add JSConsumerDeliveryNakAdvisory
The advisory `JSAdvisoryConsumerMsgNakPre` will be triggered
when a message is naked
2022-04-25 16:13:32 +02:00
Ivan Kozlovic
646b3850bf Bump version to 2.8.2-beta
Following recommendations to push to a new version as soon as
we release.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-21 15:50:08 -06:00
Ivan Kozlovic
dcfd52413e Release v2.8.1
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-21 14:28:12 -06:00
Ivan Kozlovic
99f1bdf1d8 Bump version to 2.8.1-beta.1
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-21 11:28:24 -06:00
Ivan Kozlovic
363849bf3a [FIXED] JetStream: Mirrors would fail to be recovered
This is a continuation of PR #3060, but extends to clustering.

Verified with manual test that a mirror created with v2.7.4 has
the duplicates window set and on restart with main would still
complain about use of dedup in cluster mode. The mirror stream
was recovered but showing as R1.
With this fix, a restart of the cluster - with existing data -
will properly recover the stream as an R3 and messages that
were published while in a bad state are synchronized.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Signed-off-by: Matthias Hanel mh@synadia.com
2022-04-21 10:59:23 -06:00
Ivan Kozlovic
b9463b322f [FIXED] JetStream: stream mirror issues in mixed mode clusters
Similar to PR #3061

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-20 23:21:15 -06:00
Ivan Kozlovic
df61a335c7 Merge pull request #3061 from nats-io/js_fix_stream_source
[FIXED] JetStream: stream sources issue in mixed mode clusters
2022-04-20 23:20:41 -06:00
Ivan Kozlovic
9975a38c6e [FIXED] JetStream: stream sources issue in mixed mode clusters
The main issue was that in mixed-mode, the interest through gateway
may still be in optimistic mode, which when creating the source
consumer would start delivery before we had a chance to setup
the subscription to receive those messages.

The approach is to create the subscription prior to sending
the consumer create request. Also refactored a bit the code in
the hope to make the retries a bit more bullet proof.

We may also look at making sure that gateways are switched to
interest-mode when detecting a mixed-mode setup.

Also fixed a defect that could cause a source to be canceled
when updating a stream.

Resovles #2801

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-20 21:02:35 -06:00
Matthias Hanel
254c970876 Fix subject renaming for leaf connections and queue subs (#3062)
* [fix] on queue sub, a consumers  delivery subject, was not changed

to the original publish subject the stream received
the code added is a copy of what regular subs do

* [fixed] subject renaming for leaf node connections as well

also updated multi server test to test for queue and non queue scenarios

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-04-20 19:23:21 -04:00
Matthias Hanel
9db2e91403 Fixes issue on restart where mirror config was invalid (#3060)
This issue was introduced by a bug that assigned a de dupe default value
do mirrors.
This is an invalid config that used to be checked on stream create.
Subsequently this logic was moved and then got executed on startup.
Ending up checking mirrors that got the bad default assigned.
Fix is to clear de dupe window for mirrors

Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-04-20 13:58:30 -04:00
Matthias Hanel
ff5d60973d introducing max_age/dupe_window minimum value of 100ms. (#3056)
Signed-off-by: Matthias Hanel <mh@synadia.com>
2022-04-20 13:58:19 -04:00
Derek Collison
e2ab9d7cb4 Merge pull request #3059 from nats-io/move-fix
Polling too quickly could make migration fail.
2022-04-20 09:36:09 -07:00
Derek Collison
9f9732ad97 When we polled too quickly on migration we could check before catchup logic had even kicked in.
Signed-off-by: Derek Collison <derek@nats.io>
2022-04-20 16:56:18 +01:00
Ivan Kozlovic
730d8921e4 [FIXED] LeafNode: propagation interest issue after a config reload
When a configuration reload is done, the account's leaf node connections
were not transfered to the new instance of the account, causing the
interest to not be propagated until a leafnode reconnect or a server
restart.

Resolves #3009

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-20 08:03:34 -06:00
Ivan Kozlovic
69ea1ab5f4 Bump version
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-18 16:36:33 -06:00
Ivan Kozlovic
38bbc6cb72 Release v2.8.0
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-18 16:21:31 -06:00
Ivan Kozlovic
ddd31b1988 Merge pull request #3022 from LaurensVergote/Windows
Allow nats-server to run as system user on Windows
2022-04-18 14:33:32 -06:00
Ivan Kozlovic
ca63b206f1 Bump version to 2.8.0-beta.23
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2022-04-18 14:04:42 -06:00
Ivan Kozlovic
6d71937ba7 Merge pull request #3053 from nats-io/js_add_file_names
[IMPROVED] JetStream: add file names for invalid checksums
2022-04-18 14:00:15 -06:00
xieyuschen
322115be31 [fixed] On config reload js got disabled, when previously set via command line arg
fixes #3003
2022-04-18 15:58:10 -04:00
Ivan Kozlovic
af1a80d7c4 Merge pull request #3047 from nats-io/move-back
If we moved a stream back to a cluster we were once at, the stream would be empty.
2022-04-18 13:46:05 -06:00