-
Notifications
You must be signed in to change notification settings - Fork 805
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
add jitter to timer / transfer / replication queue sanity scan #864
Conversation
service/history/queueAckMgr_test.go
Outdated
@@ -140,7 +140,10 @@ func (s *queueAckMgrSuite) SetupTest() { | |||
} | |||
s.mockShard.config.ShardUpdateMinInterval = dynamicconfig.GetDurationPropertyFn(0 * time.Second) | |||
|
|||
s.queueAckMgr = newQueueAckMgr(s.mockShard, &QueueProcessorOptions{UpdateShardTaskCount: 1, MetricScope: metrics.ReplicatorQueueProcessorScope}, s.mockProcessor, 0, s.logger) | |||
s.queueAckMgr = newQueueAckMgr(s.mockShard, &QueueProcessorOptions{ | |||
UpdateShardTaskCount: func(opts ...dynamicconfig.FilterOption) int { return 1 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use dynamicconfig.GetIntPropertyFn() which is mock for tests.
service/history/queueAckMgr_test.go
Outdated
@@ -346,7 +349,10 @@ func (s *queueFailoverAckMgrSuite) SetupTest() { | |||
} | |||
s.mockShard.config.ShardUpdateMinInterval = dynamicconfig.GetDurationPropertyFn(0 * time.Second) | |||
|
|||
s.queueFailoverAckMgr = newQueueFailoverAckMgr(s.mockShard, &QueueProcessorOptions{UpdateShardTaskCount: 1, MetricScope: metrics.ReplicatorQueueProcessorScope}, s.mockProcessor, 0, s.logger) | |||
s.queueFailoverAckMgr = newQueueFailoverAckMgr(s.mockShard, &QueueProcessorOptions{ | |||
UpdateShardTaskCount: func(opts ...dynamicconfig.FilterOption) int { return 1 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use dynamicconfig.GetIntPropertyFn()
@@ -177,6 +177,8 @@ const ( | |||
TimerProcessorCompleteTimerInterval | |||
// TimerProcessorMaxPollInterval is max poll interval for timer processor | |||
TimerProcessorMaxPollInterval | |||
// TimerProcessorMaxPollIntervalJitterCoefficient is the max poll interval jitter coefficient | |||
TimerProcessorMaxPollIntervalJitterCoefficient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There new added keys also need to updated in keys
map in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynamic config part LGTM
@@ -292,7 +296,10 @@ continueProcessor: | |||
// Timer Fired. | |||
case <-pollTimer.C: | |||
// forced timer scan | |||
pollTimer.Reset(t.config.TimerProcessorMaxPollInterval()) | |||
pollTimer.Reset(jitter.JitDuration( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep track of the last updated time and skip force timer scan if it is less then max poll interval?
service/history/queueProcessor.go
Outdated
@@ -156,10 +160,10 @@ processorPumpLoop: | |||
p.processBatch(tasksCh) | |||
case <-pollTimer.C: | |||
p.processBatch(tasksCh) | |||
pollTimer.Reset(p.options.MaxPollInterval) | |||
pollTimer.Reset(jitter.JitDuration(p.options.MaxPollInterval(), p.options.MaxPollIntervalJitterCoefficient())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want same logic to skip the forced scan if already performed recently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall all good. You can check it in after adding the logic to skip force scan if recently updated.
solve #856