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

Use stree for message block fss #5559

Merged
merged 2 commits into from
Jun 21, 2024
Merged

Use stree for message block fss #5559

merged 2 commits into from
Jun 21, 2024

Conversation

neilalexander
Copy link
Member

Should provide some deduplication of long subjects in memory when message blocks are loaded in.

Signed-off-by: Neil Twigg neil@nats.io

@neilalexander neilalexander marked this pull request as ready for review June 21, 2024 08:37
@neilalexander neilalexander requested a review from a team as a code owner June 21, 2024 08:37
@neilalexander neilalexander changed the title [2.11] Use stree for message block fss Use stree for message block fss Jun 21, 2024
server/filestore.go Outdated Show resolved Hide resolved
server/filestore.go Outdated Show resolved Hide resolved
server/filestore.go Outdated Show resolved Hide resolved
server/filestore.go Outdated Show resolved Hide resolved
Should provide some deduplication of long subjects in memory.

Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Derek Collison <derek@nats.io>
Copy link
Member

@wallyqs wallyqs 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 self-requested a review June 21, 2024 21:22
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

@derekcollison derekcollison merged commit 72e0637 into main Jun 21, 2024
3 checks passed
@derekcollison derekcollison deleted the neil/streefss branch June 21, 2024 21:25
wallyqs pushed a commit that referenced this pull request Jun 21, 2024
Should provide some deduplication of long subjects in memory when
message blocks are loaded in.

Signed-off-by: Neil Twigg <neil@nats.io>

---------

Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Derek Collison <derek@nats.io>
Co-authored-by: Derek Collison <derek@nats.io>
wallyqs added a commit that referenced this pull request Jun 21, 2024
Includes:

* #5571 
* #5082
* #5573
* #5574
* #5575
* #5577
* #5578
* #5580 
* #5559 

Signed-off-by: Neil Twigg <neil@nats.io>
derekcollison added a commit that referenced this pull request Jul 7, 2024
This PR contains some bug-fixes for the filestore FSS state.

First, if the filter provided is `_EMPTY_` then we need to overwrite it
to `>` for the stree functions to work, but we failed to set `wc` when
doing so. This could affect the decision on whether to linear-scan or
not. We will now set `wc` too in this case.

Second, if the FSS only contains a single subject then we may not
correctly set `isAll` if the filter contained a wildcard, as `Find` does
not work with wildcards and therefore wouldn't match the single subject.
Updated to use `Match` instead, so that it correctly uses wildcards.

Third, replaces `Match(>)` with `Iter` in `enforceMsgPerSubjectLimit`,
not because it is behaviourally different, but because we need to walk
the entire stree anyway and `Iter` saves CPU cycles by skipping the
match step.

Fourth, updates the bounds checking on various functions that use `Find`
so that the logic matches the `Match` equivalents. This also matters in
particular in `SubjectsState` which could fail altogether when the
filter was a subject literal rather than a wildcard and the `psim` was
out-of-date/needing update.

Fifth, in `NumPending` and in `filteredPendingLocked` when matching the
FSS state, if we find a partial, don't process any further matches after
that. This bug was introduced in #5559 as there used to be a `break`
there, whereas now the `Match` that replaces it can't be interrupted in
the same way.

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.

3 participants