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 FirstSeq not being updated with filestore when purging subject #4042

Merged
merged 1 commit into from Apr 12, 2023
Merged

Fix FirstSeq not being updated with filestore when purging subject #4042

merged 1 commit into from Apr 12, 2023

Conversation

MauriceVanVeen
Copy link
Contributor

Resolves #4041

Keeps firstSeqNeedsUpdate set if set previously, to ensure the FirstSeq gets updated.

@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner April 12, 2023 08:48
@@ -5098,7 +5098,8 @@ func (fs *fileStore) PurgeEx(subject string, sequence, keep uint64) (purged uint
if mb.isEmpty() {
fs.removeMsgBlock(mb)
i--
firstSeqNeedsUpdate = seq == fs.state.FirstSeq
// keep flag set, if set previously
firstSeqNeedsUpdate = firstSeqNeedsUpdate || seq == fs.state.FirstSeq
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If preferred, could also update to:

Suggested change
firstSeqNeedsUpdate = firstSeqNeedsUpdate || seq == fs.state.FirstSeq
if !firstSeqNeedsUpdate && seq == fs.state.FirstSeq {
firstSeqNeedsUpdate = true
}

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! - Thanks.

@derekcollison derekcollison merged commit 4fcc2ff into nats-io:main Apr 12, 2023
1 check passed
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.

Purging subjects using file storage doesn't update the first seq correctly
2 participants