Skip to content

fix(bigtable): use the configured retry policy for bulk mutation failures - #16572

Open
rootkiller6788 wants to merge 2 commits into
googleapis:mainfrom
rootkiller6788:fix-bulk-apply-retry-policy
Open

rootkiller6788 wants to merge 2 commits into
googleapis:mainfrom
rootkiller6788:fix-bulk-apply-retry-policy

Conversation

@rootkiller6788

Copy link
Copy Markdown

BulkApply() was deciding whether a failed mutation deserved another attempt with the library's default retry traits, so a policy set through DataRetryPolicyOption only ever affected the stream errors. If your policy says PERMISSION_DENIED is worth retrying, or that UNAVAILABLE is not, the per-mutation handling ignored you.

What I changed:

  • BulkMutatorState::OnRead() now takes the options for the request and asks the configured policy to classify each failed mutation. It only calls IsPermanentFailure(); the policy is never told about the error, because retrying a single mutation is not a new attempt of the operation and the retry loop around the RPC already does the accounting. That matches the notes in Bigtable BulkApply does not respect custom retry policies for individual mutation errors #14656.
  • Both callers hand over what they already have: BulkMutator::MakeOneRequest() has the options, and AsyncBulkApplier keeps them around for its own use.
  • With no policy configured we keep the old default classification, so nothing moves for the default setup. The default DataRetryPolicy delegates straight to SafeGrpcRetry, so this only changes behavior if you actually set a custom policy.

I added two tests: one where the policy makes an UNAVAILABLE mutation permanent, and one where it makes a PERMISSION_DENIED mutation retryable.

I could not build this on my machine (no gRPC/Abseil installed here), so the unit tests are doing the checking I normally would.

Fixes #14656

…ures

BulkApply() decided whether a failed mutation was worth retrying with the
default retry traits, so a policy set through DataRetryPolicyOption only
affected the stream errors. Reach for the configured policy instead, which
lets an application make a mutation error retryable or permanent.

The policy is only asked to classify the error, it is never told about it:
retrying a single mutation is not a new attempt of the operation and the
retry loop driving the RPC does the accounting.

Fixes googleapis#14656
…tried

One test makes an UNAVAILABLE mutation permanent through a policy, the
other makes a PERMISSION_DENIED mutation retryable.
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Oct 16, 2026

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

Copy link
Copy Markdown

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 the Bigtable bulk mutator to respect the application-configured DataRetryPolicyOption when classifying mutation failures, falling back to default transient failure classification if none is configured. Unit tests were added to verify this behavior. The review feedback recommends replacing 1UL with std::size_t{1} in the assertions of the new unit tests to prevent portability issues and compilation warnings on platforms like Windows x64.

EXPECT_STATUS_OK(status);
EXPECT_FALSE(mutator.HasPendingMutations());
auto failures = std::move(mutator).OnRetryDone();
ASSERT_EQ(1UL, failures.size());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using 1UL can lead to portability issues or compilation warnings on platforms where std::size_t is not defined as unsigned long (such as Windows x64, where unsigned long is 32-bit and std::size_t is 64-bit). We should use std::size_t{1} to ensure type safety and portability across all supported platforms.

  ASSERT_EQ(std::size_t{1}, failures.size());

EXPECT_STATUS_OK(status);
EXPECT_TRUE(mutator.HasPendingMutations());
auto failures = std::move(mutator).OnRetryDone();
ASSERT_EQ(1UL, failures.size());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using 1UL can lead to portability issues or compilation warnings on platforms where std::size_t is not defined as unsigned long (such as Windows x64, where unsigned long is 32-bit and std::size_t is 64-bit). We should use std::size_t{1} to ensure type safety and portability across all supported platforms.

  ASSERT_EQ(std::size_t{1}, failures.size());

@rootkiller6788
rootkiller6788 marked this pull request as ready for review October 17, 2026 07:41
@rootkiller6788
rootkiller6788 requested a review from a team as a code owner October 17, 2026 07:41
@colinmoy

Copy link
Copy Markdown
Collaborator

/gcbrun

@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.10145% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.32%. Comparing base (272499d) to head (3e7ba07).
⚠️ Report is 75 commits behind head on main.

Files with missing lines Patch % Lines
...oogle/cloud/bigtable/internal/bulk_mutator_test.cc 96.72% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16572      +/-   ##
==========================================
+ Coverage   92.29%   92.32%   +0.02%     
==========================================
  Files        2257     2257              
  Lines      215637   215703      +66     
==========================================
+ Hits       199032   199147     +115     
+ Misses      16605    16556      -49     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch was successfully deployed

1 active deployment
false — 3e7ba071 Deployed Oct 16, 2026 by rootkiller6788 via Save PR ref #12480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bigtable BulkApply does not respect custom retry policies for individual mutation errors

2 participants