Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions service/frontend/namespace_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,9 @@ func (d *namespaceHandler) createResponse(
WorkflowTaskCompletionPagination: d.config.EnableWorkflowTaskCompletionPagination(info.Name),
},
Limits: &namespacepb.NamespaceInfo_Limits{
BlobSizeLimitError: int64(d.config.BlobSizeLimitError(info.Name)),
MemoSizeLimitError: int64(d.config.MemoSizeLimitError(info.Name)),
BlobSizeLimitError: int64(d.config.BlobSizeLimitError(info.Name)),
MemoSizeLimitError: int64(d.config.MemoSizeLimitError(info.Name)),
WorkflowTaskCompletionSizeLimitError: int64(d.config.WorkflowTaskCompletionBufferSizeLimit(info.Name)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Expose a limit that applies to the whole completion

When pagination is enabled and the final page carries commands, this reports the buffer limit as the maximum total workflow-task-completion size, but AppendTaskCompletionPage enforces it only against intermediate-page commands (service/history/workflow/context.go:238-244); GetMergedTaskCompletionPages adds the final-page size only to a metric (context.go:346-350), and non-paginated completions bypass the limit entirely. Consequently, a server configured with a small limit can accept completions much larger than the value advertised to SDKs, so the new field cannot reliably guide their paging decisions; either enforce this value against the complete logical request or expose a limit whose documented semantics match the buffer-only check.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll think about this. But out of scope for this change.

},
SupportsSchedules: d.config.EnableSchedules(info.Name),
}
Expand Down
3 changes: 3 additions & 0 deletions service/frontend/namespace_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ func (s *namespaceHandlerCommonSuite) TestCapabilitiesAndLimits() {
s.False(resp.NamespaceInfo.Capabilities.WorkflowTaskCompletionPagination)
s.Equal(int64(2*1024*1024), resp.NamespaceInfo.Limits.BlobSizeLimitError)
s.Equal(int64(2*1024*1024), resp.NamespaceInfo.Limits.MemoSizeLimitError)
s.Equal(int64(40*1024*1024), resp.NamespaceInfo.Limits.WorkflowTaskCompletionSizeLimitError)

// Second call: Override the default value of dynamic configs.
s.config.EnableEagerWorkflowStart = dc.GetBoolPropertyFnFilteredByNamespace(false)
Expand All @@ -415,6 +416,7 @@ func (s *namespaceHandlerCommonSuite) TestCapabilitiesAndLimits() {
s.config.WorkerCommandsEnabled = dc.GetBoolPropertyFnFilteredByNamespace(true)
s.config.PollerAutoscalingAutoEnroll = dc.GetBoolPropertyFnFilteredByNamespace(true)
s.config.EnableWorkflowTaskCompletionPagination = dc.GetBoolPropertyFnFilteredByNamespace(true)
s.config.WorkflowTaskCompletionBufferSizeLimit = dc.GetIntPropertyFnFilteredByNamespace(4096)

resp, err = s.handler.DescribeNamespace(context.Background(), &workflowservice.DescribeNamespaceRequest{
Namespace: "ns",
Expand All @@ -434,6 +436,7 @@ func (s *namespaceHandlerCommonSuite) TestCapabilitiesAndLimits() {
s.True(resp.NamespaceInfo.Capabilities.WorkflowTaskCompletionPagination)
s.Equal(int64(1024), resp.NamespaceInfo.Limits.BlobSizeLimitError)
s.Equal(int64(512), resp.NamespaceInfo.Limits.MemoSizeLimitError)
s.Equal(int64(4096), resp.NamespaceInfo.Limits.WorkflowTaskCompletionSizeLimitError)

s.config.Activity.StartDelayEnabled = dc.GetBoolPropertyFnFilteredByNamespace(true)
s.config.Activity.EnableStandaloneActivityOperatorCommands = dc.GetBoolPropertyFnFilteredByNamespace(true)
Expand Down
2 changes: 2 additions & 0 deletions service/frontend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ type Config struct {
WorkflowTimeSkippingMaxSkipPerSession dynamicconfig.IntPropertyFnWithNamespaceFilter
StandaloneNexusOperationsEnabled dynamicconfig.BoolPropertyFnWithNamespaceFilter
EnableWorkflowTaskCompletionPagination dynamicconfig.BoolPropertyFnWithNamespaceFilter
WorkflowTaskCompletionBufferSizeLimit dynamicconfig.IntPropertyFnWithNamespaceFilter

HTTPAllowedHosts dynamicconfig.TypedPropertyFn[*regexp.Regexp]
AllowedExperiments dynamicconfig.TypedPropertyFnWithNamespaceFilter[[]string]
Expand Down Expand Up @@ -420,6 +421,7 @@ func NewConfig(
WorkflowTimeSkippingMaxSkipPerSession: dynamicconfig.WorkflowTimeSkippingMaxSkipPerSession.Get(dc),
StandaloneNexusOperationsEnabled: chasmnexus.Enabled.Get(dc),
EnableWorkflowTaskCompletionPagination: dynamicconfig.EnableWorkflowTaskCompletionPagination.Get(dc),
WorkflowTaskCompletionBufferSizeLimit: dynamicconfig.WorkflowTaskCompletionBufferSizeLimit.Get(dc),

HTTPAllowedHosts: dynamicconfig.FrontendHTTPAllowedHosts.Get(dc),
AllowedExperiments: dynamicconfig.FrontendAllowedExperiments.Get(dc),
Expand Down
2 changes: 1 addition & 1 deletion service/history/api/respondworkflowtaskcompleted/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func (handler *WorkflowTaskCompletedHandler) Invoke(
if paginationOverflow {
// Per-workflow completion buffer overflowed: terminate the workflow
wtFailedCause = newWorkflowTaskFailedCause(
enumspb.WORKFLOW_TASK_FAILED_CAUSE_PAYLOADS_TOO_LARGE,
enumspb.WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just confirm my understanding that SDK will consume the new enum compatibly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed it offline. Not sure what you mean by "compatibly" here, can talk more if something is unclear.

serviceerror.NewInvalidArgument(
"workflow task completion buffer size exceeds the per-workflow limit"),
true)
Expand Down
5 changes: 5 additions & 0 deletions tests/workflow_completion_pagination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ func (s *WorkflowCompletionPaginationTestSuite) TestBufferOverflowFailsWorkflowT
history := env.GetHistory(env.Namespace().String(), we)
s.Equal(1, countEvents(history, enumspb.EVENT_TYPE_WORKFLOW_TASK_FAILED))
s.Equal(0, countEvents(history, enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED))
for _, e := range history {
if e.GetEventType() == enumspb.EVENT_TYPE_WORKFLOW_TASK_FAILED {
s.Equal(enumspb.WORKFLOW_TASK_FAILED_CAUSE_REQUEST_TOO_LARGE, e.GetWorkflowTaskFailedEventAttributes().GetCause())
}
}
}

// TestOutOfOrderPagesReassemble verifies that pages buffered out of arrival order
Expand Down
Loading