From c5d549ae56e6c7f49dbd3c8779832e2089b999ef Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Mon, 29 Jan 2024 22:34:49 -0500 Subject: [PATCH] Don't close the Scanner until Bytes is done --- store/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/store/store.go b/store/store.go index df5e8a88..1d4fec38 100644 --- a/store/store.go +++ b/store/store.go @@ -1949,11 +1949,12 @@ func (s *Store) fsmSnapshot() (fSnap raft.FSMSnapshot, retErr error) { if err != nil { return nil, err } - walFD.Close() // We need it closed for the next step. compactedBytes, err := scanner.Bytes() if err != nil { return nil, err } + walFD.Close() // We need it closed for the next step. + stats.Get(snapshotCreateWALCompactDuration).(*expvar.Int).Set(time.Since(compactStartTime).Milliseconds()) compactedBuf = bytes.NewBuffer(compactedBytes)