Skip to content

Commit ead03dd

Browse files
authored
Merge branch 'master' into rustin-patch-fix
2 parents 6be0598 + 0ca4cae commit ead03dd

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

src/transaction/transaction.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ impl<PdC: PdClient> Transaction<PdC> {
541541
let status = self.status.read().await;
542542
if !matches!(
543543
*status,
544-
TransactionStatus::StartedRollback | TransactionStatus::Active
544+
TransactionStatus::StartedRollback
545+
| TransactionStatus::Active
546+
| TransactionStatus::StartedCommit
545547
) {
546548
return Err(Error::OperationAfterCommitError);
547549
}
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: 8 additions & 0 deletions
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) {}
@@ -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
}

0 commit comments

Comments
 (0)