chore(tsdb): set the wbl to nil as well in DBReadOnly.loadDataAsQueryable

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
machine424 2024-03-20 14:09:21 +01:00
parent a9a4fbafb0
commit 2a2e2ed28b
No known key found for this signature in database
GPG Key ID: A4B001A4FDEE017D
1 changed files with 2 additions and 1 deletions

View File

@ -529,9 +529,10 @@ func (db *DBReadOnly) loadDataAsQueryable(maxt int64) (storage.SampleAndChunkQue
if err := head.Init(maxBlockTime); err != nil { if err := head.Init(maxBlockTime); err != nil {
return nil, fmt.Errorf("read WAL: %w", err) return nil, fmt.Errorf("read WAL: %w", err)
} }
// Set the wal to nil to disable all wal operations. // Set the wal and the wbl to nil to disable related operations.
// This is mainly to avoid blocking when closing the head. // This is mainly to avoid blocking when closing the head.
head.wal = nil head.wal = nil
head.wbl = nil
} }
db.closers = append(db.closers, head) db.closers = append(db.closers, head)