125
request *historyservice.GetWorkflowExecutionHistoryRequest,
126
persistenceVisibilityMgr manager.VisibilityManager,
127
>
) (_ *historyservice.GetWorkflowExecutionHistoryResponseWithRaw, retError error) {
api.go
128
>
namespaceID := namespace.ID(request.GetNamespaceId())
129
>
namespaceName := namespace.Name(request.GetRequest().GetNamespace())
130
>
err := api.ValidateNamespaceUUID(namespaceID)
131
>
if err != nil {
132
return nil, err
133
}
134
135
>
isCloseEventOnly := request.Request.GetHistoryEventFilterType() == enumspb.HISTORY_EVENT_FILTER_TYPE_CLOSE_EVENT
api.go
136
>
137
>
queryMutableState := func(
138
>
namespaceUUID namespace.ID,
139
>
execution *commonpb.WorkflowExecution,
140
>
expectedNextEventID int64,
141
>
currentBranchToken []byte,
142
>
versionHistoryItem *historyspb.VersionHistoryItem,
143
>
versionedTransition *persistencespb.VersionedTransition,
144
>
) (
145
>
[]byte, // current branch token (to use to retrieve history events)
146
>
string, // workflow run ID
147
>
int64, // last first event ID (the event ID of the last batch of events in the history)
148
>
int64, // last first event transaction id
149
>
bool, // whether the workflow is running
150
>
*historyspb.VersionHistoryItem, // version history item for the current branch
151
>
*persistencespb.VersionedTransition, // last versioned transition
152
>
*historyspb.TransientWorkflowTaskInfo, // transient workflow task info
153
>
error, // error if any
154
>
) {
155
>
response, err := api.GetOrPollWorkflowMutableState(
156
>
ctx,
157
>
shardContext,
158
>
&historyservice.GetMutableStateRequest{
159
>
NamespaceId: namespaceUUID.String(),
160
>
Execution: execution,
161
>
ExpectedNextEventId: expectedNextEventID,
162
>
CurrentBranchToken: currentBranchToken,
163
>
VersionHistoryItem: versionHistoryItem,
164
>
VersionedTransition: versionedTransition,
165
>
},
166
>
workflowConsistencyChecker,
167
>
eventNotifier,
168
>
)
169
>
170
>
var branchErr *serviceerrors.CurrentBranchChanged
171
>
if errors.As(err, &branchErr) && isCloseEventOnly {
172
shardContext.GetLogger().Info("Got CurrentBranchChanged, retry with empty branch token",
173
tag.WorkflowNamespaceID(namespaceUUID.String()),