2727import com .google .api .gax .retrying .BasicResultRetryAlgorithm ;
2828import com .google .api .gax .retrying .ExponentialRetryAlgorithm ;
2929import com .google .api .gax .retrying .RetryAlgorithm ;
30+ import com .google .api .gax .retrying .RetrySettings ;
3031import com .google .api .gax .retrying .RetryingExecutorWithContext ;
3132import com .google .api .gax .retrying .ScheduledRetryingExecutor ;
3233import com .google .api .gax .retrying .SimpleStreamResumptionStrategy ;
3738import com .google .api .gax .rpc .RequestParamsExtractor ;
3839import com .google .api .gax .rpc .ServerStreamingCallSettings ;
3940import com .google .api .gax .rpc .ServerStreamingCallable ;
41+ import com .google .api .gax .rpc .StatusCode ;
4042import com .google .api .gax .rpc .UnaryCallSettings ;
4143import com .google .api .gax .rpc .UnaryCallable ;
4244import com .google .api .gax .tracing .SpanName ;
9799import com .google .cloud .bigtable .data .v2 .stub .mutaterows .MutateRowsRetryingCallable ;
98100import com .google .cloud .bigtable .data .v2 .stub .readrows .FilterMarkerRowsCallable ;
99101import com .google .cloud .bigtable .data .v2 .stub .readrows .LargeReadRowsResumptionStrategy ;
102+ import com .google .cloud .bigtable .data .v2 .stub .readrows .MaybePointReadCallable ;
100103import com .google .cloud .bigtable .data .v2 .stub .readrows .ReadRowsBatchingDescriptor ;
101104import com .google .cloud .bigtable .data .v2 .stub .readrows .ReadRowsResumptionStrategy ;
102105import com .google .cloud .bigtable .data .v2 .stub .readrows .ReadRowsRetryCompletedCallable ;
119122import java .time .Duration ;
120123import java .util .List ;
121124import java .util .Map ;
125+ import java .util .Set ;
122126import java .util .concurrent .TimeUnit ;
123127import java .util .function .Function ;
124128import javax .annotation .Nonnull ;
@@ -259,11 +263,20 @@ public <RowT> ServerStreamingCallable<Query, RowT> createReadRowsCallable(
259263 bigtableClientContext .getClientContext ().getTracerFactory (),
260264 span );
261265
262- return traced .withDefaultCallContext (
263- bigtableClientContext
264- .getClientContext ()
265- .getDefaultCallContext ()
266- .withRetrySettings (perOpSettings .readRowsSettings .getRetrySettings ()));
266+ ServerStreamingCallable <Query , RowT > classic =
267+ traced .withDefaultCallContext (
268+ bigtableClientContext
269+ .getClientContext ()
270+ .getDefaultCallContext ()
271+ .withRetrySettings (perOpSettings .readRowsSettings .getRetrySettings ()));
272+
273+ return new MaybePointReadCallable <>(
274+ classic ,
275+ createPointReadCallable (
276+ rowAdapter ,
277+ "ReadRows" ,
278+ perOpSettings .readRowsSettings .getRetrySettings (),
279+ perOpSettings .readRowsSettings .getRetryableCodes ()));
267280 }
268281
269282 /**
@@ -281,13 +294,25 @@ public <RowT> ServerStreamingCallable<Query, RowT> createReadRowsCallable(
281294 * </ul>
282295 */
283296 public <RowT > UnaryCallable <Query , RowT > createReadRowCallable (RowAdapter <RowT > rowAdapter ) {
297+ return createPointReadCallable (
298+ rowAdapter ,
299+ "ReadRow" ,
300+ perOpSettings .readRowSettings .getRetrySettings (),
301+ perOpSettings .readRowSettings .getRetryableCodes ());
302+ }
303+
304+ private <RowT > UnaryCallable <Query , RowT > createPointReadCallable (
305+ RowAdapter <RowT > rowAdapter ,
306+ String spanName ,
307+ RetrySettings retrySettings ,
308+ Set <StatusCode .Code > retryableCodes ) {
284309 ClientContext clientContext = bigtableClientContext .getClientContext ();
285310
286311 ServerStreamingCallable <ReadRowsRequest , RowT > readRowsCallable =
287312 createReadRowsBaseCallable (
288313 ServerStreamingCallSettings .<ReadRowsRequest , Row >newBuilder ()
289- .setRetryableCodes (perOpSettings . readRowSettings . getRetryableCodes () )
290- .setRetrySettings (perOpSettings . readRowSettings . getRetrySettings () )
314+ .setRetryableCodes (retryableCodes )
315+ .setRetrySettings (retrySettings )
291316 .setIdleTimeoutDuration (Duration .ZERO )
292317 .setWaitTimeoutDuration (Duration .ZERO )
293318 .build (),
@@ -302,16 +327,20 @@ public <RowT> UnaryCallable<Query, RowT> createReadRowCallable(RowAdapter<RowT>
302327 BigtableUnaryOperationCallable <Query , RowT > classic =
303328 new BigtableUnaryOperationCallable <>(
304329 readRowCallable ,
305- clientContext
306- .getDefaultCallContext ()
307- .withRetrySettings (perOpSettings .readRowSettings .getRetrySettings ()),
330+ clientContext .getDefaultCallContext ().withRetrySettings (retrySettings ),
308331 clientContext .getTracerFactory (),
309- getSpanName ("ReadRow" ),
332+ getSpanName (spanName ),
310333 /* allowNoResponse= */ true );
311334
335+ UnaryCallSettings <?, ?> shimSettings =
336+ perOpSettings .readRowSettings .toBuilder ()
337+ .setRetrySettings (retrySettings )
338+ .setRetryableCodes (retryableCodes )
339+ .build ();
340+
312341 return bigtableClientContext
313342 .getSessionShim ()
314- .decorateReadRow (classic , rowAdapter , perOpSettings . readRowSettings );
343+ .decorateReadRow (classic , rowAdapter , shimSettings );
315344 }
316345
317346 private <ReqT , RowT > ServerStreamingCallable <ReadRowsRequest , RowT > createReadRowsBaseCallable (
0 commit comments