mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/{mergeset,storage}: properly fsync part directory listing after writing in-memory part to disk
This is a follow-up after 42bba64aa7
Previously the part directory listing was fsync'ed implicitly inside partHeader.WriteMetadata()
by calling fs.WriteFileAtomically(). Now it must be fsync'ed explicitly.
There is no need in fsync'ing the parent directory, since it is fsync'ed by the caller
when updating parts.json file.
This commit is contained in:
parent
42bba64aa7
commit
25f089de9d
2 changed files with 4 additions and 6 deletions
|
@ -56,9 +56,8 @@ func (mp *inmemoryPart) StoreToDisk(path string) error {
|
|||
if err := mp.ph.WriteMetadata(path); err != nil {
|
||||
return fmt.Errorf("cannot store metadata: %w", err)
|
||||
}
|
||||
// Sync parent directory in order to make sure the written files remain visible after hardware reset
|
||||
parentDirPath := filepath.Dir(path)
|
||||
fs.MustSyncPath(parentDirPath)
|
||||
fs.MustSyncPath(path)
|
||||
// Do not sync parent directory - it must be synced by the caller.
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,8 @@ func (mp *inmemoryPart) StoreToDisk(path string) error {
|
|||
if err := mp.ph.WriteMetadata(path); err != nil {
|
||||
return fmt.Errorf("cannot store metadata: %w", err)
|
||||
}
|
||||
// Sync parent directory in order to make sure the written files remain visible after hardware reset
|
||||
parentDirPath := filepath.Dir(path)
|
||||
fs.MustSyncPath(parentDirPath)
|
||||
fs.MustSyncPath(path)
|
||||
// Do not sync parent directory - it must be synced by the caller.
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue