-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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] Use correct sequence on duplicate message with no interest #5818
[FIXED] Use correct sequence on duplicate message with no interest #5818
Conversation
Signed-off-by: Maurice van Veen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually seq 0 signifies from the server that the message was not stored. So this would be a behavioral departure from the initial design.
Also note the the err would be set in that pub ack as well.
Not sure if I understand this, in the
Ah, good to know. In that case there is already behavioral difference. For example a Limits-based stream does report the 'correct' sequence (depending on definitions): $ nats req limits '' -H 'Nats-Msg-Id: dedupe'
09:37:32 Sending request on "limits"
09:37:32 Received with rtt 162.995µs
{"stream":"LIMITS", "seq":1}
$ nats req limits '' -H 'Nats-Msg-Id: dedupe'
09:37:35 Sending request on "limits"
09:37:35 Received with rtt 144.56µs
{"stream":"LIMITS", "seq":1,"duplicate": true} There it does contain the This PR is actually related to an issue reported by Marco and Antithesis. The second test fails: 8f12b9e So it seems that for a duplicate message the
What would be a good way forward?
I'm leaning toward reserving |
the response going back is JSPubAckResponse Lines 118 to 121 in 2cae85d
|
Yeah I've seen that, but |
Ah, indeed if its 0 there should be an error |
If we already return persisted seq and this would make that consistent I am supportive. |
So @ripienaar you agree we should merge this and make the behavior consistent, so on dupe detection we return duplicate: true but seq > 0 and matches the original? |
server/jetstream_test.go
Outdated
@@ -23925,3 +23925,32 @@ func TestJetStreamConsumerStartSequenceNotInStream(t *testing.T) { | |||
require_Equal(t, consumer.asflr, 10) | |||
}() | |||
} | |||
|
|||
func TestInterestStreamWithDuplicateMessages(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the test name ok? I think it has to be TestJetStreamInterestStreamWithDuplicateMessages
for it to run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected this and another case.
Signed-off-by: Maurice van Veen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
A duplicate message inserted into an Interest-based stream with no interest would return 0 as sequence instead of the sequence of the initial message. ```sh $ nats req interest '' -H 'Nats-Msg-Id: dedupe' 20:31:43 Sending request on "interest" 20:31:43 Received with rtt 187.55µs {"stream":"INTEREST", "seq":6} $ nats req interest '' -H 'Nats-Msg-Id: dedupe' 20:31:43 Sending request on "interest" 20:31:43 Received with rtt 101.95µs {"stream":"INTEREST", "seq":0,"duplicate": true} # ---- seq should be 6 -----^ ``` Signed-off-by: Maurice van Veen <[email protected]> --------- Signed-off-by: Maurice van Veen <[email protected]>
Test should've been prefixed with `TestJetStream`. As noted by @wallyqs: #5818 (comment) Signed-off-by: Maurice van Veen <[email protected]>
A duplicate message inserted into an Interest-based stream with no interest would return 0 as sequence instead of the sequence of the initial message. ```sh $ nats req interest '' -H 'Nats-Msg-Id: dedupe' 20:31:43 Sending request on "interest" 20:31:43 Received with rtt 187.55µs {"stream":"INTEREST", "seq":6} $ nats req interest '' -H 'Nats-Msg-Id: dedupe' 20:31:43 Sending request on "interest" 20:31:43 Received with rtt 101.95µs {"stream":"INTEREST", "seq":0,"duplicate": true} # ---- seq should be 6 -----^ ``` Signed-off-by: Maurice van Veen <[email protected]> --------- Signed-off-by: Maurice van Veen <[email protected]>
A duplicate message inserted into an Interest-based stream with no interest would return 0 as sequence instead of the sequence of the initial message.
Signed-off-by: Maurice van Veen [email protected]