server: skip directory fsync on Windows in the tier download path

os.Open(dir).Sync() is unsupported on Windows and returns an error, which would
fail VolumeTierMoveDatFromRemote entirely there. Skip the directory fsync on
Windows, matching how the storage-side helper tolerates the unsupported case.
This commit is contained in:
Chris Lu
2026-06-13 13:10:36 -07:00
parent ce27276deb
commit 50f934aafb
+6 -1
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"time"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
@@ -121,8 +122,12 @@ func swapToLocalDatBackend(v *storage.Volume, datFileName string) error {
return nil
}
// fsyncDir flushes a directory entry so renamed/created files within it survive a crash.
// fsyncDir flushes a directory entry so renamed/created files within it survive
// a crash. Directory fsync is unsupported on Windows, so it is skipped there.
func fsyncDir(dir string) error {
if runtime.GOOS == "windows" {
return nil
}
d, err := os.Open(dir)
if err != nil {
return err