Skip to content

Commit 135bf3b

Browse files
committed
dynamic config
1 parent a15019f commit 135bf3b

File tree

6 files changed

+15
-3
lines changed

6 files changed

+15
-3
lines changed

common/dynamicconfig/constants.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,11 @@ the number of children greater than or equal to this threshold`,
22612261
time.Minute*10,
22622262
`WorkflowTaskRetryMaxInterval is the maximum interval added to a workflow task's startToClose timeout for slowing down retry`,
22632263
)
2264+
EnableWorkflowTaskStampIncrementOnFailure = NewGlobalBoolSetting(
2265+
"history.enableWorkflowTaskStampIncrementOnFailure",
2266+
false,
2267+
`EnableWorkflowTaskStampIncrementOnFailure controls whether the workflow task stamp is incremented when a workflow task fails and is rescheduled`,
2268+
)
22642269
DiscardSpeculativeWorkflowTaskMaximumEventsCount = NewGlobalIntSetting(
22652270
"history.discardSpeculativeWorkflowTaskMaximumEventsCount",
22662271
10,

service/history/configs/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ type Config struct {
247247
WorkflowTaskHeartbeatTimeout dynamicconfig.DurationPropertyFnWithNamespaceFilter
248248
WorkflowTaskCriticalAttempts dynamicconfig.IntPropertyFn
249249
WorkflowTaskRetryMaxInterval dynamicconfig.DurationPropertyFn
250+
EnableWorkflowTaskStampIncrementOnFailure dynamicconfig.BoolPropertyFn
250251
DiscardSpeculativeWorkflowTaskMaximumEventsCount dynamicconfig.IntPropertyFn
251252
EnableDropRepeatedWorkflowTaskFailures dynamicconfig.BoolPropertyFnWithNamespaceFilter
252253

@@ -624,6 +625,7 @@ func NewConfig(
624625
WorkflowTaskHeartbeatTimeout: dynamicconfig.WorkflowTaskHeartbeatTimeout.Get(dc),
625626
WorkflowTaskCriticalAttempts: dynamicconfig.WorkflowTaskCriticalAttempts.Get(dc),
626627
WorkflowTaskRetryMaxInterval: dynamicconfig.WorkflowTaskRetryMaxInterval.Get(dc),
628+
EnableWorkflowTaskStampIncrementOnFailure: dynamicconfig.EnableWorkflowTaskStampIncrementOnFailure.Get(dc),
627629
DiscardSpeculativeWorkflowTaskMaximumEventsCount: dynamicconfig.DiscardSpeculativeWorkflowTaskMaximumEventsCount.Get(dc),
628630
EnableDropRepeatedWorkflowTaskFailures: dynamicconfig.EnableDropRepeatedWorkflowTaskFailures.Get(dc),
629631

service/history/timer_queue_standby_task_executor_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func (s *timerQueueStandbyTaskExecutorSuite) SetupTest() {
109109
s.ProtoAssertions = protorequire.New(s.T())
110110

111111
s.config = tests.NewDynamicConfig()
112+
s.config.EnableWorkflowTaskStampIncrementOnFailure = func() bool { return true }
112113
s.namespaceEntry = tests.GlobalStandbyNamespaceEntry
113114
s.namespaceID = s.namespaceEntry.ID()
114115
s.version = s.namespaceEntry.FailoverVersion()

service/history/workflow/workflow_task_state_machine.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,9 @@ func (m *workflowTaskStateMachine) failWorkflowTask(
940940
if incrementAttempt {
941941
failWorkflowTaskInfo.Attempt = m.ms.executionInfo.WorkflowTaskAttempt + 1
942942
failWorkflowTaskInfo.ScheduledTime = m.ms.timeSource.Now().UTC()
943-
m.ms.executionInfo.WorkflowTaskStamp += 1
943+
if m.ms.config.EnableWorkflowTaskStampIncrementOnFailure() {
944+
m.ms.executionInfo.WorkflowTaskStamp += 1
945+
}
944946
}
945947
m.retainWorkflowTaskBuildIdInfo(failWorkflowTaskInfo)
946948
m.UpdateWorkflowTask(failWorkflowTaskInfo)

tests/versioning_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func (s *VersioningIntegSuite) SetupSuite() {
6464
dynamicconfig.FrontendEnableWorkerVersioningRuleAPIs.Key(): true,
6565
dynamicconfig.MatchingForwarderMaxChildrenPerNode.Key(): partitionTreeDegree,
6666
dynamicconfig.TaskQueuesPerBuildIdLimit.Key(): 3,
67+
dynamicconfig.EnableWorkflowTaskStampIncrementOnFailure.Key(): true,
6768

6869
dynamicconfig.AssignmentRuleLimitPerQueue.Key(): 10,
6970
dynamicconfig.RedirectRuleLimitPerQueue.Key(): 10,

tests/xdc/stream_based_replication_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ func TestStreamBasedReplicationTestSuite(t *testing.T) {
8888
func (s *streamBasedReplicationTestSuite) SetupSuite() {
8989
s.controller = gomock.NewController(s.T())
9090
s.dynamicConfigOverrides = map[dynamicconfig.Key]any{
91-
dynamicconfig.EnableReplicationStream.Key(): true,
92-
dynamicconfig.EnableReplicationTaskBatching.Key(): true,
91+
dynamicconfig.EnableReplicationStream.Key(): true,
92+
dynamicconfig.EnableReplicationTaskBatching.Key(): true,
93+
dynamicconfig.EnableWorkflowTaskStampIncrementOnFailure.Key(): true,
9394
}
9495
s.logger = log.NewTestLogger()
9596
s.serializer = serialization.NewSerializer()

0 commit comments

Comments
 (0)