Skip to content

Commit

Permalink
[FIXED] Protect against going upside down on mb.msgs. (#4575)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Sep 22, 2023
2 parents ece431f + 2716248 commit 6fdcd1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/filestore.go
Expand Up @@ -1576,7 +1576,11 @@ func (fs *fileStore) recoverFullState() (rerr error) {
return errCorruptState
}
mb.dmap = *dmap
mb.msgs -= numDeleted
if mb.msgs > numDeleted {
mb.msgs -= numDeleted
} else {
mb.msgs = 0
}
bi += n
}
// Only add in if not empty or the lmb.
Expand Down

0 comments on commit 6fdcd1e

Please sign in to comment.