Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increased timeout value for delete history event task #5888

Merged
merged 7 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
12 changes: 12 additions & 0 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,13 @@ const (
IsolationGroupStateUpdateRetryAttempts

LargeShardHistoryBlobMetricThreshold

// DeleteHistoryEventContextTimeout
timl3136 marked this conversation as resolved.
Show resolved Hide resolved
// KeyName: system.deleteHistoryEventContextTimeout
// Value type: Int
// Default value: 30
DeleteHistoryEventContextTimeout

// LastIntKey must be the last one in this const group
LastIntKey
)
Expand Down Expand Up @@ -3791,6 +3798,11 @@ var IntKeys = map[IntKey]DynamicInt{
Description: "The number of attempts to push Isolation group configuration to the config store",
DefaultValue: 2,
},
DeleteHistoryEventContextTimeout: DynamicInt{
KeyName: "system.deleteHistoryEventContextTimeout",
Description: "This is the number of seconds allowed for a deleteHistoryEvent task to the database",
DefaultValue: 30,
},
}

var BoolKeys = map[BoolKey]DynamicBool{
Expand Down
60 changes: 31 additions & 29 deletions service/history/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,36 @@ import (

// Config represents configuration for cadence-history service
type Config struct {
NumberOfShards int
IsAdvancedVisConfigExist bool
RPS dynamicconfig.IntPropertyFn
MaxIDLengthWarnLimit dynamicconfig.IntPropertyFn
DomainNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
IdentityMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
WorkflowIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
SignalNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
WorkflowTypeMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
RequestIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
TaskListNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
ActivityIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
ActivityTypeMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
MarkerNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
TimerIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
PersistenceMaxQPS dynamicconfig.IntPropertyFn
PersistenceGlobalMaxQPS dynamicconfig.IntPropertyFn
EnableVisibilitySampling dynamicconfig.BoolPropertyFn
EnableReadFromClosedExecutionV2 dynamicconfig.BoolPropertyFn
VisibilityOpenMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
VisibilityClosedMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
AdvancedVisibilityWritingMode dynamicconfig.StringPropertyFn
EmitShardDiffLog dynamicconfig.BoolPropertyFn
MaxAutoResetPoints dynamicconfig.IntPropertyFnWithDomainFilter
ThrottledLogRPS dynamicconfig.IntPropertyFn
EnableStickyQuery dynamicconfig.BoolPropertyFnWithDomainFilter
ShutdownDrainDuration dynamicconfig.DurationPropertyFn
WorkflowDeletionJitterRange dynamicconfig.IntPropertyFnWithDomainFilter
MaxResponseSize int
NumberOfShards int
IsAdvancedVisConfigExist bool
RPS dynamicconfig.IntPropertyFn
MaxIDLengthWarnLimit dynamicconfig.IntPropertyFn
DomainNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
IdentityMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
WorkflowIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
SignalNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
WorkflowTypeMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
RequestIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
TaskListNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
ActivityIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
ActivityTypeMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
MarkerNameMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
TimerIDMaxLength dynamicconfig.IntPropertyFnWithDomainFilter
PersistenceMaxQPS dynamicconfig.IntPropertyFn
PersistenceGlobalMaxQPS dynamicconfig.IntPropertyFn
EnableVisibilitySampling dynamicconfig.BoolPropertyFn
EnableReadFromClosedExecutionV2 dynamicconfig.BoolPropertyFn
VisibilityOpenMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
VisibilityClosedMaxQPS dynamicconfig.IntPropertyFnWithDomainFilter
AdvancedVisibilityWritingMode dynamicconfig.StringPropertyFn
EmitShardDiffLog dynamicconfig.BoolPropertyFn
MaxAutoResetPoints dynamicconfig.IntPropertyFnWithDomainFilter
ThrottledLogRPS dynamicconfig.IntPropertyFn
EnableStickyQuery dynamicconfig.BoolPropertyFnWithDomainFilter
ShutdownDrainDuration dynamicconfig.DurationPropertyFn
WorkflowDeletionJitterRange dynamicconfig.IntPropertyFnWithDomainFilter
DeleteHistoryEventContextTimeout dynamicconfig.IntPropertyFn
MaxResponseSize int

// HistoryCache settings
// Change of these configs require shard restart
Expand Down Expand Up @@ -387,6 +388,7 @@ func New(dc *dynamicconfig.Collection, numberOfShards int, maxMessageSize int, s
StandbyTaskMissingEventsResendDelay: dc.GetDurationProperty(dynamicconfig.StandbyTaskMissingEventsResendDelay),
StandbyTaskMissingEventsDiscardDelay: dc.GetDurationProperty(dynamicconfig.StandbyTaskMissingEventsDiscardDelay),
WorkflowDeletionJitterRange: dc.GetIntPropertyFilteredByDomain(dynamicconfig.WorkflowDeletionJitterRange),
DeleteHistoryEventContextTimeout: dc.GetIntProperty(dynamicconfig.DeleteHistoryEventContextTimeout),
MaxResponseSize: maxMessageSize,

TaskProcessRPS: dc.GetIntPropertyFilteredByDomain(dynamicconfig.TaskProcessRPS),
Expand Down
5 changes: 4 additions & 1 deletion service/history/task/timer_active_task_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ func (t *timerActiveTaskExecutor) Execute(
case persistence.TaskTypeWorkflowBackoffTimer:
return t.executeWorkflowBackoffTimerTask(ctx, timerTask)
case persistence.TaskTypeDeleteHistoryEvent:
return t.executeDeleteHistoryEventTask(ctx, timerTask)
// special timeout for delete history event
deleteHistoryEventContext, deleteHistoryEventCancel := context.WithTimeout(context.Background(), time.Duration(t.config.DeleteHistoryEventContextTimeout())*time.Second)
defer deleteHistoryEventCancel()
return t.executeDeleteHistoryEventTask(deleteHistoryEventContext, timerTask)
default:
return errUnknownTimerTask
}
Expand Down
11 changes: 11 additions & 0 deletions service/history/task/timer_active_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1246,3 +1246,14 @@ func (s *timerActiveTaskExecutorSuite) newTimerTaskFromInfo(
) Task {
return NewTimerTask(s.mockShard, info, QueueTypeActiveTimer, s.logger, nil, nil, nil, nil, nil)
}

func (s *timerActiveTaskExecutorSuite) TestActiveTaskTimeout() {
deleteHistoryEventTask := s.newTimerTaskFromInfo(&persistence.TimerTaskInfo{
Version: s.version,
DomainID: s.domainID,
TaskID: int64(100),
TaskType: persistence.TaskTypeDeleteHistoryEvent,
TimeoutType: int(types.TimeoutTypeStartToClose),
})
s.timerActiveTaskExecutor.Execute(deleteHistoryEventTask, true)
}
5 changes: 4 additions & 1 deletion service/history/task/timer_standby_task_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ func (t *timerStandbyTaskExecutor) Execute(
case persistence.TaskTypeWorkflowBackoffTimer:
return t.executeWorkflowBackoffTimerTask(ctx, timerTask)
case persistence.TaskTypeDeleteHistoryEvent:
return t.executeDeleteHistoryEventTask(ctx, timerTask)
// special timeout for delete history event
deleteHistoryEventContext, deleteHistoryEventCancel := context.WithTimeout(context.Background(), time.Duration(t.config.DeleteHistoryEventContextTimeout())*time.Second)
defer deleteHistoryEventCancel()
return t.executeDeleteHistoryEventTask(deleteHistoryEventContext, timerTask)
default:
return errUnknownTimerTask
}
Expand Down
11 changes: 11 additions & 0 deletions service/history/task/timer_standby_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,3 +808,14 @@ func (s *timerStandbyTaskExecutorSuite) newTimerTaskFromInfo(
) Task {
return NewTimerTask(s.mockShard, info, QueueTypeStandbyTimer, s.logger, nil, nil, nil, nil, nil)
}

func (s *timerStandbyTaskExecutorSuite) TestTransferTaskTimeout() {
deleteHistoryEventTask := s.newTimerTaskFromInfo(&persistence.TimerTaskInfo{
Version: s.version,
DomainID: s.domainID,
TaskID: int64(100),
TaskType: persistence.TaskTypeDeleteHistoryEvent,
TimeoutType: int(types.TimeoutTypeStartToClose),
})
s.timerStandbyTaskExecutor.Execute(deleteHistoryEventTask, true)
}
5 changes: 2 additions & 3 deletions service/history/task/transfer_task_executor_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ const (
taskDefaultTimeout = 3 * time.Second
taskGetExecutionContextTimeout = 500 * time.Millisecond
taskRPCCallTimeout = 2 * time.Second

secondsInDay = int32(24 * time.Hour / time.Second)
defaultDomainName = "defaultDomainName"
secondsInDay = int32(24 * time.Hour / time.Second)
defaultDomainName = "defaultDomainName"
)

type (
Expand Down
Loading