Skip to content

fix(bigtable): honor per-call retryableCodes in MutateRowsAttemptCallable - #15046

Open
igorbernstein2 wants to merge 2 commits into
mainfrom
fix-mutaterows-per-call-retryable-codes
Open

igorbernstein2 wants to merge 2 commits into
mainfrom
fix-mutaterows-per-call-retryable-codes

Conversation

@igorbernstein2

Copy link
Copy Markdown
Contributor

Summary

When a caller overrides retryableCodes per call via ApiCallContext.withRetryableCodes(...), MutateRowsAttemptCallable previously ignored callContext.getRetryableCodes() in createEntryError (always checking the stub default this.retryableCodes) and in createSyntheticErrorForRpcFailure (keeping requestApiException.isRetryable() computed from the stub default).

Changes

  • Use callContext.getRetryableCodes() when non-null in createEntryError and createSyntheticErrorForRpcFailure (falling back to the stub default retryableCodes).
  • Add unit tests in MutateRowsAttemptCallableTest verifying per-call retryableCodes overrides for both entry-level and RPC-level errors.

@igorbernstein2
igorbernstein2 requested review from a team as code owners November 16, 2026 22:46

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 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.

Comment on lines +365 to +370
boolean isRetryable =
callContext.getRetryableCodes() != null
? callContext
.getRetryableCodes()
.contains(requestApiException.getStatusCode().getCode())
: requestApiException.isRetryable();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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());

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant