Improve partial profile cache mount option override handling#1219
Improve partial profile cache mount option override handling#1219uriel-guzman wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
Conversation
|
Skipping CI for Draft Pull Request. |
Summary of ChangesHello @uriel-guzman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the cache recommendation system by providing more granular control and better handling of user-defined cache settings. It ensures that explicit user overrides for metadata and file cache sizes are respected, while still attempting to find optimal storage mediums. The changes prevent unintended overrides of default profile values and improve the robustness of cache allocation in various scenarios. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: uriel-guzman The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request refactors the cache recommendation logic to better handle user-provided overrides from mount options. The changes introduce a cacheOverrides struct and update the recommendation functions to respect these overrides. The logic for skipping recommendations is also refined to only skip file cache recommendations when a custom medium is used.
I've identified a critical bug in the parseCacheOverrides function that prevents user overrides from being applied correctly, as detailed in the specific comment. Additionally, the tests for recommender.go appear to be outdated and do not cover the new functionality, which is a significant gap. Please ensure that the tests are updated to reflect these changes and provide adequate coverage.
7a8203e to
f6dc6c8
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the cache recommendation logic to better handle user-provided overrides for cache sizes. The changes introduce a more granular approach, allowing the recommender to respect user-defined values on a per-cache basis rather than skipping all recommendations. However, a significant bug was identified in the handling of infinite file cache overrides where the system does not correctly respect the user's setting. A detailed comment with a suggested fix is provided to address this high-severity issue.
f6dc6c8 to
8df355e
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves how user-provided cache configuration overrides are handled. Instead of skipping all smart cache recommendations when an override is detected, the new logic intelligently incorporates user-defined values into the recommendation process. It makes a best-effort attempt to respect user overrides while still considering available resource budgets, providing warnings if the overrides might lead to issues like OOM. The changes are well-structured, and the addition of comprehensive test cases for various override scenarios is excellent. I've found a couple of minor typos in comments and error messages.
8df355e to
0359d9f
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the cache recommendation logic to better handle user-provided overrides for cache sizes. The changes introduce a cacheOverrides struct to represent user settings, and the recommendation functions are updated to respect these overrides while still providing warnings about potential resource exhaustion. The logic for skipping file cache recommendations is also refined. The accompanying test changes are thorough and cover various override scenarios.
My feedback focuses on improving the clarity of warning messages by logging sizes in MiB instead of bytes, and on adhering to standard Go formatting (gofmt) for case statements. These changes will enhance user experience during debugging and improve code readability.
0359d9f to
d2b3793
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves the cache recommendation logic by incorporating user-provided overrides instead of disabling smart recommendations. The changes are well-structured, introducing a cacheOverrides struct and a parsing mechanism to handle user inputs gracefully. The recommendation functions for both metadata and file caches have been updated to respect these overrides, with clear logic for handling finite, infinite, and disabled cache sizes. The test suite has been expanded with comprehensive cases covering the new override scenarios.
I've found a couple of minor issues in warning log messages where format specifiers and units could be improved for clarity. I've left specific comments with suggestions for these. Overall, this is a solid improvement to the feature.
931d993 to
0af84e3
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves how user-provided cache configuration overrides are handled. Instead of disabling all smart recommendations when an override is present, the new logic incorporates user preferences into the recommendation algorithm. This allows for partial overrides, providing more flexibility. The changes are extensive, touching the core recommendation logic, logging, and mount option merging. The test suite has also been expanded to cover these new override scenarios. The changes are well-structured and improve the feature's usability. I've found a few minor issues related to logging and comments.
942241c to
233bdc4
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves the handling of user-provided cache configuration overrides. Instead of disabling all smart recommendations, the new logic intelligently incorporates user overrides for metadata and file caches into the recommendation algorithm. The changes are well-structured, with clear separation of concerns for parsing overrides and applying them. The introduction of new constants for CLI mount option keys and a normalizeOpt function enhances robustness and deduplication. The test suite has been commendably expanded to cover a wide range of override scenarios, ensuring the new logic is well-vetted. Overall, this is a solid enhancement. I have one minor suggestion to improve a log message for clarity and consistency.
233bdc4 to
4c1d402
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a significant improvement by handling user-provided cache configuration overrides more gracefully, rather than completely disabling smart recommendations. The changes are well-structured, with clear separation of concerns for parsing overrides and applying them to the recommendation logic. The introduction of the cacheOverrides struct and the refactoring of mount option key handling are excellent. I have one suggestion to simplify the logic for handling LSSD on TPU nodes, which should make the code cleaner and more robust, aligning with principles of maintainability and redundancy reduction. Overall, this is a great enhancement.
27938ad to
20190d1
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves the handling of partial profile cache mount option overrides in the GCS FUSE CSI driver. It allows users to override specific cache settings (metadata stat, metadata type, or file cache) while still benefiting from smart recommendations for the remaining parameters. The changes include robust parsing of mount options in both CLI and config-file formats, improved resource budget calculations that respect overrides, and enhanced logging for better transparency. Additionally, several bug fixes in E2E tests and log formatting were addressed.
20190d1 to
247c3dc
Compare
What type of PR is this?
/kind feature
What this PR does / why we need it:
Before: If the customer specifies any of the following mountOptions:
or configures a custom file cache medium, all smart recommendation are disabled. The rationale was that it is complex to integrate the customer's cache preferences into the recommendation algortihm.
After: If the customer specifies any of the mountOptions above, they will be incorporated into the recommendation algorithm in the following manner:
Metadata caches
The same rationale applies for
metadata-cache:stat-max-size-mb.metadata-cache:type-cache-max-size-mb:0: Disabling a single cache size doesn't affect other recommendations, so this should work flawlessly.metadata-cache:type-cache-max-size-mb:-1: Since the desired cache size is infinite, we can assume it can potentially grow up to the estimated cache size. Therefore, we subtract the estimated cache size from the memory budget for the remaining recommendations, and log a warning if the estimated cache size exceeds the RAM available, while still allowing the customer's override, instead of capping it.metadata-cache:type-cache-max-size-mb:<some finite value>: Since the desired cache size is finite, we can use it as input for the algorithm. Since we need to respect the override, a warning is logged if the override exceeds the RAM available, while still allowing the customer's override, instead of capping it.File cache
File cache max size will be overriden and smart file cache size calculation + medium evalutation will be skipped because we can't provide a medium if the cache size exceeds all available mediums, and we shouldn't disable file caching because the customer explicitly requested their file cache to be of this size.
Custom file cache medium
If the customer set a custom file cache medium, we can't know what the size of that medium is, since it could literally be any type of volume. Therefore, we disable smart file cache size calculation, and allow the default size to take place, which is unlimited when this feature is used: https://docs.cloud.google.com/storage/docs/cloud-storage-fuse/cli-options#file-cache-max-size-mb.
This PR essentially allows partial overrides, i.e. overriding file cache should still allow metadata stat cache to be automatically calculated, since it should be independent.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: