mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
lib/filestream: transform Open() -> MustOpen()
Callers of this function log the returned error and exit. Let's log the error with the path to the filename and call stack inside the function. This simplifies the code at callers' side without reducing the level of debuggability.
This commit is contained in:
@@ -100,10 +100,7 @@ func (q *queue) mustResetFiles() {
|
||||
q.writer = w
|
||||
|
||||
q.readerPath = q.writerPath
|
||||
r, err := filestream.Open(q.readerPath, true)
|
||||
if err != nil {
|
||||
logger.Panicf("FATAL: cannot open chunk file %q: %s", q.readerPath, err)
|
||||
}
|
||||
r := filestream.MustOpen(q.readerPath, true)
|
||||
q.reader = r
|
||||
|
||||
if err := q.flushMetainfo(); err != nil {
|
||||
@@ -559,10 +556,7 @@ func (q *queue) nextChunkFileForRead() error {
|
||||
}
|
||||
q.readerLocalOffset = 0
|
||||
q.readerPath = q.chunkFilePath(q.readerOffset)
|
||||
r, err := filestream.Open(q.readerPath, true)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot open chunk file %q: %w", q.readerPath, err)
|
||||
}
|
||||
r := filestream.MustOpen(q.readerPath, true)
|
||||
q.reader = r
|
||||
if err := q.flushMetainfo(); err != nil {
|
||||
return fmt.Errorf("cannot flush metainfo: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user