Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ to docs, or any other relevant information.
specific to the Temporal CLI dev server implementation and may no longer be valid if that implementation changes.

### Fixed
- Fixed workflow task completion pagination, which threw `UnsupportedOperationException` before
sending the first page. A completion that needed pagination timed out on every attempt instead
of being sent. The same fix lets `RpcRetryOptions.newBuilder(options).addDoNotRetry(...)` extend
existing options, which also threw `UnsupportedOperationException`.
- `RpcRetryOptions` no longer changes when the builder that created it is reused. Previously,
`addDoNotRetry` calls made after `build()` or `validateBuildWithDefaults()` also appeared in
the options already built.
- `ActivityClient` now sends the `temporal-namespace` gRPC header like `WorkflowClient` and `ScheduleClient` do,
so standalone activity calls are no longer rejected with `PERMISSION_DENIED` by namespace-scoped auth (e.g.
Temporal Cloud API keys).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private Builder(RpcRetryOptions options) {
this.congestionInitialInterval = options.getCongestionInitialInterval();
this.maximumInterval = options.getMaximumInterval();
this.maximumJitterCoefficient = options.getMaximumJitterCoefficient();
this.doNotRetry = options.getDoNotRetry();
Comment thread
jmaeagle99 marked this conversation as resolved.
Resolved
this.doNotRetry = new ArrayList<>(options.getDoNotRetry());
}

/**
Expand Down Expand Up @@ -413,7 +413,7 @@ private RpcRetryOptions(
this.maximumAttempts = maximumAttempts;
this.maximumInterval = maximumInterval;
this.maximumJitterCoefficient = maximumJitterCoefficient;
this.doNotRetry = Collections.unmodifiableList(doNotRetry);
this.doNotRetry = Collections.unmodifiableList(new ArrayList<>(doNotRetry));
}

public Duration getInitialInterval() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

import static org.junit.Assert.assertEquals;

import io.grpc.Status;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.junit.Test;

public class RpcRetryOptionsTest {
Expand All @@ -27,4 +32,42 @@ public void setRetryOptionsMergesCongestionInitialInterval() {
assertEquals(Duration.ofMillis(200), merged.getInitialInterval());
assertEquals(Duration.ofSeconds(7), merged.getCongestionInitialInterval());
}

@Test
public void aBuilderCopiedFromOptionsCanAddDoNotRetryItems() {
RpcRetryOptions source =
RpcRetryOptions.newBuilder()
.addDoNotRetry(Status.Code.NOT_FOUND, null)
.validateBuildWithDefaults();

RpcRetryOptions copy =
RpcRetryOptions.newBuilder(source)
.addDoNotRetry(Status.Code.ABORTED, null)
.validateBuildWithDefaults();

assertEquals(Arrays.asList(Status.Code.NOT_FOUND, Status.Code.ABORTED), codes(copy));
assertEquals(Collections.singletonList(Status.Code.NOT_FOUND), codes(source));
}

@Test
public void reusingABuilderDoesNotChangeOptionsItAlreadyBuilt() {
RpcRetryOptions.Builder builder =
RpcRetryOptions.newBuilder().addDoNotRetry(Status.Code.NOT_FOUND, null);
RpcRetryOptions validated = builder.validateBuildWithDefaults();
RpcRetryOptions built = builder.build();

builder.addDoNotRetry(Status.Code.ABORTED, null);

assertEquals(Collections.singletonList(Status.Code.NOT_FOUND), codes(validated));
assertEquals(Collections.singletonList(Status.Code.NOT_FOUND), codes(built));
assertEquals(Arrays.asList(Status.Code.NOT_FOUND, Status.Code.ABORTED), codes(builder.build()));
}

private static List<Status.Code> codes(RpcRetryOptions options) {
List<Status.Code> codes = new ArrayList<>();
for (RpcRetryOptions.DoNotRetryItem item : options.getDoNotRetry()) {
codes.add(item.getCode());
}
return codes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ private static List<String> repositoryServerArguments() {
"--dynamic-config-value",
"frontend.workerCommandsEnabled=true",
"--dynamic-config-value",
"system.enableCancelActivityWorkerCommand=true");
"system.enableCancelActivityWorkerCommand=true",
"--dynamic-config-value",
"history.enableWorkflowTaskCompletionPagination=true",
// Pagination clears the gRPC request limit, but the recombined completion still persists as
// one transaction, so the persistence limit must be above it.
"--dynamic-config-value",
"system.transactionSizeLimit=33554432");
}

private static File workingDirectory() {
Expand Down
Loading