-
Notifications
You must be signed in to change notification settings - Fork 40
Enable negative cache in VirtualTableInfoManager to improve performance #3209
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
Enable negative cache in VirtualTableInfoManager to improve performance #3209
Conversation
Summary of ChangesHello @brfrn169, 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 introduces negative caching to the Highlights
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces negative caching to VirtualTableInfoManager to improve performance by caching lookups for non-existent virtual tables. The implementation correctly uses Optional<VirtualTableInfo> in the LoadingCache to store both successful lookups and negative results. The corresponding tests are also updated to verify the new caching behavior. The change is logical and well-executed. I have one suggestion regarding cache configuration to enhance robustness against potential memory issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements negative caching in VirtualTableInfoManager to improve performance by caching non-existent virtual table lookups. Previously, when a virtual table did not exist, the manager would return null without caching, causing repeated queries to the storage admin. The implementation wraps the cache value type in Optional to distinguish between "not yet cached" and "cached as non-existent".
Key changes:
- Changed cache type from
LoadingCache<TableKey, VirtualTableInfo>toLoadingCache<TableKey, Optional<VirtualTableInfo>>to enable negative caching - Updated cache loader to return
Optionaldirectly instead of unwrapping withorElse(null) - Modified
getVirtualTableInfoto unwrap the cachedOptionalvalue withorElse(null)to maintain API compatibility
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| VirtualTableInfoManager.java | Changed cache type to use Optional wrapper and updated cache loader and retrieval logic to support negative caching |
| VirtualTableInfoManagerTest.java | Updated test name and assertions to verify that non-existent virtual tables are cached (1 admin call instead of 3) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0514661 to
c24b16d
Compare
feeblefakie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
komamitsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Torch3333
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Description
Previously, when a virtual table did not exist,
VirtualTableInfoManagerreturnednullwithout caching the result. This caused repeated queries to the storage admin for non-existent virtual tables, leading to unnecessary overhead. By implementing negative caching, we can avoid these redundant lookups.Related issues and/or PRs
N/A
Changes made
VirtualTableInfoManagerto cache non-existent virtual table lookupsChecklist
Additional notes (optional)
N/A
Release notes
N/A