Skip to content

docs: add PD maintenance guides#10950

Open
rleungx wants to merge 2 commits into
tikv:masterfrom
rleungx:docs-maintenance-guides
Open

docs: add PD maintenance guides#10950
rleungx wants to merge 2 commits into
tikv:masterfrom
rleungx:docs-maintenance-guides

Conversation

@rleungx

@rleungx rleungx commented Jun 29, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number:

This PR adds a maintainer-oriented guide set for the PD repository, following the structure of the TiKV maintenance guide work and adapting it to PD subsystem boundaries.

What is changed and how does it work?

Add docs/maintenance-guides as a maintainer-oriented guide set for PD.

This change adds:
- docs/maintenance-guides/README.md as the entry index and maintainer contract
- docs/maintenance-guides/repo-overview.md as the repository-level maintenance map
- subsystem guides for:
  - server
  - config
  - member-election
  - api-and-client
  - cluster
  - scheduling
  - statistics
  - placement-policy
  - storage
  - tso
  - keyspace-and-microservices
  - resource-manager

The guide set focuses on ownership boundaries, startup sequencing, metadata
contracts, observability, failure modes, must-read file order, and review
checklists for maintainers and reviewers.

Check List

Tests

  • No code

Release note

None.

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive set of maintainer guides covering PD subsystem maintenance, including server, config, cluster, scheduling, storage, TSO, statistics, placement policy, resource management, member election, keyspace & microservices, and API/client compatibility boundaries.
    • Added repository-wide overview and navigation materials (reading order, cross-cutting checklists, and observability/change-review guidance).
    • Updated the scheduling maintenance guide to clarify ownership boundaries and review expectations.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. labels Jun 29, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

[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 andremouche 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 the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rleungx, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3fcd81b3-b915-4f6a-b119-e74d736cb9e1

📥 Commits

Reviewing files that changed from the base of the PR and between cf9b307 and 4c9dc1d.

📒 Files selected for processing (1)
  • tests/integrations/realcluster/reboot_pd_test.go
📝 Walkthrough

Walkthrough

Adds a repository maintainer index and new subsystem maintenance guides under docs/maintenance-guides/ for server, config, membership, cluster, storage, statistics, scheduling, placement policy, TSO, API/client, keyspace/microservices, and resource manager.

Changes

PD Maintenance Guides

Layer / File(s) Summary
Index and repository map
docs/maintenance-guides/README.md, docs/maintenance-guides/repo-overview.md
Adds the maintainer index, guide contract, retrieval entry points, system map, guide index, review checklist, current scope, and repository-wide maintenance overview.
Core control-plane guides
docs/maintenance-guides/server.md, docs/maintenance-guides/config.md, docs/maintenance-guides/member-election.md, docs/maintenance-guides/cluster.md, docs/maintenance-guides/storage.md
Adds maintenance guides for server startup/shutdown, config ownership, member election, cluster/heartbeat ownership, and storage responsibilities with lifecycle, contract, observability, and review sections.
Scheduling, placement, statistics, and TSO
docs/maintenance-guides/scheduling.md, docs/maintenance-guides/placement-policy.md, docs/maintenance-guides/statistics.md, docs/maintenance-guides/tso.md
Adds subsystem guides covering scheduling behavior, placement policy, statistics collection, and timestamp oracle ownership, including lifecycle anchors, contracts, observability, and checklists.
API, keyspace, and resource manager
docs/maintenance-guides/api-and-client.md, docs/maintenance-guides/keyspace-and-microservices.md, docs/maintenance-guides/resource-manager.md
Adds guides for API/client compatibility, keyspace and microservice ownership, and resource manager contracts, each with sequencing, hot contracts, observability, change guidance, and review checklists.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Suggested labels

lgtm, approved

Suggested reviewers

  • liyishuai
  • okJiang
  • lhy1024

Poem

🐇 I hopped through guides from root to root,
With maps and rules in tidyూట?
From TSO ticks to rabbit trails,
The maintainer lantern never fails.
Hop, hop—each doc now points the way,
For careful paws to read and stay.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description follows the template overall, but the required Issue Number line is incomplete and lacks a linked issue. Add a valid Issue Number line, e.g. Issue Number: Close #123``, and ensure it links the relevant issue.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding PD maintenance guides.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@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.

🧹 Nitpick comments (10)
docs/maintenance-guides/repo-overview.md (2)

406-428: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Glossary is helpful but could define additional cross-cutting terms.

Consider adding: "Follower" (used in failure modes and cluster guides), "Epoch" (used in metadata contracts), and "Operator" (though defined, could be expanded). These appear frequently across guides.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/repo-overview.md` around lines 406 - 428, The
Glossary section in repo-overview.md should be expanded with the missing
cross-cutting terms mentioned in the review. Update the existing Glossary list
near the current definitions for Operator and Placement rule to add clear
entries for Follower and Epoch, and expand the Operator definition so it better
matches its usage across the guides.

148-163: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Startup sequencing is accurate but less granular than server.md.

The 7-step sequence here correctly captures the high-level flow. The server.md breaks this into 9 specific anchors. Consider adding a note that server.md contains the detailed sequencing, or align the step count for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/repo-overview.md` around lines 148 - 163, The startup
sequence in the repo overview is correct but too coarse compared with server.md,
so update the classic PD startup section to either note that server.md contains
the more detailed 9-step sequencing or revise this list to match that
granularity. Use the existing startup/shutdown overview text and the related
server lifecycle wording to keep the step count and terminology consistent
across both docs.
docs/maintenance-guides/server.md (1)

72-74: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shutdown description omits hotRegionStorage and meteringWriter.

The Close code snippet also closes hotRegionStorage and stops meteringWriter, which are not mentioned in the shutdown description. Consider adding them for completeness since they represent persistent state and I/O resources.

 Shutdown is centered on `Close`, which stops server loops first, then closes
-owned managers, clients, embedded etcd member state, heartbeat streams, storage,
-rate limiters, callbacks, and client connections.
+owned managers, clients, embedded etcd member state, heartbeat streams, storage,
+hot-region storage, metering writer, rate limiters, callbacks, and client connections.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/server.md` around lines 72 - 74, Update the shutdown
description in the Close section to also mention hotRegionStorage and
meteringWriter alongside the other owned resources. Keep the wording aligned
with the Close shutdown flow so the documentation reflects that hotRegionStorage
is closed and meteringWriter is stopped before cleanup finishes.
docs/maintenance-guides/README.md (1)

131-151: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Current scope coverage question: pkg/election/ is not listed.

The member-election.md guide covers pkg/election/ (mentioned in its own file), but pkg/election/ is absent from the Current Scope list. If this directory is covered by the member-election guide, consider adding it to the scope for completeness.

Similarly, pkg/schedule/placement/, pkg/schedule/labeler/, and pkg/schedule/affinity/ are covered by placement-policy.md but not explicitly listed. Consider whether the scope should list these or if the current package-level granularity is intentional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/README.md` around lines 131 - 151, The Current Scope
list is missing directories that are already covered by the maintenance guides,
including pkg/election/ from member-election.md and the pkg/schedule
subdirectories covered by placement-policy.md. Update the scope section in
README.md to either explicitly add these paths for completeness or clearly
document that the list is intentionally package-level and covers those
subdirectories implicitly, keeping the wording consistent with the existing
scope entries.
docs/maintenance-guides/placement-policy.md (2)

89-89: 📐 Maintainability & Code Quality | 🔵 Trivial

Fix hyphenation: "user-visible".

Change "user visible" to "user-visible" to follow standard hyphenation for compound modifiers.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/placement-policy.md` at line 89, Fix the wording in
the placement-policy documentation to use the standard compound modifier
“user-visible” instead of “user visible”. Update the sentence in the policy
metadata note so the hyphenation is consistent with the intended terminology and
keeps the existing meaning unchanged.

Source: Linters/SAST tools


96-96: 📐 Maintainability & Code Quality | 🔵 Trivial

Format directory path consistently.

Line 96 lists pkg/schedule/placement as a directory while other entries are specific files. Append a trailing slash or list the specific entry file (e.g., pkg/schedule/placement/rule_manager.go).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/placement-policy.md` at line 96, The directory
reference in the placement-policy guide is inconsistent with the surrounding
file-level entries. Update the `pkg/schedule/placement` entry in the markdown
list to either use a trailing slash for the directory or replace it with a
specific file path, matching the existing style used elsewhere in the document.
docs/maintenance-guides/storage.md (1)

118-118: 📐 Maintainability & Code Quality | 🔵 Trivial

Format directory path consistently.

Line 118 lists pkg/utils/keypath as a directory while all other entries are specific files. Append a trailing slash to indicate it's a directory, or list the specific entry file (e.g., pkg/utils/keypath/keypath.go).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/storage.md` at line 118, The storage maintenance
guide lists pkg/utils/keypath as a directory while the surrounding entries use
concrete file paths, so update the referenced item in the guide to be consistent
by either adding a trailing slash or replacing it with the specific keypath file
name. Locate the list entry by the pkg/utils/keypath symbol in the maintenance
guide and make the path format match the other items.
docs/maintenance-guides/scheduling.md (1)

51-53: 📐 Maintainability & Code Quality | 🔵 Trivial

Use constructor/function anchors for startup sequencing.

Lines 51-53 list type names (schedulers.Controller, checker.Controller, operator.Controller) rather than initialization points. For consistency with the other anchors and to make this actionable for maintainers, use constructor names like schedulers.NewController or initialization methods like Controller.Start().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/scheduling.md` around lines 51 - 53, The startup
sequencing anchors currently point to controller type names instead of
executable initialization points, so update the references in the scheduling
guide to use constructor or startup symbols such as schedulers.NewController,
checker.NewController, operator.NewController, or Controller.Start() to match
the other actionable anchors and help maintainers locate the actual startup
flow.
docs/maintenance-guides/keyspace-and-microservices.md (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: Title case "And" should be "and" for consistency with standard title case.

Current: "Keyspace And Microservices"
Suggested: "Keyspace and Microservices"

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/keyspace-and-microservices.md` at line 1, The
document title uses inconsistent title case in the Keyspace And Microservices
heading. Update the top-level heading in the markdown so it follows standard
title case conventions by changing the capitalized conjunction to the lowercase
form, and keep the rest of the title unchanged.
docs/maintenance-guides/api-and-client.md (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Minor: Title case "And" should be "and" for consistency with standard title case.

Current: "API And Client"
Suggested: "API and Client"

This matches typical title case conventions where coordinating conjunctions are lowercase unless they're the first or last word.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/maintenance-guides/api-and-client.md` at line 1, Update the document
title in the API and client guide so it follows standard title case conventions
by changing “API And Client” to “API and Client.” This is a simple text fix in
the heading at the top of the guide, and the unique symbol to locate is the
document title “API And Client.”
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/maintenance-guides/api-and-client.md`:
- Line 1: Update the document title in the API and client guide so it follows
standard title case conventions by changing “API And Client” to “API and
Client.” This is a simple text fix in the heading at the top of the guide, and
the unique symbol to locate is the document title “API And Client.”

In `@docs/maintenance-guides/keyspace-and-microservices.md`:
- Line 1: The document title uses inconsistent title case in the Keyspace And
Microservices heading. Update the top-level heading in the markdown so it
follows standard title case conventions by changing the capitalized conjunction
to the lowercase form, and keep the rest of the title unchanged.

In `@docs/maintenance-guides/placement-policy.md`:
- Line 89: Fix the wording in the placement-policy documentation to use the
standard compound modifier “user-visible” instead of “user visible”. Update the
sentence in the policy metadata note so the hyphenation is consistent with the
intended terminology and keeps the existing meaning unchanged.
- Line 96: The directory reference in the placement-policy guide is inconsistent
with the surrounding file-level entries. Update the `pkg/schedule/placement`
entry in the markdown list to either use a trailing slash for the directory or
replace it with a specific file path, matching the existing style used elsewhere
in the document.

In `@docs/maintenance-guides/README.md`:
- Around line 131-151: The Current Scope list is missing directories that are
already covered by the maintenance guides, including pkg/election/ from
member-election.md and the pkg/schedule subdirectories covered by
placement-policy.md. Update the scope section in README.md to either explicitly
add these paths for completeness or clearly document that the list is
intentionally package-level and covers those subdirectories implicitly, keeping
the wording consistent with the existing scope entries.

In `@docs/maintenance-guides/repo-overview.md`:
- Around line 406-428: The Glossary section in repo-overview.md should be
expanded with the missing cross-cutting terms mentioned in the review. Update
the existing Glossary list near the current definitions for Operator and
Placement rule to add clear entries for Follower and Epoch, and expand the
Operator definition so it better matches its usage across the guides.
- Around line 148-163: The startup sequence in the repo overview is correct but
too coarse compared with server.md, so update the classic PD startup section to
either note that server.md contains the more detailed 9-step sequencing or
revise this list to match that granularity. Use the existing startup/shutdown
overview text and the related server lifecycle wording to keep the step count
and terminology consistent across both docs.

In `@docs/maintenance-guides/scheduling.md`:
- Around line 51-53: The startup sequencing anchors currently point to
controller type names instead of executable initialization points, so update the
references in the scheduling guide to use constructor or startup symbols such as
schedulers.NewController, checker.NewController, operator.NewController, or
Controller.Start() to match the other actionable anchors and help maintainers
locate the actual startup flow.

In `@docs/maintenance-guides/server.md`:
- Around line 72-74: Update the shutdown description in the Close section to
also mention hotRegionStorage and meteringWriter alongside the other owned
resources. Keep the wording aligned with the Close shutdown flow so the
documentation reflects that hotRegionStorage is closed and meteringWriter is
stopped before cleanup finishes.

In `@docs/maintenance-guides/storage.md`:
- Line 118: The storage maintenance guide lists pkg/utils/keypath as a directory
while the surrounding entries use concrete file paths, so update the referenced
item in the guide to be consistent by either adding a trailing slash or
replacing it with the specific keypath file name. Locate the list entry by the
pkg/utils/keypath symbol in the maintenance guide and make the path format match
the other items.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 79f48df0-bbbd-4f29-bcce-b35a175d6042

📥 Commits

Reviewing files that changed from the base of the PR and between 0d6dafc and 4a975be.

📒 Files selected for processing (14)
  • docs/maintenance-guides/README.md
  • docs/maintenance-guides/api-and-client.md
  • docs/maintenance-guides/cluster.md
  • docs/maintenance-guides/config.md
  • docs/maintenance-guides/keyspace-and-microservices.md
  • docs/maintenance-guides/member-election.md
  • docs/maintenance-guides/placement-policy.md
  • docs/maintenance-guides/repo-overview.md
  • docs/maintenance-guides/resource-manager.md
  • docs/maintenance-guides/scheduling.md
  • docs/maintenance-guides/server.md
  • docs/maintenance-guides/statistics.md
  • docs/maintenance-guides/storage.md
  • docs/maintenance-guides/tso.md

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.19%. Comparing base (6f795b1) to head (4c9dc1d).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10950      +/-   ##
==========================================
- Coverage   79.21%   79.19%   -0.03%     
==========================================
  Files         541      541              
  Lines       75112    75114       +2     
==========================================
- Hits        59500    59483      -17     
- Misses      11411    11430      +19     
  Partials     4201     4201              
Flag Coverage Δ
unittests 79.19% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx rleungx force-pushed the docs-maintenance-guides branch from 345744e to 4c9dc1d Compare June 29, 2026 10:22
@ti-chi-bot

ti-chi-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@rleungx: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-unit-test-next-gen-3 4c9dc1d link true /test pull-unit-test-next-gen-3

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@rleungx rleungx force-pushed the docs-maintenance-guides branch from 4c9dc1d to cf9b307 Compare June 30, 2026 02:32
@ti-chi-bot

ti-chi-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456, multiple issues should use full syntax for each issue and be separated by a comma, like: Issue Number: close #123, ref #456.

📖 For more info, you can check the "Linking issues" section in the CONTRIBUTING.md.

@okJiang okJiang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the docs for different components be placed in their respective code directories?

The root directory may only need to contain high-level architectural designs.

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

Labels

dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants