googleapis / sdk-platform-java

Tooling and shared libraries for Cloud SDK for Java
https://cloud.google.com/java/docs/bom
Apache License 2.0
68 stars 53 forks source link

gax : GrpcSpannerStub create(ClientContext clientContext) not using `SpannerStubSettings` configuration #3360

Open surbhigarg92 opened 2 weeks ago

surbhigarg92 commented 2 weeks ago

Regarding the bug fix for canUseDirectPath returning false when DirectPath is enabled, the recommendation was to pass clientContext in the GrpcSpannerStub.create instead of SpannerStubSetting

This approach works for standard requests, but it fails in cases where custom timeouts are applied.

Further investigation showed that passing clientContext to GrpcSpannerStub.create results in a new SpannerStubSettings.newBuilder().build() instance being created rather than using the SpannerStubSettings from clientContext . See code reference.

Using the protected constructor that accepts both stubSettings and clientContext directly resolves the issue. Refer PR

Expected fix: Expose a new public static method for accepting both stubSettings and clientContext