mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/fs: panic with fatal error when directories cannot be removed
Unremoved directories may lead to inconsistent data directory, so VictoriaMetrics will fail to start next time. So panic on the first error when trying to remove directory in order to simplify recover process.
This commit is contained in:
parent
d897bc3f08
commit
28d9904efc
1 changed files with 2 additions and 4 deletions
|
@ -246,16 +246,14 @@ func dirRemover() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !isTemporaryNFSError(err) {
|
if !isTemporaryNFSError(err) {
|
||||||
logger.Errorf("cannot remove %q: %s", path, err)
|
logger.Panicf("FATAL: cannot remove %q: %s", path, err)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
// NFS prevents from removing directories with open files.
|
// NFS prevents from removing directories with open files.
|
||||||
// Sleep for a while and try again in the hope open files will be closed.
|
// Sleep for a while and try again in the hope open files will be closed.
|
||||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/61 .
|
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/61 .
|
||||||
attempts++
|
attempts++
|
||||||
if attempts > 10 {
|
if attempts > 10 {
|
||||||
logger.Errorf("cannot remove %q in %d attempts: %s", path, attempts, err)
|
logger.Panicf("FATAL: cannot remove %q in %d attempts: %s", path, attempts, err)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue