Skip to content

import_sstpb: add RestoreRegion RPC for snapshot restore - #1533

Open
RidRisR wants to merge 1 commit into
pingcap:masterfrom
RidRisR:import-sstpb-restore-region
Open

import_sstpb: add RestoreRegion RPC for snapshot restore#1533
RidRisR wants to merge 1 commit into
pingcap:masterfrom
RidRisR:import-sstpb-restore-region

Conversation

@RidRisR

@RidRisR RidRisR commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What changed and how does it work?

Add ImportSST.RestoreRegion so BR can ask a target Region leader to restore snapshot SSTs through the cloud storage engine. The response reuses IngestResponse; success means the generated files have been applied. Failed or interrupted requests may already have taken effect, so the API does not promise idempotent retries.

RestoreRegionRequest carries the Region context, shared source storage and optional cipher configuration. Each RestoreRegionSource identifies a source write/default SST, its size, logical key-prefix/timestamp rewrite rule and optional IV. TiKV derives the crop range from the target Region. Timestamp filtering is unsupported.

This is an additive protocol change. Existing RPCs and the backup metadata format are unchanged. Include regenerated Go bindings and the compatibility lock; Rust bindings are generated at build time.

Validation

  • make proto-fmt-check
  • protolock status against both the updated lock and the upstream master lock
  • Regenerated import_sstpb using the repository's generation options; git diff --exit-code remained clean
  • go test ./pkg/import_sstpb (package compilation; no test files)
  • go build ./pkg/...
  • cargo check --locked -j 8
  • cargo check --locked --no-default-features --features prost-codec -j 8
  • git diff --check origin/master...HEAD

The protocol source is byte-for-byte identical to the version used by both BR and TiKV in a prior end-to-end full-snapshot restore test (write/default CFs, secondary index, checksum and three-replica Apply). That test used local dependency overrides on older dependency baselines; integration after updating consumers to this PR revision remains separate work.

C++ generation/build and a new end-to-end consumer run on this rebased revision were not run locally.

Summary by CodeRabbit

  • New Features
    • Added support for restoring a complete snapshot into an existing region.
    • Added configuration for target-region context, shared storage, source SST files, column families, rewrite rules, file lengths, and encryption settings.

@ti-chi-bot

ti-chi-bot Bot commented Sep 8, 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 ichn-hu, zhangjinpeng87 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 Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 72b9d7a4-2bf1-449c-96bb-379f417e41c8

📥 Commits

Reviewing files that changed from the base of the PR and between f9b4ae7 and d51dc40.

⛔ Files ignored due to path filters (2)
  • pkg/import_sstpb/import_sstpb.pb.go is excluded by !**/*.pb.go
  • scripts/proto.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • proto/import_sstpb.proto

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The import SST protocol adds RestoreRegion and request messages for restoring snapshot SST files into an existing region, including storage, column family, rewrite, file-length, and encryption metadata.

Changes

Region Restore

Layer / File(s) Summary
Restore RPC and request contract
proto/import_sstpb.proto
Adds the RestoreRegion RPC, RestoreRegionRequest, and RestoreRegionSource with region context, storage configuration, SST metadata, rewrite rules, and encryption settings.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Merge Risk: ⚪ Minimal · up to d51dc

This change adds the RestoreRegion RPC and its SST restore request metadata. The generated bindings align with the new contract, and no concrete current-head merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding the RestoreRegion RPC to import_sstpb for snapshot restoration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

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

@ti-chi-bot

ti-chi-bot Bot commented Sep 8, 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 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