Skip to content

Commit 908a672

Browse files
authored
Fail workflow task with BadSearchAttributes cause if search attributes mapper returned an error (#3919)
1 parent 9e37fec commit 908a672

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

service/history/workflowTaskHandler.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,11 @@ func (handler *workflowTaskHandlerImpl) handleCommandContinueAsNewWorkflow(
817817
namespaceName.String(),
818818
)
819819
if err != nil {
820-
handler.stopProcessing = true
821-
return err
820+
return handler.failWorkflowTaskOnInvalidArgument(enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, err)
822821
}
823822
if unaliasedSas != nil {
823+
// Create a shallow copy of the `attr` to avoid modification of original `attr`,
824+
// which can be needed again in case of retry.
824825
newAttr := *attr
825826
newAttr.SearchAttributes = unaliasedSas
826827
attr = &newAttr
@@ -928,10 +929,11 @@ func (handler *workflowTaskHandlerImpl) handleCommandStartChildWorkflow(
928929
targetNamespace.String(),
929930
)
930931
if err != nil {
931-
handler.stopProcessing = true
932-
return err
932+
return handler.failWorkflowTaskOnInvalidArgument(enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, err)
933933
}
934934
if unaliasedSas != nil {
935+
// Create a shallow copy of the `attr` to avoid modification of original `attr`,
936+
// which can be needed again in case of retry.
935937
newAttr := *attr
936938
newAttr.SearchAttributes = unaliasedSas
937939
attr = &newAttr
@@ -1072,10 +1074,11 @@ func (handler *workflowTaskHandlerImpl) handleCommandUpsertWorkflowSearchAttribu
10721074
namespace.String(),
10731075
)
10741076
if err != nil {
1075-
handler.stopProcessing = true
1076-
return err
1077+
return handler.failWorkflowTaskOnInvalidArgument(enumspb.WORKFLOW_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES, err)
10771078
}
10781079
if unaliasedSas != nil {
1080+
// Create a shallow copy of the `attr` to avoid modification of original `attr`,
1081+
// which can be needed again in case of retry.
10791082
newAttr := *attr
10801083
newAttr.SearchAttributes = unaliasedSas
10811084
attr = &newAttr

0 commit comments

Comments
 (0)