Commit Graph

164 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
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
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
R.I.Pienaar
a0fcf0bb65 further tagged error confusion cleanups
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-06-18 20:11:09 +02: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
ee9d10f40b restore old error constants for backwards compat
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-05-26 08:04:50 +02: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
8888ab51f4 Fix for #2243. We were not allowing replicated acks processing for workqueues properly, only interest retention.
Signed-off-by: Derek Collison <derek@nats.io>
2021-05-24 09:53:31 -07:00
Derek Collison
308355a2fd Fix for #2242.
When we had a duplicate detected in R>1 mode we set the skip sequence indicator but were not using that when dealing with underlying store.

Signed-off-by: Derek Collison <derek@nats.io>
2021-05-24 08:21:41 -07:00
Derek Collison
9ccc843382 Removing peers should wait for RemovePeer entry replication.
Signed-off-by: Derek Collison <derek@nats.io>
2021-05-19 18:58:19 -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
06fc2f3f06 Fix data race
Signed-off-by: Derek Collison <derek@nats.io>
2021-05-10 17:29:24 -07:00
Derek Collison
9a517194a1 Merge pull request #2191 from nats-io/raft_catchup_snap
[FIXED] Raft groups could continually spin trying to catch up.
2021-05-07 14:20:37 -07:00
Derek Collison
70a2521f95 For interest or workqueue streams with ephemerals we need to not reduce replication to 1.
We need the consumer state on the stream leader.
Also if we can't find the store yet for a consumer fallback to calculate needsAck.

Signed-off-by: Derek Collison <derek@nats.io>
2021-05-07 12:07:27 -07:00
R.I.Pienaar
b5f846a719 add domain in JS advisories
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-05-07 19:35:46 +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
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
Derek Collison
8bf99224c5 This adds ability to have a single node server with a system leafnode expand an existing JetStream cluster domain.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-30 16:20:32 -07:00
Derek Collison
2ac05785c3 Do not persist or snapshot consumer state after a restore.
This can lead to a data race and is not needed after being applied.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-21 18:50:38 -07:00
Derek Collison
c9c70dea33 Fix race
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-21 16:17:58 -07:00
Derek Collison
3418847881 Merge pull request #2146 from nats-io/chblock
Make sure to not have the raft layer block on apply channel on exit.
2021-04-21 15:58:50 -07:00
Derek Collison
0678e649d3 Make sure to not have the raft layer block on apply channel on exit.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-21 15:52:54 -07:00
Derek Collison
50fabe261d Check for overlapping subjects on stream update.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-21 15:38:38 -07:00
Derek Collison
a181238cf0 Fix for consumer on restore being deleted
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-21 06:54:54 -07:00
Derek Collison
518ff9be14 Concurrent multiple durable subscribers would cause unpredictable behaviors.
Upgraded to current Go client.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-20 19:50:24 -07:00
Derek Collison
902b9dec12 Merge pull request #2131 from nats-io/updates
General Updates and Stability Improvements
2021-04-20 13:52:39 -07:00
Derek Collison
68ddd519d2 Process upstream missing messages for mirrors better.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-19 20:15:21 -07:00
Matthias Hanel
b73be52862 [fixed] only become observer if the leaf config has raft not restricted (#2125)
If a subject in the system accounts leafnode deny_imports matches $NRG.>
then jetstream is explicitly disconnected and the server can become
leader.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-04-19 13:10:49 -04:00
Derek Collison
542adc4bc3 Make sure clseq does not fall below lseq
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-18 18:47:33 -07:00
Derek Collison
6a7f3a3153 Cleanup error handling, fix deadlock in test
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-16 13:56:54 -07:00
Derek Collison
f6a82a7c98 When messages were no longer available in an upstream stream a mirror could wedge and not resolve.
This fixes that scenario by detecting the situation and inserting skip msgs to catch up.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-13 11:46:03 -07:00
Derek Collison
755ef74855 When a cluser of leafnodes connects to a cluster or supercluster hub and they share the system account make the leafnode servers observers.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-12 17:00:55 -07:00
Derek Collison
0cee993e3b When checking cluster size we need to make sure we have heard from all peers before making adjustments.
Also check back periodically.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-10 15:55:51 -07:00
Derek Collison
27d8b939b5 Updated based on comments that the one fix was actually a misconfiguration.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-09 16:49:24 -07:00
Derek Collison
e438d2f5fa Mixed mode improvements.
1. When in mixed mode and only running the global account we now will check the account for JS.
2. Added code to decrease the cluster set size if we guessed wrong in mixed mode setup.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-09 14:58:35 -07:00
Derek Collison
1ea4a430da If we fail to load an account while processing a stream assignment, send error back to metaleader.
Signed-off-by: Derek Collison <derek@nats.io>
2021-04-07 14:23:12 -07:00
Derek Collison
44ada49b16 During repeated server restarts or failures consumer state could drift between replicas.
We now make sure to sync state of the replicas when a new leader takes over. We also update ack floors regardless of detection on pending list.

Signed-off-by: Derek Collison <derek@nats.io>
2021-04-02 08:20:29 -07:00
Matthias Hanel
cd602231ac [Fixed] missing unlock and added a warning trace (#2054)
* [Fixed] missing unlock and added a warning trace

Signed-off-by: Matthias Hanel <mh@synadia.com>
2021-03-31 19:22:19 -04:00
Derek Collison
bb7a8a5f79 Introduced default max ack pending for ack explicit.
Fixed a bug that would introduce performance degradation for durable consumers R>1.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-30 11:47:24 -07:00
Derek Collison
5a48369b4b Make sure to not delete streams on bad updates.
If an update was asssigned but failed at the stream group server we would send back the result which would always delete the stream.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-29 07:35:30 -07:00
Derek Collison
c564b18482 Protect against negative
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-26 05:28:00 -07:00
Derek Collison
5d6fe9e4b0 Check for subject overlaps after check for pre-existing
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-25 19:00:15 -07:00
Derek Collison
5d5de5925f Introduce a previous leader state in the raft layer to allow quicker responses when leaderless.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-25 17:08:29 -07:00
Derek Collison
e53caee5e8 Enforce server limits even when dynamic limits for accounts in play.
We were not properly enforcing server limits. This commit will allow a server to enforce limits but still remain functional even at the JetStream level.
Also fixed a bug for RAFT replay that could cause instability.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-25 16:06:27 -07:00
Derek Collison
a627db9fc8 Do not request streaminfo from streams that are completely offline.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-24 10:26:09 -07:00
Derek Collison
06803dafbf Tweak seq tracking for flow control, also fixup code
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-24 09:46:54 -07:00
Derek Collison
2ed53035ed Reworked flow control for sources and mirrors.
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-24 07:07:33 -07:00
Derek Collison
a75e8f8c80 Fix for an issue with multiple restarts that showed stalled and sometimes lost streams.
The issue was when a state was removed from a server and restarted it would catch up properly.
However upon cluster restart the system could exhibit strange behaviors. This was due to on
catchup not properly creating a meta snapshot when one was received, leaving no meta state to recover.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-22 20:06:38 -07:00
Derek Collison
0f548edcc6 Reduce sliding window for direct consumers and catchup stream windows.
Remove another possible wire blocking operation in raft.

Signed-off-by: Derek Collison <derek@nats.io>
2021-03-21 09:24:27 -07:00
Derek Collison
faa6dc85eb Fix for flapping test
Signed-off-by: Derek Collison <derek@nats.io>
2021-03-20 11:16:40 -07:00