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 warning log when creating a new cache dir #5200

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

polyrabbit
Copy link
Contributor

After updating to the latest master branch, a lot of warning logs show up (see attached screenshot).

This happens because dir is appended with "/" in the CacheManager (I don't know why), and when calling filepath.Dir on a string ending with "/", the function returns the same dir (with "/" trimed). So same dir is passed to os.Mkdir twice, and the second call will raise a warning log. This may cause confusion to users.

image

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.94%. Comparing base (c2b21f4) to head (68f6ff2).
Report is 27 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5200       +/-   ##
===========================================
- Coverage   54.27%   43.94%   -10.33%     
===========================================
  Files         161      104       -57     
  Lines       43776    19341    -24435     
===========================================
- Hits        23758     8500    -15258     
+ Misses      17336    10066     -7270     
+ Partials     2682      775     -1907     
Flag Coverage Δ
43.94% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davies
Copy link
Contributor

davies commented Sep 29, 2024

we should ignore the EEXISTS from Mkdir, it's an expected behavior

Signed-off-by: jiefenghuang <[email protected]>
@polyrabbit
Copy link
Contributor Author

polyrabbit commented Sep 29, 2024

We have os.Stat check in the beginning, and only create if os.Stat says it doesn't exist. So I suppose the EEXISTS error is a unexpected behavior?

@davies
Copy link
Contributor

davies commented Sep 29, 2024

It's expected that more than one goroutine will call createDir(), so one fail with EEXISTS is expected.

@polyrabbit
Copy link
Contributor Author

OK, get it - it has concurrent access when writing caches.

@davies davies merged commit 7eb68cb into juicedata:main Oct 8, 2024
37 of 39 checks passed
jiefenghuang added a commit that referenced this pull request Nov 26, 2024
Signed-off-by: Changxin Miao <[email protected]>
Signed-off-by: jiefenghuang <[email protected]>
Co-authored-by: jiefenghuang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants