mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/persistentqueue: properly re-create flock.lock file inside directory if persistent queue is broken.
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5249 Thanks to @Sniper91 for the bugreport and initial fix at https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5233
This commit is contained in:
parent
efb6ac27c2
commit
98699f203b
1 changed files with 2 additions and 0 deletions
|
@ -188,7 +188,9 @@ func tryOpeningQueue(path, name string, chunkFileSize, maxBlockSize, maxPendingB
|
||||||
}
|
}
|
||||||
|
|
||||||
// path contents is broken or missing. Re-create it from scratch.
|
// path contents is broken or missing. Re-create it from scratch.
|
||||||
|
fs.MustClose(q.flockF)
|
||||||
fs.RemoveDirContents(path)
|
fs.RemoveDirContents(path)
|
||||||
|
q.flockF = fs.MustCreateFlockFile(path)
|
||||||
mi.Reset()
|
mi.Reset()
|
||||||
mi.Name = q.name
|
mi.Name = q.name
|
||||||
if err := mi.WriteToFile(metainfoPath); err != nil {
|
if err := mi.WriteToFile(metainfoPath); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue