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

Implementation of stream.purge() seems wrong for consumers with multiple filter subjects #4826

Closed
svenfoo opened this issue Nov 28, 2023 · 1 comment · Fixed by #4873
Closed
Assignees
Labels
defect Suspected defect such as a bug or regression

Comments

@svenfoo
Copy link
Contributor

svenfoo commented Nov 28, 2023

Observed behavior

While reading the code of stream.purge() I found what looks like an oversight:

https://github.com/nats-io/nats-server/blob/main/server/stream.go#L2005 and the lines below check if the subject of the purge request matches the consumer's filter subject. A consumer can however have multiple filter subjects and this is not taken into account here.

Expected behavior

The code should probably not use the consumer's config, but instead check if the purge subject is a subset match for any of the consumers's subject filters by accessing o.subj (https://github.com/nats-io/nats-server/blob/main/server/consumer.go#L311).

Server and client version

server version 2.10.5

Host environment

No response

Steps to reproduce

No response

@svenfoo svenfoo added the defect Suspected defect such as a bug or regression label Nov 28, 2023
svenfoo added a commit to holoplot/nats-server that referenced this issue Dec 11, 2023
Closes nats-io#4826

Signed-off-by: Sven Neumann <sven.neumann@holoplot.com>
svenfoo added a commit to holoplot/nats-server that referenced this issue Dec 11, 2023
Closes nats-io#4826

Signed-off-by: Sven Neumann <sven.neumann@holoplot.com>
@svenfoo
Copy link
Contributor Author

svenfoo commented Dec 11, 2023

I've got a fix for this here, but it builds on top of #4864, so I'll wait until this has been merged.

svenfoo added a commit to holoplot/nats-server that referenced this issue Dec 11, 2023
Closes nats-io#4826

Signed-off-by: Sven Neumann <sven.neumann@holoplot.com>
wallyqs pushed a commit that referenced this issue Dec 15, 2023
Closes #4826

Signed-off-by: Sven Neumann <sven.neumann@holoplot.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants