From 6c41f31f337ec8daf97834d09d3632f599875be9 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Sat, 10 Feb 2018 01:13:28 -0800 Subject: [PATCH 1/6] bugfix: request cancel info should be pass down to persistence layer bugfix: cancel workflow control is not used add functionality to allow workflow signal and cancellation to specify target child workflow only --- .gen/go/history/idl.go | 4 +- .gen/go/history/types.go | 108 +++++++- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 234 ++++++++++++++++-- common/persistence/cassandraPersistence.go | 28 ++- .../persistence/cassandraPersistence_test.go | 211 +++++++++++++--- common/persistence/dataInterfaces.go | 44 ++-- idl/github.com/uber/cadence/history.thrift | 3 + idl/github.com/uber/cadence/shared.thrift | 6 + schema/cadence/schema.cql | 22 +- .../add_control_to_request_cancel_info.cql | 1 + ...t_child_workflow_only_to_transfer_task.cql | 1 + schema/cadence/versioned/v0.6/manifest.json | 9 + service/history/historyBuilder.go | 20 +- service/history/historyBuilder_test.go | 231 +++++++++++++++++ service/history/historyEngine.go | 68 +++-- service/history/mutableStateBuilder.go | 88 +++---- service/history/timerQueueProcessor_test.go | 1 - service/history/transferQueueProcessor.go | 48 ++-- .../history/transferQueueProcessor_test.go | 4 +- service/history/workflowExecutionContext.go | 23 +- service/matching/matchingEngine_test.go | 2 - tools/cassandra/updateTask_test.go | 2 +- 23 files changed, 949 insertions(+), 213 deletions(-) create mode 100644 schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql create mode 100644 schema/cadence/versioned/v0.6/add_target_child_workflow_only_to_transfer_task.cql create mode 100644 schema/cadence/versioned/v0.6/manifest.json 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 1a1ed9a5fd7..de6000f38a9 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "e92bac909809ac3c45b878593c2f3bb58e5fbf00", + SHA1: "f9ba7e3ad51ab477460cb998e34297a378eb7138", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\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}\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" +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}\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 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\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 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 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 50: optional binary control\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 419ec56653e..5e4f87c4b99 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -9512,6 +9512,7 @@ type ExternalWorkflowExecutionCancelRequestedEventAttributes struct { InitiatedEventId *int64 `json:"initiatedEventId,omitempty"` Domain *string `json:"domain,omitempty"` WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` + Control []byte `json:"control,omitempty"` } // ToWire translates a ExternalWorkflowExecutionCancelRequestedEventAttributes struct into a Thrift-level intermediate @@ -9531,7 +9532,7 @@ type ExternalWorkflowExecutionCancelRequestedEventAttributes struct { // } func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [3]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error @@ -9561,6 +9562,14 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) ToWire() (wire fields[i] = wire.Field{ID: 30, Value: w} i++ } + if v.Control != nil { + w, err = wire.NewValueBinary(v.Control), 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 } @@ -9614,6 +9623,14 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) FromWire(w wir return err } + } + case 40: + if field.Value.Type() == wire.TBinary { + v.Control, err = field.Value.GetBinary(), error(nil) + if err != nil { + return err + } + } } } @@ -9628,7 +9645,7 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) String() strin return "" } - var fields [3]string + var fields [4]string i := 0 if v.InitiatedEventId != nil { fields[i] = fmt.Sprintf("InitiatedEventId: %v", *(v.InitiatedEventId)) @@ -9642,6 +9659,10 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) String() strin fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution) i++ } + if v.Control != nil { + fields[i] = fmt.Sprintf("Control: %v", v.Control) + i++ + } return fmt.Sprintf("ExternalWorkflowExecutionCancelRequestedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -9660,6 +9681,9 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) Equals(rhs *Ex if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) { return false } + if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { + return false + } return true } @@ -16560,10 +16584,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 @@ -16583,7 +16608,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 @@ -16621,6 +16646,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 } @@ -16684,6 +16717,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 + } + } } } @@ -16698,7 +16741,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)) @@ -16716,6 +16759,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], ", ")) } @@ -16737,6 +16784,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 } @@ -16771,6 +16821,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"` @@ -17064,6 +17124,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 @@ -17083,7 +17144,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 @@ -17121,6 +17182,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 } @@ -17182,6 +17251,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 + } + } } } @@ -17196,7 +17275,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)) @@ -17214,6 +17293,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], ", ")) } @@ -17235,6 +17318,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 } @@ -17259,11 +17345,22 @@ 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"` Identity *string `json:"identity,omitempty"` RequestId *string `json:"requestId,omitempty"` + Control []byte `json:"control,omitempty"` } // ToWire translates a RequestCancelWorkflowExecutionRequest struct into a Thrift-level intermediate @@ -17283,7 +17380,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 @@ -17321,6 +17418,14 @@ func (v *RequestCancelWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 40, Value: w} i++ } + if v.Control != nil { + w, err = wire.NewValueBinary(v.Control), 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 } @@ -17384,6 +17489,14 @@ func (v *RequestCancelWorkflowExecutionRequest) FromWire(w wire.Value) error { return err } + } + case 50: + if field.Value.Type() == wire.TBinary { + v.Control, err = field.Value.GetBinary(), error(nil) + if err != nil { + return err + } + } } } @@ -17398,7 +17511,7 @@ func (v *RequestCancelWorkflowExecutionRequest) String() string { return "" } - var fields [4]string + var fields [5]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -17416,6 +17529,10 @@ func (v *RequestCancelWorkflowExecutionRequest) String() string { fields[i] = fmt.Sprintf("RequestId: %v", *(v.RequestId)) i++ } + if v.Control != nil { + fields[i] = fmt.Sprintf("Control: %v", v.Control) + i++ + } return fmt.Sprintf("RequestCancelWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -17437,6 +17554,9 @@ func (v *RequestCancelWorkflowExecutionRequest) Equals(rhs *RequestCancelWorkflo if !_String_EqualsPtr(v.RequestId, rhs.RequestId) { return false } + if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { + return false + } return true } @@ -20068,11 +20188,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 @@ -20092,7 +20213,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 @@ -20138,6 +20259,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 } @@ -20207,6 +20336,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 + } + } } } @@ -20221,7 +20360,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)) @@ -20243,6 +20382,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], ", ")) } @@ -20267,6 +20410,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 } @@ -20291,6 +20437,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 ( @@ -20707,6 +20863,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 @@ -20726,7 +20883,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 @@ -20780,6 +20937,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 } @@ -20859,6 +21024,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 + } + } } } @@ -20873,7 +21048,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)) @@ -20899,6 +21074,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], ", ")) } @@ -20926,6 +21105,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 } @@ -20960,6 +21142,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..b5bdb7e91c7 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,8 @@ const ( templateRequestCancelInfoType = `{` + `initiated_id: ?, ` + - `cancel_request_id: ?` + + `cancel_request_id: ?, ` + + `control: ?` + `}` templateSignalInfoType = `{` + @@ -1800,6 +1802,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 +1819,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 +1832,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 +1854,7 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT targetDomainID, targetWorkflowID, targetRunID, + targetChildWorkflowOnly, taskList, task.GetType(), scheduleID, @@ -2034,6 +2043,7 @@ func (d *cassandraPersistence) updateRequestCancelInfos(batch *gocql.Batch, requ c.InitiatedID, c.InitiatedID, c.CancelRequestID, + c.Control, d.shardID, rowTypeExecution, domainID, @@ -2278,6 +2288,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": @@ -2379,6 +2394,8 @@ func createRequestCancelInfo(result map[string]interface{}) *RequestCancelInfo { info.InitiatedID = v.(int64) case "cancel_request_id": info.CancelRequestID = v.(string) + case "control": + info.Control = v.([]byte) } } @@ -2525,8 +2542,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..d988e7dd50e 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.") - tasks, err := s.GetTransferTasks(1) + tasks1, err := s.GetTransferTasks(1) 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) + 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"), + } + + 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.") + + 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,12 @@ func (s *cassandraPersistenceSuite) TestWorkflowMutableState_RequestCancel() { updatedInfo.NextEventID = int64(5) updatedInfo.LastProcessedEvent = int64(2) cancelRequestID := uuid.New() - requestCancelInfos := []*RequestCancelInfo{ - { - InitiatedID: 1, - CancelRequestID: cancelRequestID, - }} + control := []byte("some random control information") + requestCancelInfos := []*RequestCancelInfo{{ + InitiatedID: 1, + CancelRequestID: cancelRequestID, + Control: control, + }} err2 := s.UpsertRequestCancelState(updatedInfo, int64(3), requestCancelInfos) s.Nil(err2, "No error expected.") @@ -962,6 +1104,7 @@ func (s *cassandraPersistenceSuite) TestWorkflowMutableState_RequestCancel() { s.NotNil(ri) s.Equal(int64(1), ri.InitiatedID) s.Equal(cancelRequestID, ri.CancelRequestID) + s.Equal(control, ri.Control) err2 = s.DeleteCancelState(updatedInfo, int64(5), int64(1)) s.Nil(err2, "No error expected.") diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index 714fcd6a515..b3b5bd1ecb3 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 @@ -355,6 +358,7 @@ type ( RequestCancelInfo struct { InitiatedID int64 CancelRequestID string + Control []byte } // SignalInfo has details for pending external workflow signal 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 d8f01d64949..742cb41c79f 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -296,6 +296,7 @@ struct RequestCancelExternalWorkflowExecutionDecisionAttributes { 20: optional string workflowId 30: optional string runId 40: optional binary control + 50: optional bool childWorkflowOnly } struct SignalExternalWorkflowExecutionDecisionAttributes { @@ -304,6 +305,7 @@ struct SignalExternalWorkflowExecutionDecisionAttributes { 30: optional string signalName 40: optional binary input 50: optional binary control + 60: optional bool childWorkflowOnly } struct RecordMarkerDecisionAttributes { @@ -535,6 +537,7 @@ struct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { 20: optional string domain 30: optional WorkflowExecution workflowExecution 40: optional binary control + 50: optional bool childWorkflowOnly } struct RequestCancelExternalWorkflowExecutionFailedEventAttributes { @@ -550,6 +553,7 @@ struct ExternalWorkflowExecutionCancelRequestedEventAttributes { 10: optional i64 (js.type = "Long") initiatedEventId 20: optional string domain 30: optional WorkflowExecution workflowExecution + 40: optional binary control } struct SignalExternalWorkflowExecutionInitiatedEventAttributes { @@ -559,6 +563,7 @@ struct SignalExternalWorkflowExecutionInitiatedEventAttributes { 40: optional string signalName 50: optional binary input 60: optional binary control + 70: optional bool childWorkflowOnly } struct SignalExternalWorkflowExecutionFailedEventAttributes { @@ -919,6 +924,7 @@ struct RequestCancelWorkflowExecutionRequest { 20: optional WorkflowExecution workflowExecution 30: optional string identity 40: optional string requestId + 50: optional binary control } struct GetWorkflowExecutionHistoryRequest { diff --git a/schema/cadence/schema.cql b/schema/cadence/schema.cql index ce7dfb44d67..f27beb5f487 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 ( @@ -117,6 +118,7 @@ CREATE TYPE child_execution_info ( CREATE TYPE request_cancel_info ( initiated_id bigint, cancel_request_id text, + control blob, ); -- External workflow signal in progress mutable state diff --git a/schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql b/schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql new file mode 100644 index 00000000000..f548217a256 --- /dev/null +++ b/schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql @@ -0,0 +1 @@ +ALTER TYPE request_cancel_info ADD control blob; \ No newline at end of file diff --git a/schema/cadence/versioned/v0.6/add_target_child_workflow_only_to_transfer_task.cql b/schema/cadence/versioned/v0.6/add_target_child_workflow_only_to_transfer_task.cql new file mode 100644 index 00000000000..344073c892b --- /dev/null +++ b/schema/cadence/versioned/v0.6/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.6/manifest.json b/schema/cadence/versioned/v0.6/manifest.json new file mode 100644 index 00000000000..65995165c7d --- /dev/null +++ b/schema/cadence/versioned/v0.6/manifest.json @@ -0,0 +1,9 @@ +{ + "CurrVersion": "0.6", + "MinCompatibleVersion": "0.6", + "Description": "add control to request cancel info, add target child workflow only to transfer task", + "SchemaUpdateCqlFiles": [ + "add_control_to_request_cancel_info.cql", + "add_target_child_workflow_only_to_transfer_task.cql" + ] +} diff --git a/service/history/historyBuilder.go b/service/history/historyBuilder.go index 8db1c615739..3eb9bf757ae 100644 --- a/service/history/historyBuilder.go +++ b/service/history/historyBuilder.go @@ -295,17 +295,17 @@ func (b *historyBuilder) AddRequestCancelExternalWorkflowExecutionInitiatedEvent } func (b *historyBuilder) AddRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedEventID int64, - domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { event := b.newRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedEventID, - domain, workflowID, runID, cause) + domain, workflowID, runID, control, cause) return b.addEventToHistory(event) } func (b *historyBuilder) AddExternalWorkflowExecutionCancelRequested(initiatedEventID int64, - domain, workflowID, runID string) *workflow.HistoryEvent { + domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { event := b.newExternalWorkflowExecutionCancelRequestedEvent(initiatedEventID, - domain, workflowID, runID) + domain, workflowID, runID, control) return b.addEventToHistory(event) } @@ -659,17 +659,18 @@ func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionInitiatedEvent attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID) attributes.Domain = common.StringPtr(*request.Domain) attributes.WorkflowExecution = &workflow.WorkflowExecution{ - WorkflowId: common.StringPtr(*request.WorkflowId), - RunId: common.StringPtr(*request.RunId), + WorkflowId: common.StringPtr(request.GetWorkflowId()), + RunId: common.StringPtr(request.GetRunId()), } attributes.Control = request.Control + attributes.ChildWorkflowOnly = request.ChildWorkflowOnly event.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes = attributes return event } func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedEventID int64, - domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { event := b.msBuilder.createNewHistoryEvent(workflow.EventTypeRequestCancelExternalWorkflowExecutionFailed) attributes := &workflow.RequestCancelExternalWorkflowExecutionFailedEventAttributes{} attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID) @@ -679,6 +680,7 @@ func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionFailedEvent(de WorkflowId: common.StringPtr(workflowID), RunId: common.StringPtr(runID), } + attributes.Control = control attributes.Cause = common.CancelExternalWorkflowExecutionFailedCausePtr(cause) event.RequestCancelExternalWorkflowExecutionFailedEventAttributes = attributes @@ -686,7 +688,7 @@ func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionFailedEvent(de } func (b *historyBuilder) newExternalWorkflowExecutionCancelRequestedEvent(initiatedEventID int64, - domain, workflowID, runID string) *workflow.HistoryEvent { + domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { event := b.msBuilder.createNewHistoryEvent(workflow.EventTypeExternalWorkflowExecutionCancelRequested) attributes := &workflow.ExternalWorkflowExecutionCancelRequestedEventAttributes{} attributes.InitiatedEventId = common.Int64Ptr(initiatedEventID) @@ -695,6 +697,7 @@ func (b *historyBuilder) newExternalWorkflowExecutionCancelRequestedEvent(initia WorkflowId: common.StringPtr(workflowID), RunId: common.StringPtr(runID), } + attributes.Control = control event.ExternalWorkflowExecutionCancelRequestedEventAttributes = attributes return event @@ -713,6 +716,7 @@ func (b *historyBuilder) newSignalExternalWorkflowExecutionInitiatedEvent(decisi 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..882b45dbeba 100644 --- a/service/history/historyBuilder_test.go +++ b/service/history/historyBuilder_test.go @@ -465,6 +465,153 @@ 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"), + } + cancellationControl := []byte("some random cancellation control") + cancellationChildWorkflowOnly := true + cancellationInitiatedEvent := s.addRequestCancelExternalWorkflowExecutionInitiatedEvent( + 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + ) + s.validateRequestCancelExternalWorkflowExecutionInitiatedEvent( + cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + ) + s.Equal(int64(6), s.getNextEventID()) + + cancellationRequestedEvent := s.addExternalWorkflowExecutionCancelRequested( + 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), cancellationControl, + ) + s.validateExternalWorkflowExecutionCancelRequested( + cancellationRequestedEvent, 6, 5, targetDomain, targetExecution, cancellationControl, + ) + 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"), + } + cancellationControl := []byte("some random cancellation control") + cancellationChildWorkflowOnly := true + cancellationFailedCause := workflow.CancelExternalWorkflowExecutionFailedCause(59) + cancellationInitiatedEvent := s.addRequestCancelExternalWorkflowExecutionInitiatedEvent( + 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + ) + s.validateRequestCancelExternalWorkflowExecutionInitiatedEvent( + cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + ) + s.Equal(int64(6), s.getNextEventID()) + + cancellationRequestedEvent := s.addRequestCancelExternalWorkflowExecutionFailedEvent( + 4, 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), cancellationControl, cancellationFailedCause, + ) + s.validateRequestCancelExternalWorkflowExecutionFailedEvent( + cancellationRequestedEvent, 6, 4, 5, targetDomain, targetExecution, cancellationControl, cancellationFailedCause, + ) + s.Equal(int64(7), s.getNextEventID()) +} + func (s *historyBuilderSuite) getNextEventID() int64 { return s.msBuilder.executionInfo.NextEventID } @@ -561,6 +708,41 @@ func (s *historyBuilderSuite) addActivityTaskFailedEvent(scheduleID, startedID i return e } +func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionInitiatedEvent( + decisionCompletedEventID int64, targetDomain string, targetExecution workflow.WorkflowExecution, + targetControl []byte, childWorkflowOnly bool) *workflow.HistoryEvent { + e, _ := s.msBuilder.AddRequestCancelExternalWorkflowExecutionInitiatedEvent( + decisionCompletedEventID, + uuid.New(), + &workflow.RequestCancelExternalWorkflowExecutionDecisionAttributes{ + Domain: common.StringPtr(targetDomain), + WorkflowId: targetExecution.WorkflowId, + RunId: targetExecution.RunId, + Control: targetControl, + ChildWorkflowOnly: common.BoolPtr(childWorkflowOnly), + }, + ) + + return e +} + +func (s *historyBuilderSuite) addExternalWorkflowExecutionCancelRequested( + initiatedID int64, domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { + + return s.msBuilder.AddExternalWorkflowExecutionCancelRequested( + initiatedID, domain, workflowID, runID, control, + ) +} + +func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionFailedEvent( + decisionTaskCompletedEventID, initiatedID int64, + domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + + return s.msBuilder.AddRequestCancelExternalWorkflowExecutionFailedEvent( + decisionTaskCompletedEventID, initiatedID, domain, workflowID, runID, control, cause, + ) +} + func (s *historyBuilderSuite) validateWorkflowExecutionStartedEvent(event *workflow.HistoryEvent, workflowType, taskList string, input []byte, executionStartToCloseTimeout, taskStartToCloseTimeout int32, identity string) { s.NotNil(event) @@ -662,6 +844,55 @@ 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, control []byte, 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(control, attributes.Control) + s.Equal(childWorkflowOnly, *attributes.ChildWorkflowOnly) +} + +func (s *historyBuilderSuite) validateExternalWorkflowExecutionCancelRequested( + event *workflow.HistoryEvent, eventID, initiatedEventID int64, + domain string, execution workflow.WorkflowExecution, control []byte) { + 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()) + s.Equal(control, attributes.Control) +} + +func (s *historyBuilderSuite) validateRequestCancelExternalWorkflowExecutionFailedEvent( + event *workflow.HistoryEvent, eventID, decisionTaskCompletedEventID, initiatedEventID int64, + domain string, execution workflow.WorkflowExecution, control []byte, + 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(control, attributes.Control) + 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 aee800c1a3b..5380f4bd94c 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.BadRequestError{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,10 @@ Update_History_Loop: break Process_Decision_Loop } - foreignDomainEntry, err := e.domainCache.GetDomain(*attributes.Domain) + foreignDomainEntry, err := e.domainCache.GetDomain(attributes.GetDomain()) if err != nil { return &workflow.InternalServiceError{ - Message: fmt.Sprintf("Unable to cancel workflow across domain: %v.", - *attributes.Domain)} + Message: fmt.Sprintf("Unable to cancel workflow across domain: %v.", attributes.GetDomain())} } cancelRequestID := uuid.New() @@ -993,10 +995,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: foreignDomainEntry.Info.ID, + TargetWorkflowID: attributes.GetWorkflowId(), + TargetRunID: attributes.GetRunId(), + TargetChildWorkflowOnly: attributes.GetChildWorkflowOnly(), + InitiatedID: wfCancelReqEvent.GetEventId(), }) case workflow.DecisionTypeSignalExternalWorkflowExecution: @@ -1025,10 +1028,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: foreignDomainEntry.Info.ID, + TargetWorkflowID: attributes.Execution.GetWorkflowId(), + TargetRunID: attributes.Execution.GetRunId(), + TargetChildWorkflowOnly: attributes.GetChildWorkflowOnly(), + InitiatedID: wfSignalReqEvent.GetEventId(), }) case workflow.DecisionTypeContinueAsNewWorkflowExecution: @@ -1448,18 +1452,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 @@ -1469,10 +1483,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 { @@ -1489,6 +1502,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, @@ -1500,6 +1515,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) { @@ -1940,10 +1964,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 7e021607f46..2a152d09716 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 @@ -1330,6 +1329,7 @@ func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionInitiated ri := &persistence.RequestCancelInfo{ InitiatedID: initiatedEventID, CancelRequestID: cancelRequestID, + Control: request.Control, } e.pendingRequestCancelInfoIDs[initiatedEventID] = ri @@ -1339,7 +1339,7 @@ func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionInitiated } func (e *mutableStateBuilder) AddExternalWorkflowExecutionCancelRequested(initiatedID int64, - domain, workflowID, runID string) *workflow.HistoryEvent { + domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { _, ok := e.GetRequestCancelInfo(initiatedID) if !ok { logging.LogInvalidHistoryActionEvent(e.logger, logging.TagValueActionWorkflowCancelRequested, e.GetNextEventID(), @@ -1349,7 +1349,7 @@ func (e *mutableStateBuilder) AddExternalWorkflowExecutionCancelRequested(initia } if e.DeletePendingRequestCancel(initiatedID) == nil { - return e.hBuilder.AddExternalWorkflowExecutionCancelRequested(initiatedID, domain, workflowID, runID) + return e.hBuilder.AddExternalWorkflowExecutionCancelRequested(initiatedID, domain, workflowID, runID, control) } return nil @@ -1357,7 +1357,7 @@ func (e *mutableStateBuilder) AddExternalWorkflowExecutionCancelRequested(initia func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionFailedEvent( decisionTaskCompletedEventID, initiatedID int64, - domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { _, ok := e.GetRequestCancelInfo(initiatedID) if !ok { logging.LogInvalidHistoryActionEvent(e.logger, logging.TagValueActionWorkflowCancelFailed, e.GetNextEventID(), @@ -1368,7 +1368,7 @@ func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionFailedEve if e.DeletePendingRequestCancel(initiatedID) == nil { return e.hBuilder.AddRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedID, - domain, workflowID, runID, cause) + domain, workflowID, runID, control, cause) } return 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 6ff8122d1c0..7f835479393 100644 --- a/service/history/transferQueueProcessor.go +++ b/service/history/transferQueueProcessor.go @@ -229,6 +229,14 @@ func (t *transferQueueProcessorImpl) processTransferTasks(tasksCh chan<- *persis return } + // here we may have a serious bug + // 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 serious of decitions, one depend on another, + // e.g. 1. start child workflow; 2. signal this workflow, the execution order + // is not guatanteed. so, client can experience weird situation. + // one way of solving this is to send all tasks of a workflow to one worker, + // i.e. do a workflow ID -> worker mapping for _, tsk := range tasks { tasksCh <- tsk } @@ -510,8 +518,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 +543,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{ @@ -550,13 +559,14 @@ func (t *transferQueueProcessorImpl) processCancelExecution(task *persistence.Tr Identity: common.StringPtr(identityHistoryService), // Use the same request ID to dedupe RequestCancelWorkflowExecution calls RequestId: common.StringPtr(ri.CancelRequestID), + Control: ri.Control, }, - // 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 +576,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 +583,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 +665,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 +680,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 +718,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 +934,9 @@ 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), + request.CancelRequest.Control, + ) return nil }) @@ -978,6 +991,7 @@ func (t *transferQueueProcessorImpl) requestCancelFailed(task *persistence.Trans *request.DomainUUID, *request.CancelRequest.WorkflowExecution.WorkflowId, common.StringDefault(request.CancelRequest.WorkflowExecution.RunId), + request.CancelRequest.Control, workflow.CancelExternalWorkflowExecutionFailedCauseUnknownExternalWorkflowExecution) 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()) } diff --git a/tools/cassandra/updateTask_test.go b/tools/cassandra/updateTask_test.go index 12a1dafdd8a..0eba412f876 100644 --- a/tools/cassandra/updateTask_test.go +++ b/tools/cassandra/updateTask_test.go @@ -130,7 +130,7 @@ func (s *UpdateSchemaTestSuite) TestDryrun() { s.Nil(err) // update the version to the latest s.log.Infof("Ver: %v", ver) - s.Equal(0, cmpVersion(ver, "0.5")) + s.Equal(0, cmpVersion(ver, "0.6")) dropAllTablesTypes(client) } From 8b87f531f0d660a34691fa0eb286f503995320a8 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Mon, 12 Feb 2018 10:32:29 -0800 Subject: [PATCH 2/6] address comments --- service/history/historyBuilder.go | 12 +++++------ service/history/historyEngine.go | 33 ++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/service/history/historyBuilder.go b/service/history/historyBuilder.go index 3eb9bf757ae..9ab0b1f6038 100644 --- a/service/history/historyBuilder.go +++ b/service/history/historyBuilder.go @@ -657,10 +657,10 @@ 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.GetWorkflowId()), - RunId: common.StringPtr(request.GetRunId()), + WorkflowId: request.WorkflowId, + RunId: request.RunId, } attributes.Control = request.Control attributes.ChildWorkflowOnly = request.ChildWorkflowOnly @@ -708,10 +708,10 @@ 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 diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index 5380f4bd94c..fb808a09bbd 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -981,10 +981,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 cancel 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 cancel workflow across domain: %v.", attributes.GetDomain())} + } + foreignDomainID = foreignDomainEntry.Info.ID } cancelRequestID := uuid.New() @@ -995,7 +1001,7 @@ Update_History_Loop: } transferTasks = append(transferTasks, &persistence.CancelExecutionTask{ - TargetDomainID: foreignDomainEntry.Info.ID, + TargetDomainID: foreignDomainID, TargetWorkflowID: attributes.GetWorkflowId(), TargetRunID: attributes.GetRunId(), TargetChildWorkflowOnly: attributes.GetChildWorkflowOnly(), @@ -1013,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 @@ -1028,7 +1039,7 @@ Update_History_Loop: } transferTasks = append(transferTasks, &persistence.SignalExecutionTask{ - TargetDomainID: foreignDomainEntry.Info.ID, + TargetDomainID: foreignDomainID, TargetWorkflowID: attributes.Execution.GetWorkflowId(), TargetRunID: attributes.Execution.GetRunId(), TargetChildWorkflowOnly: attributes.GetChildWorkflowOnly(), From 17ba10037c3c5b9ef585ccdad17c71b1e3a63ef5 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Tue, 13 Feb 2018 18:17:46 -0800 Subject: [PATCH 3/6] remove propagation of control for cancel external workflow, due to issue #405 on the client side --- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 56 ++----------------- common/persistence/cassandraPersistence.go | 6 +- .../persistence/cassandraPersistence_test.go | 3 - common/persistence/dataInterfaces.go | 1 - idl/github.com/uber/cadence/shared.thrift | 2 - schema/cadence/schema.cql | 1 - .../add_control_to_request_cancel_info.cql | 1 - schema/cadence/versioned/v0.6/manifest.json | 3 +- service/history/historyBuilder.go | 14 ++--- service/history/historyBuilder_test.go | 39 ++++++------- service/history/mutableStateBuilder.go | 9 ++- service/history/transferQueueProcessor.go | 3 - 13 files changed, 34 insertions(+), 108 deletions(-) delete mode 100644 schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index de6000f38a9..102f18b2d4c 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "f9ba7e3ad51ab477460cb998e34297a378eb7138", + SHA1: "a3d2adbdae0d2e1276fefcb241b47316844ed628", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\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}\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 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\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 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 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 50: optional binary control\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" +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}\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 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n}\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 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 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 5e4f87c4b99..277a97bfc88 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -9512,7 +9512,6 @@ type ExternalWorkflowExecutionCancelRequestedEventAttributes struct { InitiatedEventId *int64 `json:"initiatedEventId,omitempty"` Domain *string `json:"domain,omitempty"` WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` - Control []byte `json:"control,omitempty"` } // ToWire translates a ExternalWorkflowExecutionCancelRequestedEventAttributes struct into a Thrift-level intermediate @@ -9532,7 +9531,7 @@ type ExternalWorkflowExecutionCancelRequestedEventAttributes struct { // } func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [3]wire.Field i int = 0 w wire.Value err error @@ -9562,14 +9561,6 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) ToWire() (wire fields[i] = wire.Field{ID: 30, Value: w} i++ } - if v.Control != nil { - w, err = wire.NewValueBinary(v.Control), 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 } @@ -9623,14 +9614,6 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) FromWire(w wir return err } - } - case 40: - if field.Value.Type() == wire.TBinary { - v.Control, err = field.Value.GetBinary(), error(nil) - if err != nil { - return err - } - } } } @@ -9645,7 +9628,7 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) String() strin return "" } - var fields [4]string + var fields [3]string i := 0 if v.InitiatedEventId != nil { fields[i] = fmt.Sprintf("InitiatedEventId: %v", *(v.InitiatedEventId)) @@ -9659,10 +9642,6 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) String() strin fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution) i++ } - if v.Control != nil { - fields[i] = fmt.Sprintf("Control: %v", v.Control) - i++ - } return fmt.Sprintf("ExternalWorkflowExecutionCancelRequestedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -9681,9 +9660,6 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) Equals(rhs *Ex if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) { return false } - if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { - return false - } return true } @@ -17360,7 +17336,6 @@ type RequestCancelWorkflowExecutionRequest struct { WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` Identity *string `json:"identity,omitempty"` RequestId *string `json:"requestId,omitempty"` - Control []byte `json:"control,omitempty"` } // ToWire translates a RequestCancelWorkflowExecutionRequest struct into a Thrift-level intermediate @@ -17380,7 +17355,7 @@ type RequestCancelWorkflowExecutionRequest struct { // } func (v *RequestCancelWorkflowExecutionRequest) ToWire() (wire.Value, error) { var ( - fields [5]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error @@ -17418,14 +17393,6 @@ func (v *RequestCancelWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 40, Value: w} i++ } - if v.Control != nil { - w, err = wire.NewValueBinary(v.Control), 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 } @@ -17489,14 +17456,6 @@ func (v *RequestCancelWorkflowExecutionRequest) FromWire(w wire.Value) error { return err } - } - case 50: - if field.Value.Type() == wire.TBinary { - v.Control, err = field.Value.GetBinary(), error(nil) - if err != nil { - return err - } - } } } @@ -17511,7 +17470,7 @@ func (v *RequestCancelWorkflowExecutionRequest) String() string { return "" } - var fields [5]string + var fields [4]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -17529,10 +17488,6 @@ func (v *RequestCancelWorkflowExecutionRequest) String() string { fields[i] = fmt.Sprintf("RequestId: %v", *(v.RequestId)) i++ } - if v.Control != nil { - fields[i] = fmt.Sprintf("Control: %v", v.Control) - i++ - } return fmt.Sprintf("RequestCancelWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -17554,9 +17509,6 @@ func (v *RequestCancelWorkflowExecutionRequest) Equals(rhs *RequestCancelWorkflo if !_String_EqualsPtr(v.RequestId, rhs.RequestId) { return false } - if !((v.Control == nil && rhs.Control == nil) || (v.Control != nil && rhs.Control != nil && bytes.Equal(v.Control, rhs.Control))) { - return false - } return true } diff --git a/common/persistence/cassandraPersistence.go b/common/persistence/cassandraPersistence.go index b5bdb7e91c7..bc0508ba1ad 100644 --- a/common/persistence/cassandraPersistence.go +++ b/common/persistence/cassandraPersistence.go @@ -204,8 +204,7 @@ const ( templateRequestCancelInfoType = `{` + `initiated_id: ?, ` + - `cancel_request_id: ?, ` + - `control: ?` + + `cancel_request_id: ? ` + `}` templateSignalInfoType = `{` + @@ -2043,7 +2042,6 @@ func (d *cassandraPersistence) updateRequestCancelInfos(batch *gocql.Batch, requ c.InitiatedID, c.InitiatedID, c.CancelRequestID, - c.Control, d.shardID, rowTypeExecution, domainID, @@ -2394,8 +2392,6 @@ func createRequestCancelInfo(result map[string]interface{}) *RequestCancelInfo { info.InitiatedID = v.(int64) case "cancel_request_id": info.CancelRequestID = v.(string) - case "control": - info.Control = v.([]byte) } } diff --git a/common/persistence/cassandraPersistence_test.go b/common/persistence/cassandraPersistence_test.go index d988e7dd50e..2858a3700b9 100644 --- a/common/persistence/cassandraPersistence_test.go +++ b/common/persistence/cassandraPersistence_test.go @@ -1086,11 +1086,9 @@ func (s *cassandraPersistenceSuite) TestWorkflowMutableState_RequestCancel() { updatedInfo.NextEventID = int64(5) updatedInfo.LastProcessedEvent = int64(2) cancelRequestID := uuid.New() - control := []byte("some random control information") requestCancelInfos := []*RequestCancelInfo{{ InitiatedID: 1, CancelRequestID: cancelRequestID, - Control: control, }} err2 := s.UpsertRequestCancelState(updatedInfo, int64(3), requestCancelInfos) s.Nil(err2, "No error expected.") @@ -1104,7 +1102,6 @@ func (s *cassandraPersistenceSuite) TestWorkflowMutableState_RequestCancel() { s.NotNil(ri) s.Equal(int64(1), ri.InitiatedID) s.Equal(cancelRequestID, ri.CancelRequestID) - s.Equal(control, ri.Control) err2 = s.DeleteCancelState(updatedInfo, int64(5), int64(1)) s.Nil(err2, "No error expected.") diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index b3b5bd1ecb3..3a8a982fe5f 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -358,7 +358,6 @@ type ( RequestCancelInfo struct { InitiatedID int64 CancelRequestID string - Control []byte } // SignalInfo has details for pending external workflow signal diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 742cb41c79f..49e7223a598 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -553,7 +553,6 @@ struct ExternalWorkflowExecutionCancelRequestedEventAttributes { 10: optional i64 (js.type = "Long") initiatedEventId 20: optional string domain 30: optional WorkflowExecution workflowExecution - 40: optional binary control } struct SignalExternalWorkflowExecutionInitiatedEventAttributes { @@ -924,7 +923,6 @@ struct RequestCancelWorkflowExecutionRequest { 20: optional WorkflowExecution workflowExecution 30: optional string identity 40: optional string requestId - 50: optional binary control } struct GetWorkflowExecutionHistoryRequest { diff --git a/schema/cadence/schema.cql b/schema/cadence/schema.cql index f27beb5f487..7909459d669 100644 --- a/schema/cadence/schema.cql +++ b/schema/cadence/schema.cql @@ -118,7 +118,6 @@ CREATE TYPE child_execution_info ( CREATE TYPE request_cancel_info ( initiated_id bigint, cancel_request_id text, - control blob, ); -- External workflow signal in progress mutable state diff --git a/schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql b/schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql deleted file mode 100644 index f548217a256..00000000000 --- a/schema/cadence/versioned/v0.6/add_control_to_request_cancel_info.cql +++ /dev/null @@ -1 +0,0 @@ -ALTER TYPE request_cancel_info ADD control blob; \ No newline at end of file diff --git a/schema/cadence/versioned/v0.6/manifest.json b/schema/cadence/versioned/v0.6/manifest.json index 65995165c7d..77e2d09d520 100644 --- a/schema/cadence/versioned/v0.6/manifest.json +++ b/schema/cadence/versioned/v0.6/manifest.json @@ -1,9 +1,8 @@ { "CurrVersion": "0.6", "MinCompatibleVersion": "0.6", - "Description": "add control to request cancel info, add target child workflow only to transfer task", + "Description": "add target child workflow only to transfer task", "SchemaUpdateCqlFiles": [ - "add_control_to_request_cancel_info.cql", "add_target_child_workflow_only_to_transfer_task.cql" ] } diff --git a/service/history/historyBuilder.go b/service/history/historyBuilder.go index 9ab0b1f6038..dce2597ff2d 100644 --- a/service/history/historyBuilder.go +++ b/service/history/historyBuilder.go @@ -295,17 +295,17 @@ func (b *historyBuilder) AddRequestCancelExternalWorkflowExecutionInitiatedEvent } func (b *historyBuilder) AddRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedEventID int64, - domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { event := b.newRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedEventID, - domain, workflowID, runID, control, cause) + domain, workflowID, runID, cause) return b.addEventToHistory(event) } func (b *historyBuilder) AddExternalWorkflowExecutionCancelRequested(initiatedEventID int64, - domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { + domain, workflowID, runID string) *workflow.HistoryEvent { event := b.newExternalWorkflowExecutionCancelRequestedEvent(initiatedEventID, - domain, workflowID, runID, control) + domain, workflowID, runID) return b.addEventToHistory(event) } @@ -670,7 +670,7 @@ func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionInitiatedEvent } func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedEventID int64, - domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { event := b.msBuilder.createNewHistoryEvent(workflow.EventTypeRequestCancelExternalWorkflowExecutionFailed) attributes := &workflow.RequestCancelExternalWorkflowExecutionFailedEventAttributes{} attributes.DecisionTaskCompletedEventId = common.Int64Ptr(decisionTaskCompletedEventID) @@ -680,7 +680,6 @@ func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionFailedEvent(de WorkflowId: common.StringPtr(workflowID), RunId: common.StringPtr(runID), } - attributes.Control = control attributes.Cause = common.CancelExternalWorkflowExecutionFailedCausePtr(cause) event.RequestCancelExternalWorkflowExecutionFailedEventAttributes = attributes @@ -688,7 +687,7 @@ func (b *historyBuilder) newRequestCancelExternalWorkflowExecutionFailedEvent(de } func (b *historyBuilder) newExternalWorkflowExecutionCancelRequestedEvent(initiatedEventID int64, - domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { + domain, workflowID, runID string) *workflow.HistoryEvent { event := b.msBuilder.createNewHistoryEvent(workflow.EventTypeExternalWorkflowExecutionCancelRequested) attributes := &workflow.ExternalWorkflowExecutionCancelRequestedEventAttributes{} attributes.InitiatedEventId = common.Int64Ptr(initiatedEventID) @@ -697,7 +696,6 @@ func (b *historyBuilder) newExternalWorkflowExecutionCancelRequestedEvent(initia WorkflowId: common.StringPtr(workflowID), RunId: common.StringPtr(runID), } - attributes.Control = control event.ExternalWorkflowExecutionCancelRequestedEventAttributes = attributes return event diff --git a/service/history/historyBuilder_test.go b/service/history/historyBuilder_test.go index 882b45dbeba..c547b90efb9 100644 --- a/service/history/historyBuilder_test.go +++ b/service/history/historyBuilder_test.go @@ -519,21 +519,20 @@ func (s *historyBuilderSuite) TestHistoryBuilderWorkflowCancellationRequested() WorkflowId: common.StringPtr("some random target workflow ID"), RunId: common.StringPtr("some random target run ID"), } - cancellationControl := []byte("some random cancellation control") cancellationChildWorkflowOnly := true cancellationInitiatedEvent := s.addRequestCancelExternalWorkflowExecutionInitiatedEvent( - 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, ) s.validateRequestCancelExternalWorkflowExecutionInitiatedEvent( - cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, ) s.Equal(int64(6), s.getNextEventID()) cancellationRequestedEvent := s.addExternalWorkflowExecutionCancelRequested( - 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), cancellationControl, + 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), ) s.validateExternalWorkflowExecutionCancelRequested( - cancellationRequestedEvent, 6, 5, targetDomain, targetExecution, cancellationControl, + cancellationRequestedEvent, 6, 5, targetDomain, targetExecution, ) s.Equal(int64(7), s.getNextEventID()) } @@ -592,22 +591,21 @@ func (s *historyBuilderSuite) TestHistoryBuilderWorkflowCancellationFailed() { WorkflowId: common.StringPtr("some random target workflow ID"), RunId: common.StringPtr("some random target run ID"), } - cancellationControl := []byte("some random cancellation control") cancellationChildWorkflowOnly := true cancellationFailedCause := workflow.CancelExternalWorkflowExecutionFailedCause(59) cancellationInitiatedEvent := s.addRequestCancelExternalWorkflowExecutionInitiatedEvent( - 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, ) s.validateRequestCancelExternalWorkflowExecutionInitiatedEvent( - cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationControl, cancellationChildWorkflowOnly, + cancellationInitiatedEvent, 5, 4, targetDomain, targetExecution, cancellationChildWorkflowOnly, ) s.Equal(int64(6), s.getNextEventID()) cancellationRequestedEvent := s.addRequestCancelExternalWorkflowExecutionFailedEvent( - 4, 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), cancellationControl, cancellationFailedCause, + 4, 5, targetDomain, targetExecution.GetWorkflowId(), targetExecution.GetRunId(), cancellationFailedCause, ) s.validateRequestCancelExternalWorkflowExecutionFailedEvent( - cancellationRequestedEvent, 6, 4, 5, targetDomain, targetExecution, cancellationControl, cancellationFailedCause, + cancellationRequestedEvent, 6, 4, 5, targetDomain, targetExecution, cancellationFailedCause, ) s.Equal(int64(7), s.getNextEventID()) } @@ -710,7 +708,7 @@ func (s *historyBuilderSuite) addActivityTaskFailedEvent(scheduleID, startedID i func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionInitiatedEvent( decisionCompletedEventID int64, targetDomain string, targetExecution workflow.WorkflowExecution, - targetControl []byte, childWorkflowOnly bool) *workflow.HistoryEvent { + childWorkflowOnly bool) *workflow.HistoryEvent { e, _ := s.msBuilder.AddRequestCancelExternalWorkflowExecutionInitiatedEvent( decisionCompletedEventID, uuid.New(), @@ -718,7 +716,6 @@ func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionInitiated Domain: common.StringPtr(targetDomain), WorkflowId: targetExecution.WorkflowId, RunId: targetExecution.RunId, - Control: targetControl, ChildWorkflowOnly: common.BoolPtr(childWorkflowOnly), }, ) @@ -727,19 +724,19 @@ func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionInitiated } func (s *historyBuilderSuite) addExternalWorkflowExecutionCancelRequested( - initiatedID int64, domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { + initiatedID int64, domain, workflowID, runID string) *workflow.HistoryEvent { return s.msBuilder.AddExternalWorkflowExecutionCancelRequested( - initiatedID, domain, workflowID, runID, control, + initiatedID, domain, workflowID, runID, ) } func (s *historyBuilderSuite) addRequestCancelExternalWorkflowExecutionFailedEvent( decisionTaskCompletedEventID, initiatedID int64, - domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { return s.msBuilder.AddRequestCancelExternalWorkflowExecutionFailedEvent( - decisionTaskCompletedEventID, initiatedID, domain, workflowID, runID, control, cause, + decisionTaskCompletedEventID, initiatedID, domain, workflowID, runID, cause, ) } @@ -846,7 +843,7 @@ func (s *historyBuilderSuite) validateActivityTaskFailedEvent(event *workflow.Hi func (s *historyBuilderSuite) validateRequestCancelExternalWorkflowExecutionInitiatedEvent( event *workflow.HistoryEvent, eventID, decisionTaskCompletedEventID int64, - domain string, execution workflow.WorkflowExecution, control []byte, childWorkflowOnly bool) { + domain string, execution workflow.WorkflowExecution, childWorkflowOnly bool) { s.NotNil(event) s.Equal(workflow.EventTypeRequestCancelExternalWorkflowExecutionInitiated, *event.EventType) s.Equal(eventID, *event.EventId) @@ -856,13 +853,12 @@ func (s *historyBuilderSuite) validateRequestCancelExternalWorkflowExecutionInit s.Equal(domain, attributes.GetDomain()) s.Equal(execution.GetWorkflowId(), attributes.WorkflowExecution.GetWorkflowId()) s.Equal(execution.GetRunId(), attributes.WorkflowExecution.GetRunId()) - s.Equal(control, attributes.Control) s.Equal(childWorkflowOnly, *attributes.ChildWorkflowOnly) } func (s *historyBuilderSuite) validateExternalWorkflowExecutionCancelRequested( event *workflow.HistoryEvent, eventID, initiatedEventID int64, - domain string, execution workflow.WorkflowExecution, control []byte) { + domain string, execution workflow.WorkflowExecution) { s.NotNil(event) s.Equal(workflow.EventTypeExternalWorkflowExecutionCancelRequested, *event.EventType) s.Equal(eventID, *event.EventId) @@ -872,13 +868,11 @@ func (s *historyBuilderSuite) validateExternalWorkflowExecutionCancelRequested( s.Equal(domain, attributes.GetDomain()) s.Equal(execution.GetWorkflowId(), attributes.WorkflowExecution.GetWorkflowId()) s.Equal(execution.GetRunId(), attributes.WorkflowExecution.GetRunId()) - s.Equal(control, attributes.Control) } func (s *historyBuilderSuite) validateRequestCancelExternalWorkflowExecutionFailedEvent( event *workflow.HistoryEvent, eventID, decisionTaskCompletedEventID, initiatedEventID int64, - domain string, execution workflow.WorkflowExecution, control []byte, - cause workflow.CancelExternalWorkflowExecutionFailedCause) { + domain string, execution workflow.WorkflowExecution, cause workflow.CancelExternalWorkflowExecutionFailedCause) { s.NotNil(event) s.Equal(workflow.EventTypeRequestCancelExternalWorkflowExecutionFailed, *event.EventType) s.Equal(eventID, *event.EventId) @@ -889,7 +883,6 @@ func (s *historyBuilderSuite) validateRequestCancelExternalWorkflowExecutionFail s.Equal(domain, attributes.GetDomain()) s.Equal(execution.GetWorkflowId(), attributes.WorkflowExecution.GetWorkflowId()) s.Equal(execution.GetRunId(), attributes.WorkflowExecution.GetRunId()) - s.Equal(control, attributes.Control) s.Equal(cause, *attributes.Cause) } diff --git a/service/history/mutableStateBuilder.go b/service/history/mutableStateBuilder.go index 2a152d09716..1f0d13e9dbe 100644 --- a/service/history/mutableStateBuilder.go +++ b/service/history/mutableStateBuilder.go @@ -1329,7 +1329,6 @@ func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionInitiated ri := &persistence.RequestCancelInfo{ InitiatedID: initiatedEventID, CancelRequestID: cancelRequestID, - Control: request.Control, } e.pendingRequestCancelInfoIDs[initiatedEventID] = ri @@ -1339,7 +1338,7 @@ func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionInitiated } func (e *mutableStateBuilder) AddExternalWorkflowExecutionCancelRequested(initiatedID int64, - domain, workflowID, runID string, control []byte) *workflow.HistoryEvent { + domain, workflowID, runID string) *workflow.HistoryEvent { _, ok := e.GetRequestCancelInfo(initiatedID) if !ok { logging.LogInvalidHistoryActionEvent(e.logger, logging.TagValueActionWorkflowCancelRequested, e.GetNextEventID(), @@ -1349,7 +1348,7 @@ func (e *mutableStateBuilder) AddExternalWorkflowExecutionCancelRequested(initia } if e.DeletePendingRequestCancel(initiatedID) == nil { - return e.hBuilder.AddExternalWorkflowExecutionCancelRequested(initiatedID, domain, workflowID, runID, control) + return e.hBuilder.AddExternalWorkflowExecutionCancelRequested(initiatedID, domain, workflowID, runID) } return nil @@ -1357,7 +1356,7 @@ func (e *mutableStateBuilder) AddExternalWorkflowExecutionCancelRequested(initia func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionFailedEvent( decisionTaskCompletedEventID, initiatedID int64, - domain, workflowID, runID string, control []byte, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { + domain, workflowID, runID string, cause workflow.CancelExternalWorkflowExecutionFailedCause) *workflow.HistoryEvent { _, ok := e.GetRequestCancelInfo(initiatedID) if !ok { logging.LogInvalidHistoryActionEvent(e.logger, logging.TagValueActionWorkflowCancelFailed, e.GetNextEventID(), @@ -1368,7 +1367,7 @@ func (e *mutableStateBuilder) AddRequestCancelExternalWorkflowExecutionFailedEve if e.DeletePendingRequestCancel(initiatedID) == nil { return e.hBuilder.AddRequestCancelExternalWorkflowExecutionFailedEvent(decisionTaskCompletedEventID, initiatedID, - domain, workflowID, runID, control, cause) + domain, workflowID, runID, cause) } return nil diff --git a/service/history/transferQueueProcessor.go b/service/history/transferQueueProcessor.go index 7f835479393..89625a9d012 100644 --- a/service/history/transferQueueProcessor.go +++ b/service/history/transferQueueProcessor.go @@ -559,7 +559,6 @@ func (t *transferQueueProcessorImpl) processCancelExecution(task *persistence.Tr Identity: common.StringPtr(identityHistoryService), // Use the same request ID to dedupe RequestCancelWorkflowExecution calls RequestId: common.StringPtr(ri.CancelRequestID), - Control: ri.Control, }, ExternalInitiatedEventId: common.Int64Ptr(task.ScheduleID), ExternalWorkflowExecution: &workflow.WorkflowExecution{ @@ -935,7 +934,6 @@ func (t *transferQueueProcessorImpl) requestCancelCompleted(task *persistence.Tr *request.DomainUUID, *request.CancelRequest.WorkflowExecution.WorkflowId, common.StringDefault(request.CancelRequest.WorkflowExecution.RunId), - request.CancelRequest.Control, ) return nil @@ -991,7 +989,6 @@ func (t *transferQueueProcessorImpl) requestCancelFailed(task *persistence.Trans *request.DomainUUID, *request.CancelRequest.WorkflowExecution.WorkflowId, common.StringDefault(request.CancelRequest.WorkflowExecution.RunId), - request.CancelRequest.Control, workflow.CancelExternalWorkflowExecutionFailedCauseUnknownExternalWorkflowExecution) return nil From 9e22a99c5d505e24afc75e207651d8b93f499c73 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Tue, 13 Feb 2018 18:28:30 -0800 Subject: [PATCH 4/6] fix return err --- common/util.go | 2 ++ service/history/historyEngine.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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/service/history/historyEngine.go b/service/history/historyEngine.go index fb808a09bbd..30d84c94a75 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -89,7 +89,7 @@ var ( // 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.BadRequestError{Message: "Workflow parent does not match."} + 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 From 0fb3728ece7acba39dce62168ca8572a8b7b8e10 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Wed, 14 Feb 2018 11:25:41 -0800 Subject: [PATCH 5/6] move schema change into 0.5 version --- .../add_target_child_workflow_only_to_transfer_task.cql | 0 schema/cadence/versioned/v0.5/manifest.json | 5 +++-- schema/cadence/versioned/v0.6/manifest.json | 8 -------- tools/cassandra/updateTask_test.go | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) rename schema/cadence/versioned/{v0.6 => v0.5}/add_target_child_workflow_only_to_transfer_task.cql (100%) delete mode 100644 schema/cadence/versioned/v0.6/manifest.json diff --git a/schema/cadence/versioned/v0.6/add_target_child_workflow_only_to_transfer_task.cql b/schema/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql similarity index 100% rename from schema/cadence/versioned/v0.6/add_target_child_workflow_only_to_transfer_task.cql rename to schema/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql 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/schema/cadence/versioned/v0.6/manifest.json b/schema/cadence/versioned/v0.6/manifest.json deleted file mode 100644 index 77e2d09d520..00000000000 --- a/schema/cadence/versioned/v0.6/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CurrVersion": "0.6", - "MinCompatibleVersion": "0.6", - "Description": "add target child workflow only to transfer task", - "SchemaUpdateCqlFiles": [ - "add_target_child_workflow_only_to_transfer_task.cql" - ] -} diff --git a/tools/cassandra/updateTask_test.go b/tools/cassandra/updateTask_test.go index 0eba412f876..12a1dafdd8a 100644 --- a/tools/cassandra/updateTask_test.go +++ b/tools/cassandra/updateTask_test.go @@ -130,7 +130,7 @@ func (s *UpdateSchemaTestSuite) TestDryrun() { s.Nil(err) // update the version to the latest s.log.Infof("Ver: %v", ver) - s.Equal(0, cmpVersion(ver, "0.6")) + s.Equal(0, cmpVersion(ver, "0.5")) dropAllTablesTypes(client) } From d0cd1340f9fcd80a85e7203b15c523887bb7011d Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 16 Feb 2018 13:26:12 -0800 Subject: [PATCH 6/6] address comments --- service/history/transferQueueProcessor.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/service/history/transferQueueProcessor.go b/service/history/transferQueueProcessor.go index 89625a9d012..eb911d65316 100644 --- a/service/history/transferQueueProcessor.go +++ b/service/history/transferQueueProcessor.go @@ -229,14 +229,11 @@ func (t *transferQueueProcessorImpl) processTransferTasks(tasksCh chan<- *persis return } - // here we may have a serious bug // 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 serious of decitions, one depend on another, + // 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. so, client can experience weird situation. - // one way of solving this is to send all tasks of a workflow to one worker, - // i.e. do a workflow ID -> worker mapping + // is not guatanteed. for _, tsk := range tasks { tasksCh <- tsk }