mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +00:00
lib/persistentqueue: verify that ReaderOffset doesnt exceed WriterOffset when opening the persistent queue
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/964
This commit is contained in:
parent
ae972429c7
commit
d006b41eff
1 changed files with 4 additions and 0 deletions
|
@ -336,6 +336,10 @@ func tryOpeningQueue(path, name string, chunkFileSize, maxBlockSize, maxPendingB
|
||||||
cleanOnError()
|
cleanOnError()
|
||||||
return nil, fmt.Errorf("couldn't find chunk file for writing in %q", q.dir)
|
return nil, fmt.Errorf("couldn't find chunk file for writing in %q", q.dir)
|
||||||
}
|
}
|
||||||
|
if q.readerOffset > q.writerOffset {
|
||||||
|
cleanOnError()
|
||||||
|
return nil, fmt.Errorf("readerOffset=%d cannot exceed writerOffset=%d", q.readerOffset, q.writerOffset)
|
||||||
|
}
|
||||||
mustCloseFlockF = false
|
mustCloseFlockF = false
|
||||||
return &q, nil
|
return &q, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue