lib/backup/fsremote/fsremote.go: remove unneeded fsync for the hard-linked file

The source file contents should be already fsynced to disk before creating a hard link,
so there is no sense in calling fsync() on the created hard link.
This commit is contained in:
Aliaksandr Valialkin
2025-08-30 01:44:15 +02:00
parent 3c4004673e
commit 3b656147ef

View File

@@ -9,7 +9,6 @@ import (
"github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/common"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/backup/fscommon"
libfs "github.com/VictoriaMetrics/VictoriaMetrics/lib/fs"
"github.com/VictoriaMetrics/VictoriaMetrics/lib/logger"
)
@@ -103,7 +102,7 @@ func (fs *FS) CopyPart(srcFS common.OriginFS, p common.Part) error {
}
// Attempt to create hardlink from srcPath to dstPath.
if err := os.Link(srcPath, dstPath); err == nil {
libfs.MustSyncPath(dstPath)
// There is no need in fsync for dstPath, since its contents must be already synced at srcPath.
return nil
}