Repository navigation
fix(bigtable): use the configured retry policy for bulk mutation failures - #16572
rootkiller6788 wants to merge 2 commits into
Conversation
…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.
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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());|
/gcbrun |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
BulkApply() was deciding whether a failed mutation deserved another attempt with the library's default retry traits, so a policy set through
DataRetryPolicyOptiononly 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 callsIsPermanentFailure(); 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.BulkMutator::MakeOneRequest()has the options, andAsyncBulkApplierkeeps them around for its own use.DataRetryPolicydelegates straight toSafeGrpcRetry, 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