diff --git a/dynamic-config.md b/dynamic-config.md index 2e3932dd53d1..35849a343df4 100644 --- a/dynamic-config.md +++ b/dynamic-config.md @@ -131,10 +131,6 @@ show warnings; | raftstore.max-apply-unpersisted-log-limit | 允许 apply 已 commit 但尚未持久化的 Raft 日志的最大数量 | | raftstore.split-region-check-tick-interval | 检查 Region 是否需要分裂的时间间隔 | | raftstore.region-split-check-diff | 允许 Region 数据超过指定大小的最大值 | -| raftstore.region-compact-check-interval | 检查是否需要人工触发 RocksDB compaction 的时间间隔 | -| raftstore.region-compact-check-step | 每轮校验人工 compaction 时,一次性检查的 Region 个数 | -| raftstore.region-compact-min-tombstones | 触发 RocksDB compaction 需要的 tombstone 个数 | -| raftstore.region-compact-tombstones-percent | 触发 RocksDB compaction 需要的 tombstone 所占比例 | | raftstore.pd-heartbeat-tick-interval | 触发 Region 对 PD 心跳的时间间隔 | | raftstore.pd-store-heartbeat-tick-interval | 触发 store 对 PD 心跳的时间间隔 | | raftstore.snap-mgr-gc-tick-interval | 触发回收过期 snapshot 文件的时间间隔 | @@ -188,6 +184,12 @@ show warnings; | gc.max-write-bytes-per-sec | 一秒可写入 RocksDB 的最大字节数 | | gc.enable-compaction-filter | 是否使用 compaction filter | | gc.compaction-filter-skip-version-check | 是否跳过 compaction filter 的集群版本检查(未 release)| +| gc.auto-compaction.check-interval | TiKV 检查是否需要触发自动 RocksDB compaction 的时间间隔 | +| gc.auto-compaction.tombstone-num-threshold | 触发 TiKV 自动 (RocksDB) compaction 需要的 RocksDB tombstone 个数 | +| gc.auto-compaction.tombstone-percent-threshold | 触发 TiKV 自动 (RocksDB) compaction 需要的 RocksDB tombstone 所占比例 | +| gc.auto-compaction.redundant-rows-threshold | 触发 TiKV 自动 (RocksDB) compaction 需要的冗余的 MVCC 数据行数 | +| gc.auto-compaction.redundant-rows-percent-threshold | 触发 TiKV 自动 (RocksDB) compaction 需要的冗余的 MVCC 数据行数所占比例 | +| gc.auto-compaction.bottommost-level-force | 控制是否强制对 RocksDB 最底层文件进行 compaction | | {db-name}.max-total-wal-size | WAL 总大小限制 | | {db-name}.max-background-jobs | RocksDB 后台线程个数 | | {db-name}.max-background-flushes | RocksDB flush 线程个数 | diff --git a/garbage-collection-configuration.md b/garbage-collection-configuration.md index 1355c3a77c09..7fee196ccd7f 100644 --- a/garbage-collection-configuration.md +++ b/garbage-collection-configuration.md @@ -92,4 +92,5 @@ show config where type = 'tikv' and name like '%enable-compaction-filter%'; > 在使用 Compaction Filter 机制时,可能会出现 GC 进度延迟的情况,从而影响 TiKV 扫描性能。当你的负载中含有大量 coprocessor 请求,并且在 [**TiKV-Details > Coprocessor Detail**](/grafana-tikv-dashboard.md#coprocessor-detail) 面板中发现 Total Ops Details 的 `next()` 或 `prev()` 调用次数远远超过 `processed_keys` 调用的三倍时,可以采取以下措施: > > - 对于 TiDB v7.1.3 之前版本,建议尝试关闭 Compaction Filter,以加快 GC 速度。 -> - 从 v7.1.3 开始,TiDB 会根据每个 Region 的冗余版本数量 [`region-compact-min-redundant-rows`](/tikv-configuration-file.md#region-compact-min-redundant-rows-从-v710-版本开始引入) 和比例 [`region-compact-redundant-rows-percent`](/tikv-configuration-file.md#region-compact-redundant-rows-percent-从-v710-版本开始引入) 自动触发 compaction,从而提高 Compaction Filter 的 GC 速度。因此,在 v7.1.3 及之后的版本中,如果遇到上述情况,建议调整这两个参数,无需关闭 Compaction Filter。 +> - 在 TiDB v7.1.3 到 v7.5.6 及其之间的版本中,TiDB 会根据每个 Region 的冗余版本数量 [`region-compact-min-redundant-rows`](/tikv-configuration-file.md#region-compact-min-redundant-rows-从-v710-版本开始引入) 和比例 [`region-compact-redundant-rows-percent`](/tikv-configuration-file.md#region-compact-redundant-rows-percent-从-v710-版本开始引入) 自动触发 compaction,从而提高 Compaction Filter 的 GC 速度。如果遇到上述情况,建议调整这两个参数,无需关闭 Compaction Filter。 +> - 从 TiDB v7.5.7 开始,[`region-compact-min-redundant-rows`](/tikv-configuration-file.md#region-compact-min-redundant-rows-从-v710-版本开始引入) 和 [`region-compact-redundant-rows-percent`](/tikv-configuration-file.md#region-compact-redundant-rows-percent-从-v710-版本开始引入) 已废弃,TiDB 会根据 [`gc.auto-compaction.redundant-rows-threshold`](/tikv-configuration-file.md#redundant-rows-threshold-从-v757-和-v900-版本开始引入) 和 [`gc.auto-compaction.redundant-rows-percent-threshold`](/tikv-configuration-file.md#redundant-rows-percent-threshold-从-v757-和-v900-版本开始引入) 自动触发 compaction。如果遇到上述情况,建议调整这两个参数,无需关闭 Compaction Filter。 diff --git a/tikv-configuration-file.md b/tikv-configuration-file.md index 009c90bb4043..214dfb18171e 100644 --- a/tikv-configuration-file.md +++ b/tikv-configuration-file.md @@ -818,12 +818,20 @@ raftstore 相关的配置项。 ### `region-compact-check-interval` +> **警告:** +> +> 从 v7.5.7 和 v9.0.0 开始,该配置项被废弃,其功能由 [`gc.auto-compaction.check-interval`](#check-interval-从-v757-和-v900-版本开始引入) 代替。 + + 检查是否需要人工触发 RocksDB compaction 的时间间隔,0 表示不启用。 + 默认值:5m + 最小值:0 ### `region-compact-check-step` +> **警告:** +> +> 从 v7.5.7 和 v9.0.0 开始,该配置项被废弃。 + + 每轮校验人工 compaction 时,一次性检查的 Region 个数。 + 默认值: + 当 `storage.engine="raft-kv"` 时,默认值为 100。 @@ -831,12 +839,20 @@ raftstore 相关的配置项。 ### `region-compact-min-tombstones` +> **警告:** +> +> 从 v7.5.7 和 v9.0.0 开始,该配置项被废弃,其功能由 [`gc.auto-compaction.tombstone-num-threshold`](#tombstone-num-threshold-从-v757-和-v900-版本开始引入) 代替。 + + 触发 RocksDB compaction 需要的 tombstone 个数。 + 默认值:10000 + 最小值:0 ### `region-compact-tombstones-percent` +> **警告:** +> +> 从 v7.5.7 和 v9.0.0 开始,该配置项被废弃,其功能由 [`gc.auto-compaction.tombstone-percent-threshold`](#tombstone-percent-threshold-从-v757-和-v900-版本开始引入) 代替。 + + 触发 RocksDB compaction 需要的 tombstone 所占比例。 + 默认值:30 + 最小值:1 @@ -844,12 +860,20 @@ raftstore 相关的配置项。 ### `region-compact-min-redundant-rows` 从 v7.1.0 版本开始引入 +> **警告:** +> +> 从 v7.5.7 和 v9.0.0 开始,该配置项被废弃,其功能由 [`gc.auto-compaction.redundant-rows-threshold`](#redundant-rows-threshold-从-v757-和-v900-版本开始引入) 代替。 + + 触发 RocksDB compaction 需要的冗余的 MVCC 数据行数。 + 默认值:`50000` + 最小值:`0` ### `region-compact-redundant-rows-percent` 从 v7.1.0 版本开始引入 +> **警告:** +> +> 从 v7.5.7 和 v9.0.0 开始,该配置项被废弃,其功能由 [`gc.auto-compaction.redundant-rows-percent-threshold`](#redundant-rows-percent-threshold-从-v757-和-v900-版本开始引入) 代替。 + + 触发 RocksDB compaction 需要的冗余的 MVCC 数据行所占比例。 + 默认值:`20` + 最小值:`1` @@ -2258,6 +2282,50 @@ Raft Engine 相关的配置项。 + 当 `enable-compaction-filter` 为 `false` 时 GC 线程个数。 + 默认值:1 +## gc.auto-compaction + +用于配置 TiKV 自动 compaction 的行为。 + +### `check-interval` 从 v7.5.7 和 v9.0.0 版本开始引入 + ++ TiKV 检查是否需要触发自动 compaction 的时间间隔。在此时间段内,满足自动 compaction 条件的 Region 会按优先级进行处理。当到达此间隔时,TiKV 会重新扫描 Region 信息并重新计算优先级。 ++ 默认值:`"300s"` + +### `tombstone-num-threshold` 从 v7.5.7 和 v9.0.0 版本开始引入 + ++ 触发 TiKV 自动 compaction 需要的 RocksDB tombstone 个数。当 tombstone 数量达到此阈值,或 tombstone 所占比例达到 [`tombstone-percent-threshold`](#tombstone-percent-threshold-从-v757-和-v900-版本开始引入) 时,TiKV 将触发自动 compaction。 ++ 仅在关闭 [Compaction Filter](/garbage-collection-configuration.md) 时生效。 ++ 默认值:`10000` ++ 最小值:`0` + +### `tombstone-percent-threshold` 从 v7.5.7 和 v9.0.0 版本开始引入 + ++ 触发 TiKV 自动 compaction 需要的 RocksDB tombstone 所占比例。当 tombstone 所占比例达到此阈值,或 tombstone 数量达到 [`tombstone-num-threshold`](#tombstone-num-threshold-从-v757-和-v900-版本开始引入) 时,TiKV 将触发自动 compaction。 ++ 仅在关闭 [Compaction Filter](/garbage-collection-configuration.md) 时生效。 ++ 默认值:`30` ++ 最小值:`0` ++ 最大值:`100` + +### `redundant-rows-threshold` 从 v7.5.7 和 v9.0.0 版本开始引入 + ++ 触发 TiKV 自动 compaction 需要的冗余的 MVCC 数据行数,包含 RocksDB tombstone、TiKV stale versions 和 TiKV deletion tombstones。当冗余的 MVCC 数据行数达到此阈值,或这些行数的占比达到 [`redundant-rows-percent-threshold`](#redundant-rows-percent-threshold-从-v757-和-v900-版本开始引入) 时,TiKV 将触发自动 compaction。 ++ 仅在开启 [Compaction Filter](/garbage-collection-configuration.md) 时生效。 ++ 默认值:`50000` ++ 最小值:`0` + +### `redundant-rows-percent-threshold` 从 v7.5.7 和 v9.0.0 版本开始引入 + ++ 触发 TiKV 自动 compaction 需要的冗余的 MVCC 数据行数所占比例。冗余数据包含 RocksDB tombstone、TiKV stale versions 和 TiKV deletion tombstones。当冗余的 MVCC 数据行数达到 [`redundant-rows-threshold`](#redundant-rows-threshold-从-v757-和-v900-版本开始引入),或这些行数的占比达到 `redundant-rows-percent-threshold` 时,TiKV 将触发自动 compaction。 ++ 仅在开启 [Compaction Filter](/garbage-collection-configuration.md) 时生效。 ++ 默认值:`20` ++ 最小值:`0` ++ 最大值:`100` + +### `bottommost-level-force` 从 v7.5.7 和 v9.0.0 版本开始引入 + ++ 控制是否强制对 RocksDB 最底层文件进行 compaction。 ++ 默认值:`true` + ## backup 用于 BR 备份相关的配置项。