diff --git a/.gen/go/history/history.go b/.gen/go/history/history.go index 74f850d4e9b..78c825211a0 100644 --- a/.gen/go/history/history.go +++ b/.gen/go/history/history.go @@ -740,6 +740,7 @@ type GetMutableStateRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` Execution *shared.WorkflowExecution `json:"execution,omitempty"` ExpectedNextEventId *int64 `json:"expectedNextEventId,omitempty"` + CurrentBranchToken []byte `json:"currentBranchToken,omitempty"` } // ToWire translates a GetMutableStateRequest struct into a Thrift-level intermediate @@ -759,7 +760,7 @@ type GetMutableStateRequest struct { // } func (v *GetMutableStateRequest) ToWire() (wire.Value, error) { var ( - fields [3]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error @@ -789,6 +790,14 @@ func (v *GetMutableStateRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 30, Value: w} i++ } + if v.CurrentBranchToken != nil { + w, err = wire.NewValueBinary(v.CurrentBranchToken), 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 } @@ -842,6 +851,14 @@ func (v *GetMutableStateRequest) FromWire(w wire.Value) error { return err } + } + case 40: + if field.Value.Type() == wire.TBinary { + v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil) + if err != nil { + return err + } + } } } @@ -856,7 +873,7 @@ func (v *GetMutableStateRequest) String() string { return "" } - var fields [3]string + var fields [4]string i := 0 if v.DomainUUID != nil { fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID)) @@ -870,6 +887,10 @@ func (v *GetMutableStateRequest) String() string { fields[i] = fmt.Sprintf("ExpectedNextEventId: %v", *(v.ExpectedNextEventId)) i++ } + if v.CurrentBranchToken != nil { + fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken) + i++ + } return fmt.Sprintf("GetMutableStateRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -903,6 +924,9 @@ func (v *GetMutableStateRequest) Equals(rhs *GetMutableStateRequest) bool { if !_I64_EqualsPtr(v.ExpectedNextEventId, rhs.ExpectedNextEventId) { return false } + if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) { + return false + } return true } @@ -922,6 +946,9 @@ func (v *GetMutableStateRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (er if v.ExpectedNextEventId != nil { enc.AddInt64("expectedNextEventId", *v.ExpectedNextEventId) } + if v.CurrentBranchToken != nil { + enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken)) + } return err } @@ -970,6 +997,21 @@ func (v *GetMutableStateRequest) IsSetExpectedNextEventId() bool { return v != nil && v.ExpectedNextEventId != nil } +// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its +// zero value if it is unset. +func (v *GetMutableStateRequest) GetCurrentBranchToken() (o []byte) { + if v != nil && v.CurrentBranchToken != nil { + return v.CurrentBranchToken + } + + return +} + +// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil. +func (v *GetMutableStateRequest) IsSetCurrentBranchToken() bool { + return v != nil && v.CurrentBranchToken != nil +} + type GetMutableStateResponse struct { Execution *shared.WorkflowExecution `json:"execution,omitempty"` WorkflowType *shared.WorkflowType `json:"workflowType,omitempty"` @@ -984,7 +1026,7 @@ type GetMutableStateResponse struct { IsWorkflowRunning *bool `json:"isWorkflowRunning,omitempty"` StickyTaskListScheduleToStartTimeout *int32 `json:"stickyTaskListScheduleToStartTimeout,omitempty"` EventStoreVersion *int32 `json:"eventStoreVersion,omitempty"` - BranchToken []byte `json:"branchToken,omitempty"` + CurrentBranchToken []byte `json:"currentBranchToken,omitempty"` ReplicationInfo map[string]*shared.ReplicationInfo `json:"replicationInfo,omitempty"` VersionHistories *shared.VersionHistories `json:"versionHistories,omitempty"` WorkflowState *int32 `json:"workflowState,omitempty"` @@ -1156,8 +1198,8 @@ func (v *GetMutableStateResponse) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 120, Value: w} i++ } - if v.BranchToken != nil { - w, err = wire.NewValueBinary(v.BranchToken), error(nil) + if v.CurrentBranchToken != nil { + w, err = wire.NewValueBinary(v.CurrentBranchToken), error(nil) if err != nil { return w, err } @@ -1398,7 +1440,7 @@ func (v *GetMutableStateResponse) FromWire(w wire.Value) error { } case 130: if field.Value.Type() == wire.TBinary { - v.BranchToken, err = field.Value.GetBinary(), error(nil) + v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil) if err != nil { return err } @@ -1507,8 +1549,8 @@ func (v *GetMutableStateResponse) String() string { fields[i] = fmt.Sprintf("EventStoreVersion: %v", *(v.EventStoreVersion)) i++ } - if v.BranchToken != nil { - fields[i] = fmt.Sprintf("BranchToken: %v", v.BranchToken) + if v.CurrentBranchToken != nil { + fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken) i++ } if v.ReplicationInfo != nil { @@ -1617,7 +1659,7 @@ func (v *GetMutableStateResponse) Equals(rhs *GetMutableStateResponse) bool { if !_I32_EqualsPtr(v.EventStoreVersion, rhs.EventStoreVersion) { return false } - if !((v.BranchToken == nil && rhs.BranchToken == nil) || (v.BranchToken != nil && rhs.BranchToken != nil && bytes.Equal(v.BranchToken, rhs.BranchToken))) { + if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) { return false } if !((v.ReplicationInfo == nil && rhs.ReplicationInfo == nil) || (v.ReplicationInfo != nil && rhs.ReplicationInfo != nil && _Map_String_ReplicationInfo_Equals(v.ReplicationInfo, rhs.ReplicationInfo))) { @@ -1692,8 +1734,8 @@ func (v *GetMutableStateResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (e if v.EventStoreVersion != nil { enc.AddInt32("eventStoreVersion", *v.EventStoreVersion) } - if v.BranchToken != nil { - enc.AddString("branchToken", base64.StdEncoding.EncodeToString(v.BranchToken)) + if v.CurrentBranchToken != nil { + enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken)) } if v.ReplicationInfo != nil { err = multierr.Append(err, enc.AddObject("replicationInfo", (_Map_String_ReplicationInfo_Zapper)(v.ReplicationInfo))) @@ -1905,19 +1947,19 @@ func (v *GetMutableStateResponse) IsSetEventStoreVersion() bool { return v != nil && v.EventStoreVersion != nil } -// GetBranchToken returns the value of BranchToken if it is set or its +// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its // zero value if it is unset. -func (v *GetMutableStateResponse) GetBranchToken() (o []byte) { - if v != nil && v.BranchToken != nil { - return v.BranchToken +func (v *GetMutableStateResponse) GetCurrentBranchToken() (o []byte) { + if v != nil && v.CurrentBranchToken != nil { + return v.CurrentBranchToken } return } -// IsSetBranchToken returns true if BranchToken is not nil. -func (v *GetMutableStateResponse) IsSetBranchToken() bool { - return v != nil && v.BranchToken != nil +// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil. +func (v *GetMutableStateResponse) IsSetCurrentBranchToken() bool { + return v != nil && v.CurrentBranchToken != nil } // GetReplicationInfo returns the value of ReplicationInfo if it is set or its @@ -2252,6 +2294,7 @@ type PollMutableStateRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` Execution *shared.WorkflowExecution `json:"execution,omitempty"` ExpectedNextEventId *int64 `json:"expectedNextEventId,omitempty"` + CurrentBranchToken []byte `json:"currentBranchToken,omitempty"` } // ToWire translates a PollMutableStateRequest struct into a Thrift-level intermediate @@ -2271,7 +2314,7 @@ type PollMutableStateRequest struct { // } func (v *PollMutableStateRequest) ToWire() (wire.Value, error) { var ( - fields [3]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error @@ -2301,6 +2344,14 @@ func (v *PollMutableStateRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 30, Value: w} i++ } + if v.CurrentBranchToken != nil { + w, err = wire.NewValueBinary(v.CurrentBranchToken), 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 } @@ -2354,6 +2405,14 @@ func (v *PollMutableStateRequest) FromWire(w wire.Value) error { return err } + } + case 40: + if field.Value.Type() == wire.TBinary { + v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil) + if err != nil { + return err + } + } } } @@ -2368,7 +2427,7 @@ func (v *PollMutableStateRequest) String() string { return "" } - var fields [3]string + var fields [4]string i := 0 if v.DomainUUID != nil { fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID)) @@ -2382,6 +2441,10 @@ func (v *PollMutableStateRequest) String() string { fields[i] = fmt.Sprintf("ExpectedNextEventId: %v", *(v.ExpectedNextEventId)) i++ } + if v.CurrentBranchToken != nil { + fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken) + i++ + } return fmt.Sprintf("PollMutableStateRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -2405,6 +2468,9 @@ func (v *PollMutableStateRequest) Equals(rhs *PollMutableStateRequest) bool { if !_I64_EqualsPtr(v.ExpectedNextEventId, rhs.ExpectedNextEventId) { return false } + if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) { + return false + } return true } @@ -2424,6 +2490,9 @@ func (v *PollMutableStateRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (e if v.ExpectedNextEventId != nil { enc.AddInt64("expectedNextEventId", *v.ExpectedNextEventId) } + if v.CurrentBranchToken != nil { + enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken)) + } return err } @@ -2472,6 +2541,21 @@ func (v *PollMutableStateRequest) IsSetExpectedNextEventId() bool { return v != nil && v.ExpectedNextEventId != nil } +// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its +// zero value if it is unset. +func (v *PollMutableStateRequest) GetCurrentBranchToken() (o []byte) { + if v != nil && v.CurrentBranchToken != nil { + return v.CurrentBranchToken + } + + return +} + +// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil. +func (v *PollMutableStateRequest) IsSetCurrentBranchToken() bool { + return v != nil && v.CurrentBranchToken != nil +} + type PollMutableStateResponse struct { Execution *shared.WorkflowExecution `json:"execution,omitempty"` WorkflowType *shared.WorkflowType `json:"workflowType,omitempty"` @@ -2484,7 +2568,7 @@ type PollMutableStateResponse struct { ClientFeatureVersion *string `json:"clientFeatureVersion,omitempty"` ClientImpl *string `json:"clientImpl,omitempty"` StickyTaskListScheduleToStartTimeout *int32 `json:"stickyTaskListScheduleToStartTimeout,omitempty"` - BranchToken []byte `json:"branchToken,omitempty"` + CurrentBranchToken []byte `json:"currentBranchToken,omitempty"` ReplicationInfo map[string]*shared.ReplicationInfo `json:"replicationInfo,omitempty"` VersionHistories *shared.VersionHistories `json:"versionHistories,omitempty"` WorkflowState *int32 `json:"workflowState,omitempty"` @@ -2602,8 +2686,8 @@ func (v *PollMutableStateResponse) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 100, Value: w} i++ } - if v.BranchToken != nil { - w, err = wire.NewValueBinary(v.BranchToken), error(nil) + if v.CurrentBranchToken != nil { + w, err = wire.NewValueBinary(v.CurrentBranchToken), error(nil) if err != nil { return w, err } @@ -2772,7 +2856,7 @@ func (v *PollMutableStateResponse) FromWire(w wire.Value) error { } case 110: if field.Value.Type() == wire.TBinary { - v.BranchToken, err = field.Value.GetBinary(), error(nil) + v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil) if err != nil { return err } @@ -2873,8 +2957,8 @@ func (v *PollMutableStateResponse) String() string { fields[i] = fmt.Sprintf("StickyTaskListScheduleToStartTimeout: %v", *(v.StickyTaskListScheduleToStartTimeout)) i++ } - if v.BranchToken != nil { - fields[i] = fmt.Sprintf("BranchToken: %v", v.BranchToken) + if v.CurrentBranchToken != nil { + fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken) i++ } if v.ReplicationInfo != nil { @@ -2940,7 +3024,7 @@ func (v *PollMutableStateResponse) Equals(rhs *PollMutableStateResponse) bool { if !_I32_EqualsPtr(v.StickyTaskListScheduleToStartTimeout, rhs.StickyTaskListScheduleToStartTimeout) { return false } - if !((v.BranchToken == nil && rhs.BranchToken == nil) || (v.BranchToken != nil && rhs.BranchToken != nil && bytes.Equal(v.BranchToken, rhs.BranchToken))) { + if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) { return false } if !((v.ReplicationInfo == nil && rhs.ReplicationInfo == nil) || (v.ReplicationInfo != nil && rhs.ReplicationInfo != nil && _Map_String_ReplicationInfo_Equals(v.ReplicationInfo, rhs.ReplicationInfo))) { @@ -2998,8 +3082,8 @@ func (v *PollMutableStateResponse) MarshalLogObject(enc zapcore.ObjectEncoder) ( if v.StickyTaskListScheduleToStartTimeout != nil { enc.AddInt32("stickyTaskListScheduleToStartTimeout", *v.StickyTaskListScheduleToStartTimeout) } - if v.BranchToken != nil { - enc.AddString("branchToken", base64.StdEncoding.EncodeToString(v.BranchToken)) + if v.CurrentBranchToken != nil { + enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken)) } if v.ReplicationInfo != nil { err = multierr.Append(err, enc.AddObject("replicationInfo", (_Map_String_ReplicationInfo_Zapper)(v.ReplicationInfo))) @@ -3181,19 +3265,19 @@ func (v *PollMutableStateResponse) IsSetStickyTaskListScheduleToStartTimeout() b return v != nil && v.StickyTaskListScheduleToStartTimeout != nil } -// GetBranchToken returns the value of BranchToken if it is set or its +// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its // zero value if it is unset. -func (v *PollMutableStateResponse) GetBranchToken() (o []byte) { - if v != nil && v.BranchToken != nil { - return v.BranchToken +func (v *PollMutableStateResponse) GetCurrentBranchToken() (o []byte) { + if v != nil && v.CurrentBranchToken != nil { + return v.CurrentBranchToken } return } -// IsSetBranchToken returns true if BranchToken is not nil. -func (v *PollMutableStateResponse) IsSetBranchToken() bool { - return v != nil && v.BranchToken != nil +// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil. +func (v *PollMutableStateResponse) IsSetCurrentBranchToken() bool { + return v != nil && v.CurrentBranchToken != nil } // GetReplicationInfo returns the value of ReplicationInfo if it is set or its @@ -11176,14 +11260,14 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "history", Package: "github.com/uber/cadence/.gen/go/history", FilePath: "history.thrift", - SHA1: "f5bc637aef97220737a370988d8add37bc3ba297", + SHA1: "b972e5822b1aefc674929cce24f641b23ed4095c", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.history\n\nexception EventAlreadyStartedError {\n 1: required string message\n}\n\nexception ShardOwnershipLostError {\n 10: optional string message\n 20: optional string owner\n}\n\nstruct ParentExecutionInfo {\n 10: optional string domainUUID\n 15: optional string domain\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") initiatedId\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.StartWorkflowExecutionRequest startRequest\n 30: optional ParentExecutionInfo parentExecutionInfo\n 40: optional i32 attempt\n 50: optional i64 (js.type = \"Long\") expirationTimestamp\n 55: optional shared.ContinueAsNewInitiator continueAsNewInitiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional i32 firstDecisionTaskBackoffSeconds\n}\n\nstruct DescribeMutableStateRequest{\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct DescribeMutableStateResponse{\n 30: optional string mutableStateInCache\n 40: optional string mutableStateInDatabase\n}\n\nstruct GetMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n}\n\nstruct GetMutableStateResponse {\n 10: optional shared.WorkflowExecution execution\n 20: optional shared.WorkflowType workflowType\n 30: optional i64 (js.type = \"Long\") NextEventId\n 35: optional i64 (js.type = \"Long\") PreviousStartedEventId\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 //TODO: isWorkflowRunning is deprecating. workflowState is going replace this field\n 100: optional bool isWorkflowRunning\n 110: optional i32 stickyTaskListScheduleToStartTimeout\n 120: optional i32 eventStoreVersion\n 130: optional binary branchToken\n 140: optional map replicationInfo\n 150: optional shared.VersionHistories versionHistories\n 160: optional i32 workflowState\n 170: optional i32 workflowCloseState\n}\n\nstruct PollMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n}\n\nstruct PollMutableStateResponse {\n 10: optional shared.WorkflowExecution execution\n 20: optional shared.WorkflowType workflowType\n 30: optional i64 (js.type = \"Long\") NextEventId\n 35: optional i64 (js.type = \"Long\") PreviousStartedEventId\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 i32 stickyTaskListScheduleToStartTimeout\n 110: optional binary branchToken\n 120: optional map replicationInfo\n 130: optional shared.VersionHistories versionHistories\n 140: optional i32 workflowState\n 150: optional i32 workflowCloseState\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional RecordDecisionTaskStartedResponse startedResponse\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskFailedRequest failedRequest\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional string domainUUID\n 20: optional shared.RecordActivityTaskHeartbeatRequest heartbeatRequest\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCompletedRequest completeRequest\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskFailedRequest failedRequest\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCanceledRequest cancelRequest\n}\n\nstruct RecordActivityTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct RecordActivityTaskStartedResponse {\n 20: optional shared.HistoryEvent scheduledEvent\n 30: optional i64 (js.type = \"Long\") startedTimestamp\n 40: optional i64 (js.type = \"Long\") attempt\n 50: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 60: optional binary heartbeatDetails\n 70: optional shared.WorkflowType workflowType\n 80: optional string workflowDomain\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 90: optional shared.TaskList WorkflowExecutionTaskList\n 100: optional i32 eventStoreVersion\n 110: optional binary branchToken\n 120: optional i64 (js.type = \"Long\") scheduledTimestamp\n 130: optional i64 (js.type = \"Long\") startedTimestamp\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWorkflowExecutionRequest signalRequest\n 30: optional shared.WorkflowExecution externalWorkflowExecution\n 40: optional bool childWorkflowOnly\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWithStartWorkflowExecutionRequest signalWithStartRequest\n}\n\nstruct RemoveSignalMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional string requestId\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.TerminateWorkflowExecutionRequest terminateRequest\n}\n\nstruct ResetWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.ResetWorkflowExecutionRequest resetRequest\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 30: optional bool isFirstDecision\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.DescribeWorkflowExecutionRequest request\n}\n\n/**\n* RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow\n* execution which started it. When a child execution is completed it creates this request and calls the\n* RecordChildExecutionCompleted API with the workflowExecution of parent. It also sets the completedExecution of the\n* child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when\n* child creates multiple runs through ContinueAsNew before finally completing.\n**/\nstruct RecordChildExecutionCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") initiatedId\n 40: optional shared.WorkflowExecution completedExecution\n 50: optional shared.HistoryEvent completionEvent\n}\n\nstruct ReplicateEventsRequest {\n 10: optional string sourceCluster\n 20: optional string domainUUID\n 30: optional shared.WorkflowExecution workflowExecution\n 40: optional i64 (js.type = \"Long\") firstEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") version\n 70: optional map replicationInfo\n 80: optional shared.History history\n 90: optional shared.History newRunHistory\n 100: optional bool forceBufferEvents // this attribute is deprecated\n 110: optional i32 eventStoreVersion\n 120: optional i32 newRunEventStoreVersion\n 130: optional bool resetWorkflow\n}\n\nstruct ReplicateRawEventsRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional map replicationInfo\n 40: optional shared.DataBlob history\n 50: optional shared.DataBlob newRunHistory\n 60: optional i32 eventStoreVersion\n 70: optional i32 newRunEventStoreVersion\n}\n\nstruct SyncShardStatusRequest {\n 10: optional string sourceCluster\n 20: optional i64 (js.type = \"Long\") shardId\n 30: optional i64 (js.type = \"Long\") timestamp\n}\n\nstruct SyncActivityRequest {\n 10: optional string domainId\n 20: optional string workflowId\n 30: optional string runId\n 40: optional i64 (js.type = \"Long\") version\n 50: optional i64 (js.type = \"Long\") scheduledId\n 60: optional i64 (js.type = \"Long\") scheduledTime\n 70: optional i64 (js.type = \"Long\") startedId\n 80: optional i64 (js.type = \"Long\") startedTime\n 90: optional i64 (js.type = \"Long\") lastHeartbeatTime\n 100: optional binary details\n 110: optional i32 attempt\n 120: optional string lastFailureReason\n 130: optional string lastWorkerIdentity\n}\n\n/**\n* HistoryService provides API to start a new long running workflow instance, as well as query and update the history\n* of workflow instances already created.\n**/\nservice HistoryService {\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\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 * It returns CurrentBranchChangedError if the workflow version branch has changed.\n **/\n GetMutableStateResponse GetMutableState(1: GetMutableStateRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.CurrentBranchChangedError currentBranchChangedError,\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 * It returns CurrentBranchChangedError if the workflow version branch has changed.\n **/\n PollMutableStateResponse PollMutableState(1: PollMutableStateRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.CurrentBranchChangedError currentBranchChangedError,\n )\n\n /**\n * Reset the sticky tasklist related information in mutable state of a given workflow.\n * Things cleared are:\n * 1. StickyTaskList\n * 2. StickyScheduleToStartTimeout\n * 3. ClientLibraryVersion\n * 4. ClientFeatureVersion\n * 5. ClientImpl\n **/\n ResetStickyTaskListResponse ResetStickyTaskList(1: ResetStickyTaskListRequest resetRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordDecisionTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForDecisionTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordDecisionTaskStartedResponse RecordDecisionTaskStarted(1: RecordDecisionTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n 8: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForActivityTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordActivityTaskStartedResponse RecordActivityTaskStarted(1: RecordActivityTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n 8: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(1: RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report ny panics during DecisionTask processing.\n **/\n void RespondDecisionTaskFailed(1: RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * SignalWithStartWorkflowExecution is used to ensure sending a signal event to a workflow execution.\n * If workflow is running, this results in WorkflowExecutionSignaled event recorded in the history\n * and a decision task being created for the execution.\n * If workflow is not running or not found, it will first try start workflow with given WorkflowIDResuePolicy,\n * and record WorkflowExecutionStarted and WorkflowExecutionSignaled event in case of success.\n * It will return `WorkflowExecutionAlreadyStartedError` if start workflow failed with given policy.\n **/\n shared.StartWorkflowExecutionResponse SignalWithStartWorkflowExecution(1: SignalWithStartWorkflowExecutionRequest signalWithStartRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: ShardOwnershipLostError shardOwnershipLostError,\n 4: shared.DomainNotActiveError domainNotActiveError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.WorkflowExecutionAlreadyStartedError workflowAlreadyStartedError,\n )\n\n /**\n * RemoveSignalMutableState is used to remove a signal request ID that was previously recorded. This is currently\n * used to clean execution info when signal decision finished.\n **/\n void RemoveSignalMutableState(1: RemoveSignalMutableStateRequest removeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ResetWorkflowExecution reset an existing workflow execution by a firstEventID of a existing event batch\n * in the history and immediately terminating the current execution instance.\n * After reset, the history will grow from nextFirstEventID.\n **/\n shared.ResetWorkflowExecutionResponse ResetWorkflowExecution(1: ResetWorkflowExecutionRequest resetRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n 8: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ScheduleDecisionTask is used for creating a decision task for already started workflow execution. This is mainly\n * used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts\n * child execution without creating the decision task and then calls this API after updating the mutable state of\n * parent execution.\n **/\n void ScheduleDecisionTask(1: ScheduleDecisionTaskRequest scheduleRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent.\n * This is mainly called by transfer queue processor during the processing of DeleteExecution task.\n **/\n void RecordChildExecutionCompleted(1: RecordChildExecutionCompletedRequest completionRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n )\n\n void ReplicateEvents(1: ReplicateEventsRequest replicateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.RetryTaskError retryTaskError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n void ReplicateRawEvents(1: ReplicateRawEventsRequest replicateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.RetryTaskError retryTaskError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SyncShardStatus sync the status between shards\n **/\n void SyncShardStatus(1: SyncShardStatusRequest syncShardStatusRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SyncActivity sync the activity status\n **/\n void SyncActivity(1: SyncActivityRequest syncActivityRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.ServiceBusyError serviceBusyError,\n 6: shared.RetryTaskError retryTaskError,\n )\n\n /**\n * DescribeMutableState returns information about the internal states of workflow mutable state.\n **/\n DescribeMutableStateResponse DescribeMutableState(1: DescribeMutableStateRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.AccessDeniedError accessDeniedError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * DescribeHistoryHost returns information about the internal states of a history host\n **/\n shared.DescribeHistoryHostResponse DescribeHistoryHost(1: shared.DescribeHistoryHostRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.AccessDeniedError accessDeniedError,\n )\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.history\n\nexception EventAlreadyStartedError {\n 1: required string message\n}\n\nexception ShardOwnershipLostError {\n 10: optional string message\n 20: optional string owner\n}\n\nstruct ParentExecutionInfo {\n 10: optional string domainUUID\n 15: optional string domain\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") initiatedId\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.StartWorkflowExecutionRequest startRequest\n 30: optional ParentExecutionInfo parentExecutionInfo\n 40: optional i32 attempt\n 50: optional i64 (js.type = \"Long\") expirationTimestamp\n 55: optional shared.ContinueAsNewInitiator continueAsNewInitiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional i32 firstDecisionTaskBackoffSeconds\n}\n\nstruct DescribeMutableStateRequest{\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct DescribeMutableStateResponse{\n 30: optional string mutableStateInCache\n 40: optional string mutableStateInDatabase\n}\n\nstruct GetMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n 40: optional binary currentBranchToken\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 35: optional i64 (js.type = \"Long\") PreviousStartedEventId\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 //TODO: isWorkflowRunning is deprecating. workflowState is going replace this field\n 100: optional bool isWorkflowRunning\n 110: optional i32 stickyTaskListScheduleToStartTimeout\n 120: optional i32 eventStoreVersion\n 130: optional binary currentBranchToken\n 140: optional map replicationInfo\n 150: optional shared.VersionHistories versionHistories\n //TODO: change these fields to enum when possible\n 160: optional i32 workflowState\n 170: optional i32 workflowCloseState\n}\n\nstruct PollMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional i64 (js.type = \"Long\") expectedNextEventId\n 40: optional binary currentBranchToken\n}\n\nstruct PollMutableStateResponse {\n 10: optional shared.WorkflowExecution execution\n 20: optional shared.WorkflowType workflowType\n 30: optional i64 (js.type = \"Long\") NextEventId\n 35: optional i64 (js.type = \"Long\") PreviousStartedEventId\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 i32 stickyTaskListScheduleToStartTimeout\n 110: optional binary currentBranchToken\n 120: optional map replicationInfo\n 130: optional shared.VersionHistories versionHistories\n //TODO: change these fields to enum when possible\n 140: optional i32 workflowState\n 150: optional i32 workflowCloseState\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional RecordDecisionTaskStartedResponse startedResponse\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondDecisionTaskFailedRequest failedRequest\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional string domainUUID\n 20: optional shared.RecordActivityTaskHeartbeatRequest heartbeatRequest\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCompletedRequest completeRequest\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskFailedRequest failedRequest\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional string domainUUID\n 20: optional shared.RespondActivityTaskCanceledRequest cancelRequest\n}\n\nstruct RecordActivityTaskStartedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") scheduleId\n 40: optional i64 (js.type = \"Long\") taskId\n 45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n 50: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct RecordActivityTaskStartedResponse {\n 20: optional shared.HistoryEvent scheduledEvent\n 30: optional i64 (js.type = \"Long\") startedTimestamp\n 40: optional i64 (js.type = \"Long\") attempt\n 50: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 60: optional binary heartbeatDetails\n 70: optional shared.WorkflowType workflowType\n 80: optional string workflowDomain\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 90: optional shared.TaskList WorkflowExecutionTaskList\n 100: optional i32 eventStoreVersion\n 110: optional binary branchToken\n 120: optional i64 (js.type = \"Long\") scheduledTimestamp\n 130: optional i64 (js.type = \"Long\") startedTimestamp\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWorkflowExecutionRequest signalRequest\n 30: optional shared.WorkflowExecution externalWorkflowExecution\n 40: optional bool childWorkflowOnly\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.SignalWithStartWorkflowExecutionRequest signalWithStartRequest\n}\n\nstruct RemoveSignalMutableStateRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional string requestId\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.TerminateWorkflowExecutionRequest terminateRequest\n}\n\nstruct ResetWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.ResetWorkflowExecutionRequest resetRequest\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 30: optional bool isFirstDecision\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domainUUID\n 20: optional shared.DescribeWorkflowExecutionRequest request\n}\n\n/**\n* RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow\n* execution which started it. When a child execution is completed it creates this request and calls the\n* RecordChildExecutionCompleted API with the workflowExecution of parent. It also sets the completedExecution of the\n* child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when\n* child creates multiple runs through ContinueAsNew before finally completing.\n**/\nstruct RecordChildExecutionCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional i64 (js.type = \"Long\") initiatedId\n 40: optional shared.WorkflowExecution completedExecution\n 50: optional shared.HistoryEvent completionEvent\n}\n\nstruct ReplicateEventsRequest {\n 10: optional string sourceCluster\n 20: optional string domainUUID\n 30: optional shared.WorkflowExecution workflowExecution\n 40: optional i64 (js.type = \"Long\") firstEventId\n 50: optional i64 (js.type = \"Long\") nextEventId\n 60: optional i64 (js.type = \"Long\") version\n 70: optional map replicationInfo\n 80: optional shared.History history\n 90: optional shared.History newRunHistory\n 100: optional bool forceBufferEvents // this attribute is deprecated\n 110: optional i32 eventStoreVersion\n 120: optional i32 newRunEventStoreVersion\n 130: optional bool resetWorkflow\n}\n\nstruct ReplicateRawEventsRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional map replicationInfo\n 40: optional shared.DataBlob history\n 50: optional shared.DataBlob newRunHistory\n 60: optional i32 eventStoreVersion\n 70: optional i32 newRunEventStoreVersion\n}\n\nstruct SyncShardStatusRequest {\n 10: optional string sourceCluster\n 20: optional i64 (js.type = \"Long\") shardId\n 30: optional i64 (js.type = \"Long\") timestamp\n}\n\nstruct SyncActivityRequest {\n 10: optional string domainId\n 20: optional string workflowId\n 30: optional string runId\n 40: optional i64 (js.type = \"Long\") version\n 50: optional i64 (js.type = \"Long\") scheduledId\n 60: optional i64 (js.type = \"Long\") scheduledTime\n 70: optional i64 (js.type = \"Long\") startedId\n 80: optional i64 (js.type = \"Long\") startedTime\n 90: optional i64 (js.type = \"Long\") lastHeartbeatTime\n 100: optional binary details\n 110: optional i32 attempt\n 120: optional string lastFailureReason\n 130: optional string lastWorkerIdentity\n}\n\n/**\n* HistoryService provides API to start a new long running workflow instance, as well as query and update the history\n* of workflow instances already created.\n**/\nservice HistoryService {\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\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 * It returns CurrentBranchChangedError if the workflow version branch has changed.\n **/\n GetMutableStateResponse GetMutableState(1: GetMutableStateRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.CurrentBranchChangedError currentBranchChangedError,\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 * It returns CurrentBranchChangedError if the workflow version branch has changed.\n **/\n PollMutableStateResponse PollMutableState(1: PollMutableStateRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.CurrentBranchChangedError currentBranchChangedError,\n )\n\n /**\n * Reset the sticky tasklist related information in mutable state of a given workflow.\n * Things cleared are:\n * 1. StickyTaskList\n * 2. StickyScheduleToStartTimeout\n * 3. ClientLibraryVersion\n * 4. ClientFeatureVersion\n * 5. ClientImpl\n **/\n ResetStickyTaskListResponse ResetStickyTaskList(1: ResetStickyTaskListRequest resetRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordDecisionTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForDecisionTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordDecisionTaskStartedResponse RecordDecisionTaskStarted(1: RecordDecisionTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n 8: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n * a PollForActivityTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n * if the workflow's execution history already includes a record of the event starting.\n **/\n RecordActivityTaskStartedResponse RecordActivityTaskStarted(1: RecordActivityTaskStartedRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: EventAlreadyStartedError eventAlreadyStartedError,\n 4: shared.EntityNotExistsError entityNotExistError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n 8: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(1: RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report ny panics during DecisionTask processing.\n **/\n void RespondDecisionTaskFailed(1: RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * SignalWithStartWorkflowExecution is used to ensure sending a signal event to a workflow execution.\n * If workflow is running, this results in WorkflowExecutionSignaled event recorded in the history\n * and a decision task being created for the execution.\n * If workflow is not running or not found, it will first try start workflow with given WorkflowIDResuePolicy,\n * and record WorkflowExecutionStarted and WorkflowExecutionSignaled event in case of success.\n * It will return `WorkflowExecutionAlreadyStartedError` if start workflow failed with given policy.\n **/\n shared.StartWorkflowExecutionResponse SignalWithStartWorkflowExecution(1: SignalWithStartWorkflowExecutionRequest signalWithStartRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: ShardOwnershipLostError shardOwnershipLostError,\n 4: shared.DomainNotActiveError domainNotActiveError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n 7: shared.WorkflowExecutionAlreadyStartedError workflowAlreadyStartedError,\n )\n\n /**\n * RemoveSignalMutableState is used to remove a signal request ID that was previously recorded. This is currently\n * used to clean execution info when signal decision finished.\n **/\n void RemoveSignalMutableState(1: RemoveSignalMutableStateRequest removeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ResetWorkflowExecution reset an existing workflow execution by a firstEventID of a existing event batch\n * in the history and immediately terminating the current execution instance.\n * After reset, the history will grow from nextFirstEventID.\n **/\n shared.ResetWorkflowExecutionResponse ResetWorkflowExecution(1: ResetWorkflowExecutionRequest resetRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 6: shared.DomainNotActiveError domainNotActiveError,\n 7: shared.LimitExceededError limitExceededError,\n 8: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ScheduleDecisionTask is used for creating a decision task for already started workflow execution. This is mainly\n * used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts\n * child execution without creating the decision task and then calls this API after updating the mutable state of\n * parent execution.\n **/\n void ScheduleDecisionTask(1: ScheduleDecisionTaskRequest scheduleRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent.\n * This is mainly called by transfer queue processor during the processing of DeleteExecution task.\n **/\n void RecordChildExecutionCompleted(1: RecordChildExecutionCompletedRequest completionRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.DomainNotActiveError domainNotActiveError,\n 6: shared.LimitExceededError limitExceededError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n )\n\n void ReplicateEvents(1: ReplicateEventsRequest replicateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.RetryTaskError retryTaskError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n void ReplicateRawEvents(1: ReplicateRawEventsRequest replicateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.RetryTaskError retryTaskError,\n 7: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SyncShardStatus sync the status between shards\n **/\n void SyncShardStatus(1: SyncShardStatusRequest syncShardStatusRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.LimitExceededError limitExceededError,\n 6: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SyncActivity sync the activity status\n **/\n void SyncActivity(1: SyncActivityRequest syncActivityRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: ShardOwnershipLostError shardOwnershipLostError,\n 5: shared.ServiceBusyError serviceBusyError,\n 6: shared.RetryTaskError retryTaskError,\n )\n\n /**\n * DescribeMutableState returns information about the internal states of workflow mutable state.\n **/\n DescribeMutableStateResponse DescribeMutableState(1: DescribeMutableStateRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.AccessDeniedError accessDeniedError,\n 5: ShardOwnershipLostError shardOwnershipLostError,\n 6: shared.LimitExceededError limitExceededError,\n )\n\n /**\n * DescribeHistoryHost returns information about the internal states of a history host\n **/\n shared.DescribeHistoryHostResponse DescribeHistoryHost(1: shared.DescribeHistoryHostRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.AccessDeniedError accessDeniedError,\n )\n}\n" // HistoryService_DescribeHistoryHost_Args represents the arguments for the HistoryService.DescribeHistoryHost function. // @@ -14145,7 +14229,7 @@ func (v *HistoryService_GetMutableState_Result) EnvelopeType() wire.EnvelopeType // // The arguments for PollMutableState are sent and received over the wire as this struct. type HistoryService_PollMutableState_Args struct { - GetRequest *PollMutableStateRequest `json:"getRequest,omitempty"` + PollRequest *PollMutableStateRequest `json:"pollRequest,omitempty"` } // ToWire translates a HistoryService_PollMutableState_Args struct into a Thrift-level intermediate @@ -14171,8 +14255,8 @@ func (v *HistoryService_PollMutableState_Args) ToWire() (wire.Value, error) { err error ) - if v.GetRequest != nil { - w, err = v.GetRequest.ToWire() + if v.PollRequest != nil { + w, err = v.PollRequest.ToWire() if err != nil { return w, err } @@ -14213,7 +14297,7 @@ func (v *HistoryService_PollMutableState_Args) FromWire(w wire.Value) error { switch field.ID { case 1: if field.Value.Type() == wire.TStruct { - v.GetRequest, err = _PollMutableStateRequest_Read(field.Value) + v.PollRequest, err = _PollMutableStateRequest_Read(field.Value) if err != nil { return err } @@ -14234,8 +14318,8 @@ func (v *HistoryService_PollMutableState_Args) String() string { var fields [1]string i := 0 - if v.GetRequest != nil { - fields[i] = fmt.Sprintf("GetRequest: %v", v.GetRequest) + if v.PollRequest != nil { + fields[i] = fmt.Sprintf("PollRequest: %v", v.PollRequest) i++ } @@ -14252,7 +14336,7 @@ func (v *HistoryService_PollMutableState_Args) Equals(rhs *HistoryService_PollMu } else if rhs == nil { return false } - if !((v.GetRequest == nil && rhs.GetRequest == nil) || (v.GetRequest != nil && rhs.GetRequest != nil && v.GetRequest.Equals(rhs.GetRequest))) { + if !((v.PollRequest == nil && rhs.PollRequest == nil) || (v.PollRequest != nil && rhs.PollRequest != nil && v.PollRequest.Equals(rhs.PollRequest))) { return false } @@ -14265,25 +14349,25 @@ func (v *HistoryService_PollMutableState_Args) MarshalLogObject(enc zapcore.Obje if v == nil { return nil } - if v.GetRequest != nil { - err = multierr.Append(err, enc.AddObject("getRequest", v.GetRequest)) + if v.PollRequest != nil { + err = multierr.Append(err, enc.AddObject("pollRequest", v.PollRequest)) } return err } -// GetGetRequest returns the value of GetRequest if it is set or its +// GetPollRequest returns the value of PollRequest if it is set or its // zero value if it is unset. -func (v *HistoryService_PollMutableState_Args) GetGetRequest() (o *PollMutableStateRequest) { - if v != nil && v.GetRequest != nil { - return v.GetRequest +func (v *HistoryService_PollMutableState_Args) GetPollRequest() (o *PollMutableStateRequest) { + if v != nil && v.PollRequest != nil { + return v.PollRequest } return } -// IsSetGetRequest returns true if GetRequest is not nil. -func (v *HistoryService_PollMutableState_Args) IsSetGetRequest() bool { - return v != nil && v.GetRequest != nil +// IsSetPollRequest returns true if PollRequest is not nil. +func (v *HistoryService_PollMutableState_Args) IsSetPollRequest() bool { + return v != nil && v.PollRequest != nil } // MethodName returns the name of the Thrift function as specified in @@ -14308,7 +14392,7 @@ var HistoryService_PollMutableState_Helper = struct { // Args accepts the parameters of PollMutableState in-order and returns // the arguments struct for the function. Args func( - getRequest *PollMutableStateRequest, + pollRequest *PollMutableStateRequest, ) *HistoryService_PollMutableState_Args // IsException returns true if the given error can be thrown @@ -14348,10 +14432,10 @@ var HistoryService_PollMutableState_Helper = struct { func init() { HistoryService_PollMutableState_Helper.Args = func( - getRequest *PollMutableStateRequest, + pollRequest *PollMutableStateRequest, ) *HistoryService_PollMutableState_Args { return &HistoryService_PollMutableState_Args{ - GetRequest: getRequest, + PollRequest: pollRequest, } } diff --git a/.gen/go/history/historyserviceclient/client.go b/.gen/go/history/historyserviceclient/client.go index 345533cf3b7..6c3b21fb35d 100644 --- a/.gen/go/history/historyserviceclient/client.go +++ b/.gen/go/history/historyserviceclient/client.go @@ -64,7 +64,7 @@ type Interface interface { PollMutableState( ctx context.Context, - GetRequest *history.PollMutableStateRequest, + PollRequest *history.PollMutableStateRequest, opts ...yarpc.CallOption, ) (*history.PollMutableStateResponse, error) @@ -319,11 +319,11 @@ func (c client) GetMutableState( func (c client) PollMutableState( ctx context.Context, - _GetRequest *history.PollMutableStateRequest, + _PollRequest *history.PollMutableStateRequest, opts ...yarpc.CallOption, ) (success *history.PollMutableStateResponse, err error) { - args := history.HistoryService_PollMutableState_Helper.Args(_GetRequest) + args := history.HistoryService_PollMutableState_Helper.Args(_PollRequest) var body wire.Value body, err = c.c.Call(ctx, args, opts...) diff --git a/.gen/go/history/historyserviceserver/server.go b/.gen/go/history/historyserviceserver/server.go index 970c1ae1ff5..2c8fc18a722 100644 --- a/.gen/go/history/historyserviceserver/server.go +++ b/.gen/go/history/historyserviceserver/server.go @@ -58,7 +58,7 @@ type Interface interface { PollMutableState( ctx context.Context, - GetRequest *history.PollMutableStateRequest, + PollRequest *history.PollMutableStateRequest, ) (*history.PollMutableStateResponse, error) RecordActivityTaskHeartbeat( @@ -234,7 +234,7 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { Type: transport.Unary, Unary: thrift.UnaryHandler(h.PollMutableState), }, - Signature: "PollMutableState(GetRequest *history.PollMutableStateRequest) (*history.PollMutableStateResponse)", + Signature: "PollMutableState(PollRequest *history.PollMutableStateRequest) (*history.PollMutableStateResponse)", ThriftModule: history.ThriftModule, }, @@ -571,7 +571,7 @@ func (h handler) PollMutableState(ctx context.Context, body wire.Value) (thrift. return thrift.Response{}, err } - success, err := h.impl.PollMutableState(ctx, args.GetRequest) + success, err := h.impl.PollMutableState(ctx, args.PollRequest) hadError := err != nil result, err := history.HistoryService_PollMutableState_Helper.WrapResponse(success, err) diff --git a/.gen/go/history/historyservicetest/client.go b/.gen/go/history/historyservicetest/client.go index 97007c99c4a..d451b93f00c 100644 --- a/.gen/go/history/historyservicetest/client.go +++ b/.gen/go/history/historyservicetest/client.go @@ -205,11 +205,11 @@ func (mr *_MockClientRecorder) GetMutableState( // ... := client.PollMutableState(...) func (m *MockClient) PollMutableState( ctx context.Context, - _GetRequest *history.PollMutableStateRequest, + _PollRequest *history.PollMutableStateRequest, opts ...yarpc.CallOption, ) (success *history.PollMutableStateResponse, err error) { - args := []interface{}{ctx, _GetRequest} + args := []interface{}{ctx, _PollRequest} for _, o := range opts { args = append(args, o) } @@ -223,10 +223,10 @@ func (m *MockClient) PollMutableState( func (mr *_MockClientRecorder) PollMutableState( ctx interface{}, - _GetRequest interface{}, + _PollRequest interface{}, opts ...interface{}, ) *gomock.Call { - args := append([]interface{}{ctx, _GetRequest}, opts...) + args := append([]interface{}{ctx, _PollRequest}, opts...) return mr.mock.ctrl.RecordCall(mr.mock, "PollMutableState", args...) } diff --git a/idl/github.com/uber/cadence/history.thrift b/idl/github.com/uber/cadence/history.thrift index dafba221715..8e13231655d 100644 --- a/idl/github.com/uber/cadence/history.thrift +++ b/idl/github.com/uber/cadence/history.thrift @@ -65,6 +65,7 @@ struct GetMutableStateRequest { 10: optional string domainUUID 20: optional shared.WorkflowExecution execution 30: optional i64 (js.type = "Long") expectedNextEventId + 40: optional binary currentBranchToken } struct GetMutableStateResponse { @@ -82,7 +83,7 @@ struct GetMutableStateResponse { 100: optional bool isWorkflowRunning 110: optional i32 stickyTaskListScheduleToStartTimeout 120: optional i32 eventStoreVersion - 130: optional binary branchToken + 130: optional binary currentBranchToken 140: optional map replicationInfo 150: optional shared.VersionHistories versionHistories //TODO: change these fields to enum when possible @@ -94,6 +95,7 @@ struct PollMutableStateRequest { 10: optional string domainUUID 20: optional shared.WorkflowExecution execution 30: optional i64 (js.type = "Long") expectedNextEventId + 40: optional binary currentBranchToken } struct PollMutableStateResponse { @@ -108,10 +110,10 @@ struct PollMutableStateResponse { 80: optional string clientFeatureVersion 90: optional string clientImpl 100: optional i32 stickyTaskListScheduleToStartTimeout - 110: optional binary branchToken + 110: optional binary currentBranchToken 120: optional map replicationInfo 130: optional shared.VersionHistories versionHistories - //TODO: change these fields to enum when possible + //TODO: change these fields to enum when possible 140: optional i32 workflowState 150: optional i32 workflowCloseState } @@ -357,7 +359,7 @@ service HistoryService { * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service. * It returns CurrentBranchChangedError if the workflow version branch has changed. **/ - PollMutableStateResponse PollMutableState(1: PollMutableStateRequest getRequest) + PollMutableStateResponse PollMutableState(1: PollMutableStateRequest pollRequest) throws ( 1: shared.BadRequestError badRequestError, 2: shared.InternalServiceError internalServiceError, diff --git a/service/frontend/adminHandler.go b/service/frontend/adminHandler.go index 6ec271bfe7c..c003c706c95 100644 --- a/service/frontend/adminHandler.go +++ b/service/frontend/adminHandler.go @@ -296,9 +296,8 @@ func (adh *AdminHandler) GetWorkflowExecutionRawHistory( } response, err := adh.history.GetMutableState(ctx, &h.GetMutableStateRequest{ - DomainUUID: common.StringPtr(domainID), - Execution: execution, - ExpectedNextEventId: common.Int64Ptr(common.FirstEventID), // common.FirstEventID means no long poll + DomainUUID: common.StringPtr(domainID), + Execution: execution, }) if err != nil { return nil, err @@ -310,13 +309,17 @@ func (adh *AdminHandler) GetWorkflowExecutionRawHistory( nextEventID = response.GetNextEventId() } token = &getHistoryContinuationToken{ - RunID: execution.GetRunId(), - BranchToken: response.BranchToken, - FirstEventID: firstEventID, - NextEventID: nextEventID, - PersistenceToken: nil, // this is the initialized value - EventStoreVersion: response.GetEventStoreVersion(), - ReplicationInfo: response.ReplicationInfo, + RunID: execution.GetRunId(), + BranchToken: response.CurrentBranchToken, + FirstEventID: firstEventID, + NextEventID: nextEventID, + PersistenceToken: nil, // this is the initialized value + ReplicationInfo: response.ReplicationInfo, + } + // calculate event store version based on if branch token exist + token.EventStoreVersion = persistence.EventStoreVersionV2 + if token.BranchToken == nil { + token.EventStoreVersion = 0 } } diff --git a/service/frontend/workflowHandler.go b/service/frontend/workflowHandler.go index 740596b598c..29fec6d041d 100644 --- a/service/frontend/workflowHandler.go +++ b/service/frontend/workflowHandler.go @@ -1686,18 +1686,37 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory( // 3. the next event ID // 4. whether the workflow is closed // 5. error if any - queryHistory := func(domainUUID string, execution *gen.WorkflowExecution, expectedNextEventID int64) (int32, []byte, string, int64, int64, bool, error) { - response, err := wh.history.GetMutableState(ctx, &h.GetMutableStateRequest{ + queryHistory := func( + domainUUID string, + execution *gen.WorkflowExecution, + expectedNextEventID int64, + currentBranchToken []byte, + ) (int32, []byte, string, int64, int64, bool, error) { + response, err := wh.history.PollMutableState(ctx, &h.PollMutableStateRequest{ DomainUUID: common.StringPtr(domainUUID), Execution: execution, ExpectedNextEventId: common.Int64Ptr(expectedNextEventID), + CurrentBranchToken: currentBranchToken, }) if err != nil { return 0, nil, "", 0, 0, false, err } + isWorkflowRunning := response.GetWorkflowCloseState() == persistence.WorkflowCloseStatusNone - return response.GetEventStoreVersion(), response.BranchToken, response.Execution.GetRunId(), response.GetLastFirstEventId(), response.GetNextEventId(), response.GetIsWorkflowRunning(), nil + // calculate event store version based on if branch token exist + eventStoreVersion := persistence.EventStoreVersionV2 + if len(response.GetCurrentBranchToken()) == 0 { + eventStoreVersion = 0 + } + + return int32(eventStoreVersion), + response.CurrentBranchToken, + response.Execution.GetRunId(), + response.GetLastFirstEventId(), + response.GetNextEventId(), + isWorkflowRunning, + nil } isLongPoll := getRequest.GetWaitForNewEvent() @@ -1728,7 +1747,8 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory( if !isCloseEventOnly { queryNextEventID = token.NextEventID } - token.EventStoreVersion, token.BranchToken, _, lastFirstEventID, nextEventID, isWorkflowRunning, err = queryHistory(domainID, execution, queryNextEventID) + token.EventStoreVersion, token.BranchToken, _, lastFirstEventID, nextEventID, isWorkflowRunning, err = + queryHistory(domainID, execution, queryNextEventID, token.BranchToken) if err != nil { return nil, wh.error(err, scope) } @@ -1740,7 +1760,8 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory( if !isCloseEventOnly { queryNextEventID = common.FirstEventID } - token.EventStoreVersion, token.BranchToken, runID, lastFirstEventID, nextEventID, isWorkflowRunning, err = queryHistory(domainID, execution, queryNextEventID) + token.EventStoreVersion, token.BranchToken, runID, lastFirstEventID, nextEventID, isWorkflowRunning, err = + queryHistory(domainID, execution, queryNextEventID, nil) if err != nil { return nil, wh.error(err, scope) } @@ -1767,7 +1788,6 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory( getRequest.GetMaximumPageSize(), nil, token.TransientDecision, - token.EventStoreVersion, token.BranchToken, ) if err != nil { @@ -1800,7 +1820,6 @@ func (wh *WorkflowHandler) GetWorkflowExecutionHistory( getRequest.GetMaximumPageSize(), token.PersistenceToken, token.TransientDecision, - token.EventStoreVersion, token.BranchToken, ) if err != nil { @@ -2882,13 +2901,12 @@ func (wh *WorkflowHandler) getHistory( pageSize int32, nextPageToken []byte, transientDecision *gen.TransientDecisionInfo, - eventStoreVersion int32, branchToken []byte, ) (*gen.History, []byte, error) { historyEvents := []*gen.HistoryEvent{} var size int - if eventStoreVersion == persistence.EventStoreVersionV2 { + if len(branchToken) != 0 { shardID := common.WorkflowIDToHistoryShard(*execution.WorkflowId, wh.config.NumHistoryShards) var err error historyEvents, size, nextPageToken, err = persistence.ReadFullPageV2Events(wh.historyV2Mgr, &persistence.ReadHistoryBranchRequest{ @@ -3125,7 +3143,8 @@ func (wh *WorkflowHandler) createPollForDecisionTaskResponse( nextEventID, int32(wh.config.HistoryMaxPageSize(domain.GetInfo().Name)), nil, - matchingResp.DecisionInfo, eventStoreVersion, branchToken, + matchingResp.DecisionInfo, + branchToken, ) if err != nil { return nil, err diff --git a/service/frontend/workflowHandler_test.go b/service/frontend/workflowHandler_test.go index 705028222b4..e2ad289ead7 100644 --- a/service/frontend/workflowHandler_test.go +++ b/service/frontend/workflowHandler_test.go @@ -1128,13 +1128,14 @@ func (s *workflowHandlerSuite) TestGetHistory() { domainID := uuid.New() firstEventID := int64(100) nextEventID := int64(101) + branchToken := []byte{1} we := gen.WorkflowExecution{ WorkflowId: common.StringPtr("wid"), RunId: common.StringPtr("rid"), } shardID := common.WorkflowIDToHistoryShard(*we.WorkflowId, numHistoryShards) req := &persistence.ReadHistoryBranchRequest{ - BranchToken: []byte{}, + BranchToken: branchToken, MinEventID: firstEventID, MaxEventID: nextEventID, PageSize: 0, @@ -1156,7 +1157,7 @@ func (s *workflowHandlerSuite) TestGetHistory() { wh := s.getWorkflowHandlerWithParams(mService, config, mMetadataManager) wh.metricsClient = wh.Service.GetMetricsClient() scope := wh.metricsClient.Scope(0) - history, token, err := wh.getHistory(scope, domainID, we, firstEventID, nextEventID, 0, []byte{}, nil, persistence.EventStoreVersionV2, []byte{}) + history, token, err := wh.getHistory(scope, domainID, we, firstEventID, nextEventID, 0, []byte{}, nil, branchToken) s.NotNil(history) s.Equal([]byte{}, token) s.NoError(err) diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index 339566e3224..ab5c434a515 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -21,6 +21,7 @@ package history import ( + "bytes" ctx "context" "encoding/json" "errors" @@ -90,30 +91,29 @@ var ( // ErrTaskRetry is the error indicating that the timer / transfer task should be retried. ErrTaskRetry = errors.New("passive task should retry due to condition in mutable state is not met") // ErrDuplicate is exported temporarily for integration test - ErrDuplicate = errors.New("Duplicate task, completing it") + ErrDuplicate = errors.New("duplicate task, completing it") // ErrConflict is exported temporarily for integration test - ErrConflict = errors.New("Conditional update failed") + ErrConflict = errors.New("conditional update failed") // ErrMaxAttemptsExceeded is exported temporarily for integration test - ErrMaxAttemptsExceeded = errors.New("Maximum attempts exceeded to update history") + ErrMaxAttemptsExceeded = errors.New("maximum attempts exceeded to update history") // ErrStaleState is the error returned during state update indicating that cached mutable state could be stale - ErrStaleState = errors.New("Cache mutable state could potentially be stale") + ErrStaleState = errors.New("cache mutable state could potentially be stale") // ErrActivityTaskNotFound is the error to indicate activity task could be duplicate and activity already completed - ErrActivityTaskNotFound = &workflow.EntityNotExistsError{Message: "Activity task not found."} + 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."} + ErrWorkflowCompleted = &workflow.EntityNotExistsError{Message: "workflow execution already completed"} // ErrWorkflowParent is the error to parent execution is given and mismatch - ErrWorkflowParent = &workflow.EntityNotExistsError{Message: "Workflow parent does not match."} + 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."} + ErrDeserializingToken = &workflow.BadRequestError{Message: "error deserializing task token"} // ErrSignalOverSize is the error to indicate signal input size is > 256K - ErrSignalOverSize = &workflow.BadRequestError{Message: "Signal input size is over 256K."} + ErrSignalOverSize = &workflow.BadRequestError{Message: "signal input size is over 256K"} // ErrCancellationAlreadyRequested is the error indicating cancellation for target workflow is already requested - ErrCancellationAlreadyRequested = &workflow.CancellationAlreadyRequestedError{Message: "Cancellation already requested for this workflow execution."} + ErrCancellationAlreadyRequested = &workflow.CancellationAlreadyRequestedError{Message: "cancellation already requested for this workflow execution"} // ErrSignalsLimitExceeded is the error indicating limit reached for maximum number of signal events - ErrSignalsLimitExceeded = &workflow.LimitExceededError{Message: "Exceeded workflow execution limit for signal events"} + ErrSignalsLimitExceeded = &workflow.LimitExceededError{Message: "exceeded workflow execution limit for signal events"} // ErrEventsAterWorkflowFinish is the error indicating server error trying to write events after workflow finish event - ErrEventsAterWorkflowFinish = &workflow.InternalServiceError{Message: "error validating last event being workflow finish event."} - + ErrEventsAterWorkflowFinish = &workflow.InternalServiceError{Message: "error validating last event being workflow finish event"} // FailedWorkflowCloseState is a set of failed workflow close states, used for start workflow policy // for start workflow execution API FailedWorkflowCloseState = map[int]bool{ @@ -526,7 +526,9 @@ func (e *historyEngineImpl) PollMutableState( response, err := e.getMutableStateOrPolling(ctx, &h.GetMutableStateRequest{ DomainUUID: request.DomainUUID, Execution: request.Execution, - ExpectedNextEventId: request.ExpectedNextEventId}) + ExpectedNextEventId: request.ExpectedNextEventId, + CurrentBranchToken: request.CurrentBranchToken}) + if err != nil { return nil, err } @@ -542,7 +544,7 @@ func (e *historyEngineImpl) PollMutableState( ClientFeatureVersion: response.ClientFeatureVersion, ClientImpl: response.ClientImpl, StickyTaskListScheduleToStartTimeout: response.StickyTaskListScheduleToStartTimeout, - BranchToken: response.BranchToken, + CurrentBranchToken: response.CurrentBranchToken, ReplicationInfo: response.ReplicationInfo, VersionHistories: response.VersionHistories, WorkflowState: response.WorkflowState, @@ -567,7 +569,14 @@ func (e *historyEngineImpl) getMutableStateOrPolling( if err != nil { return nil, err } - + if request.CurrentBranchToken == nil { + request.CurrentBranchToken = response.CurrentBranchToken + } + if !bytes.Equal(request.CurrentBranchToken, response.CurrentBranchToken) { + return nil, &workflow.CurrentBranchChangedError{ + Message: "current branch token and request branch token doesn't match.", + CurrentBranchToken: response.CurrentBranchToken} + } // set the run id in case query the current running workflow execution.RunId = response.Execution.RunId @@ -590,9 +599,13 @@ func (e *historyEngineImpl) getMutableStateOrPolling( if err != nil { return nil, err } - - if expectedNextEventID < response.GetNextEventId() || - !response.GetIsWorkflowRunning() { + // check again if the current branch token changed + if !bytes.Equal(request.CurrentBranchToken, response.CurrentBranchToken) { + return nil, &workflow.CurrentBranchChangedError{ + Message: "current branch token and request branch token doesn't match.", + CurrentBranchToken: response.CurrentBranchToken} + } + if expectedNextEventID < response.GetNextEventId() || !response.GetIsWorkflowRunning() { return response, nil } @@ -607,10 +620,16 @@ func (e *historyEngineImpl) getMutableStateOrPolling( case event := <-channel: response.LastFirstEventId = common.Int64Ptr(event.lastFirstEventID) response.NextEventId = common.Int64Ptr(event.nextEventID) - response.IsWorkflowRunning = common.BoolPtr(event.isWorkflowRunning) + response.IsWorkflowRunning = common.BoolPtr(event.workflowExecutionCloseState == persistence.WorkflowCloseStatusNone) response.PreviousStartedEventId = common.Int64Ptr(event.previousStartedEventID) - if expectedNextEventID < response.GetNextEventId() || - !response.GetIsWorkflowRunning() { + response.WorkflowState = common.Int32Ptr(int32(event.workflowExecutionState)) + response.WorkflowCloseState = common.Int32Ptr(int32(event.workflowExecutionCloseState)) + if !bytes.Equal(request.CurrentBranchToken, event.currentBranchToken) { + return nil, &workflow.CurrentBranchChangedError{ + Message: "Current branch token and request branch token doesn't match.", + CurrentBranchToken: event.currentBranchToken} + } + if expectedNextEventID < response.GetNextEventId() || !response.GetIsWorkflowRunning() { return response, nil } case <-timer.C: @@ -663,7 +682,7 @@ func (e *historyEngineImpl) getMutableState( IsWorkflowRunning: common.BoolPtr(msBuilder.IsWorkflowExecutionRunning()), StickyTaskListScheduleToStartTimeout: common.Int32Ptr(executionInfo.StickyScheduleToStartTimeout), EventStoreVersion: common.Int32Ptr(msBuilder.GetEventStoreVersion()), - BranchToken: currentBranchToken, + CurrentBranchToken: currentBranchToken, WorkflowState: common.Int32Ptr(int32(workflowState)), WorkflowCloseState: common.Int32Ptr(int32(workflowCloseState)), } diff --git a/service/history/historyEngineInterfaces.go b/service/history/historyEngineInterfaces.go index dac000bbfc4..b2ab2ae8a28 100644 --- a/service/history/historyEngineInterfaces.go +++ b/service/history/historyEngineInterfaces.go @@ -33,12 +33,14 @@ import ( type ( historyEventNotification struct { - id definition.WorkflowIdentifier - lastFirstEventID int64 - nextEventID int64 - previousStartedEventID int64 - isWorkflowRunning bool - timestamp time.Time + id definition.WorkflowIdentifier + lastFirstEventID int64 + nextEventID int64 + previousStartedEventID int64 + timestamp time.Time + currentBranchToken []byte + workflowExecutionState int + workflowExecutionCloseState int } // Engine represents an interface for managing workflow execution history. diff --git a/service/history/historyEngine_test.go b/service/history/historyEngine_test.go index ff632f4ecdf..130108e522f 100644 --- a/service/history/historyEngine_test.go +++ b/service/history/historyEngine_test.go @@ -381,10 +381,88 @@ func (s *engineSuite) TestGetMutableStateLongPoll() { }) s.True(time.Now().After(start.Add(time.Second * 1))) s.Nil(err) - s.Equal(int64(5), *pollResponse.NextEventId) + s.Equal(int64(5), pollResponse.GetNextEventId()) waitGroup.Wait() } +func (s *engineSuite) TestGetMutableStateLongPoll_CurrentBranchChanged() { + ctx := context.Background() + domainID := validDomainID + execution := workflow.WorkflowExecution{ + WorkflowId: common.StringPtr("test-get-workflow-execution-event-id"), + RunId: common.StringPtr(validRunID), + } + tasklist := "testTaskList" + identity := "testIdentity" + + msBuilder := newMutableStateBuilderWithEventV2( + s.mockHistoryEngine.shard, + s.eventsCache, + loggerimpl.NewDevelopmentForTest(s.Suite), + execution.GetRunId()) + addWorkflowExecutionStartedEvent(msBuilder, execution, "wType", tasklist, []byte("input"), 100, 200, identity) + di := addDecisionTaskScheduledEvent(msBuilder) + addDecisionTaskStartedEvent(msBuilder, di.ScheduleID, tasklist, identity) + ms := createMutableState(msBuilder) + gweResponse := &persistence.GetWorkflowExecutionResponse{State: ms} + // right now the next event ID is 4 + s.mockExecutionMgr.On("GetWorkflowExecution", mock.Anything).Return(gweResponse, nil).Once() + s.mockMetadataMgr.On("GetDomain", mock.Anything).Return( + &persistence.GetDomainResponse{ + Info: &persistence.DomainInfo{ID: domainID, Name: "testDomain"}, + Config: &persistence.DomainConfig{Retention: 1}, + ReplicationConfig: &persistence.DomainReplicationConfig{ + ActiveClusterName: cluster.TestCurrentClusterName, + Clusters: []*persistence.ClusterReplicationConfig{ + {ClusterName: cluster.TestCurrentClusterName}, + }, + }, + TableVersion: persistence.DomainTableVersionV1, + }, + nil, + ).Once() + + // test long poll on next event ID change + asyncBranchTokenUpdate := func(delay time.Duration) { + timer := time.NewTimer(delay) + <-timer.C + newExecution := &workflow.WorkflowExecution{ + WorkflowId: execution.WorkflowId, + RunId: execution.RunId, + } + s.mockHistoryEngine.historyEventNotifier.NotifyNewHistoryEvent(newHistoryEventNotification( + "domainID", + newExecution, + int64(1), + int64(4), + int64(1), + []byte{1}, + persistence.WorkflowStateCreated, + persistence.WorkflowCloseStatusNone)) + } + + // return immediately, since the expected next event ID appears + response0, err := s.mockHistoryEngine.GetMutableState(ctx, &history.GetMutableStateRequest{ + DomainUUID: common.StringPtr(domainID), + Execution: &execution, + ExpectedNextEventId: common.Int64Ptr(3), + }) + s.Nil(err) + s.Equal(int64(4), response0.GetNextEventId()) + + // long poll, new event happen before long poll timeout + go asyncBranchTokenUpdate(time.Second * 2) + start := time.Now() + response1, err := s.mockHistoryEngine.GetMutableState(ctx, &history.GetMutableStateRequest{ + DomainUUID: common.StringPtr(domainID), + Execution: &execution, + ExpectedNextEventId: common.Int64Ptr(10), + }) + s.True(time.Now().After(start.Add(time.Second * 1))) + s.Nil(err) + s.Equal(response0.GetCurrentBranchToken(), response1.GetCurrentBranchToken()) +} + func (s *engineSuite) TestGetMutableStateLongPollTimeout() { ctx := context.Background() domainID := validDomainID @@ -426,7 +504,7 @@ func (s *engineSuite) TestGetMutableStateLongPollTimeout() { ExpectedNextEventId: common.Int64Ptr(4), }) s.Nil(err) - s.Equal(int64(4), *response.NextEventId) + s.Equal(int64(4), response.GetNextEventId()) } func (s *engineSuite) TestRespondDecisionTaskCompletedInvalidToken() { @@ -4900,7 +4978,7 @@ func (s *engineSuite) TestSignalWorkflowExecution_Failed() { nil, ) err = s.mockHistoryEngine.SignalWorkflowExecution(context.Background(), signalRequest) - s.EqualError(err, "EntityNotExistsError{Message: Workflow execution already completed.}") + s.EqualError(err, "EntityNotExistsError{Message: workflow execution already completed}") } func (s *engineSuite) TestRemoveSignalMutableState() { diff --git a/service/history/historyEventNotifier.go b/service/history/historyEventNotifier.go index 1f8cccbaba9..59d534ed445 100644 --- a/service/history/historyEventNotifier.go +++ b/service/history/historyEventNotifier.go @@ -60,22 +60,38 @@ type ( var _ historyEventNotifier = (*historyEventNotifierImpl)(nil) -func newHistoryEventNotification(domainID string, workflowExecution *gen.WorkflowExecution, - lastFirstEventID int64, nextEventID int64, previousStartedEventID int64, isWorkflowRunning bool) *historyEventNotification { +func newHistoryEventNotification( + domainID string, + workflowExecution *gen.WorkflowExecution, + lastFirstEventID int64, + nextEventID int64, + previousStartedEventID int64, + currentBranchToken []byte, + workflowExecutionState int, + workflowExecutionCloseState int, +) *historyEventNotification { + return &historyEventNotification{ id: definition.NewWorkflowIdentifier( domainID, workflowExecution.GetWorkflowId(), workflowExecution.GetRunId(), ), - lastFirstEventID: lastFirstEventID, - nextEventID: nextEventID, - previousStartedEventID: previousStartedEventID, - isWorkflowRunning: isWorkflowRunning, + lastFirstEventID: lastFirstEventID, + nextEventID: nextEventID, + previousStartedEventID: previousStartedEventID, + currentBranchToken: currentBranchToken, + workflowExecutionState: workflowExecutionState, + workflowExecutionCloseState: workflowExecutionCloseState, } } -func newHistoryEventNotifier(timeSource clock.TimeSource, metrics metrics.Client, workflowIDToShardID func(string) int) *historyEventNotifierImpl { +func newHistoryEventNotifier( + timeSource clock.TimeSource, + metrics metrics.Client, + workflowIDToShardID func(string) int, +) *historyEventNotifierImpl { + hashFn := func(key interface{}) uint32 { notification, ok := key.(historyEventNotification) if !ok { diff --git a/service/history/historyEventNotifier_test.go b/service/history/historyEventNotifier_test.go index 04c6386e03a..3ba1e05d1dd 100644 --- a/service/history/historyEventNotifier_test.go +++ b/service/history/historyEventNotifier_test.go @@ -32,6 +32,7 @@ import ( "github.com/uber/cadence/common/clock" "github.com/uber/cadence/common/definition" "github.com/uber/cadence/common/metrics" + "github.com/uber/cadence/common/persistence" ) type ( @@ -75,11 +76,13 @@ func (s *historyEventNotifierSuite) TestSingleSubscriberWatchingEvents() { WorkflowId: common.StringPtr("workflow ID"), RunId: common.StringPtr("run ID"), } - var lastFirstEventID int64 = 3 - var previousStartedEventID int64 = 5 - var nextEventID int64 = 18 - isRunning := true - historyEvent := newHistoryEventNotification(domainID, execution, lastFirstEventID, nextEventID, previousStartedEventID, isRunning) + lastFirstEventID := int64(3) + previousStartedEventID := int64(5) + nextEventID := int64(18) + workflowState := persistence.WorkflowStateCreated + workflowCloseState := persistence.WorkflowCloseStatusNone + branchToken := make([]byte, 0) + historyEvent := newHistoryEventNotification(domainID, execution, lastFirstEventID, nextEventID, previousStartedEventID, branchToken, workflowState, workflowCloseState) timerChan := time.NewTimer(time.Second * 2).C subscriberID, channel, err := s.historyEventNotifier.WatchHistoryEvent(definition.NewWorkflowIdentifier(domainID, execution.GetWorkflowId(), execution.GetRunId())) @@ -106,11 +109,13 @@ func (s *historyEventNotifierSuite) TestMultipleSubscriberWatchingEvents() { RunId: common.StringPtr("run ID"), } - var lastFirstEventID int64 = 3 - var previousStartedEventID int64 = 5 - var nextEventID int64 = 18 - isRunning := true - historyEvent := newHistoryEventNotification(domainID, execution, lastFirstEventID, nextEventID, previousStartedEventID, isRunning) + lastFirstEventID := int64(3) + previousStartedEventID := int64(5) + nextEventID := int64(18) + workflowState := persistence.WorkflowStateCreated + workflowCloseState := persistence.WorkflowCloseStatusNone + branchToken := make([]byte, 0) + historyEvent := newHistoryEventNotification(domainID, execution, lastFirstEventID, nextEventID, previousStartedEventID, branchToken, workflowState, workflowCloseState) timerChan := time.NewTimer(time.Second * 5).C subscriberCount := 100 diff --git a/service/history/workflowExecutionContext.go b/service/history/workflowExecutionContext.go index a163f3a16dc..25c3e4888b5 100644 --- a/service/history/workflowExecutionContext.go +++ b/service/history/workflowExecutionContext.go @@ -442,6 +442,24 @@ func (c *workflowExecutionContextImpl) conflictResolveWorkflowExecution( return err } + currentBranchToken, err := resetMutableState.GetCurrentBranchToken() + if err != nil { + return err + } + + workflowState, workflowCloseState := resetMutableState.GetWorkflowStateCloseStatus() + // Current branch changed and notify the watchers + c.engine.NotifyNewHistoryEvent(newHistoryEventNotification( + c.domainID, + &c.workflowExecution, + resetMutableState.GetLastFirstEventID(), + resetMutableState.GetNextEventID(), + resetMutableState.GetPreviousStartedEventID(), + currentBranchToken, + workflowState, + workflowCloseState, + )) + c.notifyTasks( resetWorkflow.TransferTasks, resetWorkflow.ReplicationTasks, @@ -600,6 +618,12 @@ func (c *workflowExecutionContextImpl) updateWorkflowExecutionWithNew( CloseStatus: c.msBuilder.GetExecutionInfo().CloseStatus, }) + currentBranchToken, err := c.msBuilder.GetCurrentBranchToken() + if err != nil { + return err + } + + workflowState, workflowCloseState := c.msBuilder.GetWorkflowStateCloseStatus() // for any change in the workflow, send a event // TODO: @andrewjdawson2016 remove historyEventNotifier once plumbing for MutableStatePubSub is finished c.engine.NotifyNewHistoryEvent(newHistoryEventNotification( @@ -608,7 +632,9 @@ func (c *workflowExecutionContextImpl) updateWorkflowExecutionWithNew( c.msBuilder.GetLastFirstEventID(), c.msBuilder.GetNextEventID(), c.msBuilder.GetPreviousStartedEventID(), - c.msBuilder.IsWorkflowExecutionRunning(), + currentBranchToken, + workflowState, + workflowCloseState, )) // notify current workflow tasks diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 45ce87b12fd..86487fe1fc1 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -355,7 +355,7 @@ pollLoop: StickyExecutionEnabled: common.BoolPtr(isStickyEnabled), WorkflowExecutionTaskList: mutableStateResp.TaskList, EventStoreVersion: mutableStateResp.EventStoreVersion, - BranchToken: mutableStateResp.BranchToken, + BranchToken: mutableStateResp.CurrentBranchToken, } return e.createPollForDecisionTaskResponse(task, resp), nil } @@ -494,7 +494,7 @@ query_loop: expectedNextEventID := result.waitNextEventID wait_loop: for j := 0; j < maxQueryWaitCount; j++ { - ms, err := e.historyService.GetMutableState(ctx, &h.GetMutableStateRequest{ + ms, err := e.historyService.PollMutableState(ctx, &h.PollMutableStateRequest{ DomainUUID: queryRequest.DomainUUID, Execution: queryRequest.QueryRequest.Execution, ExpectedNextEventId: common.Int64Ptr(expectedNextEventID), @@ -505,7 +505,7 @@ query_loop: continue query_loop } - if !ms.GetIsWorkflowRunning() { + if ms.GetWorkflowCloseState() != persistence.WorkflowCloseStatusNone { return nil, &workflow.QueryFailedError{Message: "workflow closed without making any progress"} }