Skip to content

Commit

Permalink
Recycle buffers on rebuild and make sure we write out our full state …
Browse files Browse the repository at this point in the history
…prior to commencing snapshot.

Signed-off-by: Derek Collison <[email protected]>
  • Loading branch information
derekcollison committed Oct 24, 2023
1 parent 6845864 commit 2a9be3c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,8 @@ func (mb *msgBlock) rebuildStateLocked() (*LostStreamData, []uint64, error) {
mb.clearCacheAndOffset()

buf, err := mb.loadBlock(nil)
defer recycleMsgBlockBuf(buf)

if err != nil || len(buf) == 0 {
var ld *LostStreamData
// No data to rebuild from here.
Expand Down Expand Up @@ -7350,6 +7352,9 @@ func (fs *fileStore) Snapshot(deadline time.Duration, checkMsgs, includeConsumer
}
}

// Write out full state as well before proceeding.
fs.writeFullState()

pr, pw := net.Pipe()

// Set a write deadline here to protect ourselves.
Expand Down

0 comments on commit 2a9be3c

Please sign in to comment.