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

[FIXED] Multiple issues with concurrent stream create requests. #3679

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

derekcollison
Copy link
Member

This requires stream requests for the same stream be received before any assignments have been quorum'd.

First issue was applications not getting any response. However, there was also a more serious issue that would create multiple raft groups for each concurrent request. The servers would only run one stream monitor loop, however they would update the state to the new raft group's name, so on server restart the stream would be using a different raft group then existing servers.

Also added in protection for when the meta-leader knows about the stream assignment and wants to convert it to a stream info call but the leader has not been elected yet.

Signed-off-by: Derek Collison derek@nats.io

Resolves #3677

/cc @nats-io/core

First issue was applications not getting any response.
However, there was also a more serious issue that would create multiple raft groups for each concurrent request.
The servers would only run one stream monitor loop, however they would update the state to the new raft group's name, so on server restart the stream would be using a different raft group then existing servers.

Signed-off-by: Derek Collison <derek@nats.io>
@@ -759,7 +759,7 @@ func (js *jetStream) apiDispatch(sub *subscription, c *client, acc *Account, sub
jsub := rr.psubs[0]

// If this is directly from a client connection ok to do in place.
if c.kind != ROUTER && c.kind != GATEWAY {
if c.kind != ROUTER && c.kind != GATEWAY && c.kind != LEAF {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would c.kind == CLIENT be better if only ever from a client conn?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly but this future proofs for new types, like wss etc.

Copy link
Member

@ColinSullivan1 ColinSullivan1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@derekcollison derekcollison merged commit 7665787 into main Dec 6, 2022
@derekcollison derekcollison deleted the fix-3677 branch December 6, 2022 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jetstream fails to properly create consumers and jetstream in case of parallel requests
2 participants