From 32bdcb1891d31cb436acb221d7fe917af87294ec Mon Sep 17 00:00:00 2001 From: Yimin Chen Date: Thu, 14 Jun 2018 22:09:36 -0700 Subject: [PATCH] workflow/child_workflow retry --- .gen/go/history/idl.go | 4 +- .gen/go/history/types.go | 76 +++- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 338 +++++++++++++++++- common/constants.go | 5 + common/metrics/defs.go | 3 + common/persistence/cassandraPersistence.go | 74 +++- common/persistence/dataInterfaces.go | 61 ++++ common/util.go | 30 ++ host/integration_test.go | 94 +++++ idl/github.com/uber/cadence/history.thrift | 2 + idl/github.com/uber/cadence/shared.thrift | 14 + schema/cadence/schema.cql | 8 + schema/cadence/versioned/v0.9/manifest.json | 5 +- .../cadence/versioned/v0.9/workflow_retry.cql | 8 + service/frontend/workflowHandler.go | 4 + service/history/MockMutableState.go | 48 ++- service/history/historyBuilder.go | 16 + service/history/historyEngine.go | 94 +++-- service/history/historyReplicator.go | 67 ++-- service/history/mutableStateBuilder.go | 148 +++++--- service/history/retry.go | 74 ++-- service/history/stateBuilder.go | 31 +- service/history/stateBuilder_test.go | 11 +- service/history/timerQueueActiveProcessor.go | 114 +++++- service/history/timerQueueProcessorBase.go | 4 + service/history/timerQueueStandbyProcessor.go | 4 + .../history/transferQueueActiveProcessor.go | 1 + 28 files changed, 1142 insertions(+), 200 deletions(-) create mode 100644 schema/cadence/versioned/v0.9/workflow_retry.cql diff --git a/.gen/go/history/idl.go b/.gen/go/history/idl.go index 1ee6749ada3..57a29c74195 100644 --- a/.gen/go/history/idl.go +++ b/.gen/go/history/idl.go @@ -33,11 +33,11 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "history", Package: "github.com/uber/cadence/.gen/go/history", FilePath: "history.thrift", - SHA1: "6ef43339ef582850fa5f90fb500c8402a19a56bb", + SHA1: "e815b1b55f8bd283224e83e07967e8f4a171927d", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.history\n\nexception EventAlreadyStartedError {\n 1: required string message\n}\n\nexception ShardOwnershipLostError {\n 10: optional string message\n 20: optional string owner\n}\n\nstruct ParentExecutionInfo {\n 10: optional string domainUUID\n 15: optional string domain\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") initiatedId\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.StartWorkflowExecutionRequest startRequest\n 30: optional ParentExecutionInfo parentExecutionInfo\n}\n\nstruct DescribeMutableStateRequest{\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct DescribeMutableStateResponse{\n 30: optional string mutableStateInCache\n 40: optional string mutableStateInDatabase\n}\n\nstruct GetMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n}\n\nstruct GetMutableStateResponse {\n 10: optional shared.WorkflowExecution execution\n 20: optional shared.WorkflowType workflowType\n 30: optional i64 (js.type = \"Long\") NextEventId\n 40: optional i64 (js.type = \"Long\") LastFirstEventId\n 50: optional shared.TaskList taskList\n 60: optional shared.TaskList stickyTaskList\n 70: optional string clientLibraryVersion\n 80: optional string clientFeatureVersion\n 90: optional string clientImpl\n 100: optional bool isWorkflowRunning\n 110: optional i32 stickyTaskListScheduleToStartTimeout\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional RecordDecisionTaskStartedResponse startedResponse\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskFailedRequest failedRequest\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional string domainUUID\n 20: optional shared.RecordActivityTaskHeartbeatRequest heartbeatRequest\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCompletedRequest completeRequest\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskFailedRequest failedRequest\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCanceledRequest cancelRequest\n}\n\nstruct RecordActivityTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct RecordActivityTaskStartedResponse {\n 20: optional shared.HistoryEvent scheduledEvent\n 30: optional i64 (js.type = \"Long\") startedTimestamp\n 40: optional i64 (js.type = \"Long\") attempt\n 50: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n}\n\nstruct RecordDecisionTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct RecordDecisionTaskStartedResponse {\n 10: optional shared.WorkflowType workflowType\n 20: optional i64 (js.type = \"Long\") previousStartedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") attempt\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWorkflowExecutionRequest signalRequest\n 30: optional shared.WorkflowExecution externalWorkflowExecution\n 40: optional bool childWorkflowOnly\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWithStartWorkflowExecutionRequest signalWithStartRequest\n}\n\nstruct RemoveSignalMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional string requestId\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.TerminateWorkflowExecutionRequest terminateRequest\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.RequestCancelWorkflowExecutionRequest cancelRequest\n 30: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 40: optional shared.WorkflowExecution externalWorkflowExecution\n 50: optional bool childWorkflowOnly\n}\n\nstruct ScheduleDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.DescribeWorkflowExecutionRequest request\n}\n\n/**\n* RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow\n* execution which started it. When a child execution is completed it creates this request and calls the\n* RecordChildExecutionCompleted API with the workflowExecution of parent. It also sets the completedExecution of the\n* child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when\n* child creates multiple runs through ContinueAsNew before finally completing.\n**/\nstruct RecordChildExecutionCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") initiatedId\n 40: optional shared.WorkflowExecution completedExecution\n 50: optional shared.HistoryEvent completionEvent\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct ReplicateEventsRequest {\n 10: optional string sourceCluster\n 20: optional string domainUUID\n 30: optional shared.WorkflowExecution workflowExecution\n 40: optional i64 (js.type = \"Long\") firstEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") version\n 70: optional map replicationInfo\n 80: optional shared.History history\n 90: optional shared.History newRunHistory\n}\n\n/**\n* HistoryService provides API to start a new long running workflow instance, as well as query and update the history\n* of workflow instances already created.\n**/\nservice HistoryService {\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * Returns the information from mutable state of workflow execution.\n * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service.\n **/\n GetMutableStateResponse GetMutableState(1: GetMutableStateRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * Reset the sticky tasklist related information in mutable state of a given workflow.\n * Things cleared are:\n * 1. StickyTaskList\n * 2. StickyScheduleToStartTimeout\n * 3. ClientLibraryVersion\n * 4. ClientFeatureVersion\n * 5. ClientImpl\n **/\n ResetStickyTaskListResponse ResetStickyTaskList(1: ResetStickyTaskListRequest resetRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordDecisionTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForDecisionTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordDecisionTaskStartedResponse RecordDecisionTaskStarted(1: RecordDecisionTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordActivityTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForActivityTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordActivityTaskStartedResponse RecordActivityTaskStarted(1: RecordActivityTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(1: RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report ny panics during DecisionTask processing.\n **/\n void RespondDecisionTaskFailed(1: RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * SignalWithStartWorkflowExecution is used to ensure sending a signal event to a workflow execution.\n * If workflow is running, this results in WorkflowExecutionSignaled event recorded in the history\n * and a decision task being created for the execution.\n * If workflow is not running or not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled\n * event recorded in history, and a decision task being created for the execution\n **/\n shared.StartWorkflowExecutionResponse SignalWithStartWorkflowExecution(1: SignalWithStartWorkflowExecutionRequest signalWithStartRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: ShardOwnershipLostError shardOwnershipLostError,\n 4: shared.DomainNotActiveError domainNotActiveError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RemoveSignalMutableState is used to remove a signal request ID that was previously recorded. This is currently\n * used to clean execution info when signal decision finished.\n **/\n void RemoveSignalMutableState(1: RemoveSignalMutableStateRequest removeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * ScheduleDecisionTask is used for creating a decision task for already started workflow execution. This is mainly\n * used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts\n * child execution without creating the decision task and then calls this API after updating the mutable state of\n * parent execution.\n **/\n void ScheduleDecisionTask(1: ScheduleDecisionTaskRequest scheduleRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent.\n * This is mainly called by transfer queue processor during the processing of DeleteExecution task.\n **/\n void RecordChildExecutionCompleted(1: RecordChildExecutionCompletedRequest completionRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n void ReplicateEvents(1: ReplicateEventsRequest replicateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.RetryTaskError retryTaskError,\n )\n\n /**\n * DescribeMutableState returns information about the internal states of workflow mutable state.\n **/\n DescribeMutableStateResponse DescribeMutableState(1: DescribeMutableStateRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.AccessDeniedError accessDeniedError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * DescribeHistoryHost returns information about the internal states of a history host\n **/\n shared.DescribeHistoryHostResponse DescribeHistoryHost(1: shared.DescribeHistoryHostRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.AccessDeniedError accessDeniedError,\n )\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.history\n\nexception EventAlreadyStartedError {\n 1: required string message\n}\n\nexception ShardOwnershipLostError {\n 10: optional string message\n 20: optional string owner\n}\n\nstruct ParentExecutionInfo {\n 10: optional string domainUUID\n 15: optional string domain\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") initiatedId\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.StartWorkflowExecutionRequest startRequest\n 30: optional ParentExecutionInfo parentExecutionInfo\n 40: optional i32 attempt\n 50: optional i64 (js.type = \"Long\") expirationTimestamp\n}\n\nstruct DescribeMutableStateRequest{\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct DescribeMutableStateResponse{\n 30: optional string mutableStateInCache\n 40: optional string mutableStateInDatabase\n}\n\nstruct GetMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n}\n\nstruct GetMutableStateResponse {\n 10: optional shared.WorkflowExecution execution\n 20: optional shared.WorkflowType workflowType\n 30: optional i64 (js.type = \"Long\") NextEventId\n 40: optional i64 (js.type = \"Long\") LastFirstEventId\n 50: optional shared.TaskList taskList\n 60: optional shared.TaskList stickyTaskList\n 70: optional string clientLibraryVersion\n 80: optional string clientFeatureVersion\n 90: optional string clientImpl\n 100: optional bool isWorkflowRunning\n 110: optional i32 stickyTaskListScheduleToStartTimeout\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional RecordDecisionTaskStartedResponse startedResponse\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskFailedRequest failedRequest\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional string domainUUID\n 20: optional shared.RecordActivityTaskHeartbeatRequest heartbeatRequest\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCompletedRequest completeRequest\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskFailedRequest failedRequest\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCanceledRequest cancelRequest\n}\n\nstruct RecordActivityTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct RecordActivityTaskStartedResponse {\n 20: optional shared.HistoryEvent scheduledEvent\n 30: optional i64 (js.type = \"Long\") startedTimestamp\n 40: optional i64 (js.type = \"Long\") attempt\n 50: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n}\n\nstruct RecordDecisionTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct RecordDecisionTaskStartedResponse {\n 10: optional shared.WorkflowType workflowType\n 20: optional i64 (js.type = \"Long\") previousStartedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") attempt\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWorkflowExecutionRequest signalRequest\n 30: optional shared.WorkflowExecution externalWorkflowExecution\n 40: optional bool childWorkflowOnly\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWithStartWorkflowExecutionRequest signalWithStartRequest\n}\n\nstruct RemoveSignalMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional string requestId\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.TerminateWorkflowExecutionRequest terminateRequest\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.RequestCancelWorkflowExecutionRequest cancelRequest\n 30: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 40: optional shared.WorkflowExecution externalWorkflowExecution\n 50: optional bool childWorkflowOnly\n}\n\nstruct ScheduleDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.DescribeWorkflowExecutionRequest request\n}\n\n/**\n* RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow\n* execution which started it. When a child execution is completed it creates this request and calls the\n* RecordChildExecutionCompleted API with the workflowExecution of parent. It also sets the completedExecution of the\n* child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when\n* child creates multiple runs through ContinueAsNew before finally completing.\n**/\nstruct RecordChildExecutionCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") initiatedId\n 40: optional shared.WorkflowExecution completedExecution\n 50: optional shared.HistoryEvent completionEvent\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct ReplicateEventsRequest {\n 10: optional string sourceCluster\n 20: optional string domainUUID\n 30: optional shared.WorkflowExecution workflowExecution\n 40: optional i64 (js.type = \"Long\") firstEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") version\n 70: optional map replicationInfo\n 80: optional shared.History history\n 90: optional shared.History newRunHistory\n}\n\n/**\n* HistoryService provides API to start a new long running workflow instance, as well as query and update the history\n* of workflow instances already created.\n**/\nservice HistoryService {\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * Returns the information from mutable state of workflow execution.\n * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service.\n **/\n GetMutableStateResponse GetMutableState(1: GetMutableStateRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * Reset the sticky tasklist related information in mutable state of a given workflow.\n * Things cleared are:\n * 1. StickyTaskList\n * 2. StickyScheduleToStartTimeout\n * 3. ClientLibraryVersion\n * 4. ClientFeatureVersion\n * 5. ClientImpl\n **/\n ResetStickyTaskListResponse ResetStickyTaskList(1: ResetStickyTaskListRequest resetRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordDecisionTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForDecisionTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordDecisionTaskStartedResponse RecordDecisionTaskStarted(1: RecordDecisionTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordActivityTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForActivityTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordActivityTaskStartedResponse RecordActivityTaskStarted(1: RecordActivityTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(1: RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report ny panics during DecisionTask processing.\n **/\n void RespondDecisionTaskFailed(1: RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * SignalWithStartWorkflowExecution is used to ensure sending a signal event to a workflow execution.\n * If workflow is running, this results in WorkflowExecutionSignaled event recorded in the history\n * and a decision task being created for the execution.\n * If workflow is not running or not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled\n * event recorded in history, and a decision task being created for the execution\n **/\n shared.StartWorkflowExecutionResponse SignalWithStartWorkflowExecution(1: SignalWithStartWorkflowExecutionRequest signalWithStartRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: ShardOwnershipLostError shardOwnershipLostError,\n 4: shared.DomainNotActiveError domainNotActiveError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RemoveSignalMutableState is used to remove a signal request ID that was previously recorded. This is currently\n * used to clean execution info when signal decision finished.\n **/\n void RemoveSignalMutableState(1: RemoveSignalMutableStateRequest removeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * ScheduleDecisionTask is used for creating a decision task for already started workflow execution. This is mainly\n * used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts\n * child execution without creating the decision task and then calls this API after updating the mutable state of\n * parent execution.\n **/\n void ScheduleDecisionTask(1: ScheduleDecisionTaskRequest scheduleRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent.\n * This is mainly called by transfer queue processor during the processing of DeleteExecution task.\n **/\n void RecordChildExecutionCompleted(1: RecordChildExecutionCompletedRequest completionRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n )\n\n void ReplicateEvents(1: ReplicateEventsRequest replicateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.RetryTaskError retryTaskError,\n )\n\n /**\n * DescribeMutableState returns information about the internal states of workflow mutable state.\n **/\n DescribeMutableStateResponse DescribeMutableState(1: DescribeMutableStateRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.AccessDeniedError accessDeniedError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * DescribeHistoryHost returns information about the internal states of a history host\n **/\n shared.DescribeHistoryHostResponse DescribeHistoryHost(1: shared.DescribeHistoryHostRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.AccessDeniedError accessDeniedError,\n )\n}\n" diff --git a/.gen/go/history/types.go b/.gen/go/history/types.go index 5bd49e3e30f..b43922be22e 100644 --- a/.gen/go/history/types.go +++ b/.gen/go/history/types.go @@ -5681,6 +5681,8 @@ type StartWorkflowExecutionRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` StartRequest *shared.StartWorkflowExecutionRequest `json:"startRequest,omitempty"` ParentExecutionInfo *ParentExecutionInfo `json:"parentExecutionInfo,omitempty"` + Attempt *int32 `json:"attempt,omitempty"` + ExpirationTimestamp *int64 `json:"expirationTimestamp,omitempty"` } // ToWire translates a StartWorkflowExecutionRequest struct into a Thrift-level intermediate @@ -5700,7 +5702,7 @@ type StartWorkflowExecutionRequest struct { // } func (v *StartWorkflowExecutionRequest) ToWire() (wire.Value, error) { var ( - fields [3]wire.Field + fields [5]wire.Field i int = 0 w wire.Value err error @@ -5730,6 +5732,22 @@ func (v *StartWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 30, Value: w} i++ } + if v.Attempt != nil { + w, err = wire.NewValueI32(*(v.Attempt)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ + } + if v.ExpirationTimestamp != nil { + w, err = wire.NewValueI64(*(v.ExpirationTimestamp)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 50, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -5793,6 +5811,26 @@ func (v *StartWorkflowExecutionRequest) FromWire(w wire.Value) error { return err } + } + case 40: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.Attempt = &x + if err != nil { + return err + } + + } + case 50: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.ExpirationTimestamp = &x + if err != nil { + return err + } + } } } @@ -5807,7 +5845,7 @@ func (v *StartWorkflowExecutionRequest) String() string { return "" } - var fields [3]string + var fields [5]string i := 0 if v.DomainUUID != nil { fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID)) @@ -5821,6 +5859,14 @@ func (v *StartWorkflowExecutionRequest) String() string { fields[i] = fmt.Sprintf("ParentExecutionInfo: %v", v.ParentExecutionInfo) i++ } + if v.Attempt != nil { + fields[i] = fmt.Sprintf("Attempt: %v", *(v.Attempt)) + i++ + } + if v.ExpirationTimestamp != nil { + fields[i] = fmt.Sprintf("ExpirationTimestamp: %v", *(v.ExpirationTimestamp)) + i++ + } return fmt.Sprintf("StartWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -5839,6 +5885,12 @@ func (v *StartWorkflowExecutionRequest) Equals(rhs *StartWorkflowExecutionReques if !((v.ParentExecutionInfo == nil && rhs.ParentExecutionInfo == nil) || (v.ParentExecutionInfo != nil && rhs.ParentExecutionInfo != nil && v.ParentExecutionInfo.Equals(rhs.ParentExecutionInfo))) { return false } + if !_I32_EqualsPtr(v.Attempt, rhs.Attempt) { + return false + } + if !_I64_EqualsPtr(v.ExpirationTimestamp, rhs.ExpirationTimestamp) { + return false + } return true } @@ -5853,6 +5905,26 @@ func (v *StartWorkflowExecutionRequest) GetDomainUUID() (o string) { return } +// GetAttempt returns the value of Attempt if it is set or its +// zero value if it is unset. +func (v *StartWorkflowExecutionRequest) GetAttempt() (o int32) { + if v.Attempt != nil { + return *v.Attempt + } + + return +} + +// GetExpirationTimestamp returns the value of ExpirationTimestamp if it is set or its +// zero value if it is unset. +func (v *StartWorkflowExecutionRequest) GetExpirationTimestamp() (o int64) { + if v.ExpirationTimestamp != nil { + return *v.ExpirationTimestamp + } + + return +} + type TerminateWorkflowExecutionRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` TerminateRequest *shared.TerminateWorkflowExecutionRequest `json:"terminateRequest,omitempty"` diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index 57c8710104c..1fdbc0cfd41 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "f9a70b36894bf0b4a4493b5c50e51680f15bc520", + SHA1: "ea59fc94c1fcaa7007b7909a520558e84c241a66", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 60: optional string identity\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional i32 backoffStartIntervalInSeconds\n 70: optional RetryPolicy retryPolicy\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional RetryPolicy retryPolicy\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 60: optional string identity\n 70: optional RetryPolicy retryPolicy\n 80: optional i32 attempt\n 90: optional i64 (js.type = \"Long\") expirationTimestamp\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 80: optional i32 backoffStartIntervalInSeconds\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 120: optional RetryPolicy retryPolicy\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n 120: optional RetryPolicy retryPolicy\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n\n // Expiration time for the whole retry process. If not specified, default will be used which is scheduleToCloseTimeoutSeconds\n // for activity or executionStartToCloseTimeoutSeconds for workflow. If value specified is less than default, the value\n // specified will be ignored.\n 60: optional i32 expirationIntervalInSeconds\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 2bb3e7c396c..a675f109699 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -4870,6 +4870,8 @@ type ContinueAsNewWorkflowExecutionDecisionAttributes struct { Input []byte `json:"input,omitempty"` ExecutionStartToCloseTimeoutSeconds *int32 `json:"executionStartToCloseTimeoutSeconds,omitempty"` TaskStartToCloseTimeoutSeconds *int32 `json:"taskStartToCloseTimeoutSeconds,omitempty"` + BackoffStartIntervalInSeconds *int32 `json:"backoffStartIntervalInSeconds,omitempty"` + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` } // ToWire translates a ContinueAsNewWorkflowExecutionDecisionAttributes struct into a Thrift-level intermediate @@ -4889,7 +4891,7 @@ type ContinueAsNewWorkflowExecutionDecisionAttributes struct { // } func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [5]wire.Field + fields [7]wire.Field i int = 0 w wire.Value err error @@ -4935,6 +4937,22 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, fields[i] = wire.Field{ID: 50, Value: w} i++ } + if v.BackoffStartIntervalInSeconds != nil { + w, err = wire.NewValueI32(*(v.BackoffStartIntervalInSeconds)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 60, Value: w} + i++ + } + if v.RetryPolicy != nil { + w, err = v.RetryPolicy.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 70, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -5004,6 +5022,24 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) FromWire(w wire.Value return err } + } + case 60: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.BackoffStartIntervalInSeconds = &x + if err != nil { + return err + } + + } + case 70: + if field.Value.Type() == wire.TStruct { + v.RetryPolicy, err = _RetryPolicy_Read(field.Value) + if err != nil { + return err + } + } } } @@ -5018,7 +5054,7 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) String() string { return "" } - var fields [5]string + var fields [7]string i := 0 if v.WorkflowType != nil { fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType) @@ -5040,6 +5076,14 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) String() string { fields[i] = fmt.Sprintf("TaskStartToCloseTimeoutSeconds: %v", *(v.TaskStartToCloseTimeoutSeconds)) i++ } + if v.BackoffStartIntervalInSeconds != nil { + fields[i] = fmt.Sprintf("BackoffStartIntervalInSeconds: %v", *(v.BackoffStartIntervalInSeconds)) + i++ + } + if v.RetryPolicy != nil { + fields[i] = fmt.Sprintf("RetryPolicy: %v", v.RetryPolicy) + i++ + } return fmt.Sprintf("ContinueAsNewWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -5064,6 +5108,12 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) Equals(rhs *ContinueA if !_I32_EqualsPtr(v.TaskStartToCloseTimeoutSeconds, rhs.TaskStartToCloseTimeoutSeconds) { return false } + if !_I32_EqualsPtr(v.BackoffStartIntervalInSeconds, rhs.BackoffStartIntervalInSeconds) { + return false + } + if !((v.RetryPolicy == nil && rhs.RetryPolicy == nil) || (v.RetryPolicy != nil && rhs.RetryPolicy != nil && v.RetryPolicy.Equals(rhs.RetryPolicy))) { + return false + } return true } @@ -5088,6 +5138,16 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) GetTaskStartToCloseTi return } +// GetBackoffStartIntervalInSeconds returns the value of BackoffStartIntervalInSeconds if it is set or its +// zero value if it is unset. +func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) GetBackoffStartIntervalInSeconds() (o int32) { + if v.BackoffStartIntervalInSeconds != nil { + return *v.BackoffStartIntervalInSeconds + } + + return +} + type Decision struct { DecisionType *DecisionType `json:"decisionType,omitempty"` ScheduleActivityTaskDecisionAttributes *ScheduleActivityTaskDecisionAttributes `json:"scheduleActivityTaskDecisionAttributes,omitempty"` @@ -22391,11 +22451,12 @@ func (v *RespondQueryTaskCompletedRequest) GetErrorMessage() (o string) { } type RetryPolicy struct { - InitialIntervalInSeconds *int32 `json:"initialIntervalInSeconds,omitempty"` - BackoffCoefficient *float64 `json:"backoffCoefficient,omitempty"` - MaximumIntervalInSeconds *int32 `json:"maximumIntervalInSeconds,omitempty"` - MaximumAttempts *int32 `json:"maximumAttempts,omitempty"` - NonRetriableErrorReasons []string `json:"nonRetriableErrorReasons,omitempty"` + InitialIntervalInSeconds *int32 `json:"initialIntervalInSeconds,omitempty"` + BackoffCoefficient *float64 `json:"backoffCoefficient,omitempty"` + MaximumIntervalInSeconds *int32 `json:"maximumIntervalInSeconds,omitempty"` + MaximumAttempts *int32 `json:"maximumAttempts,omitempty"` + NonRetriableErrorReasons []string `json:"nonRetriableErrorReasons,omitempty"` + ExpirationIntervalInSeconds *int32 `json:"expirationIntervalInSeconds,omitempty"` } type _List_String_ValueList []string @@ -22441,7 +22502,7 @@ func (_List_String_ValueList) Close() {} // } func (v *RetryPolicy) ToWire() (wire.Value, error) { var ( - fields [5]wire.Field + fields [6]wire.Field i int = 0 w wire.Value err error @@ -22487,6 +22548,14 @@ func (v *RetryPolicy) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 50, Value: w} i++ } + if v.ExpirationIntervalInSeconds != nil { + w, err = wire.NewValueI32(*(v.ExpirationIntervalInSeconds)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 60, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -22578,6 +22647,16 @@ func (v *RetryPolicy) FromWire(w wire.Value) error { return err } + } + case 60: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.ExpirationIntervalInSeconds = &x + if err != nil { + return err + } + } } } @@ -22592,7 +22671,7 @@ func (v *RetryPolicy) String() string { return "" } - var fields [5]string + var fields [6]string i := 0 if v.InitialIntervalInSeconds != nil { fields[i] = fmt.Sprintf("InitialIntervalInSeconds: %v", *(v.InitialIntervalInSeconds)) @@ -22614,6 +22693,10 @@ func (v *RetryPolicy) String() string { fields[i] = fmt.Sprintf("NonRetriableErrorReasons: %v", v.NonRetriableErrorReasons) i++ } + if v.ExpirationIntervalInSeconds != nil { + fields[i] = fmt.Sprintf("ExpirationIntervalInSeconds: %v", *(v.ExpirationIntervalInSeconds)) + i++ + } return fmt.Sprintf("RetryPolicy{%v}", strings.Join(fields[:i], ", ")) } @@ -22663,6 +22746,9 @@ func (v *RetryPolicy) Equals(rhs *RetryPolicy) bool { if !((v.NonRetriableErrorReasons == nil && rhs.NonRetriableErrorReasons == nil) || (v.NonRetriableErrorReasons != nil && rhs.NonRetriableErrorReasons != nil && _List_String_Equals(v.NonRetriableErrorReasons, rhs.NonRetriableErrorReasons))) { return false } + if !_I32_EqualsPtr(v.ExpirationIntervalInSeconds, rhs.ExpirationIntervalInSeconds) { + return false + } return true } @@ -22707,6 +22793,16 @@ func (v *RetryPolicy) GetMaximumAttempts() (o int32) { return } +// GetExpirationIntervalInSeconds returns the value of ExpirationIntervalInSeconds if it is set or its +// zero value if it is unset. +func (v *RetryPolicy) GetExpirationIntervalInSeconds() (o int32) { + if v.ExpirationIntervalInSeconds != nil { + return *v.ExpirationIntervalInSeconds + } + + return +} + type RetryTaskError struct { Message string `json:"message,required"` } @@ -25100,6 +25196,7 @@ type StartChildWorkflowExecutionDecisionAttributes struct { ChildPolicy *ChildPolicy `json:"childPolicy,omitempty"` Control []byte `json:"control,omitempty"` WorkflowIdReusePolicy *WorkflowIdReusePolicy `json:"workflowIdReusePolicy,omitempty"` + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` } // ToWire translates a StartChildWorkflowExecutionDecisionAttributes struct into a Thrift-level intermediate @@ -25119,7 +25216,7 @@ type StartChildWorkflowExecutionDecisionAttributes struct { // } func (v *StartChildWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [10]wire.Field + fields [11]wire.Field i int = 0 w wire.Value err error @@ -25205,6 +25302,14 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, er fields[i] = wire.Field{ID: 100, Value: w} i++ } + if v.RetryPolicy != nil { + w, err = v.RetryPolicy.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 110, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -25328,6 +25433,14 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) FromWire(w wire.Value) e return err } + } + case 110: + if field.Value.Type() == wire.TStruct { + v.RetryPolicy, err = _RetryPolicy_Read(field.Value) + if err != nil { + return err + } + } } } @@ -25342,7 +25455,7 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) String() string { return "" } - var fields [10]string + var fields [11]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -25384,6 +25497,10 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) String() string { fields[i] = fmt.Sprintf("WorkflowIdReusePolicy: %v", *(v.WorkflowIdReusePolicy)) i++ } + if v.RetryPolicy != nil { + fields[i] = fmt.Sprintf("RetryPolicy: %v", v.RetryPolicy) + i++ + } return fmt.Sprintf("StartChildWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -25433,6 +25550,9 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) Equals(rhs *StartChildWo if !_WorkflowIdReusePolicy_EqualsPtr(v.WorkflowIdReusePolicy, rhs.WorkflowIdReusePolicy) { return false } + if !((v.RetryPolicy == nil && rhs.RetryPolicy == nil) || (v.RetryPolicy != nil && rhs.RetryPolicy != nil && v.RetryPolicy.Equals(rhs.RetryPolicy))) { + return false + } return true } @@ -25833,6 +25953,7 @@ type StartChildWorkflowExecutionInitiatedEventAttributes struct { Control []byte `json:"control,omitempty"` DecisionTaskCompletedEventId *int64 `json:"decisionTaskCompletedEventId,omitempty"` WorkflowIdReusePolicy *WorkflowIdReusePolicy `json:"workflowIdReusePolicy,omitempty"` + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` } // ToWire translates a StartChildWorkflowExecutionInitiatedEventAttributes struct into a Thrift-level intermediate @@ -25852,7 +25973,7 @@ type StartChildWorkflowExecutionInitiatedEventAttributes struct { // } func (v *StartChildWorkflowExecutionInitiatedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [11]wire.Field + fields [12]wire.Field i int = 0 w wire.Value err error @@ -25946,6 +26067,14 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) ToWire() (wire.Val fields[i] = wire.Field{ID: 110, Value: w} i++ } + if v.RetryPolicy != nil { + w, err = v.RetryPolicy.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 120, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -26073,6 +26202,14 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) FromWire(w wire.Va return err } + } + case 120: + if field.Value.Type() == wire.TStruct { + v.RetryPolicy, err = _RetryPolicy_Read(field.Value) + if err != nil { + return err + } + } } } @@ -26087,7 +26224,7 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) String() string { return "" } - var fields [11]string + var fields [12]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -26133,6 +26270,10 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) String() string { fields[i] = fmt.Sprintf("WorkflowIdReusePolicy: %v", *(v.WorkflowIdReusePolicy)) i++ } + if v.RetryPolicy != nil { + fields[i] = fmt.Sprintf("RetryPolicy: %v", v.RetryPolicy) + i++ + } return fmt.Sprintf("StartChildWorkflowExecutionInitiatedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -26175,6 +26316,9 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) Equals(rhs *StartC if !_WorkflowIdReusePolicy_EqualsPtr(v.WorkflowIdReusePolicy, rhs.WorkflowIdReusePolicy) { return false } + if !((v.RetryPolicy == nil && rhs.RetryPolicy == nil) || (v.RetryPolicy != nil && rhs.RetryPolicy != nil && v.RetryPolicy.Equals(rhs.RetryPolicy))) { + return false + } return true } @@ -26565,6 +26709,7 @@ type StartWorkflowExecutionRequest struct { RequestId *string `json:"requestId,omitempty"` WorkflowIdReusePolicy *WorkflowIdReusePolicy `json:"workflowIdReusePolicy,omitempty"` ChildPolicy *ChildPolicy `json:"childPolicy,omitempty"` + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` } // ToWire translates a StartWorkflowExecutionRequest struct into a Thrift-level intermediate @@ -26584,7 +26729,7 @@ type StartWorkflowExecutionRequest struct { // } func (v *StartWorkflowExecutionRequest) ToWire() (wire.Value, error) { var ( - fields [11]wire.Field + fields [12]wire.Field i int = 0 w wire.Value err error @@ -26678,6 +26823,14 @@ func (v *StartWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 110, Value: w} i++ } + if v.RetryPolicy != nil { + w, err = v.RetryPolicy.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 120, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -26807,6 +26960,14 @@ func (v *StartWorkflowExecutionRequest) FromWire(w wire.Value) error { return err } + } + case 120: + if field.Value.Type() == wire.TStruct { + v.RetryPolicy, err = _RetryPolicy_Read(field.Value) + if err != nil { + return err + } + } } } @@ -26821,7 +26982,7 @@ func (v *StartWorkflowExecutionRequest) String() string { return "" } - var fields [11]string + var fields [12]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -26867,6 +27028,10 @@ func (v *StartWorkflowExecutionRequest) String() string { fields[i] = fmt.Sprintf("ChildPolicy: %v", *(v.ChildPolicy)) i++ } + if v.RetryPolicy != nil { + fields[i] = fmt.Sprintf("RetryPolicy: %v", v.RetryPolicy) + i++ + } return fmt.Sprintf("StartWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -26909,6 +27074,9 @@ func (v *StartWorkflowExecutionRequest) Equals(rhs *StartWorkflowExecutionReques if !_ChildPolicy_EqualsPtr(v.ChildPolicy, rhs.ChildPolicy) { return false } + if !((v.RetryPolicy == nil && rhs.RetryPolicy == nil) || (v.RetryPolicy != nil && rhs.RetryPolicy != nil && v.RetryPolicy.Equals(rhs.RetryPolicy))) { + return false + } return true } @@ -30705,6 +30873,7 @@ type WorkflowExecutionContinuedAsNewEventAttributes struct { ExecutionStartToCloseTimeoutSeconds *int32 `json:"executionStartToCloseTimeoutSeconds,omitempty"` TaskStartToCloseTimeoutSeconds *int32 `json:"taskStartToCloseTimeoutSeconds,omitempty"` DecisionTaskCompletedEventId *int64 `json:"decisionTaskCompletedEventId,omitempty"` + BackoffStartIntervalInSeconds *int32 `json:"backoffStartIntervalInSeconds,omitempty"` } // ToWire translates a WorkflowExecutionContinuedAsNewEventAttributes struct into a Thrift-level intermediate @@ -30724,7 +30893,7 @@ type WorkflowExecutionContinuedAsNewEventAttributes struct { // } func (v *WorkflowExecutionContinuedAsNewEventAttributes) ToWire() (wire.Value, error) { var ( - fields [7]wire.Field + fields [8]wire.Field i int = 0 w wire.Value err error @@ -30786,6 +30955,14 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) ToWire() (wire.Value, e fields[i] = wire.Field{ID: 70, Value: w} i++ } + if v.BackoffStartIntervalInSeconds != nil { + w, err = wire.NewValueI32(*(v.BackoffStartIntervalInSeconds)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 80, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -30875,6 +31052,16 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) FromWire(w wire.Value) return err } + } + case 80: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.BackoffStartIntervalInSeconds = &x + if err != nil { + return err + } + } } } @@ -30889,7 +31076,7 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) String() string { return "" } - var fields [7]string + var fields [8]string i := 0 if v.NewExecutionRunId != nil { fields[i] = fmt.Sprintf("NewExecutionRunId: %v", *(v.NewExecutionRunId)) @@ -30919,6 +31106,10 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) String() string { fields[i] = fmt.Sprintf("DecisionTaskCompletedEventId: %v", *(v.DecisionTaskCompletedEventId)) i++ } + if v.BackoffStartIntervalInSeconds != nil { + fields[i] = fmt.Sprintf("BackoffStartIntervalInSeconds: %v", *(v.BackoffStartIntervalInSeconds)) + i++ + } return fmt.Sprintf("WorkflowExecutionContinuedAsNewEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -30949,6 +31140,9 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) Equals(rhs *WorkflowExe if !_I64_EqualsPtr(v.DecisionTaskCompletedEventId, rhs.DecisionTaskCompletedEventId) { return false } + if !_I32_EqualsPtr(v.BackoffStartIntervalInSeconds, rhs.BackoffStartIntervalInSeconds) { + return false + } return true } @@ -30993,6 +31187,16 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) GetDecisionTaskComplete return } +// GetBackoffStartIntervalInSeconds returns the value of BackoffStartIntervalInSeconds if it is set or its +// zero value if it is unset. +func (v *WorkflowExecutionContinuedAsNewEventAttributes) GetBackoffStartIntervalInSeconds() (o int32) { + if v.BackoffStartIntervalInSeconds != nil { + return *v.BackoffStartIntervalInSeconds + } + + return +} + type WorkflowExecutionFailedEventAttributes struct { Reason *string `json:"reason,omitempty"` Details []byte `json:"details,omitempty"` @@ -31745,6 +31949,9 @@ type WorkflowExecutionStartedEventAttributes struct { ChildPolicy *ChildPolicy `json:"childPolicy,omitempty"` ContinuedExecutionRunId *string `json:"continuedExecutionRunId,omitempty"` Identity *string `json:"identity,omitempty"` + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + Attempt *int32 `json:"attempt,omitempty"` + ExpirationTimestamp *int64 `json:"expirationTimestamp,omitempty"` } // ToWire translates a WorkflowExecutionStartedEventAttributes struct into a Thrift-level intermediate @@ -31764,7 +31971,7 @@ type WorkflowExecutionStartedEventAttributes struct { // } func (v *WorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [11]wire.Field + fields [14]wire.Field i int = 0 w wire.Value err error @@ -31858,6 +32065,30 @@ func (v *WorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 60, Value: w} i++ } + if v.RetryPolicy != nil { + w, err = v.RetryPolicy.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 70, Value: w} + i++ + } + if v.Attempt != nil { + w, err = wire.NewValueI32(*(v.Attempt)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 80, Value: w} + i++ + } + if v.ExpirationTimestamp != nil { + w, err = wire.NewValueI64(*(v.ExpirationTimestamp)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 90, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -31985,6 +32216,34 @@ func (v *WorkflowExecutionStartedEventAttributes) FromWire(w wire.Value) error { return err } + } + case 70: + if field.Value.Type() == wire.TStruct { + v.RetryPolicy, err = _RetryPolicy_Read(field.Value) + if err != nil { + return err + } + + } + case 80: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.Attempt = &x + if err != nil { + return err + } + + } + case 90: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.ExpirationTimestamp = &x + if err != nil { + return err + } + } } } @@ -31999,7 +32258,7 @@ func (v *WorkflowExecutionStartedEventAttributes) String() string { return "" } - var fields [11]string + var fields [14]string i := 0 if v.WorkflowType != nil { fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType) @@ -32045,6 +32304,18 @@ func (v *WorkflowExecutionStartedEventAttributes) String() string { fields[i] = fmt.Sprintf("Identity: %v", *(v.Identity)) i++ } + if v.RetryPolicy != nil { + fields[i] = fmt.Sprintf("RetryPolicy: %v", v.RetryPolicy) + i++ + } + if v.Attempt != nil { + fields[i] = fmt.Sprintf("Attempt: %v", *(v.Attempt)) + i++ + } + if v.ExpirationTimestamp != nil { + fields[i] = fmt.Sprintf("ExpirationTimestamp: %v", *(v.ExpirationTimestamp)) + i++ + } return fmt.Sprintf("WorkflowExecutionStartedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -32087,6 +32358,15 @@ func (v *WorkflowExecutionStartedEventAttributes) Equals(rhs *WorkflowExecutionS if !_String_EqualsPtr(v.Identity, rhs.Identity) { return false } + if !((v.RetryPolicy == nil && rhs.RetryPolicy == nil) || (v.RetryPolicy != nil && rhs.RetryPolicy != nil && v.RetryPolicy.Equals(rhs.RetryPolicy))) { + return false + } + if !_I32_EqualsPtr(v.Attempt, rhs.Attempt) { + return false + } + if !_I64_EqualsPtr(v.ExpirationTimestamp, rhs.ExpirationTimestamp) { + return false + } return true } @@ -32161,6 +32441,26 @@ func (v *WorkflowExecutionStartedEventAttributes) GetIdentity() (o string) { return } +// GetAttempt returns the value of Attempt if it is set or its +// zero value if it is unset. +func (v *WorkflowExecutionStartedEventAttributes) GetAttempt() (o int32) { + if v.Attempt != nil { + return *v.Attempt + } + + return +} + +// GetExpirationTimestamp returns the value of ExpirationTimestamp if it is set or its +// zero value if it is unset. +func (v *WorkflowExecutionStartedEventAttributes) GetExpirationTimestamp() (o int64) { + if v.ExpirationTimestamp != nil { + return *v.ExpirationTimestamp + } + + return +} + type WorkflowExecutionTerminatedEventAttributes struct { Reason *string `json:"reason,omitempty"` Details []byte `json:"details,omitempty"` diff --git a/common/constants.go b/common/constants.go index 70c267e7e65..a7a395db51f 100644 --- a/common/constants.go +++ b/common/constants.go @@ -20,6 +20,8 @@ package common +import "time" + const ( // FirstEventID is the id of the first event in the history FirstEventID int64 = 1 @@ -52,6 +54,9 @@ const ( EncodingTypeGob = "gob" ) +// NoRetryBackoff is used to represent backoff when no retry is needed +const NoRetryBackoff = time.Duration(-1) + type ( // EncodingType is an enum that represents various data encoding types EncodingType string diff --git a/common/metrics/defs.go b/common/metrics/defs.go index 9449033116c..3d10f8a1ff0 100644 --- a/common/metrics/defs.go +++ b/common/metrics/defs.go @@ -388,6 +388,8 @@ const ( TimerTaskWorkflowTimeoutScope // TimerTaskRetryTimerScope is the scope used by metric emitted by timer queue processor for processing retry task. TimerTaskRetryTimerScope + // TimerTaskWorkflowRetryTimerScope is the scope used by metric emitted by timer queue processor for processing retry task. + TimerTaskWorkflowRetryTimerScope // TimerTaskDeleteHistoryEvent is the scope used by metric emitted by timer queue processor for processing history event cleanup TimerTaskDeleteHistoryEvent // HistoryEventNotificationScope is the scope used by shard history event nitification @@ -580,6 +582,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ TimerTaskUserTimerScope: {operation: "TimerTaskUserTimer"}, TimerTaskWorkflowTimeoutScope: {operation: "TimerTaskWorkflowTimeout"}, TimerTaskRetryTimerScope: {operation: "TimerTaskRetryTimer"}, + TimerTaskWorkflowRetryTimerScope: {operation: "TimerTaskWorkflowRetryTimer"}, TimerTaskDeleteHistoryEvent: {operation: "TimerTaskDeleteHistoryEvent"}, HistoryEventNotificationScope: {operation: "HistoryEventNotification"}, ReplicatorQueueProcessorScope: {operation: "ReplicatorQueueProcessor"}, diff --git a/common/persistence/cassandraPersistence.go b/common/persistence/cassandraPersistence.go index 50d6da6e0c6..e6f63927b24 100644 --- a/common/persistence/cassandraPersistence.go +++ b/common/persistence/cassandraPersistence.go @@ -147,7 +147,15 @@ const ( `sticky_schedule_to_start_timeout: ?,` + `client_library_version: ?, ` + `client_feature_version: ?, ` + - `client_impl: ?` + + `client_impl: ?, ` + + `attempt: ?, ` + + `has_retry_policy: ?, ` + + `init_interval: ?, ` + + `backoff_coefficient: ?, ` + + `max_interval: ?, ` + + `expiration_time: ?, ` + + `max_attempts: ?, ` + + `non_retriable_errors: ?` + `}` templateReplicationStateType = `{` + @@ -1213,6 +1221,14 @@ func (d *cassandraPersistence) CreateWorkflowExecutionWithinBatch(request *Creat "", // client_library_version "", // client_feature_version "", // client_impl + request.Attempt, + request.HasRetryPolicy, + request.InitialInterval, + request.BackoffCoefficient, + request.MaximumInterval, + request.ExpirationTime, + request.MaximumAttempts, + request.NonRetriableErrors, request.NextEventID, defaultVisibilityTimestamp, rowTypeExecutionTaskID) @@ -1263,6 +1279,14 @@ func (d *cassandraPersistence) CreateWorkflowExecutionWithinBatch(request *Creat "", // client_library_version "", // client_feature_version "", // client_impl + request.Attempt, + request.HasRetryPolicy, + request.InitialInterval, + request.BackoffCoefficient, + request.MaximumInterval, + request.ExpirationTime, + request.MaximumAttempts, + request.NonRetriableErrors, request.ReplicationState.CurrentVersion, request.ReplicationState.StartVersion, request.ReplicationState.LastWriteVersion, @@ -1421,6 +1445,14 @@ func (d *cassandraPersistence) UpdateWorkflowExecution(request *UpdateWorkflowEx executionInfo.ClientLibraryVersion, executionInfo.ClientFeatureVersion, executionInfo.ClientImpl, + executionInfo.Attempt, + executionInfo.HasRetryPolicy, + executionInfo.InitialInterval, + executionInfo.BackoffCoefficient, + executionInfo.MaximumInterval, + executionInfo.ExpirationTime, + executionInfo.MaximumAttempts, + executionInfo.NonRetriableErrors, executionInfo.NextEventID, d.shardID, rowTypeExecution, @@ -1472,6 +1504,14 @@ func (d *cassandraPersistence) UpdateWorkflowExecution(request *UpdateWorkflowEx executionInfo.ClientLibraryVersion, executionInfo.ClientFeatureVersion, executionInfo.ClientImpl, + executionInfo.Attempt, + executionInfo.HasRetryPolicy, + executionInfo.InitialInterval, + executionInfo.BackoffCoefficient, + executionInfo.MaximumInterval, + executionInfo.ExpirationTime, + executionInfo.MaximumAttempts, + executionInfo.NonRetriableErrors, replicationState.CurrentVersion, replicationState.StartVersion, replicationState.LastWriteVersion, @@ -1698,6 +1738,14 @@ func (d *cassandraPersistence) ResetMutableState(request *ResetMutableStateReque executionInfo.ClientLibraryVersion, executionInfo.ClientFeatureVersion, executionInfo.ClientImpl, + executionInfo.Attempt, + executionInfo.HasRetryPolicy, + executionInfo.InitialInterval, + executionInfo.BackoffCoefficient, + executionInfo.MaximumInterval, + executionInfo.ExpirationTime, + executionInfo.MaximumAttempts, + executionInfo.NonRetriableErrors, replicationState.CurrentVersion, replicationState.StartVersion, replicationState.LastWriteVersion, @@ -2551,6 +2599,8 @@ func (d *cassandraPersistence) createTimerTasks(batch *gocql.Batch, timerTasks [ case *RetryTimerTask: eventID = t.EventID attempt = int64(t.Attempt) + case *WorkflowRetryTimerTask: + eventID = t.EventID } ts := common.UnixNanoToCQLTimestamp(GetVisibilityTSFrom(task).UnixNano()) @@ -3112,6 +3162,22 @@ func createWorkflowExecutionInfo(result map[string]interface{}) *WorkflowExecuti info.ClientFeatureVersion = v.(string) case "client_impl": info.ClientImpl = v.(string) + case "attempt": + info.Attempt = int32(v.(int)) + case "has_retry_policy": + info.HasRetryPolicy = v.(bool) + case "init_interval": + info.InitialInterval = int32(v.(int)) + case "backoff_coefficient": + info.BackoffCoefficient = v.(float64) + case "max_interval": + info.MaximumInterval = int32(v.(int)) + case "max_attempts": + info.MaximumAttempts = int32(v.(int)) + case "expiration_time": + info.ExpirationTime = v.(time.Time) + case "non_retriable_errors": + info.NonRetriableErrors = v.([]string) } } @@ -3609,6 +3675,9 @@ func GetVisibilityTSFrom(task Task) time.Time { case TaskTypeRetryTimer: return task.(*RetryTimerTask).VisibilityTimestamp + + case TaskTypeWorkflowRetryTimer: + return task.(*WorkflowRetryTimerTask).VisibilityTimestamp } return time.Time{} } @@ -3633,5 +3702,8 @@ func SetVisibilityTSFrom(task Task, t time.Time) { case TaskTypeRetryTimer: task.(*RetryTimerTask).VisibilityTimestamp = t + + case TaskTypeWorkflowRetryTimer: + task.(*WorkflowRetryTimerTask).VisibilityTimestamp = t } } diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index 182397c63d4..c28226c5a91 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -97,6 +97,7 @@ const ( TaskTypeWorkflowTimeout TaskTypeDeleteHistoryEvent TaskTypeRetryTimer + TaskTypeWorkflowRetryTimer ) type ( @@ -183,6 +184,15 @@ type ( ClientLibraryVersion string ClientFeatureVersion string ClientImpl string + // for retry + Attempt int32 + HasRetryPolicy bool + InitialInterval int32 + BackoffCoefficient float64 + MaximumInterval int32 + ExpirationTime time.Time + MaximumAttempts int32 + NonRetriableErrors []string } // ReplicationState represents mutable state information for global domains. @@ -373,6 +383,14 @@ type ( Attempt int32 } + // WorkflowRetryTimerTask to schedule first decision task for retried workflow + WorkflowRetryTimerTask struct { + VisibilityTimestamp time.Time + TaskID int64 + EventID int64 + Version int64 + } + // HistoryReplicationTask is the transfer task created for shipping history replication events to other clusters HistoryReplicationTask struct { TaskID int64 @@ -528,6 +546,14 @@ type ( ContinueAsNew bool PreviousRunID string ReplicationState *ReplicationState + Attempt int32 + HasRetryPolicy bool + InitialInterval int32 + BackoffCoefficient float64 + MaximumInterval int32 + ExpirationTime time.Time + MaximumAttempts int32 + NonRetriableErrors []string } // CreateWorkflowExecutionResponse is the response to CreateWorkflowExecutionRequest @@ -1222,6 +1248,41 @@ func (r *RetryTimerTask) SetVisibilityTimestamp(t time.Time) { r.VisibilityTimestamp = t } +// GetType returns the type of the retry timer task +func (r *WorkflowRetryTimerTask) GetType() int { + return TaskTypeWorkflowRetryTimer +} + +// GetVersion returns the version of the retry timer task +func (r *WorkflowRetryTimerTask) GetVersion() int64 { + return r.Version +} + +// SetVersion returns the version of the retry timer task +func (r *WorkflowRetryTimerTask) SetVersion(version int64) { + r.Version = version +} + +// GetTaskID returns the sequence ID. +func (r *WorkflowRetryTimerTask) GetTaskID() int64 { + return r.TaskID +} + +// SetTaskID sets the sequence ID. +func (r *WorkflowRetryTimerTask) SetTaskID(id int64) { + r.TaskID = id +} + +// GetVisibilityTimestamp gets the visibility time stamp +func (r *WorkflowRetryTimerTask) GetVisibilityTimestamp() time.Time { + return r.VisibilityTimestamp +} + +// SetVisibilityTimestamp gets the visibility time stamp +func (r *WorkflowRetryTimerTask) SetVisibilityTimestamp(t time.Time) { + r.VisibilityTimestamp = t +} + // GetType returns the type of the timeout task. func (u *WorkflowTimeoutTask) GetType() int { return TaskTypeWorkflowTimeout diff --git a/common/util.go b/common/util.go index 9e8cce9de6f..7d1d0893b9c 100644 --- a/common/util.go +++ b/common/util.go @@ -211,3 +211,33 @@ func CreateMatchingPollForDecisionTaskResponse(historyResponse *h.RecordDecision } return matchingResp } + +// ValidateRetryPolicy validates a retry policy +func ValidateRetryPolicy(policy *workflow.RetryPolicy) error { + if policy == nil { + // nil policy is valid which means no retry + return nil + } + if policy.GetInitialIntervalInSeconds() <= 0 { + return &workflow.BadRequestError{Message: "A valid InitialIntervalInSeconds is not set on retry policy."} + } + if policy.GetBackoffCoefficient() < 1 { + return &workflow.BadRequestError{Message: "BackoffCoefficient cannot be less than 1 on retry policy."} + } + if policy.GetMaximumIntervalInSeconds() < 0 { + return &workflow.BadRequestError{Message: "MaximumIntervalInSeconds cannot be less than 0 on retry policy."} + } + if policy.GetMaximumIntervalInSeconds() > 0 && policy.GetMaximumIntervalInSeconds() < policy.GetInitialIntervalInSeconds() { + return &workflow.BadRequestError{Message: "MaximumIntervalInSeconds cannot be less than InitialIntervalInSeconds on retry policy."} + } + if policy.GetMaximumAttempts() < 0 { + return &workflow.BadRequestError{Message: "MaximumAttempts cannot be less than 0 on retry policy."} + } + if policy.GetExpirationIntervalInSeconds() < 0 { + return &workflow.BadRequestError{Message: "ExpirationIntervalInSeconds cannot be less than 0 on retry policy."} + } + if policy.GetMaximumAttempts() == 0 && policy.GetExpirationIntervalInSeconds() == 0 { + return &workflow.BadRequestError{Message: "MaximumAttempts and ExpirationIntervalInSeconds are both 0. At least one of them must be specified."} + } + return nil +} diff --git a/host/integration_test.go b/host/integration_test.go index 854151f4f83..13c629888f0 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -1312,6 +1312,100 @@ func (s *integrationSuite) TestActivityRetry() { s.True(activityExecutedCount == 2) } +func (s *integrationSuite) TestWorkflowRetry() { + id := "integration-wf-retry-test" + wt := "integration-wf-retry-type" + tl := "integration-wf-retry-tasklist" + identity := "worker1" + + workflowType := &workflow.WorkflowType{} + workflowType.Name = common.StringPtr(wt) + + taskList := &workflow.TaskList{} + taskList.Name = common.StringPtr(tl) + + request := &workflow.StartWorkflowExecutionRequest{ + RequestId: common.StringPtr(uuid.New()), + Domain: common.StringPtr(s.domainName), + WorkflowId: common.StringPtr(id), + WorkflowType: workflowType, + TaskList: taskList, + Input: nil, + ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100), + TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1), + Identity: common.StringPtr(identity), + RetryPolicy: &workflow.RetryPolicy{ + InitialIntervalInSeconds: common.Int32Ptr(1), + MaximumAttempts: common.Int32Ptr(3), + MaximumIntervalInSeconds: common.Int32Ptr(1), + NonRetriableErrorReasons: []string{"bad-bug"}, + BackoffCoefficient: common.Float64Ptr(1), + }, + } + + we, err0 := s.engine.StartWorkflowExecution(createContext(), request) + s.Nil(err0) + + s.logger.Infof("StartWorkflowExecution: response: %v \n", *we.RunId) + + var executions []*workflow.WorkflowExecution + + attemptCount := 0 + + dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType, + previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) { + executions = append(executions, execution) + attemptCount++ + if attemptCount == 3 { + return nil, []*workflow.Decision{ + { + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution), + CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{ + Result: []byte("succeed-after-retry"), + }, + }}, nil + } + return nil, []*workflow.Decision{ + { + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeFailWorkflowExecution), + FailWorkflowExecutionDecisionAttributes: &workflow.FailWorkflowExecutionDecisionAttributes{ + Reason: common.StringPtr("retryable-error"), + Details: nil, + }, + }}, nil + } + + poller := &taskPoller{ + engine: s.engine, + domain: s.domainName, + taskList: taskList, + identity: identity, + decisionHandler: dtHandler, + logger: s.logger, + suite: s, + } + + _, err := poller.pollAndProcessDecisionTask(false, false) + s.True(err == nil, err) + + _, err = poller.pollAndProcessDecisionTask(false, false) + s.True(err == nil, err) + + _, err = poller.pollAndProcessDecisionTask(false, false) + s.True(err == nil, err) + + s.Equal(3, attemptCount) + + events := s.getHistory(s.domainName, executions[0]) + s.Equal(workflow.EventTypeWorkflowExecutionContinuedAsNew, events[len(events)-1].GetEventType()) + + events = s.getHistory(s.domainName, executions[1]) + s.Equal(workflow.EventTypeWorkflowExecutionContinuedAsNew, events[len(events)-1].GetEventType()) + + events = s.getHistory(s.domainName, executions[2]) + s.Equal(workflow.EventTypeWorkflowExecutionCompleted, events[len(events)-1].GetEventType()) +} + func (s *integrationSuite) TestActivityHeartBeatWorkflow_Timeout() { id := "integration-heartbeat-timeout-test" wt := "integration-heartbeat-timeout-test-type" diff --git a/idl/github.com/uber/cadence/history.thrift b/idl/github.com/uber/cadence/history.thrift index 3a71c1afa99..2ebf7529e79 100644 --- a/idl/github.com/uber/cadence/history.thrift +++ b/idl/github.com/uber/cadence/history.thrift @@ -42,6 +42,8 @@ struct StartWorkflowExecutionRequest { 10: optional string domainUUID 20: optional shared.StartWorkflowExecutionRequest startRequest 30: optional ParentExecutionInfo parentExecutionInfo + 40: optional i32 attempt + 50: optional i64 (js.type = "Long") expirationTimestamp } struct DescribeMutableStateRequest{ diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 2846e30263b..eba95f366df 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -349,6 +349,8 @@ struct ContinueAsNewWorkflowExecutionDecisionAttributes { 30: optional binary input 40: optional i32 executionStartToCloseTimeoutSeconds 50: optional i32 taskStartToCloseTimeoutSeconds + 60: optional i32 backoffStartIntervalInSeconds + 70: optional RetryPolicy retryPolicy } struct StartChildWorkflowExecutionDecisionAttributes { @@ -362,6 +364,7 @@ struct StartChildWorkflowExecutionDecisionAttributes { 80: optional ChildPolicy childPolicy 90: optional binary control 100: optional WorkflowIdReusePolicy workflowIdReusePolicy + 110: optional RetryPolicy retryPolicy } struct Decision { @@ -392,6 +395,9 @@ struct WorkflowExecutionStartedEventAttributes { 52: optional ChildPolicy childPolicy 54: optional string continuedExecutionRunId 60: optional string identity + 70: optional RetryPolicy retryPolicy + 80: optional i32 attempt + 90: optional i64 (js.type = "Long") expirationTimestamp } struct WorkflowExecutionCompletedEventAttributes { @@ -417,6 +423,7 @@ struct WorkflowExecutionContinuedAsNewEventAttributes { 50: optional i32 executionStartToCloseTimeoutSeconds 60: optional i32 taskStartToCloseTimeoutSeconds 70: optional i64 (js.type = "Long") decisionTaskCompletedEventId + 80: optional i32 backoffStartIntervalInSeconds } struct DecisionTaskScheduledEventAttributes { @@ -631,6 +638,7 @@ struct StartChildWorkflowExecutionInitiatedEventAttributes { 90: optional binary control 100: optional i64 (js.type = "Long") decisionTaskCompletedEventId 110: optional WorkflowIdReusePolicy workflowIdReusePolicy + 120: optional RetryPolicy retryPolicy } struct StartChildWorkflowExecutionFailedEventAttributes { @@ -855,6 +863,7 @@ struct StartWorkflowExecutionRequest { 90: optional string requestId 100: optional WorkflowIdReusePolicy workflowIdReusePolicy 110: optional ChildPolicy childPolicy + 120: optional RetryPolicy retryPolicy } struct StartWorkflowExecutionResponse { @@ -1195,4 +1204,9 @@ struct RetryPolicy { // Non-Retriable errors. Will stop retrying if error matches this list. 50: optional list nonRetriableErrorReasons + + // Expiration time for the whole retry process. If not specified, default will be used which is scheduleToCloseTimeoutSeconds + // for activity or executionStartToCloseTimeoutSeconds for workflow. If value specified is less than default, the value + // specified will be ignored. + 60: optional i32 expirationIntervalInSeconds } diff --git a/schema/cadence/schema.cql b/schema/cadence/schema.cql index cfed817b166..2a0218dc975 100644 --- a/schema/cadence/schema.cql +++ b/schema/cadence/schema.cql @@ -54,6 +54,14 @@ CREATE TYPE workflow_execution ( client_library_version text, client_feature_version text, client_impl text, + attempt int, -- starting from 0 (for initial non-retry) + has_retry_policy boolean,-- If there is a retry policy + init_interval int, -- initial retry interval, in seconds + backoff_coefficient double, + max_interval int, -- max retry interval in seconds + expiration_time timestamp, -- retry expiration time + max_attempts int, -- max number of attempts including initial non-retry attempt + non_retriable_errors list, ); -- Replication information for each cluster diff --git a/schema/cadence/versioned/v0.9/manifest.json b/schema/cadence/versioned/v0.9/manifest.json index 396dfddb6c8..4d79dcbb985 100644 --- a/schema/cadence/versioned/v0.9/manifest.json +++ b/schema/cadence/versioned/v0.9/manifest.json @@ -1,8 +1,9 @@ { "CurrVersion": "0.9", "MinCompatibleVersion": "0.9", - "Description": "Support domain customized key-value data.", + "Description": "Support domain customized key-value data. Support workflow server side retry.", "SchemaUpdateCqlFiles": [ - "domain_data.cql" + "domain_data.cql", + "workflow_retry.cql" ] } \ No newline at end of file diff --git a/schema/cadence/versioned/v0.9/workflow_retry.cql b/schema/cadence/versioned/v0.9/workflow_retry.cql new file mode 100644 index 00000000000..c6dcba34f4a --- /dev/null +++ b/schema/cadence/versioned/v0.9/workflow_retry.cql @@ -0,0 +1,8 @@ +ALTER TYPE workflow_execution ADD attempt int; +ALTER TYPE workflow_execution ADD has_retry_policy boolean; +ALTER TYPE workflow_execution ADD init_interval int; +ALTER TYPE workflow_execution ADD backoff_coefficient double; +ALTER TYPE workflow_execution ADD max_interval int; +ALTER TYPE workflow_execution ADD expiration_time timestamp; +ALTER TYPE workflow_execution ADD max_attempts int; +ALTER TYPE workflow_execution ADD non_retriable_errors list; \ No newline at end of file diff --git a/service/frontend/workflowHandler.go b/service/frontend/workflowHandler.go index bd1a818d6c2..3d32bbd94c2 100644 --- a/service/frontend/workflowHandler.go +++ b/service/frontend/workflowHandler.go @@ -1326,6 +1326,10 @@ func (wh *WorkflowHandler) StartWorkflowExecution( return nil, wh.error(&gen.BadRequestError{Message: "WorkflowId is not set on request."}, scope) } + if err := common.ValidateRetryPolicy(startRequest.RetryPolicy); err != nil { + return nil, wh.error(err, scope) + } + wh.Service.GetLogger().Debugf( "Received StartWorkflowExecution. WorkflowID: %v", startRequest.GetWorkflowId()) diff --git a/service/history/MockMutableState.go b/service/history/MockMutableState.go index f6fffab8bb9..0408046e5cc 100644 --- a/service/history/MockMutableState.go +++ b/service/history/MockMutableState.go @@ -21,6 +21,8 @@ package history import ( + "time" + "github.com/stretchr/testify/mock" h "github.com/uber/cadence/.gen/go/history" "github.com/uber/cadence/.gen/go/shared" @@ -301,12 +303,12 @@ func (_m *mockMutableState) AddCompletedWorkflowEvent(_a0 int64, _a1 *shared.Com } // AddContinueAsNewEvent provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *mockMutableState) AddContinueAsNewEvent(_a0 int64, _a1 *cache.DomainCacheEntry, _a2 string, _a3 string, _a4 *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) (*shared.HistoryEvent, mutableState, error) { - ret := _m.Called(_a0, _a1, _a2, _a3, _a4) +func (_m *mockMutableState) AddContinueAsNewEvent(_a0 int64, _a1 *cache.DomainCacheEntry, _a2 string, _a3 *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) (*shared.HistoryEvent, mutableState, error) { + ret := _m.Called(_a0, _a1, _a2, _a3) var r0 *shared.HistoryEvent - if rf, ok := ret.Get(0).(func(int64, *cache.DomainCacheEntry, string, string, *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) *shared.HistoryEvent); ok { - r0 = rf(_a0, _a1, _a2, _a3, _a4) + if rf, ok := ret.Get(0).(func(int64, *cache.DomainCacheEntry, string, *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) *shared.HistoryEvent); ok { + r0 = rf(_a0, _a1, _a2, _a3) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*shared.HistoryEvent) @@ -314,8 +316,8 @@ func (_m *mockMutableState) AddContinueAsNewEvent(_a0 int64, _a1 *cache.DomainCa } var r1 mutableState - if rf, ok := ret.Get(1).(func(int64, *cache.DomainCacheEntry, string, string, *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) mutableState); ok { - r1 = rf(_a0, _a1, _a2, _a3, _a4) + if rf, ok := ret.Get(1).(func(int64, *cache.DomainCacheEntry, string, *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) mutableState); ok { + r1 = rf(_a0, _a1, _a2, _a3) } else { if ret.Get(1) != nil { r1 = ret.Get(1).(mutableState) @@ -323,8 +325,8 @@ func (_m *mockMutableState) AddContinueAsNewEvent(_a0 int64, _a1 *cache.DomainCa } var r2 error - if rf, ok := ret.Get(2).(func(int64, *cache.DomainCacheEntry, string, string, *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) error); ok { - r2 = rf(_a0, _a1, _a2, _a3, _a4) + if rf, ok := ret.Get(2).(func(int64, *cache.DomainCacheEntry, string, *shared.ContinueAsNewWorkflowExecutionDecisionAttributes) error); ok { + r2 = rf(_a0, _a1, _a2, _a3) } else { r2 = ret.Error(2) } @@ -1513,6 +1515,22 @@ func (_m *mockMutableState) GetRequestCancelInfo(_a0 int64) (*persistence.Reques return r0, r1 } +// GetRetryBackoffDuration provides a mock function +func (_m *mockMutableState) GetRetryBackoffDuration(errReason string) time.Duration { + ret := _m.Called() + + var r0 time.Duration + if rf, ok := ret.Get(0).(func(string) time.Duration); ok { + r0 = rf(errReason) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(time.Duration) + } + } + + return r0 +} + // GetScheduleIDByActivityID provides a mock function with given fields: _a0 func (_m *mockMutableState) GetScheduleIDByActivityID(_a0 string) (int64, bool) { ret := _m.Called(_a0) @@ -2030,9 +2048,17 @@ func (_m *mockMutableState) ReplicateWorkflowExecutionCompletedEvent(_a0 *shared _m.Called(_a0) } -// ReplicateWorkflowExecutionContinuedAsNewEvent provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5 -func (_m *mockMutableState) ReplicateWorkflowExecutionContinuedAsNewEvent(_a0 string, _a1 string, _a2 *shared.HistoryEvent, _a3 *shared.HistoryEvent, _a4 *decisionInfo, _a5 mutableState) { - _m.Called(_a0, _a1, _a2, _a3, _a4, _a5) +// ReplicateWorkflowExecutionContinuedAsNewEvent provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 +func (_m *mockMutableState) ReplicateWorkflowExecutionContinuedAsNewEvent(_a0 string, _a1 string, _a2 *shared.HistoryEvent, _a3 *shared.HistoryEvent, _a4 mutableState) error { + ret := _m.Called(_a0, _a1, _a2, _a3, _a4) + var r0 error + if rf, ok := ret.Get(0).(func(string, string, *shared.HistoryEvent, *shared.HistoryEvent, mutableState) error); ok { + r0 = rf(_a0, _a1, _a2, _a3, _a4) + } else { + r0 = ret.Error(0) + } + + return r0 } // ReplicateWorkflowExecutionFailedEvent provides a mock function with given fields: _a0 diff --git a/service/history/historyBuilder.go b/service/history/historyBuilder.go index 97c755766fb..78b4c050a50 100644 --- a/service/history/historyBuilder.go +++ b/service/history/historyBuilder.go @@ -21,6 +21,8 @@ package history import ( + "time" + "github.com/uber-common/bark" h "github.com/uber/cadence/.gen/go/history" workflow "github.com/uber/cadence/.gen/go/shared" @@ -477,6 +479,18 @@ func (b *historyBuilder) newWorkflowExecutionStartedEvent( attributes.ChildPolicy = request.ChildPolicy attributes.ContinuedExecutionRunId = previousRunID attributes.Identity = common.StringPtr(common.StringDefault(request.Identity)) + attributes.RetryPolicy = request.RetryPolicy + attributes.Attempt = common.Int32Ptr(startRequest.GetAttempt()) + if startRequest.GetAttempt() == 0 { + if request.RetryPolicy != nil && request.RetryPolicy.GetExpirationIntervalInSeconds() > 0 { + expirationInSeconds := request.RetryPolicy.GetExpirationIntervalInSeconds() + deadline := time.Unix(0, historyEvent.GetTimestamp()).Add(time.Second * time.Duration(expirationInSeconds)) + attributes.ExpirationTimestamp = common.Int64Ptr(deadline.Round(time.Millisecond).UnixNano()) + } + } else { + attributes.ExpirationTimestamp = common.Int64Ptr(startRequest.GetExpirationTimestamp()) + } + parentInfo := startRequest.ParentExecutionInfo if parentInfo != nil { attributes.ParentWorkflowDomain = parentInfo.Domain @@ -836,6 +850,7 @@ func (b *historyBuilder) newWorkflowExecutionContinuedAsNewEvent(decisionTaskCom attributes.ExecutionStartToCloseTimeoutSeconds = common.Int32Ptr(*request.ExecutionStartToCloseTimeoutSeconds) attributes.TaskStartToCloseTimeoutSeconds = common.Int32Ptr(*request.TaskStartToCloseTimeoutSeconds) attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID) + attributes.BackoffStartIntervalInSeconds = common.Int32Ptr(request.GetBackoffStartIntervalInSeconds()) historyEvent.WorkflowExecutionContinuedAsNewEventAttributes = attributes return historyEvent @@ -856,6 +871,7 @@ func (b *historyBuilder) newStartChildWorkflowExecutionInitiatedEvent(decisionTa attributes.Control = startAttributes.Control attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID) attributes.WorkflowIdReusePolicy = startAttributes.WorkflowIdReusePolicy + attributes.RetryPolicy = startAttributes.RetryPolicy historyEvent.StartChildWorkflowExecutionInitiatedEventAttributes = attributes return historyEvent diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index 182608f40ed..696fe6fdff7 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -222,7 +222,6 @@ func (e *historyEngineImpl) registerDomainFailoverCallback() { // StartWorkflowExecution starts a workflow execution func (e *historyEngineImpl) StartWorkflowExecution(startRequest *h.StartWorkflowExecutionRequest) ( *workflow.StartWorkflowExecutionResponse, error) { - domainEntry, err := e.getActiveDomainEntry(startRequest.DomainUUID) if err != nil { return nil, err @@ -333,7 +332,7 @@ func (e *historyEngineImpl) StartWorkflowExecution(startRequest *h.StartWorkflow setTaskVersion(msBuilder.GetCurrentVersion(), transferTasks, timerTasks) createWorkflow := func(isBrandNew bool, prevRunID string) (string, error) { - _, err = e.shard.CreateWorkflowExecution(&persistence.CreateWorkflowExecutionRequest{ + createRequest := &persistence.CreateWorkflowExecutionRequest{ RequestID: common.StringDefault(request.RequestId), DomainID: domainID, Execution: execution, @@ -357,7 +356,20 @@ func (e *historyEngineImpl) StartWorkflowExecution(startRequest *h.StartWorkflow ContinueAsNew: !isBrandNew, PreviousRunID: prevRunID, ReplicationState: replicationState, - }) + HasRetryPolicy: request.RetryPolicy != nil, + } + if createRequest.HasRetryPolicy { + createRequest.InitialInterval = request.RetryPolicy.GetInitialIntervalInSeconds() + createRequest.BackoffCoefficient = request.RetryPolicy.GetBackoffCoefficient() + createRequest.MaximumInterval = request.RetryPolicy.GetMaximumIntervalInSeconds() + expireTimeNano := startedEvent.WorkflowExecutionStartedEventAttributes.GetExpirationTimestamp() + if expireTimeNano > 0 { + createRequest.ExpirationTime = time.Unix(0, expireTimeNano) + } + createRequest.MaximumAttempts = request.RetryPolicy.GetMaximumAttempts() + createRequest.NonRetriableErrors = request.RetryPolicy.NonRetriableErrorReasons + } + _, err = e.shard.CreateWorkflowExecution(createRequest) if err != nil { switch t := err.(type) { @@ -1030,16 +1042,43 @@ Update_History_Loop: logging.LogMultipleCompletionDecisionsEvent(e.logger, *d.DecisionType) continue Process_Decision_Loop } - attributes := d.FailWorkflowExecutionDecisionAttributes - if err = validateFailWorkflowExecutionAttributes(attributes); err != nil { + + failedAttributes := d.FailWorkflowExecutionDecisionAttributes + if err = validateFailWorkflowExecutionAttributes(failedAttributes); err != nil { failDecision = true failCause = workflow.DecisionTaskFailedCauseBadFailWorkflowExecutionAttributes break Process_Decision_Loop } - if e := msBuilder.AddFailWorkflowEvent(completedID, attributes); e == nil { - return nil, &workflow.InternalServiceError{Message: "Unable to add fail workflow event."} + + retryBackoffInterval := msBuilder.GetRetryBackoffDuration(failedAttributes.GetReason()) + if retryBackoffInterval == common.NoRetryBackoff { + // no retry + if e := msBuilder.AddFailWorkflowEvent(completedID, failedAttributes); e == nil { + return nil, &workflow.InternalServiceError{Message: "Unable to add fail workflow event."} + } + } else { + // retry with backoff + startEvent, err := getWorkflowStartedEvent(e.historyMgr, domainID, workflowExecution.GetWorkflowId(), workflowExecution.GetRunId()) + if err != nil { + return nil, err + } + + startAttributes := startEvent.WorkflowExecutionStartedEventAttributes + continueAsnewAttributes := &workflow.ContinueAsNewWorkflowExecutionDecisionAttributes{ + WorkflowType: startAttributes.WorkflowType, + TaskList: startAttributes.TaskList, + RetryPolicy: startAttributes.RetryPolicy, + Input: startAttributes.Input, + ExecutionStartToCloseTimeoutSeconds: startAttributes.ExecutionStartToCloseTimeoutSeconds, + TaskStartToCloseTimeoutSeconds: startAttributes.TaskStartToCloseTimeoutSeconds, + BackoffStartIntervalInSeconds: common.Int32Ptr(int32(retryBackoffInterval.Seconds())), + } + if _, continueAsNewBuilder, err = msBuilder.AddContinueAsNewEvent(completedID, domainEntry, startAttributes.GetParentWorkflowDomain(), continueAsnewAttributes); err != nil { + return nil, err + } } isComplete = true + case workflow.DecisionTypeCancelWorkflowExecution: e.metricsClient.IncCounter(metrics.HistoryRespondDecisionTaskCompletedScope, metrics.DecisionTypeCancelWorkflowCounter) @@ -1241,8 +1280,7 @@ Update_History_Loop: parentDomainName = parentDomainEntry.GetInfo().Name } - runID := uuid.New() - _, newStateBuilder, err := msBuilder.AddContinueAsNewEvent(completedID, domainEntry, runID, parentDomainName, attributes) + _, newStateBuilder, err := msBuilder.AddContinueAsNewEvent(completedID, domainEntry, parentDomainName, attributes) if err != nil { return nil, err } @@ -1368,6 +1406,9 @@ Update_History_Loop: if continueAsNewBuilder != nil { updateErr = context.continueAsNewWorkflowExecution(request.ExecutionContext, continueAsNewBuilder, transferTasks, timerTasks, transactionID) + if msBuilder.GetContinueAsNew() != nil { + e.timerProcessor.NotifyNewTimers(e.currentClusterName, e.shard.GetCurrentTime(e.currentClusterName), msBuilder.GetContinueAsNew().TimerTasks) + } } else { updateErr = context.updateWorkflowExecutionWithContext(request.ExecutionContext, transferTasks, timerTasks, transactionID) @@ -1384,7 +1425,7 @@ Update_History_Loop: } // add continueAsNewTimerTask - timerTasks = append(timerTasks, continueAsNewTimerTasks...) + //timerTasks = append(timerTasks, continueAsNewTimerTasks...) // Inform timer about the new ones. e.timerProcessor.NotifyNewTimers(e.currentClusterName, e.shard.GetCurrentTime(e.currentClusterName), timerTasks) @@ -2269,13 +2310,19 @@ func (e *historyEngineImpl) getDeleteWorkflowTasks( domainID string, tBuilder *timerBuilder, ) (persistence.Task, persistence.Task, error) { + return getDeleteWorkflowTasksFromShard(e.shard, domainID, tBuilder) +} +func getDeleteWorkflowTasksFromShard(shard ShardContext, + domainID string, + tBuilder *timerBuilder, +) (persistence.Task, persistence.Task, error) { // Create a transfer task to close workflow execution closeTask := &persistence.CloseExecutionTask{} // Generate a timer task to cleanup history events for this workflow execution var retentionInDays int32 - domainEntry, err := e.shard.GetDomainCache().GetDomainByID(domainID) + domainEntry, err := shard.GetDomainCache().GetDomainByID(domainID) if err != nil { if _, ok := err.(*workflow.EntityNotExistsError); !ok { return nil, nil, err @@ -2399,16 +2446,8 @@ func validateActivityScheduleAttributes(attributes *workflow.ScheduleActivityTas return &workflow.BadRequestError{Message: "ActivityType is not set on decision."} } - if policy := attributes.RetryPolicy; policy != nil { - if policy.GetInitialIntervalInSeconds() <= 0 { - return &workflow.BadRequestError{Message: "A valid InitialIntervalInSeconds is not set on retry policy."} - } - if policy.GetBackoffCoefficient() < 1 { - return &workflow.BadRequestError{Message: "BackoffCoefficient cannot be less than 1 on retry policy."} - } - if policy.GetMaximumIntervalInSeconds() < policy.GetInitialIntervalInSeconds() { - return &workflow.BadRequestError{Message: "MaximumIntervalInSeconds cannot be less than InitialIntervalInSeconds on retry policy."} - } + if err := common.ValidateRetryPolicy(attributes.RetryPolicy); err != nil { + return err } // Only attempt to deduce and fill in unspecified timeouts only when all timeouts are non-negative. @@ -2591,6 +2630,10 @@ func validateStartChildExecutionAttributes(parentInfo *persistence.WorkflowExecu return &workflow.BadRequestError{Message: "Required field ChildPolicy is not set on decision."} } + if err := common.ValidateRetryPolicy(attributes.RetryPolicy); err != nil { + return err + } + // Inherit tasklist from parent workflow execution if not provided on decision if attributes.TaskList == nil || attributes.TaskList.GetName() == "" { attributes.TaskList = &workflow.TaskList{Name: common.StringPtr(parentInfo.TaskList)} @@ -2619,6 +2662,9 @@ func validateStartWorkflowExecutionRequest(request *workflow.StartWorkflowExecut if request.TaskList == nil || request.TaskList.Name == nil || request.TaskList.GetName() == "" { return &workflow.BadRequestError{Message: "Missing Tasklist."} } + if request.RetryPolicy != nil { + // verify retry policy is valid + } return nil } @@ -2632,12 +2678,16 @@ func validateDomainUUID(domainUUID *string) (string, error) { } func (e *historyEngineImpl) getActiveDomainEntry(domainUUID *string) (*cache.DomainCacheEntry, error) { + return getActiveDomainEntryFromShard(e.shard, domainUUID) +} + +func getActiveDomainEntryFromShard(shard ShardContext, domainUUID *string) (*cache.DomainCacheEntry, error) { domainID, err := validateDomainUUID(domainUUID) if err != nil { return nil, err } - domainEntry, err := e.shard.GetDomainCache().GetDomainByID(domainID) + domainEntry, err := shard.GetDomainCache().GetDomainByID(domainID) if err != nil { return nil, err } diff --git a/service/history/historyReplicator.go b/service/history/historyReplicator.go index 9cc02225bf3..c25def86662 100644 --- a/service/history/historyReplicator.go +++ b/service/history/historyReplicator.go @@ -633,40 +633,12 @@ func (r *historyReplicator) conflictResolutionTerminateContinueAsNew(msBuilder m } getPrevRunID := func(domainID string, workflowID string, runID string) (string, error) { - response, err := r.historyMgr.GetWorkflowExecutionHistory(&persistence.GetWorkflowExecutionHistoryRequest{ - DomainID: domainID, - Execution: shared.WorkflowExecution{ - WorkflowId: common.StringPtr(workflowID), - RunId: common.StringPtr(runID), - }, - FirstEventID: common.FirstEventID, - NextEventID: common.FirstEventID + 1, - PageSize: defaultHistoryPageSize, - NextPageToken: nil, - }) - if err != nil { - return "", err - } - if len(response.Events) == 0 { - return "", fmt.Errorf("no history found for domainID: %v, workflowID: %v, runID: %v", - domainID, workflowID, runID) - } - serializedHistoryEventBatch := response.Events[0] - persistence.SetSerializedHistoryDefaults(&serializedHistoryEventBatch) - serializer, err := persistence.NewHistorySerializerFactory().Get(serializedHistoryEventBatch.EncodingType) - if err != nil { - return "", err - } - history, err := serializer.Deserialize(&serializedHistoryEventBatch) + startEvent, err := getWorkflowStartedEvent(r.historyMgr, domainID, workflowID, runID) if err != nil { return "", err } - if len(history.Events) == 0 { - return "", fmt.Errorf("no history events found for domainID: %v, workflowID: %v, runID: %v", - domainID, workflowID, runID) - } - return history.Events[0].WorkflowExecutionStartedEventAttributes.GetContinuedExecutionRunId(), nil + return startEvent.WorkflowExecutionStartedEventAttributes.GetContinuedExecutionRunId(), nil } targetRunID := msBuilder.GetExecutionInfo().RunID @@ -695,6 +667,41 @@ func (r *historyReplicator) conflictResolutionTerminateContinueAsNew(msBuilder m return r.terminateWorkflow(domainID, workflowID, currentRunID) } +func getWorkflowStartedEvent(historyMgr persistence.HistoryManager, domainID, workflowID, runID string) (*shared.HistoryEvent, error) { + response, err := historyMgr.GetWorkflowExecutionHistory(&persistence.GetWorkflowExecutionHistoryRequest{ + DomainID: domainID, + Execution: shared.WorkflowExecution{ + WorkflowId: common.StringPtr(workflowID), + RunId: common.StringPtr(runID), + }, + FirstEventID: common.FirstEventID, + NextEventID: common.FirstEventID + 1, + PageSize: defaultHistoryPageSize, + NextPageToken: nil, + }) + if err != nil { + return nil, err + } + if len(response.Events) == 0 { + return nil, fmt.Errorf("no history found for domainID: %v, workflowID: %v, runID: %v", domainID, workflowID, runID) + } + serializedHistoryEventBatch := response.Events[0] + persistence.SetSerializedHistoryDefaults(&serializedHistoryEventBatch) + serializer, err := persistence.NewHistorySerializerFactory().Get(serializedHistoryEventBatch.EncodingType) + if err != nil { + return nil, err + } + history, err := serializer.Deserialize(&serializedHistoryEventBatch) + if err != nil { + return nil, err + } + if len(history.Events) == 0 { + return nil, fmt.Errorf("no history events found for domainID: %v, workflowID: %v, runID: %v", domainID, workflowID, runID) + } + + return history.Events[0], nil +} + func (r *historyReplicator) Serialize(history *shared.History) (*persistence.SerializedHistoryEventBatch, error) { eventBatch := persistence.NewHistoryEventBatch(persistence.GetDefaultHistoryVersion(), history.Events) h, err := r.historySerializer.Serialize(eventBatch) diff --git a/service/history/mutableStateBuilder.go b/service/history/mutableStateBuilder.go index 7eb15b0085c..ed7fbf369f6 100644 --- a/service/history/mutableStateBuilder.go +++ b/service/history/mutableStateBuilder.go @@ -57,7 +57,7 @@ type ( AddChildWorkflowExecutionTerminatedEvent(int64, *workflow.WorkflowExecution, *workflow.WorkflowExecutionTerminatedEventAttributes) *workflow.HistoryEvent AddChildWorkflowExecutionTimedOutEvent(int64, *workflow.WorkflowExecution, *workflow.WorkflowExecutionTimedOutEventAttributes) *workflow.HistoryEvent AddCompletedWorkflowEvent(int64, *workflow.CompleteWorkflowExecutionDecisionAttributes) *workflow.HistoryEvent - AddContinueAsNewEvent(int64, *cache.DomainCacheEntry, string, string, *workflow.ContinueAsNewWorkflowExecutionDecisionAttributes) (*workflow.HistoryEvent, mutableState, error) + AddContinueAsNewEvent(int64, *cache.DomainCacheEntry, string, *workflow.ContinueAsNewWorkflowExecutionDecisionAttributes) (*workflow.HistoryEvent, mutableState, error) AddDecisionTaskCompletedEvent(int64, int64, *workflow.RespondDecisionTaskCompletedRequest) *workflow.HistoryEvent AddDecisionTaskFailedEvent(int64, int64, workflow.DecisionTaskFailedCause, []uint8, string) *workflow.HistoryEvent AddDecisionTaskScheduleToStartTimeoutEvent(int64) *workflow.HistoryEvent @@ -132,6 +132,7 @@ type ( GetPendingChildExecutionInfos() map[int64]*persistence.ChildExecutionInfo GetReplicationState() *persistence.ReplicationState GetRequestCancelInfo(int64) (*persistence.RequestCancelInfo, bool) + GetRetryBackoffDuration(errReason string) time.Duration GetScheduleIDByActivityID(string) (int64, bool) GetSignalInfo(int64) (*persistence.SignalInfo, bool) GetStartVersion() int64 @@ -179,7 +180,7 @@ type ( ReplicateWorkflowExecutionCancelRequestedEvent(*workflow.HistoryEvent) ReplicateWorkflowExecutionCanceledEvent(*workflow.HistoryEvent) ReplicateWorkflowExecutionCompletedEvent(*workflow.HistoryEvent) - ReplicateWorkflowExecutionContinuedAsNewEvent(string, string, *workflow.HistoryEvent, *workflow.HistoryEvent, *decisionInfo, mutableState) + ReplicateWorkflowExecutionContinuedAsNewEvent(string, string, *workflow.HistoryEvent, *workflow.HistoryEvent, mutableState) error ReplicateWorkflowExecutionFailedEvent(*workflow.HistoryEvent) ReplicateWorkflowExecutionStartedEvent(string, *string, workflow.WorkflowExecution, string, *workflow.WorkflowExecutionStartedEventAttributes) ReplicateWorkflowExecutionTerminatedEvent(*workflow.HistoryEvent) @@ -995,6 +996,15 @@ func (e *mutableStateBuilder) GetRequestCancelInfo(initiatedEventID int64) (*per return ri, ok } +func (e *mutableStateBuilder) GetRetryBackoffDuration(errReason string) time.Duration { + info := e.executionInfo + if !info.HasRetryPolicy { + return common.NoRetryBackoff + } + + return getBackoffInterval(info.Attempt, info.MaximumAttempts, info.InitialInterval, info.MaximumInterval, info.BackoffCoefficient, time.Now(), info.ExpirationTime, errReason, info.NonRetriableErrors) +} + // GetSignalInfo get details about a signal request that is currently in progress. func (e *mutableStateBuilder) GetSignalInfo(initiatedEventID int64) (*persistence.SignalInfo, bool) { ri, ok := e.pendingSignalInfoIDs[initiatedEventID] @@ -1306,8 +1316,8 @@ func (e *mutableStateBuilder) AddWorkflowExecutionStartedEventForContinueAsNew(d WorkflowType: wType, TaskStartToCloseTimeoutSeconds: common.Int32Ptr(decisionTimeout), ExecutionStartToCloseTimeoutSeconds: attributes.ExecutionStartToCloseTimeoutSeconds, - Input: attributes.Input, - Identity: nil, + Input: attributes.Input, + RetryPolicy: attributes.RetryPolicy, } req := &h.StartWorkflowExecutionRequest{ @@ -1315,6 +1325,13 @@ func (e *mutableStateBuilder) AddWorkflowExecutionStartedEventForContinueAsNew(d StartRequest: createRequest, ParentExecutionInfo: parentExecutionInfo, } + if attributes.GetBackoffStartIntervalInSeconds() > 0 { + req.Attempt = common.Int32Ptr(previousExecutionState.GetExecutionInfo().Attempt + 1) + expirationTime := previousExecutionState.GetExecutionInfo().ExpirationTime + if !expirationTime.IsZero() { + req.ExpirationTimestamp = common.Int64Ptr(expirationTime.UnixNano()) + } + } // History event only has domainName so domainID has to be passed in explicitly to update the mutable state var parentDomainID *string @@ -2235,7 +2252,7 @@ func (e *mutableStateBuilder) AddWorkflowExecutionSignaled( return e.hBuilder.AddWorkflowExecutionSignaledEvent(request) } -func (e *mutableStateBuilder) AddContinueAsNewEvent(decisionCompletedEventID int64, domainEntry *cache.DomainCacheEntry, newRunID string, +func (e *mutableStateBuilder) AddContinueAsNewEvent(decisionCompletedEventID int64, domainEntry *cache.DomainCacheEntry, parentDomainName string, attributes *workflow.ContinueAsNewWorkflowExecutionDecisionAttributes) (*workflow.HistoryEvent, mutableState, error) { if e.hasPendingTasks() || e.HasPendingDecisionTask() { @@ -2244,6 +2261,7 @@ func (e *mutableStateBuilder) AddContinueAsNewEvent(decisionCompletedEventID int e.HasPendingDecisionTask())) } + newRunID := uuid.New() newExecution := workflow.WorkflowExecution{ WorkflowId: common.StringPtr(e.executionInfo.WorkflowID), RunId: common.StringPtr(newRunID), @@ -2278,22 +2296,29 @@ func (e *mutableStateBuilder) AddContinueAsNewEvent(decisionCompletedEventID int if startedEvent == nil { return nil, nil, &workflow.InternalServiceError{Message: "Failed to add workflow execution started event."} } - di := newStateBuilder.AddDecisionTaskScheduledEvent() - if di == nil { - return nil, nil, &workflow.InternalServiceError{Message: "Failed to add decision started event."} - } - e.ReplicateWorkflowExecutionContinuedAsNewEvent("", domainID, continueAsNewEvent, startedEvent, di, newStateBuilder) + if err := e.ReplicateWorkflowExecutionContinuedAsNewEvent("", domainID, continueAsNewEvent, startedEvent, newStateBuilder); err != nil { + return nil, nil, err + } return continueAsNewEvent, newStateBuilder, nil } func (e *mutableStateBuilder) ReplicateWorkflowExecutionContinuedAsNewEvent(sourceClusterName string, domainID string, - continueAsNewEvent *workflow.HistoryEvent, startedEvent *workflow.HistoryEvent, di *decisionInfo, - newStateBuilder mutableState) { + continueAsNewEvent *workflow.HistoryEvent, startedEvent *workflow.HistoryEvent, + newStateBuilder mutableState) error { continueAsNewAttributes := continueAsNewEvent.WorkflowExecutionContinuedAsNewEventAttributes startedAttributes := startedEvent.WorkflowExecutionStartedEventAttributes + var di *decisionInfo + // First decision for retry will be created by a backoff timer + if continueAsNewAttributes.GetBackoffStartIntervalInSeconds() == 0 { + di = newStateBuilder.AddDecisionTaskScheduledEvent() + if di == nil { + return &workflow.InternalServiceError{Message: "Failed to add decision started event."} + } + } + newRunID := continueAsNewAttributes.GetNewExecutionRunId() prevRunID := startedAttributes.GetContinuedExecutionRunId() newExecution := workflow.WorkflowExecution{ @@ -2318,42 +2343,75 @@ func (e *mutableStateBuilder) ReplicateWorkflowExecutionContinuedAsNewEvent(sour initiatedID = newExecutionInfo.InitiatedID } - if newStateBuilder.GetReplicationState() != nil { - newStateBuilder.UpdateReplicationStateLastEventID(sourceClusterName, startedEvent.GetVersion(), di.ScheduleID) - } - - newTransferTasks := []persistence.Task{&persistence.DecisionTask{ - DomainID: domainID, - TaskList: newExecutionInfo.TaskList, - ScheduleID: di.ScheduleID, - }} - setTaskVersion(newStateBuilder.GetCurrentVersion(), newTransferTasks, nil) - - e.continueAsNew = &persistence.CreateWorkflowExecutionRequest{ + continueAsNew := &persistence.CreateWorkflowExecutionRequest{ // NOTE: there is no replication task for the start / decision scheduled event, // the above 2 events will be replicated along with previous continue as new event. - RequestID: uuid.New(), - DomainID: domainID, - Execution: newExecution, - ParentDomainID: parentDomainID, - ParentExecution: parentExecution, - InitiatedID: initiatedID, - TaskList: newExecutionInfo.TaskList, - WorkflowTypeName: newExecutionInfo.WorkflowTypeName, - WorkflowTimeout: newExecutionInfo.WorkflowTimeout, - DecisionTimeoutValue: newExecutionInfo.DecisionTimeoutValue, - ExecutionContext: nil, - NextEventID: newStateBuilder.GetNextEventID(), - LastProcessedEvent: common.EmptyEventID, - TransferTasks: newTransferTasks, - DecisionVersion: di.Version, - DecisionScheduleID: di.ScheduleID, - DecisionStartedID: di.StartedID, - DecisionStartToCloseTimeout: di.DecisionTimeout, - ContinueAsNew: true, - PreviousRunID: prevRunID, - ReplicationState: newStateBuilder.GetReplicationState(), + RequestID: uuid.New(), + DomainID: domainID, + Execution: newExecution, + ParentDomainID: parentDomainID, + ParentExecution: parentExecution, + InitiatedID: initiatedID, + TaskList: newExecutionInfo.TaskList, + WorkflowTypeName: newExecutionInfo.WorkflowTypeName, + WorkflowTimeout: newExecutionInfo.WorkflowTimeout, + DecisionTimeoutValue: newExecutionInfo.DecisionTimeoutValue, + ExecutionContext: nil, + NextEventID: newStateBuilder.GetNextEventID(), + LastProcessedEvent: common.EmptyEventID, + ContinueAsNew: true, + PreviousRunID: prevRunID, + ReplicationState: newStateBuilder.GetReplicationState(), + HasRetryPolicy: startedAttributes.RetryPolicy != nil, + Attempt: e.executionInfo.Attempt, + InitialInterval: e.executionInfo.InitialInterval, + BackoffCoefficient: e.executionInfo.BackoffCoefficient, + MaximumInterval: e.executionInfo.MaximumInterval, + ExpirationTime: e.executionInfo.ExpirationTime, + MaximumAttempts: e.executionInfo.MaximumAttempts, + NonRetriableErrors: e.executionInfo.NonRetriableErrors, + } + if continueAsNewAttributes.GetBackoffStartIntervalInSeconds() > 0 { + // this is a retry + continueAsNew.Attempt++ + } + + // timeout includes workflow_timeout + backoff_interval + timeoutInSeconds := continueAsNewAttributes.GetExecutionStartToCloseTimeoutSeconds() + continueAsNewAttributes.GetBackoffStartIntervalInSeconds() + timeoutDuration := time.Duration(timeoutInSeconds) * time.Second + continueAsNew.TimerTasks = []persistence.Task{&persistence.WorkflowTimeoutTask{ + VisibilityTimestamp: time.Now().Add(timeoutDuration), + }} + + if di != nil { + continueAsNew.DecisionVersion = di.Version + continueAsNew.DecisionScheduleID = di.ScheduleID + continueAsNew.DecisionStartedID = di.StartedID + continueAsNew.DecisionStartToCloseTimeout = di.DecisionTimeout + + if newStateBuilder.GetReplicationState() != nil { + newStateBuilder.UpdateReplicationStateLastEventID(sourceClusterName, startedEvent.GetVersion(), di.ScheduleID) + } + newTransferTasks := []persistence.Task{&persistence.DecisionTask{ + DomainID: domainID, + TaskList: newExecutionInfo.TaskList, + ScheduleID: di.ScheduleID, + }} + continueAsNew.TransferTasks = newTransferTasks + } else { + // this is for retry + continueAsNew.DecisionVersion = newStateBuilder.GetCurrentVersion() + continueAsNew.DecisionScheduleID = common.EmptyEventID + continueAsNew.DecisionStartedID = common.EmptyEventID + backoffTimer := &persistence.WorkflowRetryTimerTask{ + VisibilityTimestamp: time.Now().Add(time.Second * time.Duration(continueAsNewAttributes.GetBackoffStartIntervalInSeconds())), + } + continueAsNew.TimerTasks = append(continueAsNew.TimerTasks, backoffTimer) } + setTaskVersion(newStateBuilder.GetCurrentVersion(), continueAsNew.TransferTasks, continueAsNew.TimerTasks) + e.continueAsNew = continueAsNew + + return nil } func (e *mutableStateBuilder) AddStartChildWorkflowExecutionInitiatedEvent(decisionCompletedEventID int64, diff --git a/service/history/retry.go b/service/history/retry.go index cb1f43c7864..f76e8923d68 100644 --- a/service/history/retry.go +++ b/service/history/retry.go @@ -38,60 +38,70 @@ func prepareNextRetryWithNowTime(a *persistence.ActivityInfo, errReason string, return nil } - if a.MaximumAttempts == 0 && a.ExpirationTime.IsZero() { - // Invalid retry policy, Decider worker should reject this. + backoffInterval := getBackoffInterval(a.Attempt, a.MaximumAttempts, a.InitialInterval, a.MaximumInterval, a.BackoffCoefficient, now, a.ExpirationTime, errReason, a.NonRetriableErrors) + if backoffInterval == common.NoRetryBackoff { return nil } + nextScheduleTime := now.Add(backoffInterval) - if a.MaximumAttempts > 0 && a.Attempt >= a.MaximumAttempts-1 { - // Attempt starts from 0. + // a retry is needed, update activity info for next retry + a.Attempt++ + a.ScheduledTime = nextScheduleTime // update to next schedule time + a.StartedID = common.EmptyEventID + a.RequestID = "" + a.StartedTime = time.Time{} + a.LastHeartBeatUpdatedTime = time.Time{} + // clear timer created bits except for ScheduleToClose + a.TimerTaskStatus = TimerTaskStatusNone | (a.TimerTaskStatus & TimerTaskStatusCreatedScheduleToClose) + + return &persistence.RetryTimerTask{ + Version: a.Version, + VisibilityTimestamp: a.ScheduledTime, + EventID: a.ScheduleID, + Attempt: a.Attempt, + } +} + +func getBackoffInterval(currAttempt, maxAttempts, initInterval, maxInterval int32, backoffCoefficient float64, now, expirationTime time.Time, errReason string, nonRetriableErrors []string) time.Duration { + if maxAttempts == 0 && expirationTime.IsZero() { + return common.NoRetryBackoff + } + + if maxAttempts > 0 && currAttempt >= maxAttempts-1 { + // currAttempt starts from 0. // MaximumAttempts is the total attempts, including initial (non-retry) attempt. - return nil + return common.NoRetryBackoff } - nextInterval := int64(float64(a.InitialInterval) * math.Pow(a.BackoffCoefficient, float64(a.Attempt))) + nextInterval := int64(float64(initInterval) * math.Pow(backoffCoefficient, float64(currAttempt))) if nextInterval <= 0 { // math.Pow() could overflow - if a.MaximumInterval > 0 { - nextInterval = int64(a.MaximumInterval) + if maxInterval > 0 { + nextInterval = int64(maxInterval) } else { - return nil + return common.NoRetryBackoff } } - if a.MaximumInterval > 0 && nextInterval > int64(a.MaximumInterval) { + if maxInterval > 0 && nextInterval > int64(maxInterval) { // cap next interval to MaxInterval - nextInterval = int64(a.MaximumInterval) + nextInterval = int64(maxInterval) } - nextScheduleTime := now.Add(time.Duration(nextInterval) * time.Second) - if !a.ExpirationTime.IsZero() && nextScheduleTime.After(a.ExpirationTime) { - return nil + backoffInterval := time.Duration(nextInterval) * time.Second + nextScheduleTime := now.Add(backoffInterval) + if !expirationTime.IsZero() && nextScheduleTime.After(expirationTime) { + return common.NoRetryBackoff } // check if error is non-retriable - for _, er := range a.NonRetriableErrors { + for _, er := range nonRetriableErrors { if er == errReason { - return nil + return common.NoRetryBackoff } } - // a retry is needed, update activity info for next retry - a.Attempt++ - a.ScheduledTime = nextScheduleTime // update to next schedule time - a.StartedID = common.EmptyEventID - a.RequestID = "" - a.StartedTime = time.Time{} - a.LastHeartBeatUpdatedTime = time.Time{} - // clear timer created bits except for ScheduleToClose - a.TimerTaskStatus = TimerTaskStatusNone | (a.TimerTaskStatus & TimerTaskStatusCreatedScheduleToClose) - - return &persistence.RetryTimerTask{ - Version: a.Version, - VisibilityTimestamp: a.ScheduledTime, - EventID: a.ScheduleID, - Attempt: a.Attempt, - } + return backoffInterval } func getTimeoutErrorReason(timeoutType shared.TimeoutType) string { diff --git a/service/history/stateBuilder.go b/service/history/stateBuilder.go index af360e7d730..4be2e42eb4a 100644 --- a/service/history/stateBuilder.go +++ b/service/history/stateBuilder.go @@ -332,7 +332,6 @@ func (b *stateBuilderImpl) applyEvents(domainID, requestID string, execution sha // ContinuedAsNew event also has history for first 2 events for next run as they are created transactionally startedEvent := newRunHistory.Events[0] startedAttributes := startedEvent.WorkflowExecutionStartedEventAttributes - dtScheduledEvent := newRunHistory.Events[1] // History event only have the parentDomainName. Lookup the domain ID from cache var parentDomainID *string @@ -350,19 +349,23 @@ func (b *stateBuilderImpl) applyEvents(domainID, requestID string, execution sha WorkflowId: execution.WorkflowId, RunId: common.StringPtr(newRunID), } - // Create mutable state updates for the new run newRunStateBuilder = newMutableStateBuilderWithReplicationState(b.shard.GetConfig(), b.logger, startedEvent.GetVersion()) newRunStateBuilder.ReplicateWorkflowExecutionStartedEvent(domainID, parentDomainID, newExecution, uuid.New(), startedAttributes) - di := newRunStateBuilder.ReplicateDecisionTaskScheduledEvent( - dtScheduledEvent.GetVersion(), - dtScheduledEvent.GetEventId(), - dtScheduledEvent.DecisionTaskScheduledEventAttributes.TaskList.GetName(), - dtScheduledEvent.DecisionTaskScheduledEventAttributes.GetStartToCloseTimeoutSeconds(), - ) + + nextEventID := startedEvent.GetEventId() + 1 + if startedAttributes.GetAttempt() == 0 { + dtScheduledEvent := newRunHistory.Events[1] + di := newRunStateBuilder.ReplicateDecisionTaskScheduledEvent( + dtScheduledEvent.GetVersion(), + dtScheduledEvent.GetEventId(), + dtScheduledEvent.DecisionTaskScheduledEventAttributes.TaskList.GetName(), + dtScheduledEvent.DecisionTaskScheduledEventAttributes.GetStartToCloseTimeoutSeconds(), + ) + nextEventID = di.ScheduleID + 1 + } newRunExecutionInfo := newRunStateBuilder.GetExecutionInfo() - nextEventID := di.ScheduleID + 1 newRunExecutionInfo.NextEventID = nextEventID newRunExecutionInfo.LastFirstEventID = startedEvent.GetEventId() // Set the history from replication task on the newStateBuilder @@ -370,19 +373,19 @@ func (b *stateBuilderImpl) applyEvents(domainID, requestID string, execution sha sourceClusterName := b.clusterMetadata.ClusterNameForFailoverVersion(startedEvent.GetVersion()) newRunStateBuilder.UpdateReplicationStateLastEventID(sourceClusterName, startedEvent.GetVersion(), nextEventID-1) - b.newRunTransferTasks = append(b.newRunTransferTasks, b.scheduleDecisionTransferTask(domainID, - b.getTaskList(newRunStateBuilder), di.ScheduleID)) + if startedAttributes.GetAttempt() == 0 { + b.newRunTransferTasks = append(b.newRunTransferTasks, b.scheduleDecisionTransferTask(domainID, + b.getTaskList(newRunStateBuilder), nextEventID-1)) + } b.newRunTimerTasks = append(b.newRunTimerTasks, b.scheduleWorkflowTimerTask(event, newRunStateBuilder)) - b.msBuilder.ReplicateWorkflowExecutionContinuedAsNewEvent(sourceClusterName, domainID, event, - startedEvent, di, newRunStateBuilder) + b.msBuilder.ReplicateWorkflowExecutionContinuedAsNewEvent(sourceClusterName, domainID, event, startedEvent, newRunStateBuilder) b.transferTasks = append(b.transferTasks, b.scheduleDeleteHistoryTransferTask()) timerTask, err := b.scheduleDeleteHistoryTimerTask(event, domainID) if err != nil { return nil, nil, nil, err } b.timerTasks = append(b.timerTasks, timerTask) - } } diff --git a/service/history/stateBuilder_test.go b/service/history/stateBuilder_test.go index 8f21ffb8ab8..5d23289fc24 100644 --- a/service/history/stateBuilder_test.go +++ b/service/history/stateBuilder_test.go @@ -464,17 +464,8 @@ func (s *stateBuilderSuite) TestApplyEvents_EventTypeWorkflowExecutionContinuedA domainID, continueAsNewEvent, newRunStartedEvent, - &decisionInfo{ - Version: newRunDecisionEvent.GetVersion(), - ScheduleID: newRunDecisionEvent.GetEventId(), - StartedID: common.EmptyEventID, - RequestID: emptyUUID, - DecisionTimeout: decisionTimeoutSecond, - TaskList: tasklist, - Attempt: 0, - }, mock.Anything, - ).Once() + ).Return(nil).Once() s.mockUpdateVersion(continueAsNewEvent) newRunHistory := &shared.History{Events: []*shared.HistoryEvent{newRunStartedEvent, newRunDecisionEvent}} diff --git a/service/history/timerQueueActiveProcessor.go b/service/history/timerQueueActiveProcessor.go index 00bdc0a2ac7..f013fc37ca4 100644 --- a/service/history/timerQueueActiveProcessor.go +++ b/service/history/timerQueueActiveProcessor.go @@ -172,6 +172,10 @@ func (t *timerQueueActiveProcessorImpl) process(timerTask *persistence.TimerTask scope = metrics.TimerTaskRetryTimerScope err = t.processRetryTimer(timerTask) + case persistence.TaskTypeWorkflowRetryTimer: + scope = metrics.TimerTaskWorkflowRetryTimerScope + err = t.processWorkflowRetryTimer(timerTask) + case persistence.TaskTypeDeleteHistoryEvent: scope = metrics.TimerTaskDeleteHistoryEvent err = t.timerQueueProcessorBase.processDeleteHistoryEvent(timerTask) @@ -499,6 +503,44 @@ Update_History_Loop: return ErrMaxAttemptsExceeded } +func (t *timerQueueActiveProcessorImpl) processWorkflowRetryTimer(task *persistence.TimerTaskInfo) (retError error) { + t.metricsClient.IncCounter(metrics.TimerTaskWorkflowRetryTimerScope, metrics.TaskRequests) + sw := t.metricsClient.StartTimer(metrics.TimerTaskWorkflowRetryTimerScope, metrics.TaskLatency) + defer sw.Stop() + + context, release, err0 := t.cache.getOrCreateWorkflowExecution(t.timerQueueProcessorBase.getDomainIDAndWorkflowExecution(task)) + if err0 != nil { + return err0 + } + defer func() { release(retError) }() + +Update_History_Loop: + for attempt := 0; attempt < conditionalRetryCount; attempt++ { + msBuilder, err := loadMutableStateForTimerTask(context, task, t.metricsClient, t.logger) + if err != nil { + return err + } else if msBuilder == nil || !msBuilder.IsWorkflowExecutionRunning() { + return nil + } + + if msBuilder.HasPendingDecisionTask() { + // already has decision task + return nil + } + + // schedule first decision task + err = t.updateWorkflowExecution(context, msBuilder, true, false, nil, nil) + if err != nil { + if err == ErrConflict { + continue Update_History_Loop + } + } + return err + } + + return ErrMaxAttemptsExceeded +} + func (t *timerQueueActiveProcessorImpl) processRetryTimer(task *persistence.TimerTaskInfo) error { t.metricsClient.IncCounter(metrics.TimerTaskRetryTimerScope, metrics.TaskRequests) sw := t.metricsClient.StartTimer(metrics.TimerTaskRetryTimerScope, metrics.TaskLatency) @@ -579,7 +621,8 @@ func (t *timerQueueActiveProcessorImpl) processWorkflowTimeout(task *persistence sw := t.metricsClient.StartTimer(metrics.TimerTaskWorkflowTimeoutScope, metrics.TaskLatency) defer sw.Stop() - context, release, err0 := t.cache.getOrCreateWorkflowExecution(t.timerQueueProcessorBase.getDomainIDAndWorkflowExecution(task)) + domainID, workflowExecution := t.timerQueueProcessorBase.getDomainIDAndWorkflowExecution(task) + context, release, err0 := t.cache.getOrCreateWorkflowExecution(domainID, workflowExecution) if err0 != nil { return err0 } @@ -604,15 +647,70 @@ Update_History_Loop: } } - if e := msBuilder.AddTimeoutWorkflowEvent(); e == nil { - // If we failed to add the event that means the workflow is already completed. - // we drop this timeout event. - return nil + retryBackoffInterval := msBuilder.GetRetryBackoffDuration(getTimeoutErrorReason(workflow.TimeoutTypeStartToClose)) + if retryBackoffInterval == common.NoRetryBackoff { + if e := msBuilder.AddTimeoutWorkflowEvent(); e == nil { + // If we failed to add the event that means the workflow is already completed. + // we drop this timeout event. + return nil + } + + // We apply the update to execution using optimistic concurrency. If it fails due to a conflict than reload + // the history and try the operation again. + err = t.updateWorkflowExecution(context, msBuilder, false, true, nil, nil) + if err != nil { + if err == ErrConflict { + continue Update_History_Loop + } + } + return err + } + + // workflow timeout, but a retry is needed, so we do continue as new to retry + startEvent, err := getWorkflowStartedEvent(t.historyService.historyMgr, domainID, workflowExecution.GetWorkflowId(), workflowExecution.GetRunId()) + if err != nil { + return err + } + + startAttributes := startEvent.WorkflowExecutionStartedEventAttributes + continueAsnewAttributes := &workflow.ContinueAsNewWorkflowExecutionDecisionAttributes{ + WorkflowType: startAttributes.WorkflowType, + TaskList: startAttributes.TaskList, + RetryPolicy: startAttributes.RetryPolicy, + Input: startAttributes.Input, + ExecutionStartToCloseTimeoutSeconds: startAttributes.ExecutionStartToCloseTimeoutSeconds, + TaskStartToCloseTimeoutSeconds: startAttributes.TaskStartToCloseTimeoutSeconds, + BackoffStartIntervalInSeconds: common.Int32Ptr(int32(retryBackoffInterval.Seconds())), + } + domainEntry, err := getActiveDomainEntryFromShard(t.shard, &domainID) + if err != nil { + return err + } + _, continueAsNewBuilder, err := msBuilder.AddContinueAsNewEvent(common.EmptyEventID, domainEntry, startAttributes.GetParentWorkflowDomain(), continueAsnewAttributes) + if err != nil { + return err + } + + tBuilder := t.historyService.getTimerBuilder(&context.workflowExecution) + var transferTasks, timerTasks []persistence.Task + tranT, timerT, err := getDeleteWorkflowTasksFromShard(t.shard, domainID, tBuilder) + if err != nil { + return err + } + transferTasks = append(transferTasks, tranT) + timerTasks = append(timerTasks, timerT) + + // Generate a transaction ID for appending events to history + transactionID, err3 := t.shard.GetNextTransferTaskID() + if err3 != nil { + return err3 + } + + err = context.continueAsNewWorkflowExecution(nil, continueAsNewBuilder, transferTasks, timerTasks, transactionID) + if msBuilder.GetContinueAsNew() != nil { + t.notifyNewTimers(msBuilder.GetContinueAsNew().TimerTasks) } - // We apply the update to execution using optimistic concurrency. If it fails due to a conflict than reload - // the history and try the operation again. - err = t.updateWorkflowExecution(context, msBuilder, false, true, nil, nil) if err != nil { if err == ErrConflict { continue Update_History_Loop diff --git a/service/history/timerQueueProcessorBase.go b/service/history/timerQueueProcessorBase.go index a4df5036036..07f4de857cf 100644 --- a/service/history/timerQueueProcessorBase.go +++ b/service/history/timerQueueProcessorBase.go @@ -244,6 +244,8 @@ func (t *timerQueueProcessorBase) notifyNewTimers(timerTasks []persistence.Task, t.metricsClient.IncCounter(metrics.TimerTaskDeleteHistoryEvent, counterType) case persistence.TaskTypeRetryTimer: t.metricsClient.IncCounter(metrics.TimerTaskRetryTimerScope, counterType) + case persistence.TaskTypeWorkflowRetryTimer: + t.metricsClient.IncCounter(metrics.TimerTaskWorkflowRetryTimerScope, counterType) // TODO add default } } @@ -448,6 +450,8 @@ func (t *timerQueueProcessorBase) getTimerTaskType(taskType int) string { return "DeleteHistoryEvent" case persistence.TaskTypeRetryTimer: return "RetryTimerTask" + case persistence.TaskTypeWorkflowRetryTimer: + return "WorkflowRetryTimerTask" } return "UnKnown" } diff --git a/service/history/timerQueueStandbyProcessor.go b/service/history/timerQueueStandbyProcessor.go index 91dff32bfde..a0d67a8c486 100644 --- a/service/history/timerQueueStandbyProcessor.go +++ b/service/history/timerQueueStandbyProcessor.go @@ -145,6 +145,10 @@ func (t *timerQueueStandbyProcessorImpl) process(timerTask *persistence.TimerTas scope = metrics.TimerTaskRetryTimerScope err = nil // retry backoff timer should not get created on passive cluster + case persistence.TaskTypeWorkflowRetryTimer: + scope = metrics.TimerTaskWorkflowRetryTimerScope + err = nil // retry backoff timer should not get created on passive cluster + case persistence.TaskTypeDeleteHistoryEvent: scope = metrics.TimerTaskDeleteHistoryEvent err = t.timerQueueProcessorBase.processDeleteHistoryEvent(timerTask) diff --git a/service/history/transferQueueActiveProcessor.go b/service/history/transferQueueActiveProcessor.go index ea17c49c6fa..7cc9cc38186 100644 --- a/service/history/transferQueueActiveProcessor.go +++ b/service/history/transferQueueActiveProcessor.go @@ -814,6 +814,7 @@ func (t *transferQueueActiveProcessorImpl) processStartChildExecution(task *pers RequestId: common.StringPtr(ci.CreateRequestID), WorkflowIdReusePolicy: attributes.WorkflowIdReusePolicy, ChildPolicy: attributes.ChildPolicy, + RetryPolicy: attributes.RetryPolicy, }, ParentExecutionInfo: &h.ParentExecutionInfo{ DomainUUID: common.StringPtr(domainID),