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

[FIXED] Fixes for filestore FSS state #5616

Merged
merged 7 commits into from
Jul 7, 2024
Merged

[FIXED] Fixes for filestore FSS state #5616

merged 7 commits into from
Jul 7, 2024

Conversation

neilalexander
Copy link
Member

@neilalexander neilalexander commented Jul 4, 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

… and `filteredPendingLocked`

Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
@neilalexander neilalexander changed the title Neil/filestorewc Fixes for filestore FSS state Jul 4, 2024
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 - Small comments but really good changes.

server/filestore.go Outdated Show resolved Hide resolved
server/filestore.go Outdated Show resolved Hide resolved
server/filestore.go Outdated Show resolved Hide resolved
@derekcollison derekcollison marked this pull request as ready for review July 7, 2024 18:51
@derekcollison derekcollison requested a review from a team as a code owner July 7, 2024 18:51
…Find`

Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
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 7956494 into main Jul 7, 2024
3 checks passed
@derekcollison derekcollison deleted the neil/filestorewc branch July 7, 2024 20:01
@wallyqs wallyqs changed the title Fixes for filestore FSS state [FIXED] Fixes for filestore FSS state Jul 9, 2024
wallyqs added a commit that referenced this pull request Jul 9, 2024
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.

2 participants