Skip to content

pdpb: declare LogOnly recovery status and protocol support - #1565

Draft
jiadebin wants to merge 10 commits into
pingcap:masterfrom
jiadebin:codex/logonly-recovery-protocol-v2
Draft

jiadebin wants to merge 10 commits into
pingcap:masterfrom
jiadebin:codex/logonly-recovery-protocol-v2

Conversation

@jiadebin

@jiadebin jiadebin commented Oct 27, 2026 •

Copy link
Copy Markdown

What problem does this PR solve?

CSE LogOnly witnesses may temporarily lead Raft to repair a Full voter. PD and Scheduling must distinguish that state from a data-serving leader and from an actually empty Region. Explicit protocol support must be negotiated before admitting witnesses; the old is_witness bit is not sufficient.

When a Witness reaches critical Raft-disk pressure, accepting the next Append also requires a finite plan for the Full flush/checkpoint chain that will make the accepted data recoverable from DFS. A raw retained-byte hint cannot price future ChangeSets or bind retries to one immutable Full state.

What is changed and how does it work?

  • Add immutable-role-independent Store protocol support and PD/Scheduling primary negotiation fields.
  • Carry a presence-aware recovery status on PD and Scheduling heartbeats: temporary leader state, data-service readiness, reliable-size source, target peer and recovery session.
  • Preserve the status through PD HA full/incremental sync using sparse identity-bound entries, avoiding nil/empty-message ambiguity for legacy Regions.
  • Add session-bound witness log-pressure feedback used by the Store-wide LogOnly admission protocol.
  • Add a versioned WitnessDrainPlan carried only after Full seals business input at applied == commit == last. It binds one UUID to the Full flush-ledger incarnation/revision, writable generation/write sequence, and overflow-checked aggregate future ChangeSet/L0 bounds plus the largest single ChangeSet bound needed to prove RFEngine's per-Ready encoding limit.
  • Add explicit accepted-plan and Store-owner IDs in the response. Echoing a request is not admission, and a changed ledger/frontier requires a new plan identity.
  • Keep existing field numbers and regenerate the Go/Rust/C++ bindings and protocol lock.

The drain plan is semantic evidence, not a physical IO ticket. The Witness companion must still combine it with its exact pending suffix and metadata projection and reserve every local WAL/rlog/MANIFEST copy before stepping the triggering Append. Production selector activation and the corresponding negotiated Store capability remain in the CSE draft.

The branch is synchronized with current kvproto master so the PD master draft keeps the upstream RU timeline schema while using the LogOnly protocol. Release-branch adoption should be handled as a separate backport.

Companion drafts:

Validation

  • Protocol formatting and compatibility check passed.
  • go test ./pkg/raft_serverpb passed, including nested plan presence and round-trip identity.
  • Current-head GitHub Go, Rust and C++ jobs passed.
  • The CSE companion compiled against this exact revision; its debt/ShardMeta-bound tests passed 3/3, plan construction/validation and future flush quote tests passed 3/3, and full-workspace make clippy passed with zero warnings.

Check List

  • Generated Go bindings and protocol lock
  • Protocol formatting/compatibility checks
  • Go/Rust/C++ CI
  • Cross-component focused tests in the companion draft

Signed-off-by: Debin <debin.jia@pingcap.com>
@ti-chi-bot ti-chi-bot Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

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

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 27, 2026
@pingcap-cla-assistant

pingcap-cla-assistant Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Signed-off-by: Debin <debin.jia@pingcap.com>
@ti-chi-bot ti-chi-bot Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 27, 2026
Signed-off-by: Debin <debin.jia@pingcap.com>
Signed-off-by: Debin <debin.jia@pingcap.com>
Signed-off-by: Debin <debin.jia@pingcap.com>
Signed-off-by: Debin <debin.jia@pingcap.com>
…gonly-recovery-protocol-v2

Signed-off-by: Debin <debin.jia@pingcap.com>

# Conflicts:
#	pkg/metapb/metapb.pb.go
#	pkg/pdpb/pdpb.pb.go
Signed-off-by: Debin <debin.jia@pingcap.com>
@jiadebin
jiadebin changed the base branch from release-nextgen-202609 to master October 29, 2026 08:32
Signed-off-by: Debin <debin.jia@pingcap.com>
@ti-chi-bot

ti-chi-bot Bot commented Oct 29, 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 disksing, likidu 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

Signed-off-by: Debin <debin.jia@pingcap.com>
@ti-chi-bot

ti-chi-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

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

📖 For more info, you can check the "Contribute Code" section in the development guide.

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

Labels

do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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.

1 participant