Skip to content

Clarify hotspot scheduling isolation behavior - #24798

Open
doc-claw-bot wants to merge 4 commits into
pingcap:masterfrom
doc-claw-bot:docs/hotspot-host-isolation-clarify
Open

doc-claw-bot wants to merge 4 commits into
pingcap:masterfrom
doc-claw-bot:docs/hotspot-host-isolation-clarify

Conversation

@doc-claw-bot

@doc-claw-bot doc-claw-bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

What is changed, added, or deleted? (Required)

  • Clarify which hotspot scheduling paths honor replica placement constraints.
  • Clarify how to configure location-labels and isolation-level with Placement Rules enabled or disabled to preserve host-level isolation.
  • Add guidance that hot leader transfer does not repair an existing non-isolated replica layout by itself.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • Documentation
    • Clarified how hot-region leader migrations and transfers to existing voters affect replica placement and interact with Placement Rules, location labels, and isolation settings.
    • Added host-level isolation configuration guidance for Placement Rules disabled, default-rule, and custom-rule setups, including topology-label requirements and rule-specific settings.
    • Documented that hot-region migrations can still colocate replicas on one host, and that location replacement does not prevent this for hot-read migrations.

@ti-chi-bot

ti-chi-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tangenta for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added contribution This PR is from a community contributor. missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 3, 2026
@doc-claw-bot doc-claw-bot added ONCALL Relates to documentation oncall. type/bugfix This PR fixes a bug. area/scheduling Indicates that the Issue or PR belongs to the area of scheduling. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. labels Dec 3, 2026
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The documentation adds host-level replica-isolation setup guidance and describes how hot-region scheduling handles placement constraints with Placement Rules enabled or disabled.

Changes: Placement and Hot-Region Scheduling

Layer / File(s) Summary
Configure host-level isolation
configure-placement-rules.md, best-practices/pd-scheduling-best-practices.md
The guidance covers host labels, voter replica distribution, and isolation settings for disabled Placement Rules, the default rule, and custom rules. It explains that custom rules use their own isolation settings and that label_constraints can restrict rules to non-overlapping hosts.
Document hot-region scheduling behavior
best-practices/pd-scheduling-best-practices.md, configure-placement-rules.md
The guidance describes how hot-read and hot-write leader migrations consider placement constraints. It notes that transferring leadership to an existing voter does not change replica placement and that hot-region migration can still place replicas on the same host.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Suggested reviewers: qiancai

Merge Risk: Low · previous review e0fb9

The documentation clarifies host-level replica isolation, but some open gaps could lead operators to a layout that is not host-isolated. These are low-risk documentation fixes that can be addressed before or shortly after merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title 'Clarify hotspot scheduling isolation behavior' matches the main change: the documentation now explains which hotspot scheduling paths honor location-labels and isolation-level, and how to c…
Description check Passed The description fills the template's required sections: the changed items are listed, the affected versions are checked (master and v8.5), the translation source is linked, and the AI agent involvemen…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title 'Clarify hotspot scheduling isolation behavior' matches the main change: the documentation now explains which hotspot scheduling paths honor location-labels and isolation-level, and how to configure them for host-level isolation. It is concise and specific, though it does not mention the host-level configuration guidance.

Full details: Description check

Explanation

The description fills the template's required sections: the changed items are listed, the affected versions are checked (master and v8.5), the translation source is linked, and the AI agent involvement field is marked. The Contributor License Agreement checkbox is absent from the author's copy, but it is only required for first-time contributors, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: aff3f03
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0a2d0d07-b540-48e5-97ee-082fcfcc5be7
Commits

Reviewing files that changed from the base of the PR and between b1001cb and e0fb919.

Files selected for processing: 2

  • best-practices/pd-scheduling-best-practices.md
  • configure-placement-rules.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label Dec 3, 2026
@ti-chi-bot

ti-chi-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown

In response to a cherrypick label: only pingcap org members may request cherry picks. If you are already part of the org, make sure to change your membership to public. Otherwise you can still do the cherry-pick manually.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments

Major 1
  1. Do not promise cross-rule host isolation.
Minor 3
  1. Specify the host values in custom rules.
  2. Correct the placement-rule check for existing peers.
  3. Clarify that the disabled-mode settings do not cover hot-read leader moves.
    best-practices/pd-scheduling-best-practices.md, lines 94 · 🎯 Functional Correctness · 💤 Low value
    Line 94 says these settings let PD replace peers to improve isolation. That applies to the replica checker. Readers can still assume that the same settings protect hot-read leader moves. With Placement Rules disabled, move-hot-read-leader does not check location-labels or isolation-level, so these settings do not prevent it from reducing host isolation. Add a short clarification to the bullet.
    Proposed change
    ->     - 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 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. These settings do not prevent a hot-read leader move from reducing replica isolation.
    
Additional comments: 1

configure-placement-rules.md-112-112: 1

112-112: Major · Stability & Availability · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Specify how host labels identify a physical host.

If two TiKV stores on the same host have different host label values, PD can treat them as separate locations and place replicas on both. State that stores on the same host must use the same topology labels through the host level. Also state that different hosts must have distinct host identities within their parent topology.

Also applies to: 128-128

Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: aff3f03
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d2e39896-43c6-47a2-bcbe-b737622a0556
Commits

Reviewing files that changed from the base of the PR and between aff3f03 and 5677888.

Files selected for processing: 2

  • best-practices/pd-scheduling-best-practices.md
  • configure-placement-rules.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread configure-placement-rules.md Outdated
>
> - 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major · Stability & Availability · Heavy lift

Do not promise cross-rule host isolation.

A leader rule and a follower rule can each have count = 1 and host isolation configured. PD scores isolation among the peers assigned to each rule, so replicas assigned to different rules can still share a host. A host failure can then affect both replicas. Clarify this limitation and describe how to constrain the rules to disjoint host sets, or use one rule for the replicas that must be isolated. (raw.githubusercontent.com)


Minor · Functional Correctness · Quick win

Specify the host values in custom rules.

The custom-rule instruction does not state the values that require host isolation. The example in the same section sets isolation_level to an empty string, which does not require isolation. A reader who follows that pattern can end up without host-level replica isolation. State that location_labels must include host and isolation_level must be "host", as the default-rule path does.

Suggested wording

--- "a/configure-placement-rules.md"
+++ "b/configure-placement-rules.md"
@@ -109,7 +109,7 @@
 >
 > - 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.
+> - 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` to include `host` and `isolation_level` to `"host"` explicitly in each relevant placement rule. Cluster-level replication settings do not override custom rules.
 
 ### Disable Placement Rules
 
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
> - 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.
> - 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` to include `host` and `isolation_level` to `"host"` explicitly in each relevant placement rule. Cluster-level replication settings do not override custom rules.

@ti-chi-bot ti-chi-bot Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments

Minor 2
  1. Explain how to obtain the single voter rule.
  2. Add the location-replacement prerequisite to the disabled-rules procedure.
Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: aff3f03
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: beebc986-0bfb-4846-a4c1-00a1e98ea7d5
Commits

Reviewing files that changed from the base of the PR and between 5677888 and b1001cb.

Files selected for processing: 2

  • best-practices/pd-scheduling-best-practices.md
  • configure-placement-rules.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Explain how to obtain the single voter rule.

If a cluster has retained multiple rules, enabling Placement Rules restores those rules; it does not consolidate them into one voter rule. Step 3 then has no single rule to configure. Direct readers to inspect and, if necessary, adjust the matching rules before continuing, while preserving the warning about existing policies.

As per coding guidelines, procedural steps must “make each step a clear action.”

Source: Coding guidelines


| Scenario | Configuration |
| --- | --- |
| Placement Rules disabled | Include `host` in `replication.location-labels` and set `replication.isolation-level = "host"` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Add the location-replacement prerequisite to the disabled-rules procedure.

If Placement Rules are disabled and some replicas of a Region are on the same host, the labels and isolation level in this procedure do not move those replicas. PD does not increase a replica's isolation through scheduling while schedule.enable-location-replacement is false (pd-control.md). Enable this setting before you apply the procedure to an existing cluster. Then confirm that the replicas are on different hosts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/scheduling Indicates that the Issue or PR belongs to the area of scheduling. contribution This PR is from a community contributor. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. ONCALL Relates to documentation oncall. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants