Skip to content

Commit a78bd94

Browse files
cjc7373apecloud-bot
authored andcommitted
fix: update tidb's config constraint (#2951)
(cherry picked from commit e242a73)
1 parent 94a16b8 commit a78bd94

3 files changed

Lines changed: 37 additions & 40 deletions

File tree

addons/tidb/config/pd-config-constraint.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
// Determines whether to force PD to start as a new cluster and modify the number of Raft members to `1`
1515
"force-new-cluster": bool | *false
1616

17-
// The interval at which PD updates the physical time of TSO. In a default update interval of TSO physical time, PD provides at most 262144 TSOs. To get more TSOs, you can reduce the value of this configuration item. The minimum value is `1ms`. Decreasing this configuration item might increase the CPU usage of PD. According to the test, compared with the interval of `50ms`, the [CPU usage](https://man7.org/linux/man-pages/man1/top.1.html) of PD will increase by about 10% when the interval is `1ms`.
18-
"tso-update-physical-interval": string & >=0 | *"50ms"
17+
// The interval at which PD updates the TSO physical time. The default is `"50ms"`; decreasing it can provide more TSOs but increases PD CPU usage. Minimum value: `"1ms"`.
18+
"tso-update-physical-interval": string | *"50ms"
1919

2020
// The memory limit ratio for a PD instance. The value `0` means no memory limit.
2121
"pd-server.server-memory-limit": float & >=0 & <=0.99 | *0

addons/tidb/config/tidb-config-constraint.cue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"tidb-max-reuse-column": float & >=0 & <=2.147483648e+09 | *256
1010

1111
// The number of sessions that can execute requests concurrently. Type: Integer. Maximum Value (64-bit platforms): `18446744073709551615`. Maximum Value (32-bit platforms): `4294967295`
12-
"token-limit": float & >=1 | *1000
12+
"token-limit": int & >=1 | *1000
1313

1414
// File system location used by TiDB to store temporary data. If a feature requires local storage in TiDB nodes, TiDB stores the corresponding temporary data in this location. When creating an index, if [`tidb_ddl_enable_fast_reorg`](/system-variables.md#tidb_ddl_enable_fast_reorg-new-in-v630) is enabled, data that needs to be backfilled for a newly created index will be at first stored in the TiDB local temporary directory, and then imported into TiKV in batches, thus accelerating the index creation. When [`IMPORT INTO`](/sql-statements/sql-statement-import-into.md) is used to import data, the sorted data is first stored in the TiDB local temporary directory, and then imported into TiKV in batches.
1515
"temp-dir": string | *"/tmp/tidb"
@@ -152,8 +152,8 @@
152152
// Determines whether to automatically generate the TLS certificates on startup.
153153
"security.auto-tls": bool | *false
154154

155-
// Set the minimum TLS version for MySQL Protocol connections. Optional values: `"TLSv1.0"`, `"TLSv1.1"`, `"TLSv1.2"` and `"TLSv1.3"`
156-
"security.tls-version": string | *", which allows TLSv1.1 or higher."
155+
// Sets the minimum TLS version for MySQL protocol connections. Valid values are `""`, `"TLSv1.0"`, `"TLSv1.1"`, `"TLSv1.2"`, and `"TLSv1.3"`. The template default is `""`.
156+
"security.tls-version": string | *""
157157

158158
// Set the local file path of the JSON Web Key Sets (JWKS) for the [`tidb_auth_token`](/security-compatibility-with-mysql.md#tidb_auth_token) authentication method.
159159
"security.auth-token-jwks": string
@@ -204,7 +204,7 @@
204204
"performance.force-priority": string | *"NO_PRIORITY"
205205

206206
// Determines whether the optimizer executes the operation that pushes down the aggregation function with `Distinct` (such as `select count(distinct a) from t`) to Coprocessors. Default: `false`. This variable is the initial value of the system variable [`tidb_opt_distinct_agg_push_down`](/system-variables.md#tidb_opt_distinct_agg_push_down).
207-
"performance.distinct-agg-push-down": string
207+
"performance.distinct-agg-push-down": bool | *false
208208

209209
// Determines whether to ignore the optimizer's cost estimation and to forcibly use TiFlash's MPP mode for query execution. This configuration item controls the initial value of [`tidb_enforce_mpp`](/system-variables.md#tidb_enforce_mpp-new-in-v51). For example, when this configuration item is set to `true`, the default value of `tidb_enforce_mpp` is `ON`.
210210
"performance.enforce-mpp": bool | *false
@@ -264,7 +264,7 @@
264264
"tikv-client.grpc-connection-count": int | *4
265265

266266
// The `keepalive` time interval of the RPC connection between TiDB and TiKV nodes. If there is no network packet within the specified time interval, the gRPC client executes `ping` command to TiKV to see if it is alive. Default: `10`. Unit: second
267-
"tikv-client.grpc-keepalive-time": string
267+
"tikv-client.grpc-keepalive-time": int | *10
268268

269269
// The timeout of the RPC `keepalive` check between TiDB and TiKV nodes. Unit: second
270270
"tikv-client.grpc-keepalive-timeout": int | *3
@@ -339,7 +339,7 @@
339339
"pessimistic-txn.constraint-check-in-place-pessimistic": bool | *true
340340

341341
// Controls from which engine TiDB allows to read data. Value options: Any combinations of "tikv", "tiflash", and "tidb", for example, ["tikv", "tidb"] or ["tiflash", "tidb"]
342-
"isolation-read.engines": string | *'["tikv", "tiflash", "tidb"]'
342+
"isolation-read.engines": [...string] | *["tikv", "tiflash", "tidb"]
343343

344344
// This configuration controls whether to record the execution information of each operator in the slow query log. Before v6.1.0, this configuration is set by `enable-collect-execution-info`.
345345
"instance.tidb_enable_collect_execution_info": bool | *true

addons/tidb/config/tikv-config-constraint.cue

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
// Determines whether to process requests in batches
8282
"server.enable-request-batch": bool | *true
8383

84-
// Specifies server attributes, such as `{ zone = "us-west-1", disk = "ssd" }`.
85-
"server.labels": string | *"{}"
84+
// Specifies server labels as key-value pairs, such as `{ zone = "us-west-1", disk = "ssd" }`. The template default is `{}`.
85+
"server.labels": {[string]: string} | *{}
8686

8787
// The working thread count of the background pool, including endpoint threads, BR threads, split-check threads, Region threads, and other threads of delay-insensitive tasks.
8888
// Default value: when the number of CPU cores is less than 16, the default value is 2; otherwise, the default value is 3.
@@ -103,8 +103,8 @@
103103
// The minimal working thread count of the unified read pool
104104
"readpool.unified.min-thread-count": int | *1
105105

106-
// The maximum working thread count of the unified read pool or the UnifyReadPool thread pool. When you modify the size of this thread pool, refer to [Performance tuning for TiKV thread pools](/tune-tikv-thread-performance.md#performance-tuning-for-tikv-thread-pools). Value range: `[min-thread-count, MAX(4, CPU quota * 10)]`. `MAX(4, CPU quota * 10)` takes the greater value out of `4` and the `CPU quota * 10`.
107-
"readpool.unified.max-thread-count": string | *"MAX"
106+
// The maximum working thread count of the unified read pool. The template default is `4`; the upstream default is `MAX(4, CPU * 0.8)`. Value range: `[min-thread-count, MAX(4, CPU quota * 10)]`.
107+
"readpool.unified.max-thread-count": int & >=1 | *4
108108

109109
// The stack size of the threads in the unified thread pool. Type: Integer + Unit. Unit: KiB|MiB|GiB
110110
"readpool.unified.stack-size": string | *"10MiB"
@@ -115,9 +115,8 @@
115115
// Controls whether to automatically adjust the thread pool size. When it is enabled, the read performance of TiKV is optimized by automatically adjusting the UnifyReadPool thread pool size based on the current CPU usage. The possible range of the thread pool is `[max-thread-count, MAX(4, CPU)]`. The maximum value is the same as the one of [`max-thread-count`](#max-thread-count).
116116
"readpool.unified.auto-adjust-pool-size": bool | *false
117117

118-
// Determines whether to use the unified thread pool (configured in [`readpool.unified`](#readpoolunified)) for storage requests. If the value of this parameter is `false`, a separate thread pool is used, which is configured through the rest parameters in this section (`readpool.storage`).
119-
// Default value: If this section (readpool.storage) has no other configurations, the default value is true. Otherwise, for the backward compatibility, the default value is false. Change the configuration in readpool.unified as needed before enabling this option.
120-
"readpool.storage.use-unified-pool": string
118+
// Determines whether to use the unified read pool for storage requests. If `false`, storage requests use the separate `readpool.storage` thread pool. The template default is `true`.
119+
"readpool.storage.use-unified-pool": bool | *true
121120

122121
// The allowable number of concurrent threads that handle high-priority `read` requests. When `8` ≤ `cpu num` ≤ `16`, the default value is `cpu_num * 0.5`; when `cpu num` is smaller than `8`, the default value is `4`; when `cpu num` is greater than `16`, the default value is `8`.
123122
"readpool.storage.high-concurrency": int & >=1
@@ -241,8 +240,8 @@
241240
// Enables or disables `prevote`. Enabling this feature helps reduce jitter on the system after recovery from network partition.
242241
"raftstore.prevote": bool | *true
243242

244-
// The storage capacity, which is the maximum size allowed to store data. If `capacity` is left unspecified, the capacity of the current disk prevails. To deploy multiple TiKV instances on the same physical disk, add this parameter to the TiKV configuration. For details, see [Key parameters of the hybrid deployment](/hybrid-deployment-topology.md#key-parameters). Unit: KiB|MiB|GiB
245-
"raftstore.capacity": string | *"0"
243+
// The storage capacity, which is the maximum size allowed to store data. TiKV parses this as ReadableSize, so it accepts non-negative integers such as `0` and size strings such as `"10GiB"`. If `capacity` is left unspecified, the capacity of the current disk prevails. The template default is `0`.
244+
"raftstore.capacity": int | string | *0
246245

247246
// The path to the Raft library, which is `storage.data-dir/raft` by default
248247
"raftstore.raftdb-path": string
@@ -280,9 +279,8 @@
280279
// The soft limit on the maximum allowable count of residual Raft logs
281280
"raftstore.raft-log-gc-threshold": int & >=1 | *50
282281

283-
// The hard limit on the allowable number of residual Raft logs
284-
// Default value: the log number that can be accommodated in the 3/4 Region size
285-
"raftstore.raft-log-gc-count-limit": string
282+
// The hard limit on the allowable number of residual Raft logs. The template default is `73728`; the upstream default is calculated from three-fourths of the Region size, assuming each log is 1 KiB. Minimum value: `0`.
283+
"raftstore.raft-log-gc-count-limit": int & >=0 | *73728
286284

287285
// The hard limit on the allowable size of residual Raft logs
288286
// Default value: 3/4 of the Region size
@@ -309,9 +307,8 @@
309307
// The time interval at which to check whether it is necessary to manually trigger RocksDB compaction. `0` means that this feature is disabled.
310308
"raftstore.region-compact-check-interval": string | *"5m"
311309

312-
// The number of Regions checked at one time for each round of manual compaction
313-
// Default value:When `storage.engine="raft-kv"`, the default value is `100`.When `storage.engine="partitioned-raft-kv"`, the default value is `5`.
314-
"raftstore.region-compact-check-step": string
310+
// The number of Regions checked at one time for each round of manual compaction. The template default is `100`. Minimum value: `0`.
311+
"raftstore.region-compact-check-step": int & >=0 | *100
315312

316313
// The number of tombstones required to trigger RocksDB compaction
317314
"raftstore.region-compact-min-tombstones": int & >=0 | *10000
@@ -407,16 +404,16 @@
407404
"raftstore.apply-max-batch-size": int & <=10240 | *256
408405

409406
// The allowable number of threads in the pool that flushes data to the disk, which is the size of the Apply thread pool. When you modify the size of this thread pool, refer to [Performance tuning for TiKV thread pools](/tune-tikv-thread-performance.md#performance-tuning-for-tikv-thread-pools). Value ranges: `[1, CPU * 10]`. `CPU` means the number of your CPU cores.
410-
"raftstore.apply-pool-size": int | >=1 | *2
407+
"raftstore.apply-pool-size": int & >=1 | *2
411408

412409
// Raft state machines process requests for flushing logs into the disk in batches by the BatchSystem. This configuration item specifies the maximum number of Raft state machines that can process the requests in one batch. If `hibernate-regions` is enabled, the default value is `256`. If `hibernate-regions` is disabled, the default value is `1024`.
413410
"raftstore.store-max-batch-size": int & >=0 & <=10240
414411

415412
// The allowable number of threads in the pool that processes Raft, which is the size of the Raftstore thread pool. When you modify the size of this thread pool, refer to [Performance tuning for TiKV thread pools](/tune-tikv-thread-performance.md#performance-tuning-for-tikv-thread-pools). Value ranges: `[1, CPU * 10]`. `CPU` means the number of your CPU cores.
416413
"raftstore.store-pool-size": int | *2
417414

418-
// The allowable number of threads that process Raft I/O tasks, which is the size of the StoreWriter thread pool. When you modify the size of this thread pool, refer to [Performance tuning for TiKV thread pools](/tune-tikv-thread-performance.md#performance-tuning-for-tikv-thread-pools).
419-
"raftstore.store-io-pool-size": float & >=0 | *0
415+
// The allowable number of threads that process Raft I/O tasks, which is the size of the StoreWriter thread pool. The template default is `0`, which disables the dedicated Raft I/O pool. Minimum value: `0`.
416+
"raftstore.store-io-pool-size": int & >=0 | *0
420417

421418
// The allowable number of threads that drive `future`
422419
"raftstore.future-poll-size": int | *1
@@ -427,7 +424,7 @@
427424
// At a certain interval, TiKV inspects the latency of the Raftstore component. This parameter specifies the interval of the inspection. If the latency exceeds this value, this inspection is marked as timeout. Judges whether the TiKV node is slow based on the ratio of timeout inspection.
428425
"raftstore.inspect-interval": string | *"100ms"
429426

430-
// Determines the threshold at which Raft data is written into the disk. If the data size is larger than the value of this configuration item, the data is written to the disk. When the value of `store-io-pool-size` is `0`, this configuration item does not take effect.
427+
// Determines the threshold at which Raft data is written to disk. If the data size is larger than this value, the data is written to disk. This takes effect only when `store-io-pool-size` is greater than `0`.
431428
"raftstore.raft-write-size-limit": string | *"1MiB"
432429

433430
// Determines the interval at which the minimum resolved timestamp is reported to the PD leader. If this value is set to `0`, it means that the reporting is disabled. Unit: second
@@ -461,9 +458,8 @@
461458
// The size of the newly split Region. This value is an estimate. Unit: KiB|MiB|GiB
462459
"coprocessor.region-split-size": string | *"96MiB"
463460

464-
// The maximum allowable number of keys in a Region. When this value is exceeded, the Region splits into many.
465-
// Default value: region-split-keys / 2 * 3
466-
"coprocessor.region-max-keys": string
461+
// The maximum allowable number of keys in a Region. When this value is exceeded, the Region is split. The template default is `1440000`, which is `region-split-keys / 2 * 3`.
462+
"coprocessor.region-max-keys": int | *1440000
467463

468464
// The number of keys in the newly split Region. This value is an estimate.
469465
"coprocessor.region-split-keys": int | *960000
@@ -516,8 +512,8 @@
516512
// Default value:When `storage.engine="raft-kv"`, the default value is `"4GiB"`.When `storage.engine="partitioned-raft-kv"`, the default value is `1`.
517513
"raftdb.max-total-wal-size": string
518514

519-
// Controls whether to enable the readahead feature during RocksDB compaction and specify the size of readahead data. If you use mechanical disks, it is recommended to set the value to `2MiB` at least. Unit: B|KiB|MiB|GiB. Default value: 0
520-
"raftdb.compaction-readahead-size": string
515+
// Controls whether to enable readahead during RocksDB compaction and specifies the readahead size. TiKV parses this as ReadableSize, so it accepts non-negative integers such as `0` and size strings such as `"2MiB"`. The template default is `0`, which disables readahead.
516+
"raftdb.compaction-readahead-size": int | string | *0
521517

522518
// The maximum buffer size used in WritableFileWrite. Unit: B|KiB|MiB|GiB
523519
"raftdb.writable-file-max-buffer-size": string | *"1MiB"
@@ -583,8 +579,9 @@
583579
// Default value: Total machine memory * 15%
584580
"raft-engine.memory-limit": string
585581

586-
// Disable Raft Engine by setting [`enable`](/tikv-configuration-file.md#enable-1) to `false` and restart TiKV to make the configuration take effect. Set `format-version` to `1`. Enable Raft Engine by setting `enable` to `true` and restart TiKV to make the configuration take effect.
587-
"raft-engine.format-version": string
582+
// Specifies the Raft Engine log file format version. Valid values are `1` and `2`; version `2` supports log recycling and requires TiKV v6.3.0 or later. The template default is `2`.
583+
// Changing this value can cause TiKV to fail to start. Follow the documented downgrade/upgrade steps before modifying it.
584+
"raft-engine.format-version": int | *2
588585

589586
// Determines whether to recycle stale log files in Raft Engine. When it is enabled, logically purged log files will be reserved for recycling. This reduces the long tail latency on write workloads.
590587
"raft-engine.enable-log-recycle": bool | *true
@@ -631,14 +628,14 @@
631628
// The window size of Stream channel. When the channel is full, the stream is blocked.
632629
"import.stream-channel-window": int | *128
633630

634-
// Starting from v6.5.0, PITR supports directly accessing backup log files in memory and restoring data. This configuration item specifies the ratio of memory available for PITR to the total memory of TiKV. Value range: [0.0, 0.5]
635-
"import.memory-use-ratio": float & >=0.0 & <=0.5 | *"0.3"
631+
// Specifies the ratio of TiKV memory available for PITR to directly access backup log files during restore. Value range: `[0.0, 0.5]`.
632+
"import.memory-use-ratio": float & >=0.0 & <=0.5 | *0.3
636633

637634
// The number of keys to be garbage-collected in one batch
638635
"gc.batch-keys": int | *512
639636

640-
// The maximum bytes that GC worker can write to RocksDB in one second. If the value is set to `0`, there is no limit.
641-
"gc.max-write-bytes-per-sec": int | *0
637+
// The maximum bytes that the GC worker can write to RocksDB per second. The template and upstream default are `"0"`, which means no limit.
638+
"gc.max-write-bytes-per-sec": string | *"0"
642639

643640
// Controls whether to enable the GC in Compaction Filter feature
644641
"gc.enable-compaction-filter": bool | *true
@@ -649,8 +646,8 @@
649646
// The number of GC threads when `enable-compaction-filter` is `false`.
650647
"gc.num-threads": int | *1
651648

652-
// The number of worker threads to process backup. Value range: `[1, CPU]`
653-
"backup.num-threads": string | *"MIN"
649+
// The number of worker threads used to process backup. The template default is `8`; the upstream default is `MIN(CPU * 0.5, 8)`. Value range: `[1, CPU]`.
650+
"backup.num-threads": int & >=1 | *8
654651

655652
// The number of data ranges to back up in one batch
656653
"backup.batch-size": int | *8

0 commit comments

Comments
 (0)