googleapis / googleapis/google-cloud-java

[java-spanner] Disabling retries by setting `retryableCodes` to empty Set doesn't stop from retrying

Đang mở
#12,255 1 bình luận 0 reaction 1 người được giao Được @rahul2393 nhận Xem trên GitHub
api: spanner
Ngôn ngữ chính
Java
Star
2.1k
Fork
1.2k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
154

Mô tả

Hello,
I am using google-cloud-spanner 6.69.0 for java. I am trying to disable retry mechanism for :

`com.google.cloud.spanner.SpannerException: UNAVAILABLE: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception - Statement: 'SELECT 1'`

To do that I have followed the documentation, and set:

```
SpannerOptions.Builder spannerOptionsBuilder = SpannerOptions.newBuilder();

spannerOptionsBuilder.getSpannerStubSettingsBuilder().streamingReadSettings().setRetryableCodes(Collections.emptySet());

spannerOptionsBuilder.getSpannerStubSettingsBuilder().executeStreamingSqlSettings().setRetryableCodes(Collections.emptySet());

```

However, this doesn't seem to have a valid effect because in the retrying loop:
https://github.com/googleapis/java-spanner/blob/6b7e6ca109ea9679b5e36598d3c343fa40bff724/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ResumableStreamIterator.java#L273

method `isRetryable` is defined as follows:

```
boolean isRetryable(SpannerException spannerException) {
return spannerException.isRetryable()
|| retryableCodes.contains(
GrpcStatusCode.of(spannerException.getErrorCode().getGrpcStatusCode()).getCode());
}
```

which basically ignores retryableCodes setting, as long as exception itself is marked as retryable.

Not sure if this is a bug or intended behavior, but this still causes the retries to happen, despite setting retryableCodes to empty.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.