Skip to content

Commit 64cc5ab

Browse files
---
yaml --- r: 14031 b: refs/heads/autosynth-monitoring c: 6ada222 h: refs/heads/master i: 14029: b2f4e79 14027: 9a80e00 14023: 1468d9b 14015: 4be4268
1 parent aaa54e4 commit 64cc5ab

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
@@ -115,7 +115,7 @@ refs/tags/v0.67.0: 30b56f02092efc6f3c3667650ea8b8825003e0b7
115115
refs/heads/autosynth-compute: 8e86445e504cea6f99b9fb237bfd7f0e5ef8b3ce
116116
refs/heads/autosynth-container: f6384095f50b31bfc8208542a49181e158d3681c
117117
refs/heads/autosynth-dataproc: bc74a8841bc1693d7945d991d15979df550b1fd1
118-
refs/heads/autosynth-monitoring: d468e04b9750b8e624d8ffe672feca453026d079
118+
refs/heads/autosynth-monitoring: 6ada2226d58a3528d4d818d96e70b5edc83ce936
119119
refs/heads/autosynth-pubsub: ed3340e32d13bb1a42ca4431cb1ad9bdaf550aa4
120120
refs/heads/autosynth-video-intelligence: 3e8faeeee2f803271529bd6e89b621c1ca098628
121121
refs/heads/autosynth-vision: d758c43ba2ef4f4f7ad07b722617cb39fe3f29db

branches/autosynth-monitoring/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-monitoring/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)