Skip to content

Commit

Permalink
Set limit on range queries to prevent bad queries causing degradation (
Browse files Browse the repository at this point in the history
…#4458)

* Refactored SQL plugins to split point deletes and range deletes
* Limit range deletes on timer/transfer/replication/cross-cluster tasks and run range deletes by batch (SQL only)
* Limit range queries on transfer/cross-cluster tasks query (NoSQL already supports this, add support for SQL)
* Limit range deletes on history nodes and run range deletes by batch within a single transaction (SQL only)
* Introduce TaskDeleteBatchSize dynamic config
  • Loading branch information
Shaddoll committed Sep 8, 2021
1 parent 6b9184c commit e602b8c
Show file tree
Hide file tree
Showing 38 changed files with 721 additions and 352 deletions.
32 changes: 30 additions & 2 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,13 +910,19 @@ const (
// Default value: FALSE
// Allowed filters: N/A
QueueProcessorEnableLoadQueueStates

// TimerTaskBatchSize is batch size for timer processor to process tasks
// KeyName: history.timerTaskBatchSize
// Value type: Int
// Default value: 100
// Allowed filters: N/A

TimerTaskBatchSize
// TimerTaskDeleteBatchSize is batch size for timer processor to delete timer tasks
// KeyName: history.timerTaskDeleteBatchSize
// Value type: Int
// Default value: 4000
// Allowed filters: N/A
TimerTaskDeleteBatchSize
// TimerTaskWorkerCount is number of task workers for timer processor
// KeyName: history.timerTaskWorkerCount
// Value type: Int
Expand Down Expand Up @@ -1013,13 +1019,19 @@ const (
// Default value: 1*time.Second
// Allowed filters: N/A
TimerProcessorArchivalTimeLimit

// TransferTaskBatchSize is batch size for transferQueueProcessor
// KeyName: history.transferTaskBatchSize
// Value type: Int
// Default value: 100
// Allowed filters: N/A

TransferTaskBatchSize
// TransferTaskDeleteBatchSize is batch size for transferQueueProcessor to delete transfer tasks
// KeyName: history.transferTaskDeleteBatchSize
// Value type: Int
// Default value: 4000
// Allowed filters: N/A
TransferTaskDeleteBatchSize
// TransferProcessorFailoverMaxPollRPS is max poll rate per second for transferQueueProcessor
// KeyName: history.transferProcessorFailoverMaxPollRPS
// Value type: Int
Expand Down Expand Up @@ -1117,6 +1129,12 @@ const (
// Default value: 100
// Allowed filters: N/A
CrossClusterTaskBatchSize
// CrossClusterTaskDeleteBatchSize is batch size for crossClusterQueueProcessor to delete cross cluster tasks
// KeyName: history.crossClusterTaskDeleteBatchSize
// Value type: Int
// Default value: 4000
// Allowed filters: N/A
CrossClusterTaskDeleteBatchSize
// CrossClusterProcessorMaxPollRPS is max poll rate per second for crossClusterQueueProcessor
// KeyName: history.crossClusterProcessorMaxPollRPS
// Value type: Int
Expand Down Expand Up @@ -1208,6 +1226,12 @@ const (
// Default value: 100
// Allowed filters: N/A
ReplicatorTaskBatchSize
// ReplicatorTaskDeleteBatchSize is batch size for ReplicatorProcessor to delete replication tasks
// KeyName: history.replicatorTaskDeleteBatchSize
// Value type: Int
// Default value: 4000
// Allowed filters: N/A
ReplicatorTaskDeleteBatchSize
// ReplicatorTaskWorkerCount is number of worker for ReplicatorProcessor
// KeyName: history.replicatorTaskWorkerCount
// Value type: Int
Expand Down Expand Up @@ -2112,6 +2136,7 @@ var Keys = map[Key]string{
QueueProcessorEnableLoadQueueStates: "history.queueProcessorEnableLoadQueueStates",

TimerTaskBatchSize: "history.timerTaskBatchSize",
TimerTaskDeleteBatchSize: "history.timerTaskDeleteBatchSize",
TimerTaskWorkerCount: "history.timerTaskWorkerCount",
TimerProcessorGetFailureRetryCount: "history.timerProcessorGetFailureRetryCount",
TimerProcessorCompleteTimerFailureRetryCount: "history.timerProcessorCompleteTimerFailureRetryCount",
Expand All @@ -2130,6 +2155,7 @@ var Keys = map[Key]string{
TimerProcessorArchivalTimeLimit: "history.timerProcessorArchivalTimeLimit",

TransferTaskBatchSize: "history.transferTaskBatchSize",
TransferTaskDeleteBatchSize: "history.transferTaskDeleteBatchSize",
TransferProcessorFailoverMaxPollRPS: "history.transferProcessorFailoverMaxPollRPS",
TransferProcessorMaxPollRPS: "history.transferProcessorMaxPollRPS",
TransferTaskWorkerCount: "history.transferTaskWorkerCount",
Expand All @@ -2147,6 +2173,7 @@ var Keys = map[Key]string{
TransferProcessorVisibilityArchivalTimeLimit: "history.transferProcessorVisibilityArchivalTimeLimit",

CrossClusterTaskBatchSize: "history.crossClusterTaskBatchSize",
CrossClusterTaskDeleteBatchSize: "history.crossClusterTaskDeleteBatchSize",
CrossClusterProcessorMaxPollRPS: "history.crossClusterProcessorMaxPollRPS",
CrossClusterTaskWorkerCount: "history.crossClusterTaskWorkerCount",
CrossClusterProcessorCompleteTaskFailureRetryCount: "history.crossClusterProcessorCompleteTaskFailureRetryCount",
Expand All @@ -2163,6 +2190,7 @@ var Keys = map[Key]string{
CrossClusterProcessorValidationIntervalJitterCoefficient: "history.crossClusterProcessorValidationIntervalJitterCoefficient",

ReplicatorTaskBatchSize: "history.replicatorTaskBatchSize",
ReplicatorTaskDeleteBatchSize: "history.replicatorTaskDeleteBatchSize",
ReplicatorTaskWorkerCount: "history.replicatorTaskWorkerCount",
ReplicatorReadTaskMaxRetryCount: "history.replicatorReadTaskMaxRetryCount",
ReplicatorProcessorMaxPollRPS: "history.replicatorProcessorMaxPollRPS",
Expand Down
97 changes: 71 additions & 26 deletions common/mocks/ExecutionManager.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions common/mocks/TaskManager.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e602b8c

Please sign in to comment.