Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add consumer_limits and first_seq to Stream Config #242

Open
11 of 17 tasks
Jarema opened this issue Sep 20, 2023 · 3 comments
Open
11 of 17 tasks

Add consumer_limits and first_seq to Stream Config #242

Jarema opened this issue Sep 20, 2023 · 3 comments
Assignees
Labels
client Client related work enhancement New feature or request

Comments

@Jarema
Copy link
Member

Jarema commented Sep 20, 2023

Overview

Two additional fields were added in 2.10:

  • consumer_limits
  • first_seq

consumer_limits

A new field in StreamConfig that is a struct representing consumer limits created on given stream.

  • It will not enforce limits on existing consumers. Having consumers with values higher than new limits (so it includes consumers with defaults) will result in error when setting the limits. No limits will be set at all.
  • After setting new limits, when creating new consumers, their defaults will be lowered to the current stream consumer limits if those are lower than previous limits or lower than global nats-server defaults.
  • If new consumers have explicitly set values for inactive_threshold or max_ack_pending, those will be left as they are. If passed value is too high (above limits), consumer creation will fail. Stream will not lower those values.
// In Stream Config
type StreamConfig struct {
       ...
	// The following defaults will apply to consumers when created against
	// this stream, unless overridden manually.
	ConsumerLimits StreamConsumerLimits `json:"consumer_limits"`
       ...
}

// Struct representing the `consumer_limits` field value.
type StreamConsumerLimits struct {
	InactiveThreshold time.Duration `json:"inactive_threshold,omitempty"`
	MaxAckPending     int           `json:"max_ack_pending,omitempty"`
}

first_seq

Defines sequence from which stream starts when created

type StreamConfig struct {
       ...
	FirstSeq     uint64           `json:"first_seq,omitempty"`
       ...
}

Not documented in ADRs.
Not mandatory for 2.10 client release if causes release delay.

Clients and Tools

Other Tasks

  • docs.nats.io updated @bruth
  • Update ADR to Implemented
  • Update client features spreadsheet

Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.

@Jarema Jarema added enhancement New feature or request client Client related work labels Sep 20, 2023
@ripienaar
Copy link
Contributor

@neilalexander maybe you can explain the behaviour of these for us, it says:

	// The following defaults will apply to consumers when created against
	// this stream, unless overridden manually.

But also these are limits?

So are they maximums or defaults or both a default and a maximum? I want to be sure to get the description in the schemas right

@Jarema
Copy link
Member Author

Jarema commented Sep 21, 2023

I added some explanations based on our discussions.

@ripienaar ripienaar removed their assignment Sep 21, 2023
@scottf
Copy link
Collaborator

scottf commented Sep 21, 2023

I've talked directly to Neil and Tomasz. There is some clarity to be gained on the explanation of consumer limits, but I don't think there is anything for the client to do, the server will return an error if there is a constraint violation when updating a stream of adding/updating a consumer.
Maybe the explanation just needs to be proliferated to the docs.

@scottf scottf removed their assignment Sep 22, 2023
@aricart aricart removed their assignment Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Client related work enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants