Commit Graph

52 Commits

Author SHA1 Message Date
Derek Collison
99fed910f0 Improvements to large numbers of JetStream R1 consumers per stream.
1. We were holding open FDs longer than we should for consumers causing issues with open FD limits. We now do not hold them open and cap updates a bit better.

2. When doing a stream delete, consumer delete was repeating alot of work that was not necessary, causing longer delays. This has been optimized a bit, still more improvements to be made.

3. We cover all JS under a single export, but that was also trapping GetNext for pull based consumers, and since this was a no-op (is handled at user account level) we were creating alot of garbage service import responses and reverse map entries that had to be garbage collected. We have a fix in to avoind this but still looking for a better one.

4. Still had some lingering references to all exports vs single JS export.

Signed-off-by: Derek Collison <derek@nats.io>
2021-06-29 05:45:55 -07:00
Derek Collison
bb84ef7d91 Added ability to match based on last expected sequence per subject.
Signed-off-by: Derek Collison <derek@nats.io>
2021-06-28 10:57:50 -07:00
Derek Collison
545230bd9e FIXED Clustered streams can become broken with seq mismatch state on low level store failures.
We can account for high level failure properly but were not properly accounting for low level store failures.

Signed-off-by: Derek Collison <derek@nats.io>
2021-06-25 13:46:40 -07:00
Derek Collison
08197de9e0 FIXED max consumers was not enforced when set on stream
Signed-off-by: Derek Collison <derek@nats.io>
2021-06-25 11:45:36 -07:00
Derek Collison
c0e47966ab Added in Stream get last message by subject.
This is to aid in K/V overlay for simple Get ops vs creating a full blown consumer.

Signed-off-by: Derek Collison <derek@nats.io>
2021-06-24 13:21:39 -07:00
Derek Collison
bf6335dff9 Add in ability to have encrypted JetStream filestores.
This supports XChaChaPoly1305 for Seal and Open and ChaCha20 for our message blocks which use highway hashes and sequence numbers for authenticity.
We support snapshot and restore as well.

Signed-off-by: Derek Collison <derek@nats.io>
2021-06-21 19:28:10 -07:00
Derek Collison
9398c3ca28 Allow for more advanced purge operations that filter by subject, specify the sequence or number of messages to keep.
Signed-off-by: Derek Collison <derek@nats.io>
2021-06-19 07:04:44 -07:00
Derek Collison
c75d97a0d3 Fix for #2290
Signed-off-by: Derek Collison <derek@nats.io>
2021-06-18 07:03:51 -07:00
Derek Collison
d0ac1a40ca Added in per subject limits for streams.
Signed-off-by: Derek Collison <derek@nats.io>
2021-06-15 06:36:34 -07:00
Derek Collison
08cdb2d2ea Make filtered consumers in large mixed streams more efficient.
Allow wider scoped filtered subjects.

We introduce a per subject information tracking to filestore to optimize for large mux'd streams and more efficient filtered consumers.

Signed-off-by: Derek Collison <derek@nats.io>
2021-06-15 04:44:05 -07:00
R.I.Pienaar
0d391b02eb richer api errors proposal
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-05-26 08:04:50 +02:00
Derek Collison
dd91bc8b64 Merge pull request #2206 from nats-io/sd_fix
[FIXED] A store directory on disk without 'jetstream' could appear to lose assets on restart.
2021-05-12 08:56:21 -07:00
Derek Collison
6e17b7a303 Fix for #2213
We do not want to report consumers that were created for the purpose of sources or mirrors.

Signed-off-by: Derek Collison <derek@nats.io>
2021-05-12 07:51:53 -07:00
Derek Collison
494ddeec5b Fix for #2202
When using multiple source streams from either different accounts or domains, the stream name could be the same and would cause bad behavior.

Signed-off-by: Derek Collison <derek@nats.io>
2021-05-11 13:12:10 -07:00
Derek Collison
bad9fba8ec Fix for store directory on disk prior to 2.2.3 without the 'jetstream' directory.
Signed-off-by: Derek Collison <derek@nats.io>
2021-05-10 19:24:58 -07:00
R.I.Pienaar
cc9b6735a5 remove . from domain names
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-05-07 14:46:22 +02:00
Derek Collison
c2fcc114a5 Update based on PR feedback, moved to validateOptions
Signed-off-by: Derek Collison <derek@nats.io>
2021-05-06 20:10:44 -07:00
Derek Collison
5a8791b1ef Check for bad domain names
Signed-off-by: Derek Collison <derek@nats.io>
2021-05-06 19:41:43 -07:00
Derek Collison
8499376575 Add in support for JetStream domains.
This allows a domain to be set in the JetStream server block that sets a domain name.
Once set this signals that any leafnode connections should operate as separate JetStream domains.
Each domain <NAME> is accessible via "$JS.<NAME>.API.>", even when connected to the same domain.
Also for mixed mode you can set a jetstream block now that defines a domain but specifies "enabled: false".

Signed-off-by: Derek Collison <derek@nats.io>
2021-05-06 18:46:32 -06:00
Ivan Kozlovic
6e1205b660 Cleanup some tests + GetTLSConnectionState() race fix
Missing defers

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-04-15 11:37:43 -06:00
Derek Collison
90989d57d6 Change to report total deleted by default for stream info.
Allow deleted details if requested.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-12 18:10:11 -07:00
Jaime Piña
27e9628c3a Run gofmt -s to simplify code 2021-04-09 15:18:06 -07:00
Jaime Piña
d929ee1348 Check errors when removing test directories and files
Currently in tests, we have calls to os.Remove and os.RemoveAll where we
don't check the returned error. This hides useful error messages when
tests fail to run, such as "too many open files".

This change checks for more filesystem related errors and calls t.Fatal
if there is an error.
2021-04-07 11:09:47 -07:00
Jaime Piña
e44275b963 Consolidate temporary test files and directories
Currently, temporary test files and directories are written in lots of
different paths within the OS's temp dir. This makes it hard to know
which files are from nats-server and which are unrelated. This in turn
makes it hard to clean up nats-server test files.
2021-04-06 10:42:55 -07:00
Derek Collison
c3ec8d9fb3 Agressive cache expiration was hindering performance when publishing and receiving from a stream concurrently.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-01 16:32:43 -07:00
Derek Collison
c6bb9b0644 Fix test since we moved from 500 to 404
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-01 07:09:10 -07:00
Jaime Piña
6941bb3ade Update Go client in tests 2021-03-30 13:17:34 -07:00
Derek Collison
6f8c0f9193 Fix broken test
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-22 20:31:28 -07:00
Derek Collison
022c5b4ab2 Fix for bad behavior with flow control and multiple sources streams.
Allow chaining of sources and mirrors with filtered consumers.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-22 11:13:51 -07:00
Derek Collison
1dde8aed5d Do not send idle heartbeats if not active
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-20 09:22:06 -07:00
Derek Collison
61771e88f8 In operator mode with JetStream we want to load accounts that have stable storage.
Also if an account was registered but not JetStream enabled, update it vs error.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-20 06:53:13 -07:00
Derek Collison
259cb07284 When a stream was busy but not for a filtered consumer with idle heartbeats they would be suppressed.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-18 07:46:29 -07:00
Derek Collison
74cc2b581a When a stream is a mirror or has sources we need to check the upstream streams for filter subject correctness.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-17 06:39:21 -07:00
Waldemar Quevedo
3e61c2e5b1 Prevent pull batch size larger than max ack pending
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2021-03-08 08:55:47 -08:00
Derek Collison
0b3c686430 Fixes for data races and some locking.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-05 17:19:51 -08:00
Derek Collison
ff98984358 Reworked internal consumers used for sources and mirrors.
Now use ephemerals and heartbeats and flowcontrol.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-05 14:32:57 -08:00
Derek Collison
75b0455e0b Enable opt-in flow control for push based consumers.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-05 08:48:12 -08:00
Derek Collison
955594ce9d Use code 100 instead
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-05 05:57:50 -08:00
Derek Collison
7e2b2a1033 Allow an option to push based consumers to have idle heartbeats delivered.
This allows an endpoint to know the consumer is still alive.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-05 05:48:00 -08:00
Derek Collison
32ffb55a22 Provide feedback to users when trying to pull from a push based consumer.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-03 09:17:27 -08:00
Derek Collison
d170647c04 More time to make sure mirror consumer has hooked up properly
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-03 07:58:45 -08:00
Matthias Hanel
c50ee2a1c6 [Changed] all times exposed will be computed in UTC (#1943)
This also applies to times that end up in that json.
Where applicable moved time.Now() to where it is used.
Moved calls to .UTC() to where time is created it that time is converted
later anyway.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-03-02 21:37:42 -05:00
Derek Collison
8cfc56f8b0 Enable support for changing config on stream restore.
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-28 10:01:01 -08:00
Derek Collison
57a6599777 Test updates
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-28 05:19:45 -08:00
Matthias Hanel
c73d3b21eb changing NEXT expires field from time to duration in nanoseconds
Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-02-26 20:45:44 -05:00
Derek Collison
7c670e4eae Allow sources and mirrors to not be pre-defined.
Will keep trying to establish contact.

Fixed bug where double source headers for sourced messages were causing issues.

Signed-off-by: Derek Collison <derek@nats.io>
2021-02-26 07:32:29 -08:00
R.I.Pienaar
45a42864f6 always store the filter subject
This avoids a situation where a consumer asks for
ORDERS.new today on a stream of ORDERS.new but later
someone makes the same stream ORDERS.* and the new
consumer would then get messages for other purposes
as well

Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-02-25 18:29:21 +01:00
Derek Collison
09e3d26fa3 Add in support for stream mirrors and sources.
Add in proper support for stream updates in clustered mode.
Don't send API updates without subjects, caused GW parser errors.
Stream internal loops use their own clients now.

Signed-off-by: Derek Collison <derek@nats.io>
2021-02-23 10:57:27 -08:00
Derek Collison
fcb9be5f6c Skip perf tests
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-13 14:37:15 -08:00
Derek Collison
f0cfc187d2 Set pindex to wrong setting on snapshot restore with no WAL
Signed-off-by: Derek Collison <derek@nats.io>
2021-02-13 06:50:50 -08:00