Skip to content

*: re-vendor kvproto at b41e863 (2026-06-22) and record the vendored revision#550

Open
eduralph wants to merge 2 commits into
tikv:masterfrom
getwyrd:kvproto-refresh
Open

*: re-vendor kvproto at b41e863 (2026-06-22) and record the vendored revision#550
eduralph wants to merge 2 commits into
tikv:masterfrom
getwyrd:kvproto-refresh

Conversation

@eduralph

@eduralph eduralph commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Why: the vendored protos are an unrecorded late-2023/early-2024 vintage (errorpb.proto/pdpb.proto untouched since #324, one hand-patched addition from #519). Nothing records which kvproto revision they came from, and the staleness now blocks real features.

What: all vendored protos + the include tree re-vendored at pingcap/kvproto b41e863 — the revision client-go pins today — plus a new proto/VERSION recording it. Regenerated with the existing tonic-build pipeline (21 files); one mechanical source fix (pdpb.RequestHeader gained caller_component/caller_id). Newly available surface includes KvFlush/KvBufferBatchGet (pipelined DML), HealthFeedback, and pdpb.BatchScanRegions.

Two new protocol semantics arrive with the refresh and are handled rather than silently mis-parsed:

  1. errorpb.UndeterminedResult (an unknown raft apply outcome). Following client-go's shape — its transport never retries this ("should not retry … processed by the caller", region_request.go) and each action decides — the plan layer here retries by default (replaying an idempotent request resolves the uncertainty; the error escapes unchanged on backoff exhaustion), while plans for which a replay is unsafe are terminal on first sight: raw CAS (a replay would compare against its own effect and report succeed = false for a write that happened), the primary commit (client-go returns ErrResultUndetermined there, commit.go), and async-commit/1PC prewrites (the commit point — stricter than client-go, in the safe direction). Commit paths classify the surfaced error as UndeterminedError: at a commit point, "failed" must never be claimed when the transaction may already be durable.

  2. Shared locks (SharedLock/SharedPessimisticLock; real holders live in shared_lock_infos — "DO NOT read from the wrapper"). This client doesn't implement shared-lock resolution yet, and partial handling is worse than none (resolving the wrapper checks transaction 0; filtering on wrapper fields silently drops members). Resolution refuses them with an explicit error, and the API-v2 keyspace codecs are wrapper-aware (keyed on type — the empty logical key is valid — recursing into members), so scan results can't panic the truncation path. Full shared-lock support is deliberately follow-up work.

Verification: make check green; 67 lib tests (4 new covering the undetermined and shared-lock semantics); txn/raw/failpoint integration suites green against a local api-v2 cluster; and behavior compared against client-go by driving both clients through identical transactional and raw scenarios — no observable change.

Summary by CodeRabbit

  • New Features
    • Added snapshot-backup preparation streaming APIs and on-demand log-backup flush.
    • Expanded protocols with new admin/runtime RPCs (keyspace, meta-storage delete, scheduling region buckets, PD GC safe-points/barriers) and TiKV batching commands.
    • Extended backup/import/encryption capabilities (batch SST download/force partition range, richer encryption metadata including cloud KMS options).
  • Bug Fixes
    • Improved handling of “undetermined” outcomes so multi-region operations terminate appropriately and avoid masking by other shard results.
    • Prevented shared-lock wrapper inputs from being incorrectly processed during lock resolution/cleanup.

@ti-chi-bot ti-chi-bot Bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Jul 15, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 15, 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 lonng 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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

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

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f17c6480-b464-43d9-a2b2-e83ce0ee7775

📥 Commits

Reviewing files that changed from the base of the PR and between 0bc204c and adfed61.

⛔ Files ignored due to path filters (21)
  • src/generated/backup.rs is excluded by !**/generated/**
  • src/generated/cdcpb.rs is excluded by !**/generated/**
  • src/generated/coprocessor.rs is excluded by !**/generated/**
  • src/generated/deadlock.rs is excluded by !**/generated/**
  • src/generated/encryptionpb.rs is excluded by !**/generated/**
  • src/generated/errorpb.rs is excluded by !**/generated/**
  • src/generated/import_sstpb.rs is excluded by !**/generated/**
  • src/generated/keyspacepb.rs is excluded by !**/generated/**
  • src/generated/kvrpcpb.rs is excluded by !**/generated/**
  • src/generated/logbackup.rs is excluded by !**/generated/**
  • src/generated/meta_storagepb.rs is excluded by !**/generated/**
  • src/generated/metapb.rs is excluded by !**/generated/**
  • src/generated/mpp.rs is excluded by !**/generated/**
  • src/generated/pdpb.rs is excluded by !**/generated/**
  • src/generated/raft_cmdpb.rs is excluded by !**/generated/**
  • src/generated/raft_serverpb.rs is excluded by !**/generated/**
  • src/generated/resource_manager.rs is excluded by !**/generated/**
  • src/generated/resource_usage_agent.rs is excluded by !**/generated/**
  • src/generated/schedulingpb.rs is excluded by !**/generated/**
  • src/generated/tikvpb.rs is excluded by !**/generated/**
  • src/generated/tsopb.rs is excluded by !**/generated/**
📒 Files selected for processing (45)
  • proto/VERSION
  • proto/autoid.proto
  • proto/brpb.proto
  • proto/cdcpb.proto
  • proto/configpb.proto
  • proto/coprocessor.proto
  • proto/deadlock.proto
  • proto/debugpb.proto
  • proto/diagnosticspb.proto
  • proto/disaggregated.proto
  • proto/disk_usage.proto
  • proto/encryptionpb.proto
  • proto/enginepb.proto
  • proto/errorpb.proto
  • proto/gcpb.proto
  • proto/import_kvpb.proto
  • proto/import_sstpb.proto
  • proto/include/eraftpb.proto
  • proto/include/gogoproto/gogo.proto
  • proto/include/rustproto.proto
  • proto/keyspacepb.proto
  • proto/kvrpcpb.proto
  • proto/logbackuppb.proto
  • proto/meta_storagepb.proto
  • proto/metapb.proto
  • proto/mpp.proto
  • proto/pdpb.proto
  • proto/raft_cmdpb.proto
  • proto/raft_serverpb.proto
  • proto/recoverdatapb.proto
  • proto/replication_modepb.proto
  • proto/resource_manager.proto
  • proto/resource_usage_agent.proto
  • proto/schedulingpb.proto
  • proto/tikvpb.proto
  • proto/tracepb.proto
  • proto/tsopb.proto
  • src/pd/timestamp.rs
  • src/raw/client.rs
  • src/request/keyspace.rs
  • src/request/plan.rs
  • src/request/plan_builder.rs
  • src/transaction/lock.rs
  • src/transaction/mod.rs
  • src/transaction/transaction.rs
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/transaction/mod.rs
  • proto/VERSION
  • proto/include/rustproto.proto
  • proto/include/eraftpb.proto
  • src/pd/timestamp.rs
  • src/raw/client.rs
  • proto/include/gogoproto/gogo.proto
  • src/request/plan_builder.rs
  • src/transaction/lock.rs
  • src/transaction/transaction.rs
  • src/request/plan.rs

📝 Walkthrough

Walkthrough

The update vendors a newer kvproto revision, expands protobuf service and message contracts, standardizes code-generation options, and changes Rust retry and lock handling for undetermined results and shared-lock wrappers.

Changes

Protocol and transaction safety changes

Layer / File(s) Summary
Vendored protobuf contracts and codegen updates
proto/*.proto, proto/include/*, proto/VERSION
Updates the kvproto revision and code-generation options, adds service endpoints and message fields for backup, encryption, coprocessor, GC, resource usage, scheduling, TiKV batching, and related metadata contracts.
Terminal handling for undetermined results
src/request/plan.rs, src/request/plan_builder.rs, src/raw/client.rs, src/transaction/transaction.rs
Adds terminal multi-region retry behavior for undetermined region results and applies it to compare-and-swap and transaction prewrite/commit flows.
Shared-lock rejection and keyspace encoding
src/request/keyspace.rs, src/request/plan.rs, src/transaction/lock.rs, src/transaction/mod.rs
Detects shared-lock wrappers, preserves nested lock fields during encoding and truncation, and rejects shared locks before resolution or cleanup.
Timestamp request header defaults
src/pd/timestamp.rs
Uses default request-header initialization for aggregated TSO requests while preserving the cluster identifier.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • tikv/client-rust#548: Both changes modify region-error retry handling in src/request/plan.rs, including behavior associated with retry exhaustion and undetermined results.
🚥 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 matches the main change: re-vendoring kvproto at b41e863 and updating proto/VERSION to record the vendored revision.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

@eduralph

Copy link
Copy Markdown
Contributor Author

/retest

@ti-chi-bot

ti-chi-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

@eduralph: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

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.

…revision

The vendored protos were an unrecorded late-2023/early-2024 vintage (errorpb
and pdpb untouched since tikv#324, one hand-patched addition from tikv#519). Re-vendor
everything at pingcap/kvproto b41e86365ce0 — the revision client-go currently
pins — and add proto/VERSION so the vintage is never again guesswork.

Regenerated with the existing tonic-build pipeline (21 files). One mechanical
source fix: pdpb.RequestHeader gained caller_component/caller_id.

Two new protocol semantics arrive with the refresh and are handled rather than
silently mis-parsed:

1. errorpb.UndeterminedResult (an unknown raft apply outcome). The transport
   never retries it in client-go (region_request.go: 'should not retry ...
   processed by the caller'); each action decides. Here: the plan layer retries
   by default (replaying an idempotent request resolves the uncertainty, and
   the error escapes UNCHANGED on backoff exhaustion), while plans for which a
   replay is unsafe are terminal on first sight — raw CAS (a replay would
   compare against its own effect and report a false failure), the primary
   commit (client-go returns ErrResultUndetermined there, commit.go), and
   async-commit/1PC prewrites (the commit point; stricter than client-go, in
   the safe direction). Commit paths classify the surfaced error as
   UndeterminedError: at a commit point, 'failed' must never be claimed when
   the transaction may already be durable.

2. Shared locks (SharedLock / SharedPessimisticLock, whose real holders live
   in shared_lock_infos — 'DO NOT read from the wrapper LockInfo'). This
   client does not implement shared-lock resolution yet, and partial handling
   is worse than none (resolving the wrapper checks transaction 0; filtering
   on wrapper fields silently drops members). Resolution therefore REFUSES
   them with an explicit error, before any filter. The API-v2 keyspace codecs
   are wrapper-aware (identifying wrappers by TYPE — the empty logical key is
   valid — and recursing into members), so scan results can never panic the
   truncation path.

Tests: 67 lib tests (4 new: undetermined terminal/preserved/recognized,
shared-lock refusal); txn/raw/failpoint integration suites green.

Signed-off-by: Eduard R. <eduard@ralphovi.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. dco-signoff: yes Indicates the PR's author has signed the dco. 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