Skip to content

Commit 131bbff

Browse files
authored
Merge branch 'master' into buffer-mutex
2 parents a3f5361 + 5688e08 commit 131bbff

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

mock-tikv/src/server.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,4 +513,13 @@ impl Tikv for MockTikv {
513513
) {
514514
todo!()
515515
}
516+
517+
fn coprocessor_v2(
518+
&mut self,
519+
_: grpcio::RpcContext,
520+
_: tikv_client_proto::coprocessor_v2::RawCoprocessorRequest,
521+
_: grpcio::UnarySink<tikv_client_proto::coprocessor_v2::RawCoprocessorResponse>,
522+
) {
523+
todo!()
524+
}
516525
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
syntax = "proto3";
2+
package coprocessor_v2;
3+
4+
import "errorpb.proto";
5+
import "kvrpcpb.proto";
6+
import "gogoproto/gogo.proto";
7+
import "rustproto.proto";
8+
9+
option (gogoproto.marshaler_all) = true;
10+
option (gogoproto.sizer_all) = true;
11+
option (gogoproto.unmarshaler_all) = true;
12+
option (rustproto.lite_runtime_all) = true;
13+
14+
option java_package = "org.tikv.kvproto";
15+
16+
message RawCoprocessorRequest {
17+
kvrpcpb.Context context = 1;
18+
19+
string copr_name = 2;
20+
string copr_version_constraint = 3;
21+
22+
bytes data = 4;
23+
}
24+
25+
message RawCoprocessorResponse {
26+
bytes data = 1;
27+
28+
errorpb.Error region_error = 2;
29+
30+
// Error message for cases like if no coprocessor with a matching name is found
31+
// or on a version mismatch between plugin_api and the coprocessor.
32+
string other_error = 4;
33+
}

tikv-client-proto/proto/tikvpb.proto

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ syntax = "proto3";
22
package tikvpb;
33

44
import "coprocessor.proto";
5+
import "coprocessor_v2.proto";
56
import "kvrpcpb.proto";
67
import "mpp.proto";
78
import "raft_serverpb.proto";
@@ -69,6 +70,9 @@ service Tikv {
6970
rpc CoprocessorStream(coprocessor.Request) returns (stream coprocessor.Response) {}
7071
rpc BatchCoprocessor(coprocessor.BatchRequest) returns (stream coprocessor.BatchResponse) {}
7172

73+
// Command for executing custom user requests in TiKV coprocessor_v2.
74+
rpc CoprocessorV2(coprocessor_v2.RawCoprocessorRequest) returns (coprocessor_v2.RawCoprocessorResponse) {}
75+
7276
// Raft commands (sent between TiKV nodes).
7377
rpc Raft(stream raft_serverpb.RaftMessage) returns (raft_serverpb.Done) {}
7478
rpc BatchRaft(stream BatchRaftMessage) returns (raft_serverpb.Done) {}
@@ -92,7 +96,7 @@ service Tikv {
9296
rpc EstablishMPPConnection(mpp.EstablishMPPConnectionRequest) returns (stream mpp.MPPDataPacket) {}
9397

9498
/// CheckLeader sends all information (includes region term and epoch) to other stores.
95-
/// Once a store receives a request, it checks term and epoch for each region, and sends the regions whose
99+
/// Once a store receives a request, it checks term and epoch for each region, and sends the regions whose
96100
/// term and epoch match with local information in the store.
97101
/// After the client collected all responses from all stores, it checks if got a quorum of responses from
98102
/// other stores for every region, and decides to advance resolved ts from these regions.
@@ -144,6 +148,8 @@ message BatchCommandsRequest {
144148

145149
kvrpcpb.CheckSecondaryLocksRequest CheckSecondaryLocks = 33;
146150

151+
coprocessor_v2.RawCoprocessorRequest CoprocessorV2 = 34;
152+
147153
// For some test cases.
148154
BatchCommandsEmptyRequest Empty = 255;
149155
}
@@ -197,6 +203,8 @@ message BatchCommandsResponse {
197203

198204
kvrpcpb.CheckSecondaryLocksResponse CheckSecondaryLocks = 33;
199205

206+
coprocessor_v2.RawCoprocessorResponse CoprocessorV2 = 34;
207+
200208
// For some test cases.
201209
BatchCommandsEmptyResponse Empty = 255;
202210
}

tikv-client-proto/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
22

33
use protos::*;
4-
pub use protos::{coprocessor, errorpb, kvrpcpb, metapb, mpp, pdpb, raft_serverpb, tikvpb};
4+
pub use protos::{
5+
coprocessor, coprocessor_v2, errorpb, kvrpcpb, metapb, mpp, pdpb, raft_serverpb, tikvpb,
6+
};
57

68
#[allow(dead_code)]
79
#[allow(clippy::all)]

0 commit comments

Comments
 (0)