Repository navigation
fix(bigtable): honor per-call retryableCodes in MutateRowsAttemptCallable - #15046
igorbernstein2 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates MutateRowsAttemptCallable to respect per-call retryable codes from ApiCallContext for both entry-level and RPC-level failures, and adds corresponding unit tests. The reviewer identified an inconsistency in createSyntheticErrorForRpcFailure where it falls back to requestApiException.isRetryable() instead of the stub's configured retryableCodes when no per-call override is present. A code suggestion was provided to align this fallback behavior with createEntryError.
| boolean isRetryable = | ||
| callContext.getRetryableCodes() != null | ||
| ? callContext | ||
| .getRetryableCodes() | ||
| .contains(requestApiException.getStatusCode().getCode()) | ||
| : requestApiException.isRetryable(); |
There was a problem hiding this comment.
When callContext.getRetryableCodes() is null, createSyntheticErrorForRpcFailure falls back to requestApiException.isRetryable(). However, requestApiException.isRetryable() only reflects the hardcoded default of the exception class (e.g., false for AbortedException), ignoring any custom retryableCodes configured at the stub level (which are stored in this.retryableCodes).
This creates an inconsistency where entry-level errors (via createEntryError) correctly honor the stub's configured retryableCodes when no per-call override is present, but RPC-level errors (via createSyntheticErrorForRpcFailure) ignore them.
To fix this and ensure consistency, we should fall back to this.retryableCodes instead of requestApiException.isRetryable() when callContext.getRetryableCodes() is null.
Set<StatusCode.Code> effectiveRetryableCodes =
callContext.getRetryableCodes() != null ? callContext.getRetryableCodes() : retryableCodes;
boolean isRetryable =
effectiveRetryableCodes.contains(requestApiException.getStatusCode().getCode());
Summary
When a caller overrides
retryableCodesper call viaApiCallContext.withRetryableCodes(...),MutateRowsAttemptCallablepreviously ignoredcallContext.getRetryableCodes()increateEntryError(always checking the stub defaultthis.retryableCodes) and increateSyntheticErrorForRpcFailure(keepingrequestApiException.isRetryable()computed from the stub default).Changes
callContext.getRetryableCodes()when non-null increateEntryErrorandcreateSyntheticErrorForRpcFailure(falling back to the stub defaultretryableCodes).MutateRowsAttemptCallableTestverifying per-callretryableCodesoverrides for both entry-level and RPC-level errors.