Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions google-cloud-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<bigtable.cfe-data-batch-endpoint>batch-bigtable.googleapis.com:443</bigtable.cfe-data-batch-endpoint>

<!-- These are needed to compile the protobuf used by Changestream merging acceptance test. -->
<test-protoc-grpc.version>1.65.0</test-protoc-grpc.version>
<test-protoc.version>3.25.5</test-protoc.version>
<test-protoc-grpc.version>1.76.3</test-protoc-grpc.version>
<test-protoc.version>4.33.2</test-protoc.version>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ public boolean isRefreshingChannel() {
*/
@Deprecated
public Builder setPrimingTableIds(String... tableIds) {
stubSettings.setPrimedTableIds(tableIds);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ public static BigtableClientContext create(EnhancedBigtableStubSettings settings
}

if (transportProvider != null) {
// Set up cookie holder if routing cookie is enabled
if (builder.getEnableRoutingCookie()) {
setupCookieHolder(transportProvider);
}
setupCookieHolder(transportProvider);

ChannelPrimer channelPrimer = NoOpChannelPrimer.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
import com.google.cloud.bigtable.data.v2.stub.sql.MetadataErrorHandlingCallable;
import com.google.cloud.bigtable.data.v2.stub.sql.PlanRefreshingCallable;
import com.google.cloud.bigtable.data.v2.stub.sql.SqlRowMergingCallable;
import com.google.cloud.bigtable.gaxx.retrying.ApiResultRetryAlgorithm;
import com.google.cloud.bigtable.gaxx.retrying.RetryInfoRetryAlgorithm;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Functions;
Expand Down Expand Up @@ -785,12 +784,9 @@ private UnaryCallable<BulkMutation, MutateRowsAttemptResult> createMutateRowsBas
ServerStreamingCallable<MutateRowsRequest, MutateRowsResponse> withAttemptTracer =
new BigtableTracerStreamingCallable<>(convertException);

BasicResultRetryAlgorithm<MutateRowsAttemptResult> resultRetryAlgorithm;
if (settings.getEnableRetryInfo()) {
resultRetryAlgorithm = new RetryInfoRetryAlgorithm<>();
} else {
resultRetryAlgorithm = new ApiResultRetryAlgorithm<>();
}
BasicResultRetryAlgorithm<MutateRowsAttemptResult> resultRetryAlgorithm =
new RetryInfoRetryAlgorithm<>();

MutateRowsPartialErrorRetryAlgorithm mutateRowsPartialErrorRetryAlgorithm =
new MutateRowsPartialErrorRetryAlgorithm(resultRetryAlgorithm);

Expand All @@ -810,11 +806,8 @@ private UnaryCallable<BulkMutation, MutateRowsAttemptResult> createMutateRowsBas
settings.bulkMutateRowsSettings().getRetryableCodes(),
retryAlgorithm);

UnaryCallable<MutateRowsRequest, MutateRowsAttemptResult> withCookie = baseCallable;

if (settings.getEnableRoutingCookie()) {
withCookie = new CookiesUnaryCallable<>(baseCallable);
}
UnaryCallable<MutateRowsRequest, MutateRowsAttemptResult> withCookie =
new CookiesUnaryCallable<>(baseCallable);

UnaryCallable<MutateRowsRequest, MutateRowsAttemptResult> flowControlCallable = null;
if (settings.bulkMutateRowsSettings().isLatencyBasedThrottlingEnabled()) {
Expand Down Expand Up @@ -1319,56 +1312,31 @@ ServerStreamingCallSettings<ReqT, RespT> convertUnaryToServerStreamingSettings(

private <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> withRetries(
UnaryCallable<RequestT, ResponseT> innerCallable, UnaryCallSettings<?, ?> unaryCallSettings) {
UnaryCallable<RequestT, ResponseT> retrying;
if (settings.getEnableRetryInfo()) {
retrying =
com.google.cloud.bigtable.gaxx.retrying.Callables.retrying(
innerCallable, unaryCallSettings, bigtableClientContext.getClientContext());
} else {
retrying =
Callables.retrying(
innerCallable, unaryCallSettings, bigtableClientContext.getClientContext());
}
if (settings.getEnableRoutingCookie()) {
return new CookiesUnaryCallable<>(retrying);
}
return retrying;
UnaryCallable<RequestT, ResponseT> retrying =
com.google.cloud.bigtable.gaxx.retrying.Callables.retrying(
innerCallable, unaryCallSettings, bigtableClientContext.getClientContext());
return new CookiesUnaryCallable<>(retrying);
}

private <RequestT, ResponseT> ServerStreamingCallable<RequestT, ResponseT> withRetries(
ServerStreamingCallable<RequestT, ResponseT> innerCallable,
ServerStreamingCallSettings<RequestT, ResponseT> serverStreamingCallSettings) {

ServerStreamingCallable<RequestT, ResponseT> retrying;
if (settings.getEnableRetryInfo()) {
retrying =
com.google.cloud.bigtable.gaxx.retrying.Callables.retrying(
innerCallable, serverStreamingCallSettings, bigtableClientContext.getClientContext());
} else {
retrying =
Callables.retrying(
innerCallable, serverStreamingCallSettings, bigtableClientContext.getClientContext());
}
if (settings.getEnableRoutingCookie()) {
return new CookiesServerStreamingCallable<>(retrying);
}
return retrying;
ServerStreamingCallable<RequestT, ResponseT> retrying =
com.google.cloud.bigtable.gaxx.retrying.Callables.retrying(
innerCallable, serverStreamingCallSettings, bigtableClientContext.getClientContext());

return new CookiesServerStreamingCallable<>(retrying);
}

private <RequestT, ResponseT> ServerStreamingCallable<RequestT, ResponseT> largeRowWithRetries(
ServerStreamingCallable<RequestT, ResponseT> innerCallable,
ServerStreamingCallSettings<RequestT, ResponseT> serverStreamingCallSettings) {

// Retrying algorithm in retryingForLargeRows also takes RetryInfo into consideration, so we
// skip the check for settings.getEnableRetryInfo here
ServerStreamingCallable<RequestT, ResponseT> retrying;
retrying =
ServerStreamingCallable<RequestT, ResponseT> retrying =
com.google.cloud.bigtable.gaxx.retrying.Callables.retryingForLargeRows(
innerCallable, serverStreamingCallSettings, bigtableClientContext.getClientContext());
if (settings.getEnableRoutingCookie()) {
return new CookiesServerStreamingCallable<>(retrying);
}
return retrying;
return new CookiesServerStreamingCallable<>(retrying);
}

// </editor-fold>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.threeten.bp.Duration;
Expand Down Expand Up @@ -99,9 +98,6 @@
* }</pre>
*/
public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableStubSettings> {
private static final Logger logger =
Logger.getLogger(EnhancedBigtableStubSettings.class.getName());

// The largest message that can be received is a 256 MB ReadRowsResponse.
private static final int MAX_MESSAGE_SIZE = 256 * 1024 * 1024;
private static final String SERVER_DEFAULT_APP_PROFILE_ID = "";
Expand Down Expand Up @@ -145,7 +141,6 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMinutes(1))
.setMaxAttempts(10)
.setJittered(true)
.setInitialRpcTimeout(Duration.ofMinutes(30))
.setRpcTimeoutMultiplier(2.0)
.setMaxRpcTimeout(Duration.ofMinutes(30))
Expand All @@ -172,7 +167,6 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMinutes(1))
.setMaxAttempts(10)
.setJittered(true)
.setInitialRpcTimeout(Duration.ofMinutes(1))
.setRpcTimeoutMultiplier(2.0)
.setMaxRpcTimeout(Duration.ofMinutes(10))
Expand Down Expand Up @@ -211,7 +205,6 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
.setRetryDelayMultiplier(2.0)
.setMaxRetryDelay(Duration.ofMinutes(1))
.setMaxAttempts(10)
.setJittered(true)
.setInitialRpcTimeout(Duration.ofMinutes(30))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMinutes(30))
Expand Down Expand Up @@ -255,9 +248,6 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
private final String instanceId;
private final String appProfileId;
private final boolean isRefreshingChannel;
private ImmutableList<String> primedTableIds;
private final boolean enableRoutingCookie;
private final boolean enableRetryInfo;

private final ServerStreamingCallSettings<Query, Row> readRowsSettings;
private final UnaryCallSettings<Query, Row> readRowSettings;
Expand All @@ -279,7 +269,7 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS

private final MetricsProvider metricsProvider;
@Nullable private final String metricsEndpoint;
@Nonnull private final boolean areInternalMetricsEnabled;
private final boolean areInternalMetricsEnabled;
private final String jwtAudience;

private EnhancedBigtableStubSettings(Builder builder) {
Expand All @@ -304,9 +294,6 @@ private EnhancedBigtableStubSettings(Builder builder) {
instanceId = builder.instanceId;
appProfileId = builder.appProfileId;
isRefreshingChannel = builder.isRefreshingChannel;
primedTableIds = builder.primedTableIds;
enableRoutingCookie = builder.enableRoutingCookie;
enableRetryInfo = builder.enableRetryInfo;
metricsProvider = builder.metricsProvider;
metricsEndpoint = builder.metricsEndpoint;
areInternalMetricsEnabled = builder.areInternalMetricsEnabled;
Expand Down Expand Up @@ -366,7 +353,7 @@ public boolean isRefreshingChannel() {
*/
@Deprecated
public List<String> getPrimedTableIds() {
return primedTableIds;
return ImmutableList.of();
}

/**
Expand All @@ -384,21 +371,19 @@ public MetricsProvider getMetricsProvider() {
}

/**
* Gets if routing cookie is enabled. If true, client will retry a request with extra metadata
* server sent back.
* @deprecated routing cookies are always on.
*/
@BetaApi("Routing cookie is not currently stable and may change in the future")
@Deprecated
public boolean getEnableRoutingCookie() {
return enableRoutingCookie;
return true;
}

/**
* Gets if RetryInfo is enabled. If true, client bases retry decision and back off time on server
* returned RetryInfo value. Otherwise, client uses {@link RetrySettings}.
* @deprecated RetryInfo is now always on.
*/
@BetaApi("RetryInfo is not currently stable and may change in the future")
@Deprecated
public boolean getEnableRetryInfo() {
return enableRetryInfo;
return true;
}

/**
Expand Down Expand Up @@ -745,10 +730,7 @@ public static class Builder extends StubSettings.Builder<EnhancedBigtableStubSet
private String instanceId;
private String appProfileId;
private boolean isRefreshingChannel;
private ImmutableList<String> primedTableIds;
private String jwtAudience;
private boolean enableRoutingCookie;
private boolean enableRetryInfo;

private final ServerStreamingCallSettings.Builder<Query, Row> readRowsSettings;
private final UnaryCallSettings.Builder<Query, Row> readRowSettings;
Expand All @@ -768,7 +750,7 @@ public static class Builder extends StubSettings.Builder<EnhancedBigtableStubSet
private final UnaryCallSettings.Builder<PrepareQueryRequest, PrepareResponse>
prepareQuerySettings;

private FeatureFlags.Builder featureFlags;
private final FeatureFlags.Builder featureFlags;

private MetricsProvider metricsProvider;
@Nullable private String metricsEndpoint;
Expand All @@ -785,10 +767,7 @@ public static class Builder extends StubSettings.Builder<EnhancedBigtableStubSet
private Builder() {
this.appProfileId = SERVER_DEFAULT_APP_PROFILE_ID;
this.isRefreshingChannel = true;
primedTableIds = ImmutableList.of();
setCredentialsProvider(defaultCredentialsProviderBuilder().build());
this.enableRoutingCookie = true;
this.enableRetryInfo = true;
metricsProvider = DefaultMetricsProvider.INSTANCE;
this.areInternalMetricsEnabled = true;
this.jwtAudience = DEFAULT_DATA_JWT_AUDIENCE;
Expand Down Expand Up @@ -924,9 +903,6 @@ private Builder(EnhancedBigtableStubSettings settings) {
instanceId = settings.instanceId;
appProfileId = settings.appProfileId;
isRefreshingChannel = settings.isRefreshingChannel;
primedTableIds = settings.primedTableIds;
enableRoutingCookie = settings.enableRoutingCookie;
enableRetryInfo = settings.enableRetryInfo;
metricsProvider = settings.metricsProvider;
metricsEndpoint = settings.getMetricsEndpoint();
areInternalMetricsEnabled = settings.areInternalMetricsEnabled;
Expand Down Expand Up @@ -1049,7 +1025,6 @@ public Builder setRefreshingChannel(boolean isRefreshingChannel) {
*/
@Deprecated
public Builder setPrimedTableIds(String... tableIds) {
this.primedTableIds = ImmutableList.copyOf(tableIds);
return this;
}

Expand All @@ -1069,7 +1044,7 @@ public boolean isRefreshingChannel() {
*/
@Deprecated
public List<String> getPrimedTableIds() {
return primedTableIds;
return ImmutableList.of();
}

/**
Expand Down Expand Up @@ -1159,41 +1134,35 @@ String getJwtAudience() {
}

/**
* Sets if routing cookie is enabled. If true, client will retry a request with extra metadata
* server sent back.
* @deprecated this now a no-op as routing cookies are always on.
*/
@BetaApi("Routing cookie is not currently stable and may change in the future")
@Deprecated
public Builder setEnableRoutingCookie(boolean enableRoutingCookie) {
this.enableRoutingCookie = enableRoutingCookie;
return this;
}

/**
* Gets if routing cookie is enabled. If true, client will retry a request with extra metadata
* server sent back.
* @deprecated routing cookies are always on.
*/
@BetaApi("Routing cookie is not currently stable and may change in the future")
@Deprecated
public boolean getEnableRoutingCookie() {
return enableRoutingCookie;
return true;
}

/**
* Sets if RetryInfo is enabled. If true, client bases retry decision and back off time on
* server returned RetryInfo value. Otherwise, client uses {@link RetrySettings}.
* @deprecated This is a no-op, RetryInfo is always used now.
*/
@BetaApi("RetryInfo is not currently stable and may change in the future")
@Deprecated
public Builder setEnableRetryInfo(boolean enableRetryInfo) {
this.enableRetryInfo = enableRetryInfo;
return this;
}

/**
* Gets if RetryInfo is enabled. If true, client bases retry decision and back off time on
* server returned RetryInfo value. Otherwise, client uses {@link RetrySettings}.
* @deprecated RetryInfo is always on.
*/
@BetaApi("RetryInfo is not currently stable and may change in the future")
@Deprecated
public boolean getEnableRetryInfo() {
return enableRetryInfo;
return true;
}

/** Returns the builder for the settings used for calls to readRows. */
Expand Down Expand Up @@ -1283,8 +1252,8 @@ public EnhancedBigtableStubSettings build() {
featureFlags.setMutateRowsRateLimit2(true);
}

featureFlags.setRoutingCookie(this.getEnableRoutingCookie());
featureFlags.setRetryInfo(this.getEnableRetryInfo());
featureFlags.setRoutingCookie(true);
featureFlags.setRetryInfo(true);
// client_Side_metrics_enabled feature flag is only set when a user is running with a
// DefaultMetricsProvider. This may cause false negatives when a user registered the
// metrics on their CustomOpenTelemetryMetricsProvider.
Expand Down Expand Up @@ -1325,9 +1294,6 @@ public String toString() {
.add("instanceId", instanceId)
.add("appProfileId", appProfileId)
.add("isRefreshingChannel", isRefreshingChannel)
.add("primedTableIds", primedTableIds)
.add("enableRoutingCookie", enableRoutingCookie)
.add("enableRetryInfo", enableRetryInfo)
.add("readRowsSettings", readRowsSettings)
.add("readRowSettings", readRowSettings)
.add("sampleRowKeysSettings", sampleRowKeysSettings)
Expand Down
Loading
Loading