-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: update the accounting of partial batch mutations #2149
Merged
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
7de3aba
Fixed retrying of partial errors
ron-gal aec1125
Minor changes
ron-gal e6485ee
fix tests
ron-gal e370774
fix tests
ron-gal f0f4e07
fix tests
ron-gal 4c0f12f
fix tests
ron-gal bc486e5
fix callable order
ron-gal dcd6d15
Merge branch 'googleapis:main' into retry
ron-gal bcb98d7
Fixed PR comments
ron-gal 9d225a3
reverted irrelevant changes
ron-gal 64da251
reverted irrelevant changes
ron-gal 7362b10
add tests
ron-gal 3bf1b6f
add tests
ron-gal 7c66089
add tests
ron-gal 7515f29
add tests
ron-gal 35d4c67
fix lint
ron-gal 08bcd36
Some PR fixes
ron-gal 3386f1d
more PR fixes
ron-gal ccb0a49
more PR fixes
ron-gal feb4985
fix lint
ron-gal 3f6c60a
fix test
ron-gal d57e50f
fix lint
ron-gal 820d877
add test
ron-gal 6543543
add tests
ron-gal 3f32cb5
add tests
ron-gal a7fa3dc
add tests
ron-gal 13f9c92
remove LOCAL_STATUS
ron-gal 2637e95
fix lint
ron-gal c263e51
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] a0b6f88
fix clirr warning
ron-gal ae9b8c0
fix comment
ron-gal 1570035
Merge branch 'googleapis:main' into retry
ron-gal File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Minor changes
- Loading branch information
commit aec1125cfd79a200e23042ddfb5cc65b7eddf6e1
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...in/java/com/google/cloud/bigtable/data/v2/stub/MutateRowsErrorConverterUnaryCallable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.google.cloud.bigtable.data.v2.stub; | ||
|
||
import com.google.api.core.ApiFuture; | ||
import com.google.api.core.ApiFutures; | ||
import com.google.api.gax.rpc.ApiCallContext; | ||
import com.google.api.gax.rpc.UnaryCallable; | ||
import com.google.bigtable.v2.MutateRowsRequest; | ||
import com.google.cloud.bigtable.data.v2.models.MutateRowsException; | ||
import com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsAttemptResult; | ||
import com.google.common.util.concurrent.MoreExecutors; | ||
|
||
public class MutateRowsErrorConverterUnaryCallable extends UnaryCallable<MutateRowsRequest, Void> { | ||
|
||
private final UnaryCallable<MutateRowsRequest, MutateRowsAttemptResult> innerCallable; | ||
|
||
MutateRowsErrorConverterUnaryCallable( | ||
UnaryCallable<MutateRowsRequest, MutateRowsAttemptResult> callable) { | ||
this.innerCallable = callable; | ||
} | ||
|
||
@Override | ||
public ApiFuture<Void> futureCall(MutateRowsRequest request, ApiCallContext context) { | ||
ApiFuture<MutateRowsAttemptResult> future = innerCallable.futureCall(request, context); | ||
return ApiFutures.transform( | ||
future, | ||
result -> { | ||
if (!result.failedMutations.isEmpty()) { | ||
throw MutateRowsException.create(null, result.failedMutations, result.isRetryable); | ||
} | ||
return null; | ||
}, | ||
MoreExecutors.directExecutor()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,23 +19,23 @@ | |
import com.google.api.gax.retrying.BasicResultRetryAlgorithm; | ||
import com.google.api.gax.retrying.RetryingContext; | ||
import com.google.api.gax.retrying.TimedAttemptSettings; | ||
import com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsAttemptErrors; | ||
import com.google.cloud.bigtable.data.v2.stub.mutaterows.MutateRowsAttemptResult; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
@InternalApi | ||
public class MutateRowsErrorRetryAlgorithm | ||
igorbernstein2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
extends BasicResultRetryAlgorithm<MutateRowsAttemptErrors> { | ||
BasicResultRetryAlgorithm<MutateRowsAttemptErrors> retryAlgorithm; | ||
extends BasicResultRetryAlgorithm<MutateRowsAttemptResult> { | ||
BasicResultRetryAlgorithm<MutateRowsAttemptResult> retryAlgorithm; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. private & final There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
public MutateRowsErrorRetryAlgorithm( | ||
BasicResultRetryAlgorithm<MutateRowsAttemptErrors> retryAlgorithm) { | ||
BasicResultRetryAlgorithm<MutateRowsAttemptResult> retryAlgorithm) { | ||
this.retryAlgorithm = retryAlgorithm; | ||
} | ||
|
||
@Override | ||
public TimedAttemptSettings createNextAttempt( | ||
Throwable previousThrowable, | ||
MutateRowsAttemptErrors previousResponse, | ||
MutateRowsAttemptResult previousResponse, | ||
TimedAttemptSettings previousSettings) { | ||
return retryAlgorithm.createNextAttempt(previousThrowable, previousResponse, previousSettings); | ||
} | ||
|
@@ -44,15 +44,15 @@ public TimedAttemptSettings createNextAttempt( | |
public TimedAttemptSettings createNextAttempt( | ||
RetryingContext context, | ||
Throwable previousThrowable, | ||
MutateRowsAttemptErrors previousResponse, | ||
MutateRowsAttemptResult previousResponse, | ||
TimedAttemptSettings previousSettings) { | ||
return retryAlgorithm.createNextAttempt( | ||
context, previousThrowable, previousResponse, previousSettings); | ||
} | ||
|
||
@Override | ||
public boolean shouldRetry( | ||
Throwable previousThrowable, MutateRowsAttemptErrors previousResponse) { | ||
Throwable previousThrowable, MutateRowsAttemptResult previousResponse) { | ||
if (retryAlgorithm.shouldRetry(previousThrowable, previousResponse)) { | ||
return true; | ||
} | ||
|
@@ -63,7 +63,7 @@ public boolean shouldRetry( | |
public boolean shouldRetry( | ||
@Nullable RetryingContext context, | ||
Throwable previousThrowable, | ||
MutateRowsAttemptErrors previousResponse) { | ||
MutateRowsAttemptResult previousResponse) { | ||
if (retryAlgorithm.shouldRetry(context, previousThrowable, previousResponse)) { | ||
igorbernstein2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mark this as
@InternalApi
and add javadoc explaining the purpose of this classThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I would highly recommend to use
AutoValue
for value classesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about AutoValue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done