Skip to content

[IMPROVED] Multi-Filtered Consumers#5274

Merged
derekcollison merged 2 commits intomainfrom
multi-filter-consumers
Apr 4, 2024
Merged

[IMPROVED] Multi-Filtered Consumers#5274
derekcollison merged 2 commits intomainfrom
multi-filter-consumers

Conversation

@derekcollison
Copy link
Copy Markdown
Member

This change introduces a new LoadNextMsgMulti into the store layer. It is passed a sublist that is maintained by the consumer. The store layer matches potential messages across any positive match in the sublist.

Resolves: #4888

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

Signed-off-by: Derek Collison <derek@nats.io>
…ects.

Signed-off-by: Derek Collison <derek@nats.io>
@derekcollison derekcollison requested a review from a team as a code owner April 3, 2024 23:21
Copy link
Copy Markdown
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM but wonder if we should consider #5275 for testing new functionality like this.

Copy link
Copy Markdown
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

Looks good!

Though I have one doubt which I commented about.

// Check if we are multi-filtered or not.
if o.filters != nil {
sm, sseq, err = store.LoadNextMsgMulti(o.filters, o.sseq, &pmsg.StoreMsg)
} else if o.subjf != nil { // Means single filtered subject since o.filters means > 1.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are quite few implicit assumptions and relations here:

  1. That o.filters == nil means single or none filtesrs.
  2. That o.subjf != nil means signel filter

Thoes are fine, but it's easy to introduce bugs in the future by changing how we update consumers, filters etc.

@derekcollison derekcollison merged commit 3170cc9 into main Apr 4, 2024
@derekcollison derekcollison deleted the multi-filter-consumers branch April 4, 2024 14:57
derekcollison added a commit that referenced this pull request Apr 4, 2024
Cherry-pick the following PRs into the v2.10.14 release branch:

* #5237
* #5238
* #5242
* #5208
* #5244
* #5248
* #5246
* #5112
* #5247
* #5256
* #5258
* #5264
* #5266
* #5267
* #5265
* #5271
* #5270
* #5272
* #5276
* #5274
* #5275
* #5277
* #5279

Signed-off-by: Neil Twigg <neil@nats.io>
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.

Performance issues with consumers that have multiple filter subjects

3 participants