chore: [cache-dir-size-fix] Part 1: Add disk-size utilities and shared-dir locker utilities#4414
chore: [cache-dir-size-fix] Part 1: Add disk-size utilities and shared-dir locker utilities#4414gargnitingoogle wants to merge 4 commits intomasterfrom
Conversation
|
/gemini review |
|
/gemini summary |
There was a problem hiding this comment.
Code Review
This pull request introduces valuable utilities for calculating disk size and a striped locking mechanism for directories to enhance performance and prevent race conditions. The SharedDirLocker is a good approach to reduce lock contention, and the new SafeCreateFile function correctly uses it. The disk size calculation is implemented concurrently, and the test coverage for the new functionality is thorough. I have one suggestion to improve the performance of the disk size calculation by adjusting a concurrency parameter.
Summary of ChangesThis pull request lays foundational groundwork for a cache directory size fix by introducing robust utilities for disk space management and concurrent directory access. It provides mechanisms to precisely measure disk consumption, ensure the integrity of directory structures during file creation, and safely handle operations across multiple cache directories through a striped locking mechanism. These changes are crucial for reliable cache management and preventing race conditions. Highlights
Changelog
Activity
|
There was a problem hiding this comment.
Code Review
This pull request introduces several utility functions for disk size calculation and directory locking, which are essential for managing the cache directory safely and efficiently. The new SharedDirLocker uses striped locking to minimize contention, and SafeCreateFile leverages it to prevent race conditions during file creation. The overall implementation is good, but I've identified a significant concurrency issue in the removeEmptyDirs function that could lead to race conditions and potential deadlocks. I've also noted a minor issue with a vague error message. My review includes suggestions to address these points.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4414 +/- ##
==========================================
- Coverage 83.70% 83.67% -0.03%
==========================================
Files 163 165 +2
Lines 20077 20202 +125
==========================================
+ Hits 16805 16904 +99
- Misses 2648 2663 +15
- Partials 624 635 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ebd1a5e to
fec64b0
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request introduces a robust SharedDirLocker utility and comprehensive disk utility functions, which are well-tested with a good suite of unit tests. However, the PR description should be updated to accurately reflect the presence of these new unit tests, as it currently states that unit tests are 'NA'.
|
Hi @ashmeenkaur, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
2 similar comments
|
Hi @ashmeenkaur, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
|
Hi @ashmeenkaur, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you! |
Pull request was converted to draft
|
Moving it back to draft as this approach is currently under review. Will restructure or mark it ready for review later again, if needed. |
28e5de1 to
cc61e60
Compare
address gemini comments - Add SafeCreateFile unit tests address gemini comments - update SafeCreateFile tests and Add Arrange/Act/Assert add more self-review comments
cc61e60 to
77e24b9
Compare
Description
Link to the issue in case of a bug fix.
b/477828938
Testing details
Any backward incompatible change? If so, please explain.