Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: log: Stop logging file does not exists #10588

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion storage/paths/localstorage_cached.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package paths

import (
"os"
"sync"
"time"

Expand Down Expand Up @@ -103,7 +104,9 @@ func (c *cachedLocalStorage) DiskUsage(path string) (int64, error) {
go func() {
du, err := c.base.DiskUsage(path)
if err != nil {
log.Errorw("error getting disk usage", "path", path, "error", err)
if !os.IsNotExist(err) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe still debug-log the IsNotExist error?

Copy link
Contributor Author

@rjan90 rjan90 Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the this code (the not cached part of the code) it seems like we actually do not care:

if err != nil {
// we don't care about 'not exist' errors, as storage can be
// reserved before any files are written, so this error is not
// unexpected
if !os.IsNotExist(err) {
log.Warnf("getting disk usage of '%s': %+v", p.sectorPath(id, fileType), err)
}
continue
}

I think the reason for it, is that it can take quite a bit of time between the sector being reserved, and the file being transferred over.

I can add the same comment to this part of the code as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also seems from my testing that the defualt logging setting for stores is DEBUG, which makes this logging a bit unbearable. I will look into tuning that down in another PR.

log.Errorw("error getting disk usage", "path", path, "error", err)
}
}
resCh <- diskUsageResult{
usage: du,
Expand Down