From 56778887876de0a0fbdeb98145375b4720b91fa1 Mon Sep 17 00:00:00 2001 From: doc-claw-bot Date: Thu, 3 Dec 2026 09:17:45 +0000 Subject: [PATCH 1/4] docs: clarify hotspot scheduling isolation behavior --- best-practices/pd-scheduling-best-practices.md | 8 ++++++++ configure-placement-rules.md | 3 +++ 2 files changed, 11 insertions(+) diff --git a/best-practices/pd-scheduling-best-practices.md b/best-practices/pd-scheduling-best-practices.md index 11fdf322249ec..45390aba8da5d 100644 --- a/best-practices/pd-scheduling-best-practices.md +++ b/best-practices/pd-scheduling-best-practices.md @@ -86,6 +86,14 @@ For hot regions scheduling, use `hot-region-scheduler`. Since TiDB v3.0, the pro For hot write regions, `hot-region-scheduler` attempts to redistribute both region peers and leaders; for hot read regions, `hot-region-scheduler` only redistributes region leaders. +> **Note:** +> +> - For hot write scheduling, moving a hot peer follows replica placement constraints. When Placement Rules are disabled, PD uses `location-labels` for this peer-replacement path. When Placement Rules are enabled, PD follows the matching placement rule. +> - `move-hot-read-leader` and `move-hot-write-leader` are leader-oriented paths. When Placement Rules are disabled, `move-hot-read-leader` does not check `location-labels` or `isolation-level` when it selects a target store. When Placement Rules are enabled, these leader-oriented paths check the applicable placement rule only when the target store does not already have a peer. Transferring the leader among existing voter peers does not upgrade or repair replica isolation. +> - If you need host-level replica isolation after hotspot scheduling, configure a `host` label on every TiKV store. Then use one of the following methods: +> - If Placement Rules are disabled, set `replication.location-labels` to include `host`, set `replication.isolation-level` to `host`, and keep `schedule.enable-location-replacement` enabled so PD can replace peers to improve isolation. +> - If Placement Rules are enabled, either keep only the default rule and set `replication.location-labels` and `replication.isolation-level` so PD generates a default rule whose `location_labels` include `host` and whose `isolation_level` is `host`, or configure `location_labels` and `isolation_level` explicitly in each relevant placement rule. Do not rely on hot leader transfer alone to repair an existing non-isolated replica layout. + ### Cluster topology awareness Cluster topology awareness enables PD to distribute replicas of a region as much as possible. This is how TiKV ensures high availability and disaster recovery capability. PD continuously scans all regions in the background. When PD finds that the distribution of regions is not optimal, it generates an operator to replace peers and redistribute regions. diff --git a/configure-placement-rules.md b/configure-placement-rules.md index b50cf64bc4f34..b3700d87142e2 100644 --- a/configure-placement-rules.md +++ b/configure-placement-rules.md @@ -109,6 +109,7 @@ PD also generates default rules based on the `max-replicas`, `location-labels`, > > - When Placement Rules are enabled and multiple rules exist, the previously configured `max-replicas`, `location-labels`, and `isolation-level` no longer take effect. To adjust the replica policy, use the interface related to Placement Rules. > - When Placement Rules are enabled and only one default rule exists, TiDB will automatically update this default rule when `max-replicas`, `location-labels`, or `isolation-level` configurations are changed. +> - To require host-level replica isolation when Placement Rules are enabled, configure a `host` label on every TiKV store. Then either keep only the default rule and set `replication.location-labels` to include `host` plus `replication.isolation-level = "host"`, or set `location_labels` and `isolation_level` explicitly in each relevant placement rule. Cluster-level replication settings do not override custom rules. ### Disable Placement Rules @@ -123,6 +124,8 @@ pd-ctl config placement-rules disable > **Note:** > > After disabling Placement Rules, PD uses the original `max-replicas`, `location-labels`, and `isolation-level` configurations. The modification of rules (when Placement Rules is enabled) will not update these three configurations in real time. In addition, all the rules that have been configured remain in PD and will be used the next time you enable Placement Rules. +> +> To require host-level replica isolation after disabling Placement Rules, configure a `host` label on every TiKV store, set `replication.location-labels` to include `host`, set `replication.isolation-level` to `host`, and keep `schedule.enable-location-replacement` enabled if you want PD to repair a non-isolated replica layout. ### Set rules using pd-ctl From b1001cb405f853b20a17c5f0143c856b4ca82dbb Mon Sep 17 00:00:00 2001 From: doc-claw-bot Date: Thu, 3 Dec 2026 09:52:12 +0000 Subject: [PATCH 2/4] docs: sync hotspot host isolation clarification --- .../pd-scheduling-best-practices.md | 27 ++++++++++++++----- configure-placement-rules.md | 20 ++++++++++++-- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/best-practices/pd-scheduling-best-practices.md b/best-practices/pd-scheduling-best-practices.md index 45390aba8da5d..54d2a74c8d947 100644 --- a/best-practices/pd-scheduling-best-practices.md +++ b/best-practices/pd-scheduling-best-practices.md @@ -86,13 +86,26 @@ For hot regions scheduling, use `hot-region-scheduler`. Since TiDB v3.0, the pro For hot write regions, `hot-region-scheduler` attempts to redistribute both region peers and leaders; for hot read regions, `hot-region-scheduler` only redistributes region leaders. -> **Note:** -> -> - For hot write scheduling, moving a hot peer follows replica placement constraints. When Placement Rules are disabled, PD uses `location-labels` for this peer-replacement path. When Placement Rules are enabled, PD follows the matching placement rule. -> - `move-hot-read-leader` and `move-hot-write-leader` are leader-oriented paths. When Placement Rules are disabled, `move-hot-read-leader` does not check `location-labels` or `isolation-level` when it selects a target store. When Placement Rules are enabled, these leader-oriented paths check the applicable placement rule only when the target store does not already have a peer. Transferring the leader among existing voter peers does not upgrade or repair replica isolation. -> - If you need host-level replica isolation after hotspot scheduling, configure a `host` label on every TiKV store. Then use one of the following methods: -> - If Placement Rules are disabled, set `replication.location-labels` to include `host`, set `replication.isolation-level` to `host`, and keep `schedule.enable-location-replacement` enabled so PD can replace peers to improve isolation. -> - If Placement Rules are enabled, either keep only the default rule and set `replication.location-labels` and `replication.isolation-level` so PD generates a default rule whose `location_labels` include `host` and whose `isolation_level` is `host`, or configure `location_labels` and `isolation_level` explicitly in each relevant placement rule. Do not rely on hot leader transfer alone to repair an existing non-isolated replica layout. +#### Hot region scheduling and replica isolation + +If you need to place replicas of the same Region on different physical hosts, see [Configure host-level replica isolation](/configure-placement-rules.md#configure-host-level-replica-isolation) to set TiKV store labels and the replica placement policy. However, when multiple TiKV stores are deployed on the same physical host, these settings still cannot guarantee host isolation after every hot-region migration. The limitations are as follows. + +`move-hot-read-leader` and `move-hot-write-leader` both migrate the replica that currently serves as the leader. Whether Placement Rules are enabled affects the isolation result after the migration: + +- When Placement Rules are disabled, `move-hot-read-leader` does not check `location-labels` or `isolation-level`. `move-hot-write-leader` chooses a target according to `location-labels`, but does not directly check `isolation-level`. Therefore, setting only `isolation-level = "host"` cannot guarantee host isolation after the migration. +- When Placement Rules are enabled, both migration paths consider the matching rule's label constraints and replica distribution. But if you configure multiple topology levels, PD might place two replicas on the same host in order to improve zone-level distribution. You cannot rely on `isolation_level = "host"` alone to guarantee host isolation after the migration. + +Transferring the leader only to an existing voter peer does not change replica placement and does not repair an existing isolation problem. When Placement Rules are disabled, enabling `schedule.enable-location-replacement` lets PD try to improve replica layout, but it still cannot prevent hot-read migration from producing replicas on the same host. + +#### Configuration when only host isolation is required + +If you only need host isolation and do not need replicas distributed across zones or racks, configure the cluster as follows so that leader and peer migrations for hot regions keep voter replicas on different hosts: + +1. Configure an accurate `host` label for every store, make sure the number of available hosts is at least the number of voter replicas, and confirm that existing voter replicas are already distributed across different hosts. +2. Enable Placement Rules so that all voter replicas of the same Region are managed by the same `voter` rule. +3. Set that rule's `location_labels` to `["host"]` and `isolation_level` to `"host"`. If you use only the default rule, the corresponding cluster configuration is `replication.location-labels = ["host"]` and `replication.isolation-level = "host"`. + +With this configuration, PD no longer prioritizes distributing replicas across different zones or racks. If your cluster already requires cross-zone or cross-rack disaster recovery, or uses a multi-rule layout, evaluate the impact on the existing replica policy before you apply it. ### Cluster topology awareness diff --git a/configure-placement-rules.md b/configure-placement-rules.md index b3700d87142e2..f549a5e159053 100644 --- a/configure-placement-rules.md +++ b/configure-placement-rules.md @@ -109,7 +109,6 @@ PD also generates default rules based on the `max-replicas`, `location-labels`, > > - When Placement Rules are enabled and multiple rules exist, the previously configured `max-replicas`, `location-labels`, and `isolation-level` no longer take effect. To adjust the replica policy, use the interface related to Placement Rules. > - When Placement Rules are enabled and only one default rule exists, TiDB will automatically update this default rule when `max-replicas`, `location-labels`, or `isolation-level` configurations are changed. -> - To require host-level replica isolation when Placement Rules are enabled, configure a `host` label on every TiKV store. Then either keep only the default rule and set `replication.location-labels` to include `host` plus `replication.isolation-level = "host"`, or set `location_labels` and `isolation_level` explicitly in each relevant placement rule. Cluster-level replication settings do not override custom rules. ### Disable Placement Rules @@ -124,8 +123,25 @@ pd-ctl config placement-rules disable > **Note:** > > After disabling Placement Rules, PD uses the original `max-replicas`, `location-labels`, and `isolation-level` configurations. The modification of rules (when Placement Rules is enabled) will not update these three configurations in real time. In addition, all the rules that have been configured remain in PD and will be used the next time you enable Placement Rules. + +### Configure host-level replica isolation + +Host isolation places replicas of the same Region on different physical hosts. Configure it as follows: + +1. Configure topology labels for each TiKV store so that they match the actual deployment. All stores on the same physical host must use the same `host` value, and different physical hosts must use different `host` values. If you also use upper-level labels such as `zone` or `rack`, make sure those labels also reflect the physical topology accurately. +2. Configure the replica placement policy according to how you use Placement Rules: + + | Scenario | Configuration | + | --- | --- | + | Placement Rules disabled | Include `host` in `replication.location-labels` and set `replication.isolation-level = "host"` | + | Placement Rules enabled with only the default rule | Include `host` in `replication.location-labels` and set `replication.isolation-level = "host"`. PD then updates the default rule automatically. | + | Placement Rules enabled with custom rules | Include `host` in each relevant rule's `location_labels` and set `isolation_level = "host"`. Cluster-level replication settings do not override custom rules. | + +Each rule's isolation settings apply only to the replicas matched by that rule and do not automatically guarantee isolation across rules. If voter replicas of the same Region are managed by multiple rules, you can use `label_constraints` to restrict each rule to a non-overlapping set of hosts so that host isolation also holds across rules. + +> **Note:** > -> To require host-level replica isolation after disabling Placement Rules, configure a `host` label on every TiKV store, set `replication.location-labels` to include `host`, set `replication.isolation-level` to `host`, and keep `schedule.enable-location-replacement` enabled if you want PD to repair a non-isolated replica layout. +> Even after you complete this configuration, hot-region migration can still place multiple replicas of the same Region on the same host. For the detailed limitations and the configuration that applies when you need only host isolation, see [Hot region scheduling and replica isolation](/best-practices/pd-scheduling-best-practices.md#hot-region-scheduling-and-replica-isolation). ### Set rules using pd-ctl From e0fb919df48a3c8450dd57eaed64ab1a5b1c8d8c Mon Sep 17 00:00:00 2001 From: qiancai Date: Thu, 3 Dec 2026 18:19:39 +0800 Subject: [PATCH 3/4] docs: sync host isolation clarifications from Chinese docs --- best-practices/pd-scheduling-best-practices.md | 2 +- configure-placement-rules.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/best-practices/pd-scheduling-best-practices.md b/best-practices/pd-scheduling-best-practices.md index 54d2a74c8d947..3cf31d2f03196 100644 --- a/best-practices/pd-scheduling-best-practices.md +++ b/best-practices/pd-scheduling-best-practices.md @@ -93,7 +93,7 @@ If you need to place replicas of the same Region on different physical hosts, se `move-hot-read-leader` and `move-hot-write-leader` both migrate the replica that currently serves as the leader. Whether Placement Rules are enabled affects the isolation result after the migration: - When Placement Rules are disabled, `move-hot-read-leader` does not check `location-labels` or `isolation-level`. `move-hot-write-leader` chooses a target according to `location-labels`, but does not directly check `isolation-level`. Therefore, setting only `isolation-level = "host"` cannot guarantee host isolation after the migration. -- When Placement Rules are enabled, both migration paths consider the matching rule's label constraints and replica distribution. But if you configure multiple topology levels, PD might place two replicas on the same host in order to improve zone-level distribution. You cannot rely on `isolation_level = "host"` alone to guarantee host isolation after the migration. +- When Placement Rules are enabled, both migration paths check the label constraints of the matching rule. However, if you configure multiple topology levels, PD might still place two replicas on the same host to distribute replicas across different zones. Therefore, setting `isolation_level = "host"` in the rule alone cannot guarantee host isolation after the migration. Transferring the leader only to an existing voter peer does not change replica placement and does not repair an existing isolation problem. When Placement Rules are disabled, enabling `schedule.enable-location-replacement` lets PD try to improve replica layout, but it still cannot prevent hot-read migration from producing replicas on the same host. diff --git a/configure-placement-rules.md b/configure-placement-rules.md index f549a5e159053..62a1023757f5e 100644 --- a/configure-placement-rules.md +++ b/configure-placement-rules.md @@ -128,7 +128,7 @@ pd-ctl config placement-rules disable Host isolation places replicas of the same Region on different physical hosts. Configure it as follows: -1. Configure topology labels for each TiKV store so that they match the actual deployment. All stores on the same physical host must use the same `host` value, and different physical hosts must use different `host` values. If you also use upper-level labels such as `zone` or `rack`, make sure those labels also reflect the physical topology accurately. +1. Configure topology labels for each TiKV store so that they match the actual deployment. For more information, see [Configure `labels` for TiKV, TiFlash, and TiDB](/schedule-replicas-by-topology-labels.md#configure-labels-for-tikv-tiflash-and-tidb). All stores on the same physical host must use the same `host` value, and different physical hosts must use different `host` values. If you also use upper-level labels such as `zone` or `rack`, make sure those labels also reflect the physical topology accurately. 2. Configure the replica placement policy according to how you use Placement Rules: | Scenario | Configuration | @@ -137,7 +137,7 @@ Host isolation places replicas of the same Region on different physical hosts. C | Placement Rules enabled with only the default rule | Include `host` in `replication.location-labels` and set `replication.isolation-level = "host"`. PD then updates the default rule automatically. | | Placement Rules enabled with custom rules | Include `host` in each relevant rule's `location_labels` and set `isolation_level = "host"`. Cluster-level replication settings do not override custom rules. | -Each rule's isolation settings apply only to the replicas matched by that rule and do not automatically guarantee isolation across rules. If voter replicas of the same Region are managed by multiple rules, you can use `label_constraints` to restrict each rule to a non-overlapping set of hosts so that host isolation also holds across rules. +Each rule's isolation settings apply only to the replicas matched by that rule and do not automatically guarantee isolation across rules. If voter replicas of the same Region are managed by multiple rules, you can use `label_constraints` to restrict which hosts each rule can select based on store labels. For example, if one rule can select only `host-a` and `host-b`, and another can select only `host-c` and `host-d`, replicas managed by the two rules cannot share a host. > **Note:** > From 5c27e0fd7a44ef7106325acdff811d99130d3c93 Mon Sep 17 00:00:00 2001 From: qiancai Date: Thu, 3 Dec 2026 18:23:10 +0800 Subject: [PATCH 4/4] docs: distinguish master and v8.5 hot-read placement checks --- best-practices/pd-scheduling-best-practices.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/best-practices/pd-scheduling-best-practices.md b/best-practices/pd-scheduling-best-practices.md index 3cf31d2f03196..8c10c92fab336 100644 --- a/best-practices/pd-scheduling-best-practices.md +++ b/best-practices/pd-scheduling-best-practices.md @@ -92,10 +92,14 @@ If you need to place replicas of the same Region on different physical hosts, se `move-hot-read-leader` and `move-hot-write-leader` both migrate the replica that currently serves as the leader. Whether Placement Rules are enabled affects the isolation result after the migration: -- When Placement Rules are disabled, `move-hot-read-leader` does not check `location-labels` or `isolation-level`. `move-hot-write-leader` chooses a target according to `location-labels`, but does not directly check `isolation-level`. Therefore, setting only `isolation-level = "host"` cannot guarantee host isolation after the migration. +- When Placement Rules are disabled, both migration paths choose a target according to `location-labels`, but do not directly check `isolation-level`. Therefore, setting only `isolation-level = "host"` cannot guarantee host isolation after the migration. - When Placement Rules are enabled, both migration paths check the label constraints of the matching rule. However, if you configure multiple topology levels, PD might still place two replicas on the same host to distribute replicas across different zones. Therefore, setting `isolation_level = "host"` in the rule alone cannot guarantee host isolation after the migration. -Transferring the leader only to an existing voter peer does not change replica placement and does not repair an existing isolation problem. When Placement Rules are disabled, enabling `schedule.enable-location-replacement` lets PD try to improve replica layout, but it still cannot prevent hot-read migration from producing replicas on the same host. +Transferring the leader only to an existing voter peer does not change replica placement and does not repair an existing isolation problem. + +> **Note:** +> +> In TiDB v8.5, when Placement Rules are disabled, `move-hot-read-leader` does not check `location-labels` or `isolation-level`. Enabling `schedule.enable-location-replacement` lets PD try to improve replica placement, but cannot prevent these migrations from placing replicas on the same host. #### Configuration when only host isolation is required