lib/{storage,mergeset}: sync filenames inside part when finalizing the part

Fixes https://github.com/VictoriaMetrics/VictoriaMetrics/issues/63
This commit is contained in:
Aliaksandr Valialkin 2019-06-11 21:46:21 +03:00
parent 4d9f088526
commit 20fc0e0e54
2 changed files with 12 additions and 0 deletions

View file

@ -151,6 +151,12 @@ func (bsw *blockStreamWriter) MustClose() {
bsw.itemsWriter.MustClose()
bsw.lensWriter.MustClose()
// Sync bsw.path contents to make sure it doesn't disappear
// after system crash or power loss.
if bsw.path != "" {
fs.SyncPath(bsw.path)
}
bsw.reset()
}

View file

@ -146,6 +146,12 @@ func (bsw *blockStreamWriter) MustClose() {
bsw.indexWriter.MustClose()
bsw.metaindexWriter.MustClose()
// Sync bsw.path contents to make sure it doesn't disappear
// after system crash or power loss.
if bsw.path != "" {
fs.SyncPath(bsw.path)
}
bsw.reset()
}