This is the first step to enable batch flushing. Currently, the outermost callable for bulk mutations is a RetryingCallable. Although this composes nicely with automatic batching, it makes it very difficult to reason about manual flushing of batches. For example: what happens when multiple entries fail after a flush? should batcher retry each entry individually? should it spool them? etc. By moving the retries after batching, flushing becomes easier: on flush, the batcher sends all of its batches to the retry logic and waits for all batches to either succeed or run out of attempts.
The implementation uses the retrying infrastructure directly, bypassing Callable.retrying & RetryingCallable. This is necessary because I need to track state of completed entries. This state is maintained in the new MutateRowsAttemptCallable class, which tracks incomplete mutation entries. The class also transforms the results of the RPC to be a bit more ergonomic: - upon either RPC or entry failures a MutateRowsException is thrown. This exception can be inspected to identify failed mutations. - Since a successful MutateRowsResponse holds no interesting information, it is replaced with a Void.
At some point in the future I would like to try to generalize MutateRowsAttemptCallable to simply wrap something like a BatchingDescriptor. This would allow the GAPIC generated batching configuration to be used for implementing partial retries on batches.
The PR is broken up into 3 commits:
1. Adds the new attempt Callable, which is equivalent of gax's AttemptCallable. It contains all of the logic for composing a request.
2. Wraps the new Callable in a UnaryCallable which uses gax's RetryingExecutor to manage retry attempts
3. Update the Bigtable chain to use the new functionality
It would be easiest to review this a commit at a time.
该提问来源于开源项目:googleapis/google-cloud-java