Commit Graph

237 Commits

Author SHA1 Message Date
Derek Collison
5ead954fee [ADDED] Allow certain consumer attributes to be updated #2670, #2603
Signed-off-by: Derek Collison <derek@nats.io>
2021-11-04 13:43:11 -07:00
Derek Collison
003b6996f1 If AckWait less then restart check interval use AckWait
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-28 11:00:06 -07:00
Derek Collison
3a14a984fc Fix for a bug that did not properly decode redelivered state for consumers from a filestore.
This also caused state abnormalities in a user's setup so added code to clean up bad state as needed.

Signed-off-by: Derek Collison <derek@nats.io>
2021-10-28 08:33:48 -07:00
Derek Collison
678469b40b Fix for #2644
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-25 13:12:37 -07:00
Derek Collison
cbbab295ec Merge pull request #2616 from nats-io/fix_2611
[FIXED] #2611
2021-10-12 08:46:42 -07:00
Derek Collison
8951bc54f4 Fix for stream purge where purge would remove all pending messages for a filtered consumer.
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 07:26:13 -07:00
Derek Collison
f254c110c4 Ignore the 'not filtered' shortcut if deliver last policy is set
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-12 06:15:40 -07:00
Derek Collison
9efa11ba43 Don't make consumers go backwards on purge
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-07 07:06:52 -07:00
Derek Collison
58e5c7c681 Allow consumers to request only headers to be delivered
Signed-off-by: Derek Collison <derek@nats.io>
2021-10-05 18:54:52 -07:00
Ivan Kozlovic
d34b8fdd7d [FIXED] JetStream: data race on shutdown
Replaced use of eventsEnabled() with EventsEnabled() that will
check under server lock. Also found another reference when
creating templates.

Resolves #2588

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-09-30 11:17:12 -06:00
Derek Collison
ebb24006c2 Direct consumers used for mirroring should not be affected by max consumer limits
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-22 15:01:51 -07:00
Derek Collison
eab45b404a Fix for deadlock with stream mirrors or sources where origin is interest or workqueue policy.
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-22 10:59:02 -07:00
Derek Collison
40a4d40337 Make large batch requests expire more efficiently.
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-16 15:00:18 -07:00
Derek Collison
dadc3b9fae Fixed a bug when an interest retention stream with noack consumers is in clustered mode.
We were not properly propagating the ack state and proper cleanup of the stream messages.

Signed-off-by: Derek Collison <derek@nats.io>
2021-09-08 15:02:09 -07:00
Derek Collison
29eaa9c614 Fixed bug that could lead to perceived message loss.
Under load and pressure from concurrent publishing and consuming with multiple consumers the filestore would
return a partial or no cache error to the upper layers. For consumers this could result in us skipping a stream sequence when we should not.

This change stabilizes the filestore and removes the flush state for msg blocks. I also found some bugs that did not track last sequence properly
after snapshots / restore.

Signed-off-by: Derek Collison <derek@nats.io>
2021-09-05 16:36:23 -07:00
Ivan Kozlovic
44c57a5702 [FIXED] Pull requests: don't send 408 when request expires
When expiring requests, the server would send 408 if interest was
still present, which can happen for pull subscribe implementations
that maintain interest for the duration of the pull subscription.

Let's keep the 408 for when a request is "force expired", that
is, a request was removed from the queue because it queue was
full but interest is still found.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-09-01 16:57:13 -06:00
Derek Collison
57ef5fd528 Set consumer config defaults early on to avoid a race condition.
Signed-off-by: Derek Collison <derek@nats.io>
2021-09-01 13:06:08 -07:00
Ivan Kozlovic
1308c73273 [CHANGED] ConsumerInfo's SequencePair replaced with SequenceInfo
This change was made in a previous PR wit this commit:
9405b77e46

After some discussions, we agreed that the original approach
is best, so using a dedicated object SequenceInfo for ConsumerInfo.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-08-23 12:28:23 -06:00
Derek Collison
9d7123213a Keep SequencePair vs SequenceInfo
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-14 12:01:29 -07:00
Derek Collison
9405b77e46 Added in last active reporting for consumers for delivered and ack floor.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-14 11:36:27 -07:00
Derek Collison
969cf60def Add in push bound status for consumer info.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-14 08:35:40 -07:00
Derek Collison
c4a78d91b7 Remove PushActive
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-13 15:11:31 -07:00
Derek Collison
5ec5020a8b Add in DeliverGroup to consumer as optional queue group.
Changed sublist register for notifications to be queue bound.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-13 15:07:56 -07:00
Derek Collison
d252f0f700 Make sure PushActive is nil for pull consumers
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-12 10:15:55 -07:00
Derek Collison
c781256dda Add in deliver status for consumer info
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-11 15:41:33 -07:00
scottf
84d37e8a92 assign default to MaxAckPending when AckExplicit -or- AckAll, not just AckExplicit 2021-08-10 17:38:46 -04:00
R.I.Pienaar
76ab1b8d17 attempt to improve UX of the error system
Previously we had a few confusing functions like NewT
and similar that were quite fragile to use due to minimal
validation and a panic in go stdlib string Replacer.

Now we generate helper methods for every string, these
are used to access errors, fill in templates and conditional
returns of error type using the new Unless() option

We now get compile time errors for some common mistakes
and have better IDE helpers for arguments etc

Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-08-10 16:08:28 +02:00
Derek Collison
b38c361afd Merge pull request #2427 from nats-io/bad-err
Fix for #2423
2021-08-10 07:03:39 -07:00
Derek Collison
cb6b397573 Fix for #2423
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-10 06:46:48 -07:00
Derek Collison
29536629eb Simplified flow control, avoid stalls due to msg loss
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-09 20:13:17 -07:00
Derek Collison
40c21934c5 Fix for #2416
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-06 14:58:25 -07:00
Derek Collison
bf966d84f3 Number of initial pending was off by one when DeliverLastPerSubject was utilized on a consumer.
Signed-off-by: Derek Collison <derek@nats.io>
2021-08-04 14:20:52 -07:00
Derek Collison
398ae95a4a Various bug fixes and improvements to filestore consumer stores.
Improved behavior around clustered persistent consumers.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-03 22:17:49 -07:00
Derek Collison
067ef19ce9 Fix for #2392. We were not resetting the pending timer properly during stream purge.
No we just let it fire as normal and it will be canceled or not as needed.

Signed-off-by: Derek Collison <derek@nats.io>
2021-08-01 17:28:59 -07:00
Derek Collison
170b0570d4 Off by one bug (surprise) that would skip first new message on deliver last per subject.
Signed-off-by: Derek Collison <derek@nats.io>
2021-07-30 15:19:01 -07:00
Derek Collison
959a0da1f0 Merge branch 'main' into deliver-last-per-subject
Signed-off-by: Derek Collison <derek@nats.io>
2021-07-29 05:42:45 -07:00
Derek Collison
9b0158daf9 Allow delivery policy of DeliverLastPerSubject, which is helpful for scoped watchers for K/V.
Signed-off-by: Derek Collison <derek@nats.io>
2021-07-28 12:49:02 -07:00
Derek Collison
98970ac03d Add descriptions to JetStream streams and consumers. 2021-07-27 14:05:25 -07:00
R.I.Pienaar
24584a0b4a fix error replacements in consumer validation
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-07-27 18:17:07 +02:00
Derek Collison
f13fa767c2 Remove the swapping of accounts during processing of service imports.
When processing service imports we would swap out the accounts during processing.
With the addition of internal subscriptions and internal clients publishing in JetStream we had an issue with the wrong account being used.
This was specific to delyaed pull subscribers trying to unsubscribe due to max of 1 while other JetStream API calls were running concurrently.
2021-07-26 07:57:10 -07:00
Derek Collison
225df04662 Fix for a consumer's num pending being stuck at 1.
We were trying to protect the sgap uint64 from wrapping, but in some cases the consumers is eager and can get a message before we sgap++.
Instead of slowing things down and sycnhronizing ++ then --, we allow it to wrap temporarily and have and adjustedPending() func that will set to zero for reporting.

Signed-off-by: Derek Collison <derek@nats.io>
2021-07-10 12:37:08 -07:00
R.I.Pienaar
359a4d980b remove duplicate error
Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-07-10 11:46:37 -07:00
Derek Collison
57cfba0964 Make requirement for interest on creation of ephemerals soft vs hard.
Will start the cleanup timer if no interest but allow creation.

Signed-off-by: Derek Collison <derek@nats.io>
2021-07-06 10:48:07 -07:00
Derek Collison
960c45df81 Use of sync.Pool for filestore could cause msg corruption.
Signed-off-by: Derek Collison <derek@nats.io>
2021-07-06 08:41:01 -07:00
R.I.Pienaar
709e256d64 Add error codes for all consumer creation errors
I wanted to supress some logging of consumer create
errors that just isn't needed and would be really
annoying on large networks, so I added many constants
and updated all errors.

I think only JSConsumerStoreFailedErrF is worth logging
on large networks else there would be quite a lot of
logs generated that one just cannot act on

Signed-off-by: R.I.Pienaar <rip@devco.net>
2021-07-06 14:51:03 +02:00
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
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
Derek Collison
e238512285 Handling of rewrites for subjects to a globally routed subject was not properly handling c.pa.deliver or reply rewrite.
Signed-off-by: Derek Collison <derek@nats.io>
2021-06-09 15:34:47 -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