impl(bigtable): add RandomTwoLeastUsed stub decorator#16049
impl(bigtable): add RandomTwoLeastUsed stub decorator#16049scotthart merged 1 commit intogoogleapis:mainfrom
Conversation
Summary of ChangesHello, 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 a new 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a BigtableRandomTwoLeastUsed stub decorator. This decorator uses a DynamicChannelPool to select a stub for each RPC using a 'random two least used' strategy, and it correctly manages the usage count of stubs via AcquireStub and ReleaseStub calls. The implementation is well-structured, using helper templates to reduce boilerplate for unary, streaming, and async streaming RPCs. The new functionality is also accompanied by unit tests.
My main feedback is a suggestion to improve the robustness of the UnaryHelper function by using an RAII pattern to ensure resources are released even in the case of an exception, aligning it with the safer implementation of the streaming helpers.
google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.cc
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16049 +/- ##
==========================================
- Coverage 92.68% 92.67% -0.01%
==========================================
Files 2341 2342 +1
Lines 216206 216344 +138
==========================================
+ Hits 200391 200503 +112
- Misses 15815 15841 +26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds a BigtableStub decorator that holds the DynamicChannelPool object and wraps calls to the child stub with logic to increment and decrement the ChannelUsage RPC counter.