Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces centralized unary RPC retry helpers for Cloud Spanner, adding both asynchronous and synchronous implementations along with comprehensive unit tests. The feedback highlights an issue where re-instantiating the retry policy using type(retry_policy)(...) could raise a TypeError if a custom subclass has a different constructor signature. It is recommended to directly pass the on_error handler when calling the retry policy instead.
Introduce a shared unary RPC retry helper for both the synchronous and asynchronous Spanner clients. Previously, unary RPCs relied on ad-hoc retry loops and inconsistent handling of transient errors, which prevented per-attempt request ID tracking from advancing across retries. This change lays the groundwork for unifying unary retries across the client in follow-up changes by: - Resolving method-specific retry policies from the underlying transport configuration while extending them to retry transient Spanner internal errors alongside unavailable and resource-exhausted responses. - Executing unary requests through a shared retry wrapper that allocates a single logical request ID per operation and increments the attempt counter on each retry. - Adding unit tests covering both synchronous and asynchronous retry resolution, backoff execution, error classification, and timeout behavior. No existing client operations are modified in this change.
904dd8a to
e8ea6bb
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces centralized unary RPC retry helpers for Cloud Spanner, providing both asynchronous and synchronous implementations (_async/_retry.py and _retry.py) along with comprehensive unit tests. These helpers handle transient Spanner errors, resolve effective retry policies, and execute unary RPCs with per-attempt request IDs. I have no feedback to provide as the implementation is clean and well-tested.
Introduce a shared unary RPC retry helper for both the synchronous and asynchronous Spanner clients.
Previously, unary RPCs relied on ad-hoc retry loops and inconsistent handling of transient errors, which prevented per-attempt request ID tracking from advancing across retries. This change lays the groundwork for unifying unary retries across the client in follow-up changes by:
No existing client operations are modified in this change.