From dd8b41bff2ae19ca61e42e04e74c723f705db30c Mon Sep 17 00:00:00 2001 From: Snehendu Roy <81818503+snehendu098@users.noreply.github.com> Date: Fri, 17 Apr 2026 17:15:03 +0530 Subject: [PATCH] core/rawdb: fix incorrect fsync ordering for index file truncation (#34728) --- core/rawdb/freezer_utils.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/rawdb/freezer_utils.go b/core/rawdb/freezer_utils.go index 6f424a6b61..1a549af765 100644 --- a/core/rawdb/freezer_utils.go +++ b/core/rawdb/freezer_utils.go @@ -76,6 +76,11 @@ func copyFrom(srcPath, destPath string, offset uint64, before func(f *os.File) e // we do the final move. src.Close() + // Permanently persist the content into disk + if err := f.Sync(); err != nil { + return err + } + if err := f.Close(); err != nil { return err }