Skip to content

Commit 02754a4

Browse files
---
yaml --- r: 17773 b: refs/heads/autosynth-trace c: 6ada222 h: refs/heads/master i: 17771: b1eb587
1 parent 0a071c8 commit 02754a4

3 files changed

Lines changed: 38 additions & 16 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ refs/heads/autosynth-spanner: 9bff86d057df31e04c76d72865e8e073ac5794fb
144144
refs/heads/autosynth-speech: 75d6c62a9d07d3a3642980502a25d07fbde0f232
145145
refs/heads/autosynth-tasks: b0cdb991f3f75345151a3f68db1aab273dfc069b
146146
refs/heads/autosynth-texttospeech: 2dcc5dc22be0f456caa1b6a8a4bcdace2641239c
147-
refs/heads/autosynth-trace: d468e04b9750b8e624d8ffe672feca453026d079
147+
refs/heads/autosynth-trace: 6ada2226d58a3528d4d818d96e70b5edc83ce936
148148
refs/heads/autosynth-websecurityscanner: d4febbffb6c648b74faec62fe90e20adadc9a7d3
149149
refs/heads/bigquerystorage: 06db74d123d7f8a3ef48755c2fcabed09faf8e64
150150
refs/heads/elharo-patch-1: ce159ef828d3c545991ff78e7b6e0d912a9453e9

branches/autosynth-trace/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsAttemptCallable.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ public Object getTransportCode() {
101101
};
102102

103103
// Everything needed to issue an RPC
104-
private final UnaryCallable<MutateRowsRequest, List<MutateRowsResponse>> innerCallable;
105-
private final ApiCallContext callContext;
106-
private MutateRowsRequest currentRequest;
104+
@Nonnull private final UnaryCallable<MutateRowsRequest, List<MutateRowsResponse>> innerCallable;
105+
@Nonnull private final ApiCallContext callContext;
106+
@Nonnull private MutateRowsRequest currentRequest;
107107

108108
// Everything needed to build a retry request
109-
private List<Integer> originalIndexes;
110-
private final Set<StatusCode.Code> retryableCodes;
111-
private final List<FailedMutation> permanentFailures;
109+
@Nullable private List<Integer> originalIndexes;
110+
@Nonnull private final Set<StatusCode.Code> retryableCodes;
111+
@Nullable private final List<FailedMutation> permanentFailures;
112112

113113
// Parent controller
114114
private RetryingFuture<Void> externalFuture;
@@ -135,12 +135,12 @@ public List<MutateRowsResponse> apply(Throwable throwable) {
135135
MutateRowsAttemptCallable(
136136
@Nonnull UnaryCallable<MutateRowsRequest, List<MutateRowsResponse>> innerCallable,
137137
@Nonnull MutateRowsRequest originalRequest,
138-
@Nullable ApiCallContext callContext,
138+
@Nonnull ApiCallContext callContext,
139139
@Nonnull Set<StatusCode.Code> retryableCodes) {
140-
this.innerCallable = Preconditions.checkNotNull(innerCallable);
141-
this.currentRequest = Preconditions.checkNotNull(originalRequest);
142-
this.callContext = callContext;
143-
this.retryableCodes = Preconditions.checkNotNull(retryableCodes);
140+
this.innerCallable = Preconditions.checkNotNull(innerCallable, "innerCallable");
141+
this.currentRequest = Preconditions.checkNotNull(originalRequest, "currentRequest");
142+
this.callContext = Preconditions.checkNotNull(callContext, "callContext");
143+
this.retryableCodes = Preconditions.checkNotNull(retryableCodes, "retryableCodes");
144144

145145
permanentFailures = Lists.newArrayList();
146146
}
@@ -167,10 +167,10 @@ public Void call() {
167167
currentRequest.getEntriesCount() > 0, "Request doesn't have any mutations to send");
168168

169169
// Configure the deadline
170-
ApiCallContext currentCallContext = null;
171-
if (callContext != null) {
170+
ApiCallContext currentCallContext = callContext;
171+
if (!externalFuture.getAttemptSettings().getRpcTimeout().isZero()) {
172172
currentCallContext =
173-
callContext.withTimeout(externalFuture.getAttemptSettings().getRpcTimeout());
173+
currentCallContext.withTimeout(externalFuture.getAttemptSettings().getRpcTimeout());
174174
}
175175

176176
// Handle concurrent cancellation

branches/autosynth-trace/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/mutaterows/MutateRowsAttemptCallableTest.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,28 @@ public void singleEntrySuccessTest() throws Exception {
9292
assertThat(innerCallable.lastRequest).isEqualTo(request);
9393
}
9494

95+
@Test
96+
public void testNoRpcTimeout() {
97+
parentFuture.timedAttemptSettings =
98+
parentFuture.timedAttemptSettings.toBuilder().setRpcTimeout(Duration.ZERO).build();
99+
100+
MutateRowsRequest request =
101+
MutateRowsRequest.newBuilder().addEntries(Entry.getDefaultInstance()).build();
102+
103+
innerCallable.response.add(
104+
MutateRowsResponse.newBuilder()
105+
.addEntries(
106+
MutateRowsResponse.Entry.newBuilder().setIndex(0).setStatus(OK_STATUS_PROTO))
107+
.build());
108+
109+
MutateRowsAttemptCallable attemptCallable =
110+
new MutateRowsAttemptCallable(innerCallable, request, callContext, retryCodes);
111+
attemptCallable.setExternalFuture(parentFuture);
112+
attemptCallable.call();
113+
114+
assertThat(innerCallable.lastContext.getTimeout()).isNull();
115+
}
116+
95117
@Test
96118
public void mixedTest() {
97119
// Setup the request & response
@@ -340,7 +362,7 @@ public ApiFuture<List<MutateRowsResponse>> futureCall(
340362
static class MockRetryingFuture extends AbstractApiFuture<Void> implements RetryingFuture<Void> {
341363
ApiFuture<Void> attemptFuture;
342364

343-
final TimedAttemptSettings timedAttemptSettings;
365+
TimedAttemptSettings timedAttemptSettings;
344366

345367
MockRetryingFuture() {
346368
this(Duration.ofSeconds(5));

0 commit comments

Comments
 (0)