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

Conversation

rjan90
Copy link
Contributor

@rjan90 rjan90 commented Mar 29, 2023

Related Issues

fixes: #9073

Proposed Changes

Do not log 'file does not exist' errors when retrieving disk usage information. These errors are expected, as storage can be reserved before any files are written, and they were cluttering the logs unnecessarily.

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

Stop logging `file does not exists` errors when retrieving disk usage information.
@rjan90 rjan90 marked this pull request as ready for review March 29, 2023 13:42
@rjan90 rjan90 requested a review from a team as a code owner March 29, 2023 13:42
@@ -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.

@magik6k magik6k merged commit 3af5ef1 into master Mar 30, 2023
@magik6k magik6k deleted the fix/file-does-not-exsist-logs branch March 30, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GET/Fetch clutter the logs with ERROR messages looking for sectors that are not created yet
3 participants