Skip to content
Draft
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
1 change: 1 addition & 0 deletions google-cloud-spanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>grpc-gcp</artifactId>
<version>1.6.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;

/**
/**
* Abstract base class for all {@link ReadContext}s + concrete implementations of read-only {@link
* ReadContext}s.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import com.google.cloud.grpc.GcpManagedChannel;
import com.google.cloud.grpc.GcpManagedChannelBuilder;
import com.google.cloud.grpc.GcpManagedChannelOptions;
import com.google.cloud.grpc.GcpManagedChannelOptions.GcpChannelPoolOptions;
import com.google.cloud.grpc.GcpManagedChannelOptions.GcpMetricsOptions;
import com.google.cloud.grpc.GrpcTransportOptions;
import com.google.cloud.spanner.AdminRequestsPerMinuteExceededException;
Expand Down Expand Up @@ -584,9 +585,24 @@ private static GcpManagedChannelOptions grpcGcpOptionsWithMetrics(SpannerOptions
if (metricsOptions.getNamePrefix().equals("")) {
metricsOptionsBuilder.withNamePrefix("cloud.google.com/java/spanner/gcp-channel-pool/");
}
return GcpManagedChannelOptions.newBuilder(grpcGcpOptions)
.withMetricsOptions(metricsOptionsBuilder.build())
.build();
GcpManagedChannelOptions.Builder channelOptionsBuilder =
GcpManagedChannelOptions.newBuilder(grpcGcpOptions)
.withMetricsOptions(metricsOptionsBuilder.build());

boolean isMultiplexedSessionEnabledForAllTransactions =
options.getSessionPoolOptions().getUseMultiplexedSession()
&& options.getSessionPoolOptions().getUseMultiplexedSessionForRW()
&& options.getSessionPoolOptions().getUseMultiplexedSessionPartitionedOps();
if (isMultiplexedSessionEnabledForAllTransactions) {
// When multiplexed session is enabled for all the transactions then enable dynamic channel
// pooling by default.
// TODO: What if backend throws an unimplemented error and the transactions fallback to using
// regular sessions? Is there a way to disable dynamic scaling on the fly?
GcpChannelPoolOptions.Builder channelPoolOptionsBuilder =
GcpChannelPoolOptions.newBuilder().setDynamicScaling(0, 100, Duration.ofMinutes(30L));
channelOptionsBuilder.withChannelPoolOptions(channelPoolOptionsBuilder.build());
}
return channelOptionsBuilder.build();
}

@SuppressWarnings("rawtypes")
Expand Down
Loading