diff --git a/.gen/go/history/idl.go b/.gen/go/history/idl.go index 0edd88aa411..922a0ed765c 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: "21e8379b03ed334c2e59c42c59b4973465c4b7bd", + SHA1: "da42d1197861f144e24078457e46e75123b9033b", 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 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 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}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\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 10: optional shared.HistoryEvent startedEvent\n 20: optional shared.HistoryEvent scheduledEvent\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}\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}\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\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 )\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 )\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 )\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 )\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 void 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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 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 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}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\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 10: optional shared.HistoryEvent startedEvent\n 20: optional shared.HistoryEvent scheduledEvent\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 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\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 )\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 )\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 )\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 )\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 void 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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\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 )\n\n}\n" diff --git a/.gen/go/history/types.go b/.gen/go/history/types.go index 174064b2125..036188c963e 100644 --- a/.gen/go/history/types.go +++ b/.gen/go/history/types.go @@ -2675,6 +2675,7 @@ type RequestCancelWorkflowExecutionRequest struct { CancelRequest *shared.RequestCancelWorkflowExecutionRequest `json:"cancelRequest,omitempty"` ExternalInitiatedEventId *int64 `json:"externalInitiatedEventId,omitempty"` ExternalWorkflowExecution *shared.WorkflowExecution `json:"externalWorkflowExecution,omitempty"` + ChildWorkflowOnly *bool `json:"childWorkflowOnly,omitempty"` } // ToWire translates a RequestCancelWorkflowExecutionRequest struct into a Thrift-level intermediate @@ -2694,7 +2695,7 @@ type RequestCancelWorkflowExecutionRequest struct { // } func (v *RequestCancelWorkflowExecutionRequest) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [5]wire.Field i int = 0 w wire.Value err error @@ -2732,6 +2733,14 @@ func (v *RequestCancelWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 40, Value: w} i++ } + if v.ChildWorkflowOnly != nil { + w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), 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 } @@ -2799,6 +2808,16 @@ func (v *RequestCancelWorkflowExecutionRequest) FromWire(w wire.Value) error { return err } + } + case 50: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.ChildWorkflowOnly = &x + if err != nil { + return err + } + } } } @@ -2813,7 +2832,7 @@ func (v *RequestCancelWorkflowExecutionRequest) String() string { return "" } - var fields [4]string + var fields [5]string i := 0 if v.DomainUUID != nil { fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID)) @@ -2831,6 +2850,10 @@ func (v *RequestCancelWorkflowExecutionRequest) String() string { fields[i] = fmt.Sprintf("ExternalWorkflowExecution: %v", v.ExternalWorkflowExecution) i++ } + if v.ChildWorkflowOnly != nil { + fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly)) + i++ + } return fmt.Sprintf("RequestCancelWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -2852,6 +2875,9 @@ func (v *RequestCancelWorkflowExecutionRequest) Equals(rhs *RequestCancelWorkflo if !((v.ExternalWorkflowExecution == nil && rhs.ExternalWorkflowExecution == nil) || (v.ExternalWorkflowExecution != nil && rhs.ExternalWorkflowExecution != nil && v.ExternalWorkflowExecution.Equals(rhs.ExternalWorkflowExecution))) { return false } + if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) { + return false + } return true } @@ -2876,6 +2902,16 @@ func (v *RequestCancelWorkflowExecutionRequest) GetExternalInitiatedEventId() (o return } +// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its +// zero value if it is unset. +func (v *RequestCancelWorkflowExecutionRequest) GetChildWorkflowOnly() (o bool) { + if v.ChildWorkflowOnly != nil { + return *v.ChildWorkflowOnly + } + + return +} + type RespondActivityTaskCanceledRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` CancelRequest *shared.RespondActivityTaskCanceledRequest `json:"cancelRequest,omitempty"` @@ -3903,8 +3939,10 @@ func (v *ShardOwnershipLostError) Error() string { } type SignalWorkflowExecutionRequest struct { - DomainUUID *string `json:"domainUUID,omitempty"` - SignalRequest *shared.SignalWorkflowExecutionRequest `json:"signalRequest,omitempty"` + DomainUUID *string `json:"domainUUID,omitempty"` + SignalRequest *shared.SignalWorkflowExecutionRequest `json:"signalRequest,omitempty"` + ExternalWorkflowExecution *shared.WorkflowExecution `json:"externalWorkflowExecution,omitempty"` + ChildWorkflowOnly *bool `json:"childWorkflowOnly,omitempty"` } // ToWire translates a SignalWorkflowExecutionRequest struct into a Thrift-level intermediate @@ -3924,7 +3962,7 @@ type SignalWorkflowExecutionRequest struct { // } func (v *SignalWorkflowExecutionRequest) ToWire() (wire.Value, error) { var ( - fields [2]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error @@ -3946,6 +3984,22 @@ func (v *SignalWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 20, Value: w} i++ } + if v.ExternalWorkflowExecution != nil { + w, err = v.ExternalWorkflowExecution.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 30, Value: w} + i++ + } + if v.ChildWorkflowOnly != nil { + w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -3995,6 +4049,24 @@ func (v *SignalWorkflowExecutionRequest) FromWire(w wire.Value) error { return err } + } + case 30: + if field.Value.Type() == wire.TStruct { + v.ExternalWorkflowExecution, err = _WorkflowExecution_Read(field.Value) + if err != nil { + return err + } + + } + case 40: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.ChildWorkflowOnly = &x + if err != nil { + return err + } + } } } @@ -4009,7 +4081,7 @@ func (v *SignalWorkflowExecutionRequest) String() string { return "" } - var fields [2]string + var fields [4]string i := 0 if v.DomainUUID != nil { fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID)) @@ -4019,6 +4091,14 @@ func (v *SignalWorkflowExecutionRequest) String() string { fields[i] = fmt.Sprintf("SignalRequest: %v", v.SignalRequest) i++ } + if v.ExternalWorkflowExecution != nil { + fields[i] = fmt.Sprintf("ExternalWorkflowExecution: %v", v.ExternalWorkflowExecution) + i++ + } + if v.ChildWorkflowOnly != nil { + fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly)) + i++ + } return fmt.Sprintf("SignalWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -4034,6 +4114,12 @@ func (v *SignalWorkflowExecutionRequest) Equals(rhs *SignalWorkflowExecutionRequ if !((v.SignalRequest == nil && rhs.SignalRequest == nil) || (v.SignalRequest != nil && rhs.SignalRequest != nil && v.SignalRequest.Equals(rhs.SignalRequest))) { return false } + if !((v.ExternalWorkflowExecution == nil && rhs.ExternalWorkflowExecution == nil) || (v.ExternalWorkflowExecution != nil && rhs.ExternalWorkflowExecution != nil && v.ExternalWorkflowExecution.Equals(rhs.ExternalWorkflowExecution))) { + return false + } + if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) { + return false + } return true } @@ -4048,6 +4134,16 @@ func (v *SignalWorkflowExecutionRequest) GetDomainUUID() (o string) { return } +// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its +// zero value if it is unset. +func (v *SignalWorkflowExecutionRequest) GetChildWorkflowOnly() (o bool) { + if v.ChildWorkflowOnly != nil { + return *v.ChildWorkflowOnly + } + + return +} + type StartWorkflowExecutionRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` StartRequest *shared.StartWorkflowExecutionRequest `json:"startRequest,omitempty"` diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index 9e9581cd763..e08fe9067b0 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -35,3 +35,4 @@ var ThriftModule = &thriftreflect.ThriftModule{ } 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\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\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 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}\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}\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}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\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 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\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}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\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}\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}\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}\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 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}\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}\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}\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}\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}\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}\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}\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}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: 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 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 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\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" + diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 3a291c70f7a..f2bf69546e0 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -16569,10 +16569,11 @@ func (v *RequestCancelActivityTaskFailedEventAttributes) GetDecisionTaskComplete } type RequestCancelExternalWorkflowExecutionDecisionAttributes struct { - Domain *string `json:"domain,omitempty"` - WorkflowId *string `json:"workflowId,omitempty"` - RunId *string `json:"runId,omitempty"` - Control []byte `json:"control,omitempty"` + Domain *string `json:"domain,omitempty"` + WorkflowId *string `json:"workflowId,omitempty"` + RunId *string `json:"runId,omitempty"` + Control []byte `json:"control,omitempty"` + ChildWorkflowOnly *bool `json:"childWorkflowOnly,omitempty"` } // ToWire translates a RequestCancelExternalWorkflowExecutionDecisionAttributes struct into a Thrift-level intermediate @@ -16592,7 +16593,7 @@ type RequestCancelExternalWorkflowExecutionDecisionAttributes struct { // } func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [5]wire.Field i int = 0 w wire.Value err error @@ -16630,6 +16631,14 @@ func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) ToWire() (wir fields[i] = wire.Field{ID: 40, Value: w} i++ } + if v.ChildWorkflowOnly != nil { + w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), 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 } @@ -16693,6 +16702,16 @@ func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) FromWire(w wi return err } + } + case 50: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.ChildWorkflowOnly = &x + if err != nil { + return err + } + } } } @@ -16707,7 +16726,7 @@ func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) String() stri return "" } - var fields [4]string + var fields [5]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -16725,6 +16744,10 @@ func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) String() stri fields[i] = fmt.Sprintf("Control: %v", v.Control) i++ } + if v.ChildWorkflowOnly != nil { + fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly)) + i++ + } return fmt.Sprintf("RequestCancelExternalWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -16746,6 +16769,9 @@ func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) Equals(rhs *R if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { return false } + if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) { + return false + } return true } @@ -16780,6 +16806,16 @@ func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) GetRunId() (o return } +// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its +// zero value if it is unset. +func (v *RequestCancelExternalWorkflowExecutionDecisionAttributes) GetChildWorkflowOnly() (o bool) { + if v.ChildWorkflowOnly != nil { + return *v.ChildWorkflowOnly + } + + return +} + type RequestCancelExternalWorkflowExecutionFailedEventAttributes struct { Cause *CancelExternalWorkflowExecutionFailedCause `json:"cause,omitempty"` DecisionTaskCompletedEventId *int64 `json:"decisionTaskCompletedEventId,omitempty"` @@ -17073,6 +17109,7 @@ type RequestCancelExternalWorkflowExecutionInitiatedEventAttributes struct { Domain *string `json:"domain,omitempty"` WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` Control []byte `json:"control,omitempty"` + ChildWorkflowOnly *bool `json:"childWorkflowOnly,omitempty"` } // ToWire translates a RequestCancelExternalWorkflowExecutionInitiatedEventAttributes struct into a Thrift-level intermediate @@ -17092,7 +17129,7 @@ type RequestCancelExternalWorkflowExecutionInitiatedEventAttributes struct { // } func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [5]wire.Field i int = 0 w wire.Value err error @@ -17130,6 +17167,14 @@ func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) ToWire( fields[i] = wire.Field{ID: 40, Value: w} i++ } + if v.ChildWorkflowOnly != nil { + w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), 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 } @@ -17191,6 +17236,16 @@ func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) FromWir return err } + } + case 50: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.ChildWorkflowOnly = &x + if err != nil { + return err + } + } } } @@ -17205,7 +17260,7 @@ func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) String( return "" } - var fields [4]string + var fields [5]string i := 0 if v.DecisionTaskCompletedEventId != nil { fields[i] = fmt.Sprintf("DecisionTaskCompletedEventId: %v", *(v.DecisionTaskCompletedEventId)) @@ -17223,6 +17278,10 @@ func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) String( fields[i] = fmt.Sprintf("Control: %v", v.Control) i++ } + if v.ChildWorkflowOnly != nil { + fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly)) + i++ + } return fmt.Sprintf("RequestCancelExternalWorkflowExecutionInitiatedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -17244,6 +17303,9 @@ func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) Equals( if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { return false } + if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) { + return false + } return true } @@ -17268,6 +17330,16 @@ func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) GetDoma return } +// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its +// zero value if it is unset. +func (v *RequestCancelExternalWorkflowExecutionInitiatedEventAttributes) GetChildWorkflowOnly() (o bool) { + if v.ChildWorkflowOnly != nil { + return *v.ChildWorkflowOnly + } + + return +} + type RequestCancelWorkflowExecutionRequest struct { Domain *string `json:"domain,omitempty"` WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` @@ -20077,11 +20149,12 @@ func (v *ServiceBusyError) Error() string { } type SignalExternalWorkflowExecutionDecisionAttributes struct { - Domain *string `json:"domain,omitempty"` - Execution *WorkflowExecution `json:"execution,omitempty"` - SignalName *string `json:"signalName,omitempty"` - Input []byte `json:"input,omitempty"` - Control []byte `json:"control,omitempty"` + Domain *string `json:"domain,omitempty"` + Execution *WorkflowExecution `json:"execution,omitempty"` + SignalName *string `json:"signalName,omitempty"` + Input []byte `json:"input,omitempty"` + Control []byte `json:"control,omitempty"` + ChildWorkflowOnly *bool `json:"childWorkflowOnly,omitempty"` } // ToWire translates a SignalExternalWorkflowExecutionDecisionAttributes struct into a Thrift-level intermediate @@ -20101,7 +20174,7 @@ type SignalExternalWorkflowExecutionDecisionAttributes struct { // } func (v *SignalExternalWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [5]wire.Field + fields [6]wire.Field i int = 0 w wire.Value err error @@ -20147,6 +20220,14 @@ func (v *SignalExternalWorkflowExecutionDecisionAttributes) ToWire() (wire.Value fields[i] = wire.Field{ID: 50, Value: w} i++ } + if v.ChildWorkflowOnly != nil { + w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), 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 } @@ -20216,6 +20297,16 @@ func (v *SignalExternalWorkflowExecutionDecisionAttributes) FromWire(w wire.Valu return err } + } + case 60: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.ChildWorkflowOnly = &x + if err != nil { + return err + } + } } } @@ -20230,7 +20321,7 @@ func (v *SignalExternalWorkflowExecutionDecisionAttributes) String() string { return "" } - var fields [5]string + var fields [6]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -20252,6 +20343,10 @@ func (v *SignalExternalWorkflowExecutionDecisionAttributes) String() string { fields[i] = fmt.Sprintf("Control: %v", v.Control) i++ } + if v.ChildWorkflowOnly != nil { + fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly)) + i++ + } return fmt.Sprintf("SignalExternalWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -20276,6 +20371,9 @@ func (v *SignalExternalWorkflowExecutionDecisionAttributes) Equals(rhs *SignalEx if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { return false } + if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) { + return false + } return true } @@ -20300,6 +20398,16 @@ func (v *SignalExternalWorkflowExecutionDecisionAttributes) GetSignalName() (o s return } +// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its +// zero value if it is unset. +func (v *SignalExternalWorkflowExecutionDecisionAttributes) GetChildWorkflowOnly() (o bool) { + if v.ChildWorkflowOnly != nil { + return *v.ChildWorkflowOnly + } + + return +} + type SignalExternalWorkflowExecutionFailedCause int32 const ( @@ -20716,6 +20824,7 @@ type SignalExternalWorkflowExecutionInitiatedEventAttributes struct { SignalName *string `json:"signalName,omitempty"` Input []byte `json:"input,omitempty"` Control []byte `json:"control,omitempty"` + ChildWorkflowOnly *bool `json:"childWorkflowOnly,omitempty"` } // ToWire translates a SignalExternalWorkflowExecutionInitiatedEventAttributes struct into a Thrift-level intermediate @@ -20735,7 +20844,7 @@ type SignalExternalWorkflowExecutionInitiatedEventAttributes struct { // } func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [6]wire.Field + fields [7]wire.Field i int = 0 w wire.Value err error @@ -20789,6 +20898,14 @@ func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) ToWire() (wire fields[i] = wire.Field{ID: 60, Value: w} i++ } + if v.ChildWorkflowOnly != nil { + w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 70, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -20868,6 +20985,16 @@ func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) FromWire(w wir return err } + } + case 70: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.ChildWorkflowOnly = &x + if err != nil { + return err + } + } } } @@ -20882,7 +21009,7 @@ func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) String() strin return "" } - var fields [6]string + var fields [7]string i := 0 if v.DecisionTaskCompletedEventId != nil { fields[i] = fmt.Sprintf("DecisionTaskCompletedEventId: %v", *(v.DecisionTaskCompletedEventId)) @@ -20908,6 +21035,10 @@ func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) String() strin fields[i] = fmt.Sprintf("Control: %v", v.Control) i++ } + if v.ChildWorkflowOnly != nil { + fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly)) + i++ + } return fmt.Sprintf("SignalExternalWorkflowExecutionInitiatedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -20935,6 +21066,9 @@ func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) Equals(rhs *Si if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { return false } + if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) { + return false + } return true } @@ -20969,6 +21103,16 @@ func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) GetSignalName( return } +// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its +// zero value if it is unset. +func (v *SignalExternalWorkflowExecutionInitiatedEventAttributes) GetChildWorkflowOnly() (o bool) { + if v.ChildWorkflowOnly != nil { + return *v.ChildWorkflowOnly + } + + return +} + type SignalWorkflowExecutionRequest struct { Domain *string `json:"domain,omitempty"` WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` diff --git a/common/persistence/cassandraPersistence.go b/common/persistence/cassandraPersistence.go index 746f1d91301..bc0508ba1ad 100644 --- a/common/persistence/cassandraPersistence.go +++ b/common/persistence/cassandraPersistence.go @@ -71,7 +71,7 @@ const ( // minimum current execution retention TTL when current execution is deleted, in seconds minCurrentExecutionRetentionTTL = int32(24 * time.Hour / time.Second) - stickyTaskListTTL = int32(86400) // if sticky task_list stopped being updated, remove it in one day + stickyTaskListTTL = int32(24 * time.Hour / time.Second) // if sticky task_list stopped being updated, remove it in one day ) const ( @@ -149,6 +149,7 @@ const ( `target_domain_id: ?, ` + `target_workflow_id: ?, ` + `target_run_id: ?, ` + + `target_child_workflow_only: ?, ` + `task_list: ?, ` + `type: ?, ` + `schedule_id: ?` + @@ -203,7 +204,7 @@ const ( templateRequestCancelInfoType = `{` + `initiated_id: ?, ` + - `cancel_request_id: ?` + + `cancel_request_id: ? ` + `}` templateSignalInfoType = `{` + @@ -1800,6 +1801,7 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT var scheduleID int64 targetWorkflowID := transferTaskTransferTargetWorkflowID targetRunID := transferTaskTypeTransferTargetRunID + targetChildWorkflowOnly := false switch task.GetType() { case TransferTaskTypeActivityTask: @@ -1816,7 +1818,11 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT targetDomainID = task.(*CancelExecutionTask).TargetDomainID targetWorkflowID = task.(*CancelExecutionTask).TargetWorkflowID targetRunID = task.(*CancelExecutionTask).TargetRunID - scheduleID = task.(*CancelExecutionTask).ScheduleID + if targetRunID == "" { + targetRunID = transferTaskTypeTransferTargetRunID + } + targetChildWorkflowOnly = task.(*CancelExecutionTask).TargetChildWorkflowOnly + scheduleID = task.(*CancelExecutionTask).InitiatedID case TransferTaskTypeSignalExecution: targetDomainID = task.(*SignalExecutionTask).TargetDomainID @@ -1825,6 +1831,7 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT if targetRunID == "" { targetRunID = transferTaskTypeTransferTargetRunID } + targetChildWorkflowOnly = task.(*SignalExecutionTask).TargetChildWorkflowOnly scheduleID = task.(*SignalExecutionTask).InitiatedID case TransferTaskTypeStartChildExecution: @@ -1846,6 +1853,7 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT targetDomainID, targetWorkflowID, targetRunID, + targetChildWorkflowOnly, taskList, task.GetType(), scheduleID, @@ -2278,6 +2286,11 @@ func createTransferTaskInfo(result map[string]interface{}) *TransferTaskInfo { info.TargetWorkflowID = v.(string) case "target_run_id": info.TargetRunID = v.(gocql.UUID).String() + if info.TargetRunID == transferTaskTypeTransferTargetRunID { + info.TargetRunID = "" + } + case "target_child_workflow_only": + info.TargetChildWorkflowOnly = v.(bool) case "task_list": info.TaskList = v.(string) case "type": @@ -2525,8 +2538,3 @@ func SetVisibilityTSFrom(task Task, t time.Time) { task.(*DeleteHistoryEventTask).VisibilityTimestamp = t } } - -// GetTransferTaskTypeTransferTargetRunID - helper method to the default runID -func GetTransferTaskTypeTransferTargetRunID() string { - return transferTaskTypeTransferTargetRunID -} diff --git a/common/persistence/cassandraPersistence_test.go b/common/persistence/cassandraPersistence_test.go index b8ccd8d511c..2858a3700b9 100644 --- a/common/persistence/cassandraPersistence_test.go +++ b/common/persistence/cassandraPersistence_test.go @@ -406,7 +406,7 @@ func (s *cassandraPersistenceSuite) TestTransferTasks() { s.Equal(TransferTaskTypeDecisionTask, task1.TaskType) s.Equal(int64(2), task1.ScheduleID) s.Equal(transferTaskTransferTargetWorkflowID, task1.TargetWorkflowID) - s.Equal(transferTaskTypeTransferTargetRunID, task1.TargetRunID) + s.Equal("", task1.TargetRunID) err3 := s.CompleteTransferTask(task1.TaskID) s.Nil(err3) @@ -438,6 +438,7 @@ func (s *cassandraPersistenceSuite) TestTransferTasksThroughUpdate() { s.Equal("queue1", task1.TaskList) s.Equal(TransferTaskTypeDecisionTask, task1.TaskType) s.Equal(int64(2), task1.ScheduleID) + s.Equal("", task1.TargetRunID) err3 := s.CompleteTransferTask(task1.TaskID) s.Nil(err3) @@ -461,6 +462,7 @@ func (s *cassandraPersistenceSuite) TestTransferTasksThroughUpdate() { s.Equal("queue1", task2.TaskList) s.Equal(TransferTaskTypeActivityTask, task2.TaskType) s.Equal(int64(4), task2.ScheduleID) + s.Equal("", task2.TargetRunID) err4 := s.CompleteTransferTask(task2.TaskID) s.Nil(err4) @@ -490,6 +492,7 @@ func (s *cassandraPersistenceSuite) TestTransferTasksThroughUpdate() { s.Equal(*workflowExecution.WorkflowId, task3.WorkflowID) s.Equal(*workflowExecution.RunId, task3.RunID) s.Equal(TransferTaskTypeCloseExecution, task3.TaskType) + s.Equal("", task3.TargetRunID) err8 := s.DeleteWorkflowExecution(info1) s.Nil(err8) @@ -503,8 +506,10 @@ func (s *cassandraPersistenceSuite) TestTransferTasksThroughUpdate() { func (s *cassandraPersistenceSuite) TestCancelTransferTaskTasks() { domainID := "aeac8287-527b-4b35-80a9-667cb47e7c6d" - workflowExecution := gen.WorkflowExecution{WorkflowId: common.StringPtr("get-decision-task-test"), - RunId: common.StringPtr("db20f7e2-1a1e-40d9-9278-d8b886738e05")} + workflowExecution := gen.WorkflowExecution{ + WorkflowId: common.StringPtr("cancel-workflow-test"), + RunId: common.StringPtr("db20f7e2-1a1e-40d9-9278-d8b886738e05"), + } task0, err := s.CreateWorkflowExecution(domainID, workflowExecution, "queue1", "wType", 20, 13, nil, 3, 0, 2, nil) s.Nil(err, "No error expected.") @@ -515,39 +520,175 @@ func (s *cassandraPersistenceSuite) TestCancelTransferTaskTasks() { err = s.CompleteTransferTask(taskD[0].TaskID) s.Nil(err) - state0, err1 := s.GetWorkflowExecutionInfo(domainID, workflowExecution) - s.Nil(err1, "No error expected.") - info0 := state0.ExecutionInfo - s.NotNil(info0, "Valid Workflow info expected.") - updatedInfo := copyWorkflowExecutionInfo(info0) + state1, err := s.GetWorkflowExecutionInfo(domainID, workflowExecution) + s.Nil(err, "No error expected.") + info1 := state1.ExecutionInfo + s.NotNil(info1, "Valid Workflow info expected.") + updatedInfo1 := copyWorkflowExecutionInfo(info1) targetDomainID := "f2bfaab6-7e8b-4fac-9a62-17da8d37becb" - targetWorkflowID := "target-workflow_id" + targetWorkflowID := "target-workflow-cancellation-id-1" targetRunID := "0d00698f-08e1-4d36-a3e2-3bf109f5d2d6" + targetChildWorkflowOnly := false transferTasks := []Task{&CancelExecutionTask{ - TaskID: s.GetNextSequenceNumber(), - TargetDomainID: targetDomainID, - TargetWorkflowID: targetWorkflowID, - TargetRunID: targetRunID, - ScheduleID: 1, + TaskID: s.GetNextSequenceNumber(), + TargetDomainID: targetDomainID, + TargetWorkflowID: targetWorkflowID, + TargetRunID: targetRunID, + TargetChildWorkflowOnly: targetChildWorkflowOnly, + InitiatedID: 1, }} - err1 = s.UpdateWorkflowExecutionWithTransferTasks(updatedInfo, int64(3), transferTasks, nil) - s.Nil(err1, "No error expected.") + err = s.UpdateWorkflowExecutionWithTransferTasks(updatedInfo1, int64(3), transferTasks, nil) + s.Nil(err, "No error expected.") + + tasks1, err := s.GetTransferTasks(1) + s.Nil(err, "No error expected.") + s.NotNil(tasks1, "expected valid list of tasks.") + s.Equal(1, len(tasks1), "Expected 1 cancel task.") + task1 := tasks1[0] + s.Equal(TransferTaskTypeCancelExecution, task1.TaskType) + s.Equal(domainID, task1.DomainID) + s.Equal(*workflowExecution.WorkflowId, task1.WorkflowID) + s.Equal(*workflowExecution.RunId, task1.RunID) + s.Equal(targetDomainID, task1.TargetDomainID) + s.Equal(targetWorkflowID, task1.TargetWorkflowID) + s.Equal(targetRunID, task1.TargetRunID) + s.Equal(targetChildWorkflowOnly, task1.TargetChildWorkflowOnly) + + err = s.CompleteTransferTask(task1.TaskID) + s.Nil(err) + + targetDomainID = "f2bfaab6-7e8b-4fac-9a62-17da8d37becb" + targetWorkflowID = "target-workflow-cancellation-id-2" + targetRunID = "" + targetChildWorkflowOnly = true + transferTasks = []Task{&CancelExecutionTask{ + TaskID: s.GetNextSequenceNumber(), + TargetDomainID: targetDomainID, + TargetWorkflowID: targetWorkflowID, + TargetRunID: targetRunID, + TargetChildWorkflowOnly: targetChildWorkflowOnly, + InitiatedID: 3, + }} + + state2, err := s.GetWorkflowExecutionInfo(domainID, workflowExecution) + s.Nil(err, "No error expected.") + info2 := state2.ExecutionInfo + s.NotNil(info2, "Valid Workflow info expected.") + updatedInfo2 := copyWorkflowExecutionInfo(info2) + + err = s.UpdateWorkflowExecutionWithTransferTasks(updatedInfo2, int64(3), transferTasks, nil) + s.Nil(err, "No error expected.") + + tasks2, err := s.GetTransferTasks(1) + s.Nil(err, "No error expected.") + s.NotNil(tasks2, "expected valid list of tasks.") + s.Equal(1, len(tasks2), "Expected 1 cancel task.") + task2 := tasks2[0] + s.Equal(TransferTaskTypeCancelExecution, task2.TaskType) + s.Equal(domainID, task2.DomainID) + s.Equal(*workflowExecution.WorkflowId, task2.WorkflowID) + s.Equal(*workflowExecution.RunId, task2.RunID) + s.Equal(targetDomainID, task2.TargetDomainID) + s.Equal(targetWorkflowID, task2.TargetWorkflowID) + s.Equal(targetRunID, task2.TargetRunID) + s.Equal(targetChildWorkflowOnly, task2.TargetChildWorkflowOnly) + + err = s.CompleteTransferTask(task2.TaskID) + s.Nil(err) +} + +func (s *cassandraPersistenceSuite) TestSignalTransferTaskTasks() { + domainID := "aeac8287-527b-4b35-80a9-667cb47e7c6d" + workflowExecution := gen.WorkflowExecution{ + WorkflowId: common.StringPtr("signal-workflow-test"), + RunId: common.StringPtr("db20f7e2-1a1e-40d9-9278-d8b886738e05"), + } - tasks, err := s.GetTransferTasks(1) + task0, err := s.CreateWorkflowExecution(domainID, workflowExecution, "queue1", "wType", 20, 13, nil, 3, 0, 2, nil) + s.Nil(err, "No error expected.") + s.NotEmpty(task0, "Expected non empty task identifier.") + + taskD, err := s.GetTransferTasks(1) + s.Equal(1, len(taskD), "Expected 1 decision task.") + err = s.CompleteTransferTask(taskD[0].TaskID) + s.Nil(err) + + state1, err := s.GetWorkflowExecutionInfo(domainID, workflowExecution) + s.Nil(err, "No error expected.") + info1 := state1.ExecutionInfo + s.NotNil(info1, "Valid Workflow info expected.") + updatedInfo1 := copyWorkflowExecutionInfo(info1) + + targetDomainID := "f2bfaab6-7e8b-4fac-9a62-17da8d37becb" + targetWorkflowID := "target-workflow-signal-id-1" + targetRunID := "0d00698f-08e1-4d36-a3e2-3bf109f5d2d6" + targetChildWorkflowOnly := false + transferTasks := []Task{&SignalExecutionTask{ + TaskID: s.GetNextSequenceNumber(), + TargetDomainID: targetDomainID, + TargetWorkflowID: targetWorkflowID, + TargetRunID: targetRunID, + TargetChildWorkflowOnly: targetChildWorkflowOnly, + InitiatedID: 1, + }} + err = s.UpdateWorkflowExecutionWithTransferTasks(updatedInfo1, int64(3), transferTasks, nil) + s.Nil(err, "No error expected.") + + tasks1, err := s.GetTransferTasks(1) + s.Nil(err, "No error expected.") + s.NotNil(tasks1, "expected valid list of tasks.") + s.Equal(1, len(tasks1), "Expected 1 cancel task.") + task1 := tasks1[0] + s.Equal(TransferTaskTypeSignalExecution, task1.TaskType) + s.Equal(domainID, task1.DomainID) + s.Equal(*workflowExecution.WorkflowId, task1.WorkflowID) + s.Equal(*workflowExecution.RunId, task1.RunID) + s.Equal(targetDomainID, task1.TargetDomainID) + s.Equal(targetWorkflowID, task1.TargetWorkflowID) + s.Equal(targetRunID, task1.TargetRunID) + s.Equal(targetChildWorkflowOnly, task1.TargetChildWorkflowOnly) + + err = s.CompleteTransferTask(task1.TaskID) + s.Nil(err) + + targetDomainID = "f2bfaab6-7e8b-4fac-9a62-17da8d37becb" + targetWorkflowID = "target-workflow-signal-id-2" + targetRunID = "" + targetChildWorkflowOnly = true + transferTasks = []Task{&SignalExecutionTask{ + TaskID: s.GetNextSequenceNumber(), + TargetDomainID: targetDomainID, + TargetWorkflowID: targetWorkflowID, + TargetRunID: targetRunID, + TargetChildWorkflowOnly: targetChildWorkflowOnly, + InitiatedID: 3, + }} + + state2, err := s.GetWorkflowExecutionInfo(domainID, workflowExecution) + s.Nil(err, "No error expected.") + info2 := state2.ExecutionInfo + s.NotNil(info2, "Valid Workflow info expected.") + updatedInfo2 := copyWorkflowExecutionInfo(info2) + + err = s.UpdateWorkflowExecutionWithTransferTasks(updatedInfo2, int64(3), transferTasks, nil) s.Nil(err, "No error expected.") - s.NotNil(tasks, "expected valid list of tasks.") - s.Equal(1, len(tasks), "Expected 1 cancel task.") - task := tasks[0] - s.Equal(TransferTaskTypeCancelExecution, task.TaskType) - s.Equal(domainID, task.DomainID) - s.Equal(*workflowExecution.WorkflowId, task.WorkflowID) - s.Equal(*workflowExecution.RunId, task.RunID) - s.Equal(targetDomainID, task.TargetDomainID) - s.Equal(targetWorkflowID, task.TargetWorkflowID) - s.Equal(targetRunID, task.TargetRunID) - - err = s.CompleteTransferTask(task.TaskID) + + tasks2, err := s.GetTransferTasks(1) + s.Nil(err, "No error expected.") + s.NotNil(tasks2, "expected valid list of tasks.") + s.Equal(1, len(tasks2), "Expected 1 cancel task.") + task2 := tasks2[0] + s.Equal(TransferTaskTypeSignalExecution, task2.TaskType) + s.Equal(domainID, task2.DomainID) + s.Equal(*workflowExecution.WorkflowId, task2.WorkflowID) + s.Equal(*workflowExecution.RunId, task2.RunID) + s.Equal(targetDomainID, task2.TargetDomainID) + s.Equal(targetWorkflowID, task2.TargetWorkflowID) + s.Equal(targetRunID, task2.TargetRunID) + s.Equal(targetChildWorkflowOnly, task2.TargetChildWorkflowOnly) + + err = s.CompleteTransferTask(task2.TaskID) s.Nil(err) } @@ -945,11 +1086,10 @@ func (s *cassandraPersistenceSuite) TestWorkflowMutableState_RequestCancel() { updatedInfo.NextEventID = int64(5) updatedInfo.LastProcessedEvent = int64(2) cancelRequestID := uuid.New() - requestCancelInfos := []*RequestCancelInfo{ - { - InitiatedID: 1, - CancelRequestID: cancelRequestID, - }} + requestCancelInfos := []*RequestCancelInfo{{ + InitiatedID: 1, + CancelRequestID: cancelRequestID, + }} err2 := s.UpsertRequestCancelState(updatedInfo, int64(3), requestCancelInfos) s.Nil(err2, "No error expected.") diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index 714fcd6a515..3a8a982fe5f 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -166,16 +166,17 @@ type ( // TransferTaskInfo describes a transfer task TransferTaskInfo struct { - DomainID string - WorkflowID string - RunID string - TaskID int64 - TargetDomainID string - TargetWorkflowID string - TargetRunID string - TaskList string - TaskType int - ScheduleID int64 + DomainID string + WorkflowID string + RunID string + TaskID int64 + TargetDomainID string + TargetWorkflowID string + TargetRunID string + TargetChildWorkflowOnly bool + TaskList string + TaskType int + ScheduleID int64 } // TimerTaskInfo describes a timer task. @@ -262,20 +263,22 @@ type ( // CancelExecutionTask identifies a transfer task for cancel of execution CancelExecutionTask struct { - TaskID int64 - TargetDomainID string - TargetWorkflowID string - TargetRunID string - ScheduleID int64 + TaskID int64 + TargetDomainID string + TargetWorkflowID string + TargetRunID string + TargetChildWorkflowOnly bool + InitiatedID int64 } // SignalExecutionTask identifies a transfer task for signal execution SignalExecutionTask struct { - TaskID int64 - TargetDomainID string - TargetWorkflowID string - TargetRunID string - InitiatedID int64 + TaskID int64 + TargetDomainID string + TargetWorkflowID string + TargetRunID string + TargetChildWorkflowOnly bool + InitiatedID int64 } // StartChildExecutionTask identifies a transfer task for starting child execution diff --git a/common/util.go b/common/util.go index 338b65bda9c..c929bc20214 100644 --- a/common/util.go +++ b/common/util.go @@ -120,6 +120,8 @@ func IsServiceNonRetryableError(err error) bool { return true case *workflow.BadRequestError: return true + case *workflow.CancellationAlreadyRequestedError: + return true } return false diff --git a/idl/github.com/uber/cadence/history.thrift b/idl/github.com/uber/cadence/history.thrift index fd739ab8cdf..fac3130e9e2 100644 --- a/idl/github.com/uber/cadence/history.thrift +++ b/idl/github.com/uber/cadence/history.thrift @@ -129,6 +129,8 @@ struct RecordDecisionTaskStartedResponse { struct SignalWorkflowExecutionRequest { 10: optional string domainUUID 20: optional shared.SignalWorkflowExecutionRequest signalRequest + 30: optional shared.WorkflowExecution externalWorkflowExecution + 40: optional bool childWorkflowOnly } struct RemoveSignalMutableStateRequest { @@ -147,6 +149,7 @@ struct RequestCancelWorkflowExecutionRequest { 20: optional shared.RequestCancelWorkflowExecutionRequest cancelRequest 30: optional i64 (js.type = "Long") externalInitiatedEventId 40: optional shared.WorkflowExecution externalWorkflowExecution + 50: optional bool childWorkflowOnly } struct ScheduleDecisionTaskRequest { diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index e0df59a918e..ba13c22a9c6 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -297,6 +297,7 @@ struct RequestCancelExternalWorkflowExecutionDecisionAttributes { 20: optional string workflowId 30: optional string runId 40: optional binary control + 50: optional bool childWorkflowOnly } struct SignalExternalWorkflowExecutionDecisionAttributes { @@ -305,6 +306,7 @@ struct SignalExternalWorkflowExecutionDecisionAttributes { 30: optional string signalName 40: optional binary input 50: optional binary control + 60: optional bool childWorkflowOnly } struct RecordMarkerDecisionAttributes { @@ -536,6 +538,7 @@ struct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { 20: optional string domain 30: optional WorkflowExecution workflowExecution 40: optional binary control + 50: optional bool childWorkflowOnly } struct RequestCancelExternalWorkflowExecutionFailedEventAttributes { @@ -560,6 +563,7 @@ struct SignalExternalWorkflowExecutionInitiatedEventAttributes { 40: optional string signalName 50: optional binary input 60: optional binary control + 70: optional bool childWorkflowOnly } struct SignalExternalWorkflowExecutionFailedEventAttributes { diff --git a/schema/cadence/schema.cql b/schema/cadence/schema.cql index ce7dfb44d67..7909459d669 100644 --- a/schema/cadence/schema.cql +++ b/schema/cadence/schema.cql @@ -51,16 +51,17 @@ CREATE TYPE workflow_execution ( -- TODO: Remove fields that are left over from activity and workflow tasks. CREATE TYPE transfer_task ( - domain_id uuid, -- The domain ID that this transfer task belongs to - workflow_id text, -- The workflow ID that this transfer task belongs to - run_id uuid, -- The run ID that this transfer task belongs to - task_id bigint, - target_domain_id uuid, -- The external domain ID that this transfer task is doing work for. - target_workflow_id text, -- The external workflow ID that this transfer task is doing work for. - target_run_id uuid, -- The external run ID that this transfer task is doing work for. - task_list text, - type int, -- enum TaskType {ActivityTask, DecisionTask, DeleteExecution, CancelExecution, StartChildExecution} - schedule_id bigint, + domain_id uuid, -- The domain ID that this transfer task belongs to + workflow_id text, -- The workflow ID that this transfer task belongs to + run_id uuid, -- The run ID that this transfer task belongs to + task_id bigint, + target_domain_id uuid, -- The external domain ID that this transfer task is doing work for. + target_workflow_id text, -- The external workflow ID that this transfer task is doing work for. + target_run_id uuid, -- The external run ID that this transfer task is doing work for. + target_child_workflow_only boolean, -- The whether target child workflow only. + task_list text, + type int, -- enum TaskType {ActivityTask, DecisionTask, DeleteExecution, CancelExecution, StartChildExecution} + schedule_id bigint, ); CREATE TYPE timer_task ( diff --git a/schema/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql b/schema/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql new file mode 100644 index 00000000000..344073c892b --- /dev/null +++ b/schema/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql @@ -0,0 +1 @@ +ALTER TYPE transfer_task ADD target_child_workflow_only boolean; \ No newline at end of file diff --git a/schema/cadence/versioned/v0.5/manifest.json b/schema/cadence/versioned/v0.5/manifest.json index 0cafde63139..7a5e0c47cdd 100644 --- a/schema/cadence/versioned/v0.5/manifest.json +++ b/schema/cadence/versioned/v0.5/manifest.json @@ -1,8 +1,9 @@ { "CurrVersion": "0.5", "MinCompatibleVersion": "0.5", - "Description": "add cross DC domain replication config", + "Description": "add cross DC domain replication config, add target child workflow only to transfer task", "SchemaUpdateCqlFiles": [ - "add_replication_config.cql" + "add_replication_config.cql", + "add_target_child_workflow_only_to_transfer_task.cql" ] } diff --git a/service/history/historyBuilder.go b/service/history/historyBuilder.go index 2adaf10a5b1..c976ff8a3eb 100644 --- a/service/history/historyBuilder.go +++ b/service/history/historyBuilder.go @@ -657,12 +657,13 @@ func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionInitiatedEvent event := b.msBuilder.createNewHistoryEvent(workflow.EventTypeRequestCancelExternalWorkflowExecutionInitiated) attributes := &workflow.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes{} attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID) - attributes.Domain = common.StringPtr(*request.Domain) + attributes.Domain = request.Domain attributes.WorkflowExecution = &workflow.WorkflowExecution{ - WorkflowId: common.StringPtr(*request.WorkflowId), - RunId: common.StringPtr(*request.RunId), + WorkflowId: request.WorkflowId, + RunId: request.RunId, } attributes.Control = request.Control + attributes.ChildWorkflowOnly = request.ChildWorkflowOnly event.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes = attributes return event @@ -705,14 +706,15 @@ func (b *historyBuilder) newSignalExternalWorkflowExecutionInitiatedEvent(decisi event := b.msBuilder.createNewHistoryEvent(workflow.EventTypeSignalExternalWorkflowExecutionInitiated) attributes := &workflow.SignalExternalWorkflowExecutionInitiatedEventAttributes{} attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID) - attributes.Domain = common.StringPtr(request.GetDomain()) + attributes.Domain = request.Domain attributes.WorkflowExecution = &workflow.WorkflowExecution{ - WorkflowId: common.StringPtr(request.Execution.GetWorkflowId()), - RunId: common.StringPtr(request.Execution.GetRunId()), + WorkflowId: request.Execution.WorkflowId, + RunId: request.Execution.RunId, } attributes.SignalName = common.StringPtr(request.GetSignalName()) attributes.Input = request.Input attributes.Control = request.Control + attributes.ChildWorkflowOnly = request.ChildWorkflowOnly event.SignalExternalWorkflowExecutionInitiatedEventAttributes = attributes return event diff --git a/service/history/historyBuilder_test.go b/service/history/historyBuilder_test.go index f8583ec40af..c547b90efb9 100644 --- a/service/history/historyBuilder_test.go +++ b/service/history/historyBuilder_test.go @@ -465,6 +465,151 @@ func (s *historyBuilderSuite) TestHistoryBuilderFlushBufferedEvents() { s.Equal(int64(12), activity2FailedEvent2.ActivityTaskFailedEventAttributes.GetStartedEventId()) } +func (s *historyBuilderSuite) TestHistoryBuilderWorkflowCancellationRequested() { + workflowType := "some random workflow type" + tasklist := "some random tasklist" + identity := "some random identity" + input := []byte("some random workflow input") + execTimeout := int32(60) + taskTimeout := int32(10) + workflowExecution := workflow.WorkflowExecution{ + WorkflowId: common.StringPtr("some random workflow ID"), + RunId: common.StringPtr(uuid.New()), + } + + workflowStartedEvent := s.addWorkflowExecutionStartedEvent( + workflowExecution, workflowType, tasklist, input, execTimeout, taskTimeout, identity, + ) + s.validateWorkflowExecutionStartedEvent( + workflowStartedEvent, workflowType, tasklist, input, execTimeout, taskTimeout, identity, + ) + s.Equal(int64(2), s.getNextEventID()) + + decisionInfo := s.addDecisionTaskScheduledEvent() + s.validateDecisionTaskScheduledEvent(decisionInfo, 2, tasklist, taskTimeout) + s.Equal(int64(3), s.getNextEventID()) + decisionInfo, decisionRunning := s.msBuilder.GetPendingDecision(2) + s.True(decisionRunning) + s.NotNil(decisionInfo) + s.Equal(int64(2), decisionInfo.ScheduleID) + s.Equal(emptyEventID, decisionInfo.StartedID) + s.Equal(emptyEventID, s.getPreviousDecisionStartedEventID()) + + decisionStartedEvent := s.addDecisionTaskStartedEvent(2, tasklist, identity) + s.validateDecisionTaskStartedEvent(decisionStartedEvent, 3, 2, identity) + s.Equal(int64(4), s.getNextEventID()) + decisionInfo, decisionRunning = s.msBuilder.GetPendingDecision(2) + s.True(decisionRunning) + s.NotNil(decisionInfo) + s.Equal(int64(2), decisionInfo.ScheduleID) + s.Equal(int64(3), decisionInfo.StartedID) + s.Equal(emptyEventID, s.getPreviousDecisionStartedEventID()) + + decisionContext := []byte("some random decision context") + decisionCompletedEvent := s.addDecisionTaskCompletedEvent(2, 3, decisionContext, identity) + s.validateDecisionTaskCompletedEvent(decisionCompletedEvent, 4, 2, 3, decisionContext, identity) + s.Equal(int64(5), s.getNextEventID()) + decisionInfo, decisionRunning = s.msBuilder.GetPendingDecision(2) + s.False(decisionRunning) + s.Nil(decisionInfo) + s.Equal(int64(3), s.getPreviousDecisionStartedEventID()) + + targetDomain := "some random target domain" + targetExecution := workflow.WorkflowExecution{ + WorkflowId: common.StringPtr("some random target workflow ID"), + RunId: common.StringPtr("some random target run ID"), + } + cancellationChildWorkflowOnly := true + cancellationInitiatedEvent := s.addRequestCancelExternalWorkflowExecutionInitiatedEvent( + 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, + ) + s.validateRequestCancelExternalWorkflowExecutionInitiatedEvent( + cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, + ) + s.Equal(int64(6), s.getNextEventID()) + + cancellationRequestedEvent := s.addExternalWorkflowExecutionCancelRequested( + 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), + ) + s.validateExternalWorkflowExecutionCancelRequested( + cancellationRequestedEvent, 6, 5, targetDomain, targetExecution, + ) + s.Equal(int64(7), s.getNextEventID()) +} + +func (s *historyBuilderSuite) TestHistoryBuilderWorkflowCancellationFailed() { + workflowType := "some random workflow type" + tasklist := "some random tasklist" + identity := "some random identity" + input := []byte("some random workflow input") + execTimeout := int32(60) + taskTimeout := int32(10) + workflowExecution := workflow.WorkflowExecution{ + WorkflowId: common.StringPtr("some random workflow ID"), + RunId: common.StringPtr(uuid.New()), + } + + workflowStartedEvent := s.addWorkflowExecutionStartedEvent( + workflowExecution, workflowType, tasklist, input, execTimeout, taskTimeout, identity, + ) + s.validateWorkflowExecutionStartedEvent( + workflowStartedEvent, workflowType, tasklist, input, execTimeout, taskTimeout, identity, + ) + s.Equal(int64(2), s.getNextEventID()) + + decisionInfo := s.addDecisionTaskScheduledEvent() + s.validateDecisionTaskScheduledEvent(decisionInfo, 2, tasklist, taskTimeout) + s.Equal(int64(3), s.getNextEventID()) + decisionInfo, decisionRunning := s.msBuilder.GetPendingDecision(2) + s.True(decisionRunning) + s.NotNil(decisionInfo) + s.Equal(int64(2), decisionInfo.ScheduleID) + s.Equal(emptyEventID, decisionInfo.StartedID) + s.Equal(emptyEventID, s.getPreviousDecisionStartedEventID()) + + decisionStartedEvent := s.addDecisionTaskStartedEvent(2, tasklist, identity) + s.validateDecisionTaskStartedEvent(decisionStartedEvent, 3, 2, identity) + s.Equal(int64(4), s.getNextEventID()) + decisionInfo, decisionRunning = s.msBuilder.GetPendingDecision(2) + s.True(decisionRunning) + s.NotNil(decisionInfo) + s.Equal(int64(2), decisionInfo.ScheduleID) + s.Equal(int64(3), decisionInfo.StartedID) + s.Equal(emptyEventID, s.getPreviousDecisionStartedEventID()) + + decisionContext := []byte("some random decision context") + decisionCompletedEvent := s.addDecisionTaskCompletedEvent(2, 3, decisionContext, identity) + s.validateDecisionTaskCompletedEvent(decisionCompletedEvent, 4, 2, 3, decisionContext, identity) + s.Equal(int64(5), s.getNextEventID()) + decisionInfo, decisionRunning = s.msBuilder.GetPendingDecision(2) + s.False(decisionRunning) + s.Nil(decisionInfo) + s.Equal(int64(3), s.getPreviousDecisionStartedEventID()) + + targetDomain := "some random target domain" + targetExecution := workflow.WorkflowExecution{ + WorkflowId: common.StringPtr("some random target workflow ID"), + RunId: common.StringPtr("some random target run ID"), + } + cancellationChildWorkflowOnly := true + cancellationFailedCause := workflow.CancelExternalWorkflowExecutionFailedCause(59) + cancellationInitiatedEvent := s.addRequestCancelExternalWorkflowExecutionInitiatedEvent( + 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, + ) + s.validateRequestCancelExternalWorkflowExecutionInitiatedEvent( + cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, + ) + s.Equal(int64(6), s.getNextEventID()) + + cancellationRequestedEvent := s.addRequestCancelExternalWorkflowExecutionFailedEvent( + 4, 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), cancellationFailedCause, + ) + s.validateRequestCancelExternalWorkflowExecutionFailedEvent( + cancellationRequestedEvent, 6, 4, 5, targetDomain, targetExecution, cancellationFailedCause, + ) + s.Equal(int64(7), s.getNextEventID()) +} + func (s *historyBuilderSuite) getNextEventID() int64 { return s.msBuilder.executionInfo.NextEventID } @@ -561,6 +706,40 @@ func (s *historyBuilderSuite) addActivityTaskFailedEvent(scheduleID, startedID i return e } +func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionInitiatedEvent( + decisionCompletedEventID int64, targetDomain string, targetExecution workflow.WorkflowExecution, + childWorkflowOnly bool) *workflow.HistoryEvent { + e, _ := s.msBuilder.AddRequestCancelExternalWorkflowExecutionInitiatedEvent( + decisionCompletedEventID, + uuid.New(), + &workflow.RequestCancelExternalWorkflowExecutionDecisionAttributes{ + Domain: common.StringPtr(targetDomain), + WorkflowId: targetExecution.WorkflowId, + RunId: targetExecution.RunId, + ChildWorkflowOnly: common.BoolPtr(childWorkflowOnly), + }, + ) + + return e +} + +func (s *historyBuilderSuite) addExternalWorkflowExecutionCancelRequested( + initiatedID int64, domain, workflowID, runID string) *workflow.HistoryEvent { + + return s.msBuilder.AddExternalWorkflowExecutionCancelRequested( + initiatedID, domain, workflowID, runID, + ) +} + +func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionFailedEvent( + decisionTaskCompletedEventID, initiatedID int64, + domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + + return s.msBuilder.AddRequestCancelExternalWorkflowExecutionFailedEvent( + decisionTaskCompletedEventID, initiatedID, domain, workflowID, runID, cause, + ) +} + func (s *historyBuilderSuite) validateWorkflowExecutionStartedEvent(event *workflow.HistoryEvent, workflowType, taskList string, input []byte, executionStartToCloseTimeout, taskStartToCloseTimeout int32, identity string) { s.NotNil(event) @@ -662,6 +841,51 @@ func (s *historyBuilderSuite) validateActivityTaskFailedEvent(event *workflow.Hi s.Equal(identity, *attributes.Identity) } +func (s *historyBuilderSuite) validateRequestCancelExternalWorkflowExecutionInitiatedEvent( + event *workflow.HistoryEvent, eventID, decisionTaskCompletedEventID int64, + domain string, execution workflow.WorkflowExecution, childWorkflowOnly bool) { + s.NotNil(event) + s.Equal(workflow.EventTypeRequestCancelExternalWorkflowExecutionInitiated, *event.EventType) + s.Equal(eventID, *event.EventId) + attributes := event.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + s.NotNil(attributes) + s.Equal(decisionTaskCompletedEventID, *attributes.DecisionTaskCompletedEventId) + s.Equal(domain, attributes.GetDomain()) + s.Equal(execution.GetWorkflowId(), attributes.WorkflowExecution.GetWorkflowId()) + s.Equal(execution.GetRunId(), attributes.WorkflowExecution.GetRunId()) + s.Equal(childWorkflowOnly, *attributes.ChildWorkflowOnly) +} + +func (s *historyBuilderSuite) validateExternalWorkflowExecutionCancelRequested( + event *workflow.HistoryEvent, eventID, initiatedEventID int64, + domain string, execution workflow.WorkflowExecution) { + s.NotNil(event) + s.Equal(workflow.EventTypeExternalWorkflowExecutionCancelRequested, *event.EventType) + s.Equal(eventID, *event.EventId) + attributes := event.ExternalWorkflowExecutionCancelRequestedEventAttributes + s.NotNil(attributes) + s.Equal(initiatedEventID, attributes.GetInitiatedEventId()) + s.Equal(domain, attributes.GetDomain()) + s.Equal(execution.GetWorkflowId(), attributes.WorkflowExecution.GetWorkflowId()) + s.Equal(execution.GetRunId(), attributes.WorkflowExecution.GetRunId()) +} + +func (s *historyBuilderSuite) validateRequestCancelExternalWorkflowExecutionFailedEvent( + event *workflow.HistoryEvent, eventID, decisionTaskCompletedEventID, initiatedEventID int64, + domain string, execution workflow.WorkflowExecution, cause workflow.CancelExternalWorkflowExecutionFailedCause) { + s.NotNil(event) + s.Equal(workflow.EventTypeRequestCancelExternalWorkflowExecutionFailed, *event.EventType) + s.Equal(eventID, *event.EventId) + attributes := event.RequestCancelExternalWorkflowExecutionFailedEventAttributes + s.NotNil(attributes) + s.Equal(decisionTaskCompletedEventID, attributes.GetDecisionTaskCompletedEventId()) + s.Equal(initiatedEventID, attributes.GetInitiatedEventId()) + s.Equal(domain, attributes.GetDomain()) + s.Equal(execution.GetWorkflowId(), attributes.WorkflowExecution.GetWorkflowId()) + s.Equal(execution.GetRunId(), attributes.WorkflowExecution.GetRunId()) + s.Equal(cause, *attributes.Cause) +} + func (s *historyBuilderSuite) printHistory() string { history, err := s.builder.Serialize() if err != nil { diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index c64bec99156..9e73f98c1c6 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -88,9 +88,12 @@ var ( ErrActivityTaskNotFound = &workflow.EntityNotExistsError{Message: "Activity task not found."} // ErrWorkflowCompleted is the error to indicate workflow execution already completed ErrWorkflowCompleted = &workflow.EntityNotExistsError{Message: "Workflow execution already completed."} + // ErrWorkflowParent is the error to parent execution is given and mismatch + ErrWorkflowParent = &workflow.EntityNotExistsError{Message: "Workflow parent does not match."} // ErrDeserializingToken is the error to indicate task token is invalid ErrDeserializingToken = &workflow.BadRequestError{Message: "Error deserializing task token."} - + // ErrCancellationAlreadyRequested is the error indicating cancellation for target workflow is already requested + ErrCancellationAlreadyRequested = &workflow.CancellationAlreadyRequestedError{Message: "Cancellation already requested for this workflow execution."} // FailedWorkflowCloseState is a set of failed workflow close states, used for start workflow policy // for start workflow execution API FailedWorkflowCloseState = map[int]bool{ @@ -978,11 +981,16 @@ Update_History_Loop: break Process_Decision_Loop } - foreignDomainEntry, err := e.domainCache.GetDomain(*attributes.Domain) - if err != nil { - return &workflow.InternalServiceError{ - Message: fmt.Sprintf("Unable to cancel workflow across domain: %v.", - *attributes.Domain)} + foreignDomainID := "" + if attributes.GetDomain() == "" { + foreignDomainID = msBuilder.executionInfo.DomainID + } else { + foreignDomainEntry, err := e.domainCache.GetDomain(attributes.GetDomain()) + if err != nil { + return &workflow.InternalServiceError{ + Message: fmt.Sprintf("Unable to cancel workflow across domain: %v.", attributes.GetDomain())} + } + foreignDomainID = foreignDomainEntry.Info.ID } cancelRequestID := uuid.New() @@ -993,10 +1001,11 @@ Update_History_Loop: } transferTasks = append(transferTasks, &persistence.CancelExecutionTask{ - TargetDomainID: foreignDomainEntry.Info.ID, - TargetWorkflowID: *attributes.WorkflowId, - TargetRunID: common.StringDefault(attributes.RunId), - ScheduleID: *wfCancelReqEvent.EventId, + TargetDomainID: foreignDomainID, + TargetWorkflowID: attributes.GetWorkflowId(), + TargetRunID: attributes.GetRunId(), + TargetChildWorkflowOnly: attributes.GetChildWorkflowOnly(), + InitiatedID: wfCancelReqEvent.GetEventId(), }) case workflow.DecisionTypeSignalExternalWorkflowExecution: @@ -1010,11 +1019,16 @@ Update_History_Loop: break Process_Decision_Loop } - foreignDomainEntry, err := e.domainCache.GetDomain(attributes.GetDomain()) - if err != nil { - return &workflow.InternalServiceError{ - Message: fmt.Sprintf("Unable to signal workflow across domain: %v.", - attributes.GetDomain())} + foreignDomainID := "" + if attributes.GetDomain() == "" { + foreignDomainID = msBuilder.executionInfo.DomainID + } else { + foreignDomainEntry, err := e.domainCache.GetDomain(attributes.GetDomain()) + if err != nil { + return &workflow.InternalServiceError{ + Message: fmt.Sprintf("Unable to signal workflow across domain: %v.", attributes.GetDomain())} + } + foreignDomainID = foreignDomainEntry.Info.ID } signalRequestID := uuid.New() // for deduplicate @@ -1025,10 +1039,11 @@ Update_History_Loop: } transferTasks = append(transferTasks, &persistence.SignalExecutionTask{ - TargetDomainID: foreignDomainEntry.Info.ID, - TargetWorkflowID: attributes.Execution.GetWorkflowId(), - TargetRunID: attributes.Execution.GetRunId(), - InitiatedID: wfSignalReqEvent.GetEventId(), + TargetDomainID: foreignDomainID, + TargetWorkflowID: attributes.Execution.GetWorkflowId(), + TargetRunID: attributes.Execution.GetRunId(), + TargetChildWorkflowOnly: attributes.GetChildWorkflowOnly(), + InitiatedID: wfSignalReqEvent.GetEventId(), }) case workflow.DecisionTypeContinueAsNewWorkflowExecution: @@ -1454,18 +1469,28 @@ func (e *historyEngineImpl) RequestCancelWorkflowExecution( return err } request := req.CancelRequest - - workflowExecution := workflow.WorkflowExecution{ + parentExecution := req.ExternalWorkflowExecution + childWorkflowOnly := req.GetChildWorkflowOnly() + execution := workflow.WorkflowExecution{ WorkflowId: request.WorkflowExecution.WorkflowId, RunId: request.WorkflowExecution.RunId, } - return e.updateWorkflowExecution(domainID, workflowExecution, false, true, + return e.updateWorkflowExecution(domainID, execution, false, true, func(msBuilder *mutableStateBuilder, tBuilder *timerBuilder) ([]persistence.Task, error) { if !msBuilder.isWorkflowExecutionRunning() { return nil, ErrWorkflowCompleted } + if childWorkflowOnly { + parentWorkflowID := msBuilder.executionInfo.ParentWorkflowID + parentRunID := msBuilder.executionInfo.ParentRunID + if parentExecution.GetWorkflowId() != parentWorkflowID || + parentExecution.GetRunId() != parentRunID { + return nil, ErrWorkflowParent + } + } + isCancelRequested, cancelRequestID := msBuilder.isCancelRequested() if isCancelRequested { cancelRequest := req.CancelRequest @@ -1475,10 +1500,9 @@ func (e *historyEngineImpl) RequestCancelWorkflowExecution( return nil, nil } } - - return nil, &workflow.CancellationAlreadyRequestedError{ - Message: "Cancellation already requested for this workflow execution.", - } + // if we consider workflow cancellation idempotent, then this error is redundant + // this error maybe useful if this API is invoked by external, not decision from transfer queue + return nil, ErrCancellationAlreadyRequested } if msBuilder.AddWorkflowExecutionCancelRequestedEvent("", req) == nil { @@ -1495,6 +1519,8 @@ func (e *historyEngineImpl) SignalWorkflowExecution(signalRequest *h.SignalWorkf return err } request := signalRequest.SignalRequest + parentExecution := signalRequest.ExternalWorkflowExecution + childWorkflowOnly := signalRequest.GetChildWorkflowOnly() execution := workflow.WorkflowExecution{ WorkflowId: request.WorkflowExecution.WorkflowId, RunId: request.WorkflowExecution.RunId, @@ -1506,6 +1532,15 @@ func (e *historyEngineImpl) SignalWorkflowExecution(signalRequest *h.SignalWorkf return nil, ErrWorkflowCompleted } + if childWorkflowOnly { + parentWorkflowID := msBuilder.executionInfo.ParentWorkflowID + parentRunID := msBuilder.executionInfo.ParentRunID + if parentExecution.GetWorkflowId() != parentWorkflowID || + parentExecution.GetRunId() != parentRunID { + return nil, ErrWorkflowParent + } + } + // deduplicate by request id for signal decision if requestID := request.GetRequestId(); requestID != "" { if msBuilder.isSignalRequested(requestID) { @@ -1946,10 +1981,8 @@ func validateCancelExternalWorkflowExecutionAttributes(attributes *workflow.Requ if attributes.WorkflowId == nil { return &workflow.BadRequestError{Message: "WorkflowId is not set on decision."} } - if attributes.RunId == nil { - return &workflow.BadRequestError{Message: "RunId is not set on decision."} - } - if uuid.Parse(*attributes.RunId) == nil { + runID := attributes.GetRunId() + if runID != "" && uuid.Parse(runID) == nil { return &workflow.BadRequestError{Message: "Invalid RunId set on decision."} } diff --git a/service/history/mutableStateBuilder.go b/service/history/mutableStateBuilder.go index 44f5a4c6615..335a2f764b7 100644 --- a/service/history/mutableStateBuilder.go +++ b/service/history/mutableStateBuilder.go @@ -55,8 +55,8 @@ type ( deleteChildExecutionInfo *int64 // Deleted ChildExecution Info since last update pendingRequestCancelInfoIDs map[int64]*persistence.RequestCancelInfo // Initiated Event ID -> RequestCancelInfo - updateRequestCancelInfos []*persistence.RequestCancelInfo // Modified RequestCancel Infos since last update - deleteRequestCancelInfo *int64 // Deleted RequestCancel Info since last update + updateRequestCancelInfos []*persistence.RequestCancelInfo // Modified RequestCancel Infos since last update, for persistence update + deleteRequestCancelInfo *int64 // Deleted RequestCancel Info since last update, for persistence update pendingSignalInfoIDs map[int64]*persistence.SignalInfo // Initiated Event ID -> SignalInfo updateSignalInfos []*persistence.SignalInfo // Modified SignalInfo since last update @@ -79,22 +79,22 @@ type ( } mutableStateSessionUpdates struct { - newEventsBuilder *historyBuilder - updateActivityInfos []*persistence.ActivityInfo - deleteActivityInfo *int64 - updateTimerInfos []*persistence.TimerInfo - deleteTimerInfos []string - updateChildExecutionInfos []*persistence.ChildExecutionInfo - deleteChildExecutionInfo *int64 - //updateCancelExecutionInfos []*persistence.RequestCancelInfo - //deleteCancelExecutionInfo *int64 - updateSignalInfos []*persistence.SignalInfo - deleteSignalInfo *int64 - updateSignalRequestedIDs []string - deleteSignalRequestedID string - continueAsNew *persistence.CreateWorkflowExecutionRequest - newBufferedEvents *persistence.SerializedHistoryEventBatch - clearBufferedEvents bool + newEventsBuilder *historyBuilder + updateActivityInfos []*persistence.ActivityInfo + deleteActivityInfo *int64 + updateTimerInfos []*persistence.TimerInfo + deleteTimerInfos []string + updateChildExecutionInfos []*persistence.ChildExecutionInfo + deleteChildExecutionInfo *int64 + updateCancelExecutionInfos []*persistence.RequestCancelInfo + deleteCancelExecutionInfo *int64 + updateSignalInfos []*persistence.SignalInfo + deleteSignalInfo *int64 + updateSignalRequestedIDs []string + deleteSignalRequestedID string + continueAsNew *persistence.CreateWorkflowExecutionRequest + newBufferedEvents *persistence.SerializedHistoryEventBatch + clearBufferedEvents bool } // TODO: This should be part of persistence layer @@ -232,22 +232,22 @@ func (e *mutableStateBuilder) CloseUpdateSession() (*mutableStateSessionUpdates, } updates := &mutableStateSessionUpdates{ - newEventsBuilder: e.hBuilder, - updateActivityInfos: e.updateActivityInfos, - deleteActivityInfo: e.deleteActivityInfo, - updateTimerInfos: e.updateTimerInfos, - deleteTimerInfos: e.deleteTimerInfos, - updateChildExecutionInfos: e.updateChildExecutionInfos, - deleteChildExecutionInfo: e.deleteChildExecutionInfo, - //updateCancelExecutionInfos: e.updateRequestCancelInfos, - //deleteCancelExecutionInfo: e.deleteRequestCancelInfo, - updateSignalInfos: e.updateSignalInfos, - deleteSignalInfo: e.deleteSignalInfo, - updateSignalRequestedIDs: getSignalRequestedIDs(e.updateSignalRequestedIDs), - deleteSignalRequestedID: e.deleteSignalRequestedID, - continueAsNew: e.continueAsNew, - newBufferedEvents: e.updateBufferedEvents, - clearBufferedEvents: e.clearBufferedEvents, + newEventsBuilder: e.hBuilder, + updateActivityInfos: e.updateActivityInfos, + deleteActivityInfo: e.deleteActivityInfo, + updateTimerInfos: e.updateTimerInfos, + deleteTimerInfos: e.deleteTimerInfos, + updateChildExecutionInfos: e.updateChildExecutionInfos, + deleteChildExecutionInfo: e.deleteChildExecutionInfo, + updateCancelExecutionInfos: e.updateRequestCancelInfos, + deleteCancelExecutionInfo: e.deleteRequestCancelInfo, + updateSignalInfos: e.updateSignalInfos, + deleteSignalInfo: e.deleteSignalInfo, + updateSignalRequestedIDs: getSignalRequestedIDs(e.updateSignalRequestedIDs), + deleteSignalRequestedID: e.deleteSignalRequestedID, + continueAsNew: e.continueAsNew, + newBufferedEvents: e.updateBufferedEvents, + clearBufferedEvents: e.clearBufferedEvents, } // Clear all updates to prepare for the next session @@ -258,8 +258,8 @@ func (e *mutableStateBuilder) CloseUpdateSession() (*mutableStateSessionUpdates, e.deleteTimerInfos = []string{} e.updateChildExecutionInfos = []*persistence.ChildExecutionInfo{} e.deleteChildExecutionInfo = nil - //e.updateRequestCancelInfos = []*persistence.RequestCancelInfo{} - //e.deleteRequestCancelInfo = nil + e.updateRequestCancelInfos = []*persistence.RequestCancelInfo{} + e.deleteRequestCancelInfo = nil e.updateSignalInfos = []*persistence.SignalInfo{} e.deleteSignalInfo = nil e.updateSignalRequestedIDs = make(map[string]struct{}) @@ -1317,10 +1317,9 @@ func (e *mutableStateBuilder) AddWorkflowExecutionCanceledEvent(decisionTaskComp return event } -func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionInitiatedEvent(decisionCompletedEventID int64, - cancelRequestID string, - request *workflow.RequestCancelExternalWorkflowExecutionDecisionAttributes) (*workflow.HistoryEvent, - *persistence.RequestCancelInfo) { +func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionInitiatedEvent( + decisionCompletedEventID int64, cancelRequestID string, + request *workflow.RequestCancelExternalWorkflowExecutionDecisionAttributes) (*workflow.HistoryEvent, *persistence.RequestCancelInfo) { event := e.hBuilder.AddRequestCancelExternalWorkflowExecutionInitiatedEvent(decisionCompletedEventID, request) if event == nil { return nil, nil diff --git a/service/history/timerQueueProcessor_test.go b/service/history/timerQueueProcessor_test.go index 84cab7a5e6f..5f03084ad02 100644 --- a/service/history/timerQueueProcessor_test.go +++ b/service/history/timerQueueProcessor_test.go @@ -336,7 +336,6 @@ func (s *timerQueueProcessorSuite) TestTimerTaskAfterProcessorStart() { func (s *timerQueueProcessorSuite) waitForTimerTasksToProcess(p timerQueueProcessor) { for i := 0; i < 10; i++ { timerInfo, err := s.GetTimerIndexTasks() - //fmt.Printf("TestAfterTimerTasks: GetTimerIndexTasks: Response Count: %d \n", len(timerInfo)) s.Nil(err, "No error expected.") if len(timerInfo) == 0 { p.Stop() diff --git a/service/history/transferQueueProcessor.go b/service/history/transferQueueProcessor.go index 089a76ac00a..7ce740809e6 100644 --- a/service/history/transferQueueProcessor.go +++ b/service/history/transferQueueProcessor.go @@ -229,6 +229,11 @@ func (t *transferQueueProcessorImpl) processTransferTasks(tasksCh chan<- *persis return } + // the transfer tasks are not guaranteed to be executed in serious. + // since there are multiple workers polling from this task channel + // so if one workflow, reports a series of decitions, one depend on another, + // e.g. 1. start child workflow; 2. signal this workflow, the execution order + // is not guatanteed. for _, tsk := range tasks { tasksCh <- tsk } @@ -510,8 +515,10 @@ func (t *transferQueueProcessorImpl) processCancelExecution(task *persistence.Tr var err error domainID := task.DomainID targetDomainID := task.TargetDomainID - execution := workflow.WorkflowExecution{WorkflowId: common.StringPtr(task.WorkflowID), - RunId: common.StringPtr(task.RunID)} + execution := workflow.WorkflowExecution{ + WorkflowId: common.StringPtr(task.WorkflowID), + RunId: common.StringPtr(task.RunID), + } var context *workflowExecutionContext var release releaseWorkflowExecutionFunc @@ -533,12 +540,11 @@ func (t *transferQueueProcessorImpl) processCancelExecution(task *persistence.Tr } initiatedEventID := task.ScheduleID - ri, isPending := msBuilder.GetRequestCancelInfo(initiatedEventID) - if !isPending { + ri, isRunning := msBuilder.GetRequestCancelInfo(initiatedEventID) + if !isRunning { // No pending request cancellation for this initiatedID, complete this transfer task return nil } - cancelRequest := &history.RequestCancelWorkflowExecutionRequest{ DomainUUID: common.StringPtr(targetDomainID), CancelRequest: &workflow.RequestCancelWorkflowExecutionRequest{ @@ -551,12 +557,12 @@ func (t *transferQueueProcessorImpl) processCancelExecution(task *persistence.Tr // Use the same request ID to dedupe RequestCancelWorkflowExecution calls RequestId: common.StringPtr(ri.CancelRequestID), }, - // TODO (Bowei): looks like these External properties are not used ExternalInitiatedEventId: common.Int64Ptr(task.ScheduleID), ExternalWorkflowExecution: &workflow.WorkflowExecution{ WorkflowId: common.StringPtr(task.WorkflowID), RunId: common.StringPtr(task.RunID), }, + ChildWorkflowOnly: common.BoolPtr(task.TargetChildWorkflowOnly), } op := func() error { @@ -566,7 +572,6 @@ func (t *transferQueueProcessorImpl) processCancelExecution(task *persistence.Tr err = backoff.Retry(op, persistenceOperationRetryPolicy, common.IsPersistenceTransientError) if err != nil { t.logger.Debugf("Failed to cancel external workflow execution. Error: %v", err) - // Check to see if the error is non-transient, in which case add RequestCancelFailed // event and complete transfer task by setting the err = nil if common.IsServiceNonRetryableError(err) { @@ -574,6 +579,10 @@ func (t *transferQueueProcessorImpl) processCancelExecution(task *persistence.Tr if _, ok := err.(*workflow.EntityNotExistsError); ok { // this could happen if this is a duplicate processing of the task, and the execution has already completed. return nil + } else if _, ok := err.(*workflow.CancellationAlreadyRequestedError); ok { + // this could happen if target workflow cancellation is alreay requested + // to make workflow cancellation idempotent, we should eat this error. + return nil } } return err @@ -652,20 +661,13 @@ func (t *transferQueueProcessorImpl) processSignalExecution(task *persistence.Tr return err } - targetRunID := task.TargetRunID - if targetRunID == persistence.GetTransferTaskTypeTransferTargetRunID() { - // when signal decision has empty runID, db will save default runID to transfer task. - // change it to empty string here, so that getOrCreateWorkflowExecution can return current runID for this workflow. - targetRunID = "" - } - signalRequest := &history.SignalWorkflowExecutionRequest{ DomainUUID: common.StringPtr(targetDomainID), SignalRequest: &workflow.SignalWorkflowExecutionRequest{ Domain: common.StringPtr(targetDomainID), WorkflowExecution: &workflow.WorkflowExecution{ WorkflowId: common.StringPtr(task.TargetWorkflowID), - RunId: common.StringPtr(targetRunID), + RunId: common.StringPtr(task.TargetRunID), }, Identity: common.StringPtr(identityHistoryService), SignalName: common.StringPtr(ri.SignalName), @@ -674,6 +676,11 @@ func (t *transferQueueProcessorImpl) processSignalExecution(task *persistence.Tr RequestId: common.StringPtr(ri.SignalRequestID), Control: ri.Control, }, + ExternalWorkflowExecution: &workflow.WorkflowExecution{ + WorkflowId: common.StringPtr(task.WorkflowID), + RunId: common.StringPtr(task.RunID), + }, + ChildWorkflowOnly: common.BoolPtr(task.TargetChildWorkflowOnly), } err = t.SignalExecutionWithRetry(signalRequest) @@ -707,7 +714,7 @@ func (t *transferQueueProcessorImpl) processSignalExecution(task *persistence.Tr DomainUUID: common.StringPtr(targetDomainID), WorkflowExecution: &workflow.WorkflowExecution{ WorkflowId: common.StringPtr(task.TargetWorkflowID), - RunId: common.StringPtr(targetRunID), + RunId: common.StringPtr(task.TargetRunID), }, RequestId: common.StringPtr(ri.SignalRequestID), } @@ -923,7 +930,8 @@ func (t *transferQueueProcessorImpl) requestCancelCompleted(task *persistence.Tr initiatedEventID, *request.DomainUUID, *request.CancelRequest.WorkflowExecution.WorkflowId, - common.StringDefault(request.CancelRequest.WorkflowExecution.RunId)) + common.StringDefault(request.CancelRequest.WorkflowExecution.RunId), + ) return nil }) diff --git a/service/history/transferQueueProcessor_test.go b/service/history/transferQueueProcessor_test.go index c7f44473446..4a271261b65 100644 --- a/service/history/transferQueueProcessor_test.go +++ b/service/history/transferQueueProcessor_test.go @@ -336,7 +336,7 @@ func (s *transferQueueProcessorSuite) TestCancelRemoteExecutionTransferTasks() { TargetDomainID: targetDomain, TargetWorkflowID: targetWorkflowID, TargetRunID: targetRunID, - ScheduleID: *initiatedEvent.EventId, + InitiatedID: *initiatedEvent.EventId, }} updatedInfo := copyWorkflowExecutionInfo(builder.executionInfo) err1 := s.UpdateWorkflowExecutionForRequestCancel(updatedInfo, int64(3), transferTasks, @@ -398,7 +398,7 @@ func (s *transferQueueProcessorSuite) TestCancelRemoteExecutionTransferTask_Requ TargetDomainID: targetDomain, TargetWorkflowID: targetWorkflowID, TargetRunID: targetRunID, - ScheduleID: *initiatedEvent.EventId, + InitiatedID: *initiatedEvent.EventId, }} updatedInfo := copyWorkflowExecutionInfo(builder.executionInfo) err1 := s.UpdateWorkflowExecutionForRequestCancel(updatedInfo, int64(3), transferTasks, diff --git a/service/history/workflowExecutionContext.go b/service/history/workflowExecutionContext.go index 0413e6b735a..9e19f690d79 100644 --- a/service/history/workflowExecutionContext.go +++ b/service/history/workflowExecutionContext.go @@ -187,18 +187,17 @@ func (c *workflowExecutionContext) updateWorkflowExecution(transferTasks []persi DeleteTimerInfos: updates.deleteTimerInfos, UpsertChildExecutionInfos: updates.updateChildExecutionInfos, DeleteChildExecutionInfo: updates.deleteChildExecutionInfo, - // TODO (Bowei): looks like a bug in cancel external execution, missing updateinfo - //UpsertRequestCancelInfos: updates.updateCancelExecutionInfos, - //DeleteRequestCancelInfo: updates.deleteCancelExecutionInfo, - UpsertSignalInfos: updates.updateSignalInfos, - DeleteSignalInfo: updates.deleteSignalInfo, - UpsertSignalRequestedIDs: updates.updateSignalRequestedIDs, - DeleteSignalRequestedID: updates.deleteSignalRequestedID, - NewBufferedEvents: updates.newBufferedEvents, - ClearBufferedEvents: updates.clearBufferedEvents, - ContinueAsNew: continueAsNew, - FinishExecution: finishExecution, - FinishedExecutionTTL: finishExecutionTTL, + UpsertRequestCancelInfos: updates.updateCancelExecutionInfos, + DeleteRequestCancelInfo: updates.deleteCancelExecutionInfo, + UpsertSignalInfos: updates.updateSignalInfos, + DeleteSignalInfo: updates.deleteSignalInfo, + UpsertSignalRequestedIDs: updates.updateSignalRequestedIDs, + DeleteSignalRequestedID: updates.deleteSignalRequestedID, + NewBufferedEvents: updates.newBufferedEvents, + ClearBufferedEvents: updates.clearBufferedEvents, + ContinueAsNew: continueAsNew, + FinishExecution: finishExecution, + FinishedExecutionTTL: finishExecutionTTL, }); err1 != nil { switch err1.(type) { case *persistence.ConditionFailedError: diff --git a/service/matching/matchingEngine_test.go b/service/matching/matchingEngine_test.go index 1db55c1eeb5..35b5eab7d6b 100644 --- a/service/matching/matchingEngine_test.go +++ b/service/matching/matchingEngine_test.go @@ -241,9 +241,7 @@ func (s *matchingEngineSuite) PollForTasksEmptyResultTest(taskType int) { }, }) s.NoError(err) - fmt.Printf("%v\n", len(descResp.Pollers)) s.Equal(1, len(descResp.Pollers)) - fmt.Printf("%v\n", descResp.Pollers) s.Equal(identity, descResp.Pollers[0].GetIdentity()) s.NotEmpty(descResp.Pollers[0].GetLastAccessTime()) }