mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
use fsync to force persisting the meta file. (#573)
* use fsync to force persisting the meta file. Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
This commit is contained in:
parent
aed16621c0
commit
e46ec89de6
|
@ -2,6 +2,7 @@
|
|||
- [REMOVED] `chunks.NewReader` is removed as it wasn't used anywhere.
|
||||
- [REMOVED] `FromData` is considered unused so was removed.
|
||||
- [FEATURE] Added option WALSegmentSize -1 to disable the WAL.
|
||||
- [BUGFIX] Fsync the meta file to persist it on disk to avoid data loss in case of a host crash.
|
||||
|
||||
## 0.6.1
|
||||
- [BUGFIX] Update `last` after appending a non-overlapping chunk in `chunks.MergeOverlappingChunks`. [#539](https://github.com/prometheus/tsdb/pull/539)
|
||||
|
|
5
block.go
5
block.go
|
@ -251,6 +251,11 @@ func writeMetaFile(dir string, meta *BlockMeta) error {
|
|||
merr.Add(f.Close())
|
||||
return merr.Err()
|
||||
}
|
||||
// Force the kernel to persist the file on disk to avoid data loss if the host crashes.
|
||||
if merr.Add(f.Sync()); merr.Err() != nil {
|
||||
merr.Add(f.Close())
|
||||
return merr.Err()
|
||||
}
|
||||
if err := f.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue