Skip to content

Commit fe6dc79

Browse files
authored
fix: uses old version of gax-grpc method (#426)
Internally, we are using version 1.47.1 of the gax-grpc library, which does not provide a method currently being used (setExecutor). In here we use a method that is available in 1.47.1 and achieves the same goal (setExecutorProvider).
1 parent b312091 commit fe6dc79

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import com.google.cloud.spanner.admin.instance.v1.stub.GrpcInstanceAdminStub;
6161
import com.google.cloud.spanner.admin.instance.v1.stub.InstanceAdminStub;
6262
import com.google.cloud.spanner.admin.instance.v1.stub.InstanceAdminStubSettings;
63-
import com.google.cloud.spanner.spi.v1.SpannerRpc.Option;
6463
import com.google.cloud.spanner.v1.stub.GrpcSpannerStub;
6564
import com.google.cloud.spanner.v1.stub.SpannerStub;
6665
import com.google.cloud.spanner.v1.stub.SpannerStubSettings;
@@ -171,11 +170,13 @@
171170
/** Implementation of Cloud Spanner remote calls using Gapic libraries. */
172171
@InternalApi
173172
public class GapicSpannerRpc implements SpannerRpc {
173+
174174
/**
175175
* {@link ExecutorProvider} that keeps track of the executors that are created and shuts these
176176
* down when the {@link SpannerRpc} is closed.
177177
*/
178178
private static final class ManagedInstantiatingExecutorProvider implements ExecutorProvider {
179+
179180
// 4 Gapic clients * 4 channels per client.
180181
private static final int DEFAULT_MIN_THREAD_COUNT = 16;
181182
private final List<ScheduledExecutorService> executors = new LinkedList<>();
@@ -317,7 +318,11 @@ public GapicSpannerRpc(final SpannerOptions options) {
317318
.setMaxInboundMessageSize(MAX_MESSAGE_SIZE)
318319
.setMaxInboundMetadataSize(MAX_METADATA_SIZE)
319320
.setPoolSize(options.getNumChannels())
320-
.setExecutor(executorProvider.getExecutor())
321+
322+
// Before updating this method to setExecutor, please verify with a code owner on
323+
// the lowest version of gax-grpc that needs to be supported. Currently v1.47.17,
324+
// which doesn't support the setExecutor variant.
325+
.setExecutorProvider(executorProvider)
321326

322327
// Set a keepalive time of 120 seconds to help long running
323328
// commit GRPC calls succeed
@@ -480,6 +485,7 @@ private static void checkEmulatorConnection(
480485

481486
private static final class OperationFutureRetryAlgorithm<ResultT, MetadataT>
482487
implements ResultRetryAlgorithm<OperationFuture<ResultT, MetadataT>> {
488+
483489
private static final ImmutableList<StatusCode.Code> RETRYABLE_CODES =
484490
ImmutableList.of(StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE);
485491

@@ -519,6 +525,7 @@ public boolean shouldRetry(
519525

520526
private final class OperationFutureCallable<RequestT, ResponseT, MetadataT extends Message>
521527
implements Callable<OperationFuture<ResponseT, MetadataT>> {
528+
522529
final OperationCallable<RequestT, ResponseT, MetadataT> operationCallable;
523530
final RequestT initialRequest;
524531
final MethodDescriptor<RequestT, Operation> method;
@@ -575,6 +582,7 @@ public OperationFuture<ResponseT, MetadataT> call() throws Exception {
575582
}
576583

577584
private interface OperationsLister {
585+
578586
Paginated<Operation> listOperations(String nextPageToken);
579587
}
580588

@@ -610,6 +618,7 @@ private Operation mostRecentOperation(
610618
}
611619

612620
private static final class TimestampComparator implements Comparator<Timestamp> {
621+
613622
private static final TimestampComparator INSTANCE = new TimestampComparator();
614623

615624
@Override
@@ -1458,6 +1467,7 @@ public boolean isClosed() {
14581467
* the {@link ResultStreamConsumer}.
14591468
*/
14601469
private static class SpannerResponseObserver implements ResponseObserver<PartialResultSet> {
1470+
14611471
private StreamController controller;
14621472
private final ResultStreamConsumer consumer;
14631473

0 commit comments

Comments
 (0)