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 <sujalshah28092004@gmail.com>
This commit is contained in:
Sujal Shah 2025-08-05 22:40:26 +05:30
parent 25aee26a57
commit 17c58f5fce

View File

@ -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() {