@@ -133,10 +133,23 @@ public function ReadRow(GRPC\ContextInterface $ctx, Testproxy\ReadRowRequest $in
133133 'appProfileId ' => $ config ->getAppProfileId (),
134134 ]);
135135
136- $ rowData = $ table ->readRow ($ in ->getRowKey (), [
137- 'filter ' => $ in ->getFilter (),
138- 'timeoutMillis ' => $ this ->getTimeoutMillis ($ config ->getPerOperationTimeout ()),
139- ]);
136+ $ timeoutMillis = $ this ->getTimeoutMillis ($ config ->getPerOperationTimeout ());
137+ try {
138+ $ rowData = $ table ->readRow ($ in ->getRowKey (), [
139+ 'filter ' => $ in ->getFilter (),
140+ 'retrySettings ' => [
141+ // set total timeout for the operation (including retries)
142+ 'totalTimeoutMillis ' => $ timeoutMillis ,
143+ ],
144+ // the conformance tests check for this, but I'm not sure why
145+ 'rowsLimit ' => 1 ,
146+ ]);
147+ } catch (\Google \ApiCore \ApiException $ e ) {
148+ return $ out ->setStatus (new Status ([
149+ 'code ' => $ e ->getCode (),
150+ 'message ' => $ e ->getMessage (),
151+ ]));
152+ }
140153
141154 if ($ rowData ) {
142155 $ row = $ this ->arrayToRowProto ($ rowData );
@@ -195,13 +208,16 @@ public function ReadRows(GRPC\ContextInterface $ctx, Testproxy\ReadRowsRequest $
195208
196209 $ this ->logger ->debug (json_encode ($ rowKeys ));
197210
211+ $ timeoutMillis = $ this ->getTimeoutMillis ($ config ->getPerOperationTimeout ());
198212 $ stream = $ table ->readRows ([
199213 'rowKeys ' => $ rowKeys ,
200214 'rowRanges ' => $ ranges ,
201215 'filter ' => $ request ->getFilter (),
202216 'rowsLimit ' => $ request ->getRowsLimit (),
203217 'reversed ' => $ request ->getReversed (),
204- 'timeoutMillis ' => $ this ->getTimeoutMillis ($ config ->getPerOperationTimeout ()),
218+ 'retrySettings ' => [
219+ 'totalTimeoutMillis ' => $ timeoutMillis ,
220+ ],
205221 ]);
206222
207223 $ rows = [];
@@ -309,25 +325,31 @@ public function BulkMutateRows(GRPC\ContextInterface $ctx, Testproxy\MutateRowsR
309325 $ mutations [$ entry ->getRowKey ()] = $ this ->protoToMutations ($ entry ->getMutations ());
310326 }
311327
328+ $ timeoutMillis = $ this ->getTimeoutMillis ($ config ->getPerOperationTimeout ());
312329 try {
313330 $ table ->mutateRows ($ mutations , [
314- 'timeoutMillis ' => $ this ->getTimeoutMillis ($ config ->getPerOperationTimeout ())
331+ 'retrySettings ' => [
332+ 'totalTimeoutMillis ' => $ timeoutMillis ,
333+ ]
315334 ]);
316335 } catch (BigtableDataOperationException $ e ) {
317336 $ failedEntries = [];
318337 foreach ($ e ->getMetadata () as $ metadata ) {
319- $ status = new Status ([
320- 'code ' => $ metadata ['statusCode ' ],
321- 'message ' => $ metadata ['message ' ],
322- ]);
323338 $ failedEntries [] = new Entry ([
324- 'index ' => $ metadata ['index ' ],
325- 'status ' => $ status ,
339+ 'index ' => $ metadata ['index ' ] ?? 0 ,
340+ 'status ' => new Status ([
341+ 'code ' => $ metadata ['statusCode ' ],
342+ 'message ' => $ metadata ['message ' ],
343+ ]),
326344 ]);
327345 }
328346 $ out ->setEntries ($ failedEntries );
347+ $ out ->setStatus (new Status ([
348+ 'code ' => $ e ->getCode (),
349+ 'message ' => $ e ->getMessage (),
350+ ]));
329351 } catch (\Google \ApiCore \ApiException $ e ) {
330- $ out = $ out ->setStatus (new Status ([
352+ $ out ->setStatus (new Status ([
331353 'code ' => $ e ->getCode (),
332354 'message ' => $ e ->getMessage (),
333355 ]));
0 commit comments