Skip to content

Commit 3288019

Browse files
committed
address comments
1 parent 0dc3d69 commit 3288019

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ public void clearTransactionAndChannelAffinity(
619619
keyAwareChannel.clearTransactionAndChannelAffinity(transactionId, channelHint);
620620
return;
621621
}
622-
clearTransactionAffinity(transactionId);
623622
GrpcGcpAffinityUtil.clearChannelHintAffinity(grpcGcpChannel, channelHint);
624623
}
625624

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ static void clearChannelHintAffinity(
3333
if (!(channel instanceof GcpManagedChannel) || channelHint == null) {
3434
return;
3535
}
36+
// TODO: Replace this synthetic call once grpc-gcp exposes a direct API for unbinding
37+
// affinity keys without creating and immediately cancelling a ClientCall.
3638
ClientCall<ExecuteSqlRequest, ResultSet> call =
3739
channel.newCall(
3840
SpannerGrpc.getExecuteSqlMethod(),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,10 @@ void clearTransactionAffinity(ByteString transactionId) {
305305
}
306306

307307
void clearTransactionAndChannelAffinity(ByteString transactionId, @Nullable Long channelHint) {
308+
String address = transactionAffinities.remove(transactionId);
309+
readOnlyTxPreferLeader.invalidate(transactionId);
308310
if (channelHint != null) {
309311
ManagedChannel channel = defaultChannel;
310-
String address = transactionAffinities.get(transactionId);
311312
if (address != null) {
312313
ChannelEndpoint endpoint = endpointCache.getIfPresent(address);
313314
if (endpoint != null) {
@@ -316,7 +317,6 @@ void clearTransactionAndChannelAffinity(ByteString transactionId, @Nullable Long
316317
}
317318
GrpcGcpAffinityUtil.clearChannelHintAffinity(channel, channelHint);
318319
}
319-
clearAffinity(transactionId);
320320
}
321321

322322
private void maybeExcludeEndpointOnNextCall(

0 commit comments

Comments
 (0)