Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions proto/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pingcap/kvproto b41e86365ce0e0fba482005c0dfa5e2ca967d74c (2026-06-22)
Matches client-go v2.0.8-0.20260708122311-01bd8f99f4da (go.mod: kvproto v0.0.0-20260622063236-b41e86365ce0).
pingcap/kvproto f9b4ae738fc4aa635e47039f340fdac07e4bc2a1 (2026-09-04)
Re-vendor: copy proto/*.proto (matching names only) and include/ from that revision, then `make generate`.
24 changes: 24 additions & 0 deletions proto/apipb.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";
package apipb;

import "gogoproto/gogo.proto";
import "rustproto.proto";

option java_package = "org.tikv.kvproto";
option (gogoproto.goproto_sizecache_all) = false;
option (gogoproto.goproto_unkeyed_all) = false;
option (gogoproto.goproto_unrecognized_all) = false;
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;

// KeyspaceIdentity identifies a V3 tenant keyspace.
//
// For V3 tenant-scoped APIs, namespace_id must be non-zero and keyspace_id must
// satisfy 0 < keyspace_id < 2^24. Namespace 0 and keyspace 0 mean
// missing/invalid identity and must be rejected by V3 validators.
message KeyspaceIdentity {
uint32 namespace_id = 1;
uint32 keyspace_id = 2;
}
14 changes: 13 additions & 1 deletion proto/autoid.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package autoid;

import "apipb.proto";
import "gogoproto/gogo.proto";
import "rustproto.proto";

Expand All @@ -20,7 +21,12 @@ message AutoIDRequest {
uint64 n = 4;
int64 increment = 5;
int64 offset = 6;
uint32 keyspaceID = 7;
oneof keyspace {
// V1/V2 compatibility keyspace id. V3 should use keyspace_identity.
uint32 keyspaceID = 7;
// V3 keyspace identity.
apipb.KeyspaceIdentity keyspace_identity = 8;
}
}

message AutoIDResponse {
Expand All @@ -36,6 +42,12 @@ message RebaseRequest {
bool isUnsigned = 3;
int64 base = 4;
bool force = 5;
oneof keyspace {
// V1/V2 compatibility keyspace id. V3 should use keyspace_identity.
uint32 keyspaceID = 6;
// V3 keyspace identity.
apipb.KeyspaceIdentity keyspace_identity = 7;
}
}

message RebaseResponse {
Expand Down
9 changes: 9 additions & 0 deletions proto/cdcpb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ message ResolvedTs {
uint64 request_id = 3;
}

enum ScanPriority {
SCAN_PRIORITY_UNKNOWN = 0;
SCAN_PRIORITY_LOW = 1;
SCAN_PRIORITY_HIGH = 2;
}

message ChangeDataRequest {
message Register {}

Expand Down Expand Up @@ -191,6 +197,9 @@ message ChangeDataRequest {

// Whether to filter out the value write by cdc itself.
bool filter_loop = 12;

// ScanPriority tells the CDC service how to schedule the initial scan.
ScanPriority scan_priority = 14;
}

service ChangeData {
Expand Down
40 changes: 40 additions & 0 deletions proto/coprocessor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,33 @@ message Request {
// (paging_size). The two fields target different scenarios and may be set
// independently.
uint64 paging_size_bytes = 17;
// Signals that the client can handle results of the batched tasks in `tasks`
// being merged into `Response.data` instead of each task returning its result
// in its own `StoreBatchTaskResponse.data`. Merging lets the store combine
// mergeable payloads, such as per-region ANALYZE sampling statistics, into
// one result, reducing the response size and the client's decode and merge
// work. See the batched ANALYZE design for the motivating use case:
// https://github.com/pingcap/tidb/pull/70355.
//
// For every merged task, the store still adds a `StoreBatchTaskResponse`
// with `data_merged_into_response` set. The store may return some or all task
// results separately even when this field is set, for example when a task
// fails, when its result is not mergeable, or when the store predates this
// field, so the client must handle both merged and per-task results.
//
// This field only negotiates the response shape. It does not affect task
// scheduling and may be set independently of `execute_batch_tasks_serially`.
bool allow_batch_task_data_merge = 18;
// When true, the store executes the primary task and all tasks in `tasks` one
// at a time, so at most one task of this request is running at any moment.
// Task execution order is not guaranteed.
//
// Clients that already bound their per-store concurrency by the number of
// in-flight requests, such as batched ANALYZE, set this so that batching more
// tasks into one request does not multiply that concurrency. The trade-off is
// a longer-lived request. This field only affects task scheduling and may be
// set independently of `allow_batch_task_data_merge`.
bool execute_batch_tasks_serially = 19;
}

message Response {
Expand Down Expand Up @@ -195,6 +222,19 @@ message StoreBatchTaskResponse {
string other_error = 4;
uint64 task_id = 5;
kvrpcpb.ExecDetailsV2 exec_details_v2 = 6;
// Indicates that this task's result was merged into the enclosing
// `Response.data`, so this message's `data` is empty. The store sets this
// field only when the client enables `Request.allow_batch_task_data_merge`,
// and only for a task that succeeded: a failed or non-mergeable task is
// returned as a normal per-task response with this field unset.
//
// Merging is atomic. If the store fails while merging, it returns no partial
// merged data and no response with this field set, so the client can safely
// retry the entire batch without losing or double-counting any task's result.
//
// This message still identifies the merged task by `task_id` and carries its
// execution details.
bool data_merged_into_response = 7;
}

message DelegateRequest {
Expand Down
7 changes: 6 additions & 1 deletion proto/disaggregated.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package disaggregated;

import "apipb.proto";
import "coprocessor.proto";
import "gogoproto/gogo.proto";
import "kvrpcpb.proto";
Expand Down Expand Up @@ -81,7 +82,11 @@ message DisaggTaskMeta {
uint64 local_query_id = 4; // unique local query_id if tidb don't restart.
int64 task_id = 5; // if task id is -1 , it indicates a tidb task.
string executor_id = 6; // the exectuor id
uint32 keyspace_id = 7; // keyspace id of the request
oneof keyspace {
uint32 keyspace_id = 7; // V1/V2 compatibility keyspace id of the request. V3 should use keyspace_identity.
// V3 keyspace identity of the request.
apipb.KeyspaceIdentity keyspace_identity = 12;
}
kvrpcpb.APIVersion api_version = 8; // API version of the request
uint64 connection_id = 10; // This is the session id between a client and tidb
string connection_alias = 11; // This is the session alias between a client and tidb
Expand Down
71 changes: 71 additions & 0 deletions proto/keyspace_encryptionpb.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Protobufs for keyspace encryption metadata.
// Depending on the component, these messages may be persisted (stable on-disk format)
// and/or transmitted over RPC (e.g. between TiKV and CDC).

syntax = "proto3";
package keyspace_encryptionpb;

import "apipb.proto";
import "gogoproto/gogo.proto";
import "rustproto.proto";

option java_package = "org.tikv.kvproto";
option (gogoproto.goproto_sizecache_all) = false;
option (gogoproto.goproto_unkeyed_all) = false;
option (gogoproto.goproto_unrecognized_all) = false;
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;

// Top-level metadata that describes the encryption info for a keyspace.
message EncryptionMeta {
oneof keyspace {
// V1/V2 compatibility keyspace id. V3 should use keyspace_identity.
uint32 keyspace_id = 1;
// V3 keyspace identity.
apipb.KeyspaceIdentity keyspace_identity = 6;
}
// The current encryption epoch, containing the active data key.
EncryptionEpoch current = 2;
// The master key used to encrypt the data keys in this meta file.
MasterKey master_key = 3;
// All known data keys for the keyspace, indexed by their data_key_id.
map<uint32, DataKey> data_keys = 4;
// Previous encryption epochs (ordered by creation time), useful for auditing
// or key recovery.
repeated EncryptionEpoch history = 5;
}

// Describes one encryption epoch: a versioned period during which a specific data key
// is used to encrypt user files.
message EncryptionEpoch {
// The file ID of the encryption meta associated with this epoch.
uint64 file_id = 1;
// The data key ID used to encrypt the file.
uint32 data_key_id = 2;
// The timestamp when this epoch was created (Unix time, seconds).
uint64 created_at = 3;
}

// Describes the encrypted master key and its associated CMEK metadata.
// With the CMEK info here it's possible to decrypt the master key.
message MasterKey {
// The KMS vendor (e.g., "aws-kms").
string vendor = 1;
// CMEK identifier.
string cmek_id = 2;
// The region of the KMS service, if applicable.
string region = 3;
// The endpoint of the KMS service, if applicable.
string endpoint = 4;
// The encrypted master key.
bytes ciphertext = 5;
}

// Describes a data key that is used to encrypt user data. The data key itself
// is encrypted by the master key.
message DataKey {
// The encrypted data key.
bytes ciphertext = 1;
}
Loading
Loading