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

[CHANGED] JetStream: accept "Nats-Expected-Last-Sequence" with "0" #3038

Merged
merged 1 commit into from Jul 7, 2022

Conversation

kozlovic
Copy link
Member

We use to ignore if the seq was 0, but now would treat it as
a requirement that the stream be empty if header is present but
set to 0.

This relates to client PR: nats-io/nats.go#958

Signed-off-by: Ivan Kozlovic ivan@synadia.com

@ripienaar
Copy link
Contributor

Looks good, but seems unlikely @derekcollison would have forgotten to add this when we did the per-subject one to support KV Create(), so maybe there was a reason for not doing it? Do you remember anything @derekcollison ?

@kozlovic
Copy link
Member Author

@ripienaar That's what I fear too, so a bit hesitant and would not mind if we don't add this. In the client PR you mentioned that we should have it for consistency (compared to the last-ser-per-subject). Have you changed your mind seeing the code change?

@ripienaar
Copy link
Contributor

I reckon it has good value both in being consistent and as a feature - but I am also aware we are very near a big release and might punt till 2.9.x, so would be fine if we waited a tad to give it proper thought.

@kozlovic
Copy link
Member Author

@ripienaar Could not agree more. Will switch this PR to draft and will reconsider post 2.8.0.

@kozlovic kozlovic marked this pull request as draft April 14, 2022 20:02
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

This will mean you only want to put a message in if a stream is brand new, and you only get one shot at that since purge will drop messages but not reset the first sequence to 0.

@kozlovic
Copy link
Member Author

@derekcollison Ah yes. There may be a use-case, but yeah, pretty limited. Let's leave this as draft for now.

@kozlovic
Copy link
Member Author

kozlovic commented Jul 6, 2022

@bruth @ripienaar Given the limitation described by Derek here:

This will mean you only want to put a message in if a stream is brand new, and you only get one shot at that since purge will drop messages but not reset the first sequence to 0.

would you still consider that there is value to this PR? If so, I will move it out of Draft...

@bruth
Copy link
Member

bruth commented Jul 6, 2022

I do think it would be for consistency in behavior.. obviously a call-out of this one-time situation in the docs would be important, but I am still in favor.

We use to ignore if the seq was 0, but now would treat it as
a requirement that the stream be empty if header is present but
set to 0.

This relates to client PR: nats-io/nats.go#958

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
@kozlovic kozlovic marked this pull request as ready for review July 7, 2022 16:11
@kozlovic
Copy link
Member Author

kozlovic commented Jul 7, 2022

@derekcollison @bruth @ripienaar I have rebased from main branch and switched from Draft to ready for review. If approved I will merge.

Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@kozlovic kozlovic merged commit 7ab2561 into main Jul 7, 2022
@kozlovic kozlovic deleted the js_expected_last_seq_zero branch July 7, 2022 16:36
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.

None yet

4 participants