googleapis / googleapis/google-cloud-java

[java-spanner] RetrySettings for StreamingRead/StreamingSql

Đang mở
#12,263 1 bình luận 0 reaction 1 người được giao Được giao cho @rahul2393 Xem trên GitHub
api: spanner type: feature request
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ả

Thanks for stopping by to let us know something could be better!

**Is your feature request related to a problem? Please describe.**
Recently I was working on fine tunning timeouts/retry settings for Spanner requests for one of applications.
I noticed that initRpcTimeout doesn't works on StreamingRead/StreamingSql type of requests.
So I started to go through source code and found that there are 3 places/configurations where I can work with timeouts:
- streamWaitTimeout property from GrpcCallContext which is used by WatchdogServerStreamingCallable to interrupt streaming request
- timeout property from GrpcCallContext which is used as source for 'grpc-timeout' header (if specified, otherwise totalTimeout from retrySettings is used)
- streamWatchdogCheckInterval from StubSettings which defines check interval for Watchdog used to interrupt streaming

First two aren't configurable from RetrySettings level.
Could you please makes them part of RetrySettings, so I don't have to interact with GrpcCallContext directly?

**Describe the solution you'd like**
Either to have separate set of properties in RetrySettings like (and recalculate them similarly to initRpcTimeout during retries):
```
var settings = RetrySettings.newBuilder()
.setStreamWaitTimeout(Duration.ofMillis(streamWaitTimeout))
.setSingleRequestTimeout(Duration.ofMillis(singleRequestTimeout)) // used as grpc-timeout
```
or reuse initRpcTimeout as streamWaitTimeout/grpc-timeout:
```
var settings = RetrySettings.newBuilder()
.setInitialRpcTimeout(Duration.ofMillis(initialRpcTimeout)) // used as both streamingWaitTimeout and grpc-timeout
```
**Describe alternatives you've considered**
Currently I interact with GrpcCallContext directly to set this values:
```
public static class SpannerGrpcCallContextConfigurator implements SpannerOptions.CallContextConfigurator {
public ApiCallContext configure(ApiCallContext context, ReqT request,
MethodDescriptor method) {
if (method == SpannerGrpc.getStreamingReadMethod()) {
return GrpcCallContext.createDefault().
.withTimeout(/*some timeout*/)
.withStreamWaitTimeout(/*some timeout*/);
}
return null;
}
}
```

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.