From 17c58f5fcef9e75a2880e41bb0e994af1370e836 Mon Sep 17 00:00:00 2001 From: Sujal Shah Date: Tue, 5 Aug 2025 22:40:26 +0530 Subject: [PATCH] wal: ignore os.ErrNotExist errors in DirSize during WAL size calculation This change updates `DirSize` to ignore `os.ErrNotExist` errors, since they are expected during normal WAL cleanup. All other errors continue to propagate. Fixes: #17005 Signed-off-by: Sujal Shah --- tsdb/fileutil/dir.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tsdb/fileutil/dir.go b/tsdb/fileutil/dir.go index 1672a92d4c..ad039d2231 100644 --- a/tsdb/fileutil/dir.go +++ b/tsdb/fileutil/dir.go @@ -22,6 +22,10 @@ func DirSize(dir string) (int64, error) { var size int64 err := filepath.Walk(dir, func(_ string, info os.FileInfo, err error) error { if err != nil { + // Ignore missing files that may have been deleted during the walk. + if os.IsNotExist(err) { + return nil + } return err } if !info.IsDir() {