mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 05:04:05 -08:00
Remove old checkpoint dir if it still exists (#6621)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
aad8f89ecb
commit
201491fd1b
|
@ -133,6 +133,10 @@ func Checkpoint(w *WAL, from, to int, keep func(id uint64) bool, mint int64) (*C
|
||||||
cpdir := filepath.Join(w.Dir(), fmt.Sprintf(checkpointPrefix+"%06d", to))
|
cpdir := filepath.Join(w.Dir(), fmt.Sprintf(checkpointPrefix+"%06d", to))
|
||||||
cpdirtmp := cpdir + ".tmp"
|
cpdirtmp := cpdir + ".tmp"
|
||||||
|
|
||||||
|
if err := os.RemoveAll(cpdirtmp); err != nil {
|
||||||
|
return nil, errors.Wrap(err, "remove previous temporary checkpoint dir")
|
||||||
|
}
|
||||||
|
|
||||||
if err := os.MkdirAll(cpdirtmp, 0777); err != nil {
|
if err := os.MkdirAll(cpdirtmp, 0777); err != nil {
|
||||||
return nil, errors.Wrap(err, "create checkpoint dir")
|
return nil, errors.Wrap(err, "create checkpoint dir")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue