Skip to content

titan-configuration: remove the unrecommended steps of updating TiKV configuration #20526

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

Merged
merged 7 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions storage-engine/titan-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ level-merge = false
- 当设置为 `read-only` 时,新写入的 value 不论大小均会写入 RocksDB。
- 当设置为 `fallback` 时,新写入的 value 不论大小均会写入 RocksDB,并且当 RocksDB 进行 compaction 时,会自动把所碰到的存储在 Titan blob file 中的 value 移回 RocksDB。

如果现有数据和未来数据均不再需要 Titan,可执行以下步骤关闭 Titan。一般情况下,只需要执行以下步骤 1 和步骤 3、步骤 4 即可。步骤 2 虽然可以加快数据迁移速度,但会严重影响用户 SQL 的性能。事实上,即使跳过步骤 2,由于在 Compaction 过程中会将数据从 Titan 迁移到 RocksDB,会占用额外的 I/O 和 CPU 资源,因此仍然可以观察到一定的性能损失,在资源紧张的情况下吞吐可以下降 50% 以上。
如果现有数据和未来数据均不再需要 Titan,可执行以下步骤关闭 Titan。一般情况下,只需要执行以下步骤 1 和步骤 3 即可。步骤 2 虽然可以加快数据迁移速度,但会严重影响用户 SQL 的性能。事实上,即使跳过步骤 2,由于在 Compaction 过程中会将数据从 Titan 迁移到 RocksDB,会占用额外的 I/O 和 CPU 资源,因此仍然可以观察到一定的性能损失,在资源紧张的情况下吞吐可以下降 50% 以上。

> **警告:**
>
> 对于 v8.5.0 之前的版本,关闭 Titan 时,不建议修改 TiKV 配置项 [`rocksdb.titan.enabled`](/tikv-configuration-file.md#enabled) 为 `false`,因为该修改可能导致 TiKV crash。执行以下步骤 1 即可达到关闭 Titan 的目的。

1. 更新需要关闭 Titan 的 TiKV 节点的配置。你可以通过以下两种方式之一更新 TiKV 配置:

Expand Down Expand Up @@ -169,17 +173,6 @@ level-merge = false

3. 等待数据整理结束,通过 **TiKV-Details**/**Titan - kv** 监控面板确认 **Blob file count** 指标降为 0。

4. 对于 v8.5.0 及之后的 TiDB 版本,更新 TiKV 节点的配置,关闭 Titan。

> **警告:**
>
> 对于 v8.5.0 之前的版本,建议跳过该步骤,因为在这些版本中该步骤可能导致 TiKV crash。v8.5.0 之前的版本,可以直接通过步骤 1 来达到关闭 Titan 的目的,步骤 1 中的设置和下面的设置,在数据迁移完成后,不会有性能上的差异。

```toml
[rocksdb.titan]
enabled = false
```

## Level Merge(实验功能)

TiKV 4.0 中 Titan 提供新的算法提升范围查询性能并降低 Titan GC 对前台写入性能的影响。这个新的算法称为 [Level Merge](/storage-engine/titan-overview.md#level-merge)。Level Merge 可以通过以下选项开启:
Expand Down
4 changes: 4 additions & 0 deletions tikv-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,10 @@ Titan 相关的配置项。

### `enabled`

> **警告:**
>
> 对于 v8.5.0 之前的版本,关闭 Titan 时,不建议修改该配置项值为 `false`,因为该修改可能导致 TiKV crash。要关闭 Titan,请参考[关闭 Titan](/storage-engine/titan-configuration.md#关闭-titan) 中的步骤。

> **注意:**
>
> - 从 TiDB v7.6.0 开始,参数默认值从 `false` 变更为 `true`,即新集群默认开启 Titan,以更好地支持 TiDB 宽表写入场景和 JSON。
Expand Down