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

Fix linear scan in LoadNextMsg with partial per-subject info state #5532

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

neilalexander
Copy link
Member

If the per-subject info didn't have a correct first block (which is possible as it is populated lazily), then LoadNextMsg could end up making a very expensive call through to numFilteredPending which would do a linear scan of potentially many blocks.

Signed-off-by: Neil Twigg [email protected]

@neilalexander neilalexander requested a review from a team as a code owner June 13, 2024 21:48
@neilalexander neilalexander changed the title Fix linear scan in numFilteredPending with partial per-subject info state Fix linear scan in LoadNextMsgs with partial per-subject info state Jun 13, 2024
@neilalexander neilalexander changed the title Fix linear scan in LoadNextMsgs with partial per-subject info state Fix linear scan in LoadNextMsg with partial per-subject info state Jun 13, 2024
server/filestore.go Outdated Show resolved Hide resolved
If the per-subject info didn't have a correct first block (which is possible
as it is populated lazily), then `LoadNextMsg` could end up making a very
expensive call through to `numFilteredPending` which would do a linear scan
of potentially many blocks.

Signed-off-by: Neil Twigg <[email protected]>
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 4609587 into main Jun 13, 2024
4 checks passed
@derekcollison derekcollison deleted the nfp-linear-scan branch June 13, 2024 23:28
@neilalexander neilalexander mentioned this pull request Jun 14, 2024
derekcollison added a commit that referenced this pull request Jun 14, 2024
This PR reverts #5532 as it did not solve the problem I expected it to
solve and has also surfaced another performance regression visible in
`Benchmark_FileStoreLoadNextMsgNoMsgsNotFirstSeq`.

Signed-off-by: Neil Twigg <[email protected]>
wallyqs added a commit that referenced this pull request Jun 17, 2024
Includes the following:

* #5524
* #5528
* #5533
* #5535
* #5538
* #5543
* #5546
* #5545
* #5547
* #5548
* #5530 (**BETA**)
* #5549

The following PRs were **NOT** included as they were later reverted:

* #5532

Signed-off-by: Neil Twigg <[email protected]>
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