@@ -32,6 +32,7 @@ import (
3232 "github.com/pingcap/tidb/pkg/util/size"
3333 "github.com/pingcap/tipb/go-tipb"
3434 "go.uber.org/atomic"
35+ "golang.org/x/time/rate"
3536)
3637
3738/*
@@ -234,6 +235,10 @@ const (
234235 // TiDBSlowLogRules defines multi-dimensional trigger rules for flexible slow log control.
235236 TiDBSlowLogRules = "tidb_slow_log_rules"
236237
238+ // TiDBSlowLogMaxPerSec is the maximum number of slow logs that can be recorded per second in the server.
239+ // The default value is 0, which means no rate limiting is applied.
240+ TiDBSlowLogMaxPerSec = "tidb_slow_log_max_per_sec"
241+
237242 // TiDBSlowTxnLogThreshold is used to set the slow transaction log threshold in the server.
238243 TiDBSlowTxnLogThreshold = "tidb_slow_txn_log_threshold"
239244
@@ -1759,19 +1764,20 @@ var (
17591764 // the value of `tidb_analyze_column_options` determines the behavior of the analyze operation.
17601765 // 2. If `tidb_persist_analyze_options` is disabled, `tidb_analyze_column_options` is used directly to decide
17611766 // whether to analyze all columns or just the predicate columns.
1762- AnalyzeColumnOptions = atomic .NewString (DefTiDBAnalyzeColumnOptions )
1763- GlobalLogMaxDays = atomic .NewInt32 (int32 (config .GetGlobalConfig ().Log .File .MaxDays ))
1764- QueryLogMaxLen = atomic .NewInt32 (DefTiDBQueryLogMaxLen )
1765- EnablePProfSQLCPU = atomic .NewBool (false )
1766- EnableBatchDML = atomic .NewBool (false )
1767- EnableTmpStorageOnOOM = atomic .NewBool (DefTiDBEnableTmpStorageOnOOM )
1768- DDLReorgWorkerCounter int32 = DefTiDBDDLReorgWorkerCount
1769- DDLReorgBatchSize int32 = DefTiDBDDLReorgBatchSize
1770- DDLFlashbackConcurrency int32 = DefTiDBDDLFlashbackConcurrency
1771- DDLErrorCountLimit int64 = DefTiDBDDLErrorCountLimit
1772- DDLReorgRowFormat int64 = DefTiDBRowFormatV2
1773- DDLReorgMaxWriteSpeed = atomic .NewInt64 (DefTiDBDDLReorgMaxWriteSpeed )
1774- MaxDeltaSchemaCount int64 = DefTiDBMaxDeltaSchemaCount
1767+ AnalyzeColumnOptions = atomic .NewString (DefTiDBAnalyzeColumnOptions )
1768+ GlobalLogMaxDays = atomic .NewInt32 (int32 (config .GetGlobalConfig ().Log .File .MaxDays ))
1769+ QueryLogMaxLen = atomic .NewInt32 (DefTiDBQueryLogMaxLen )
1770+ EnablePProfSQLCPU = atomic .NewBool (false )
1771+ EnableBatchDML = atomic .NewBool (false )
1772+ EnableTmpStorageOnOOM = atomic .NewBool (DefTiDBEnableTmpStorageOnOOM )
1773+ DDLReorgWorkerCounter int32 = DefTiDBDDLReorgWorkerCount
1774+ DDLReorgBatchSize int32 = DefTiDBDDLReorgBatchSize
1775+ DDLFlashbackConcurrency int32 = DefTiDBDDLFlashbackConcurrency
1776+ DDLErrorCountLimit int64 = DefTiDBDDLErrorCountLimit
1777+ DDLReorgRowFormat int64 = DefTiDBRowFormatV2
1778+ DDLReorgMaxWriteSpeed = atomic .NewInt64 (DefTiDBDDLReorgMaxWriteSpeed )
1779+ MaxDeltaSchemaCount int64 = DefTiDBMaxDeltaSchemaCount
1780+ GlobalSlowLogRateLimiter = rate .NewLimiter (rate .Inf , 1 )
17751781 // DDLSlowOprThreshold is the threshold for ddl slow operations, uint is millisecond.
17761782 DDLSlowOprThreshold = config .GetGlobalConfig ().Instance .DDLSlowOprThreshold
17771783 GlobalSlowLogRules = atomic.NewPointer [slowlogrule.GlobalSlowLogRules ](
0 commit comments