Skip to content

Commit

Permalink
Allow Bigtable RPC retries (#7636)
Browse files Browse the repository at this point in the history
* Allow Bigtable RPC retries

Following up on #7552.

Add BT total timeout and max attempts settings.

Bigtable RPC calls will not be retried if neither total timeout
nor max attempts are set.
  • Loading branch information
dimas-b authored Oct 18, 2023
1 parent da3d18c commit 424e637
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ public interface QuarkusBigTableConfig {

Optional<Duration> maxRetryDelay();

OptionalInt maxAttempts();

Optional<Duration> initialRpcTimeout();

Optional<Duration> totalTimeout();

Optional<Duration> initialRetryDelay();

OptionalInt minChannelCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public Backend buildBackend() {
configureDataClient(
dataSettings,
Optional.of(poolSettings),
bigTableConfig.totalTimeout(),
bigTableConfig.maxAttempts(),
bigTableConfig.maxRetryDelay(),
bigTableConfig.initialRpcTimeout(),
bigTableConfig.initialRetryDelay());
Expand Down
2 changes: 2 additions & 0 deletions site/docs/try/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ When setting `nessie.version.store.type=BIGTABLE` which enables Google BigTable
| `nessie.version.store.persist.bigtable.initial-channel-count` | `1` | `int` | Initial number of gRPC channels. Refer to Google docs for details. |
| `nessie.version.store.persist.bigtable.min-rpcs-per-channel` | `0` | `int` | Minimum number of RPCs per channel. Refer to Google docs for details. |
| `nessie.version.store.persist.bigtable.max-rpcs-per-channel` | (unlimited) | `int` | Maximum number of RPCs per channel. Refer to Google docs for details. |
| `nessie.version.store.persist.bigtable.max-attempts` | (unspecified) | `int` | Maximum number of attempts for each Bigtable API call (including retries). |
| `nessie.version.store.persist.bigtable.total-timeout` | (unspecified) | `Duration` | Total timeout (including retries) for Bigtable API calls. |
| `nessie.version.store.persist.bigtable.initial-rpc-timeout` | (unspecified) | `Duration` | Initial RPC timeout. |
| `nessie.version.store.persist.bigtable.initial-retry-delay` | (unspecified) | `Duration` | Initial retry delay. |
| `nessie.version.store.persist.bigtable.max-retry-delay` | (unspecified) | `Duration` | Max retry-delay. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.util.Optional;
import java.util.OptionalInt;
import org.projectnessie.versioned.storage.common.persist.Backend;
import org.projectnessie.versioned.storage.testextension.BackendTestFactory;

Expand Down Expand Up @@ -61,7 +62,13 @@ BigtableDataClient buildNewDataClient() {
.setCredentialsProvider(NoCredentialsProvider.create());

configureDataClient(
settings, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
settings,
Optional.empty(),
Optional.empty(),
OptionalInt.empty(),
Optional.empty(),
Optional.empty(),
Optional.empty());

return BigtableDataClient.create(settings.build());
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
import org.projectnessie.versioned.storage.common.persist.Backend;
Expand Down Expand Up @@ -56,6 +57,8 @@ public Backend buildBackend(@Nonnull @jakarta.annotation.Nonnull BigTableBackend
public static void configureDataClient(
BigtableDataSettings.Builder settings,
Optional<ChannelPoolSettings> channelPoolSettings,
Optional<Duration> totalRpcTimeout,
OptionalInt maxAttempts,
Optional<Duration> maxRetryDelay,
Optional<Duration> initialRpcTimeout,
Optional<Duration> initialRetryDelay) {
Expand All @@ -68,9 +71,11 @@ public static void configureDataClient(
stubSettings.mutateRowSettings().retrySettings(),
stubSettings.bulkMutateRowsSettings().retrySettings(),
stubSettings.readChangeStreamSettings().retrySettings())) {
configureDuration(totalRpcTimeout, retrySettings::setTotalTimeout);
configureDuration(initialRpcTimeout, retrySettings::setInitialRpcTimeout);
configureDuration(initialRetryDelay, retrySettings::setInitialRetryDelay);
configureDuration(maxRetryDelay, retrySettings::setMaxRetryDelay);
maxAttempts.ifPresent(retrySettings::setMaxAttempts);
}

channelPoolSettings.ifPresent(
Expand Down

0 comments on commit 424e637

Please sign in to comment.