go-ethereum/core/rawdb/freezer_utils_windows.go
Charles Dusek ed28bef1cb core/rawdb: fix freezer dir.Sync() failure on Windows
The atomicRename function calls dir.Sync() on a directory handle,
which is not supported on Windows and returns "Access is denied".
This caused truncateTail and resetTo to fail after already closing
the index file, leaving it in a closed state for subsequent reads.

Extract the directory sync into a platform-specific syncDir()
function: a no-op on Windows, and the existing fsync-with-EINVAL-
handling on Unix. This follows the same pattern already used in
triedb/pathdb/fileutils_{unix,windows}.go.

Fixes #34114
2026-03-29 10:46:59 -05:00

26 lines
1,008 B
Go

// Copyright 2022 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
//go:build windows
// +build windows
package rawdb
// syncDir is a no-op on Windows. Fsyncing a directory handle is not
// supported and returns "Access is denied".
func syncDir(name string) error {
return nil
}