Skip to content

Commit

Permalink
Merge branch 'master' into rustin-patch-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 authored Apr 15, 2021
2 parents dfd2955 + 0ca4cae commit 4ca54e1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transaction/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,9 @@ impl<PdC: PdClient> Transaction<PdC> {
let status = self.status.read().await;
if !matches!(
*status,
TransactionStatus::StartedRollback | TransactionStatus::Active
TransactionStatus::StartedRollback
| TransactionStatus::Active
| TransactionStatus::StartedCommit
) {
return Err(Error::OperationAfterCommitError);
}
Expand Down
33 changes: 33 additions & 0 deletions tikv-client-proto/proto/coprocessor_v2.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";
package coprocessor_v2;

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

option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (rustproto.lite_runtime_all) = true;

option java_package = "org.tikv.kvproto";

message RawCoprocessorRequest {
kvrpcpb.Context context = 1;

string copr_name = 2;
string copr_version_constraint = 3;

bytes data = 4;
}

message RawCoprocessorResponse {
bytes data = 1;

errorpb.Error region_error = 2;

// Error message for cases like if no coprocessor with a matching name is found
// or on a version mismatch between plugin_api and the coprocessor.
string other_error = 4;
}
8 changes: 8 additions & 0 deletions tikv-client-proto/proto/tikvpb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package tikvpb;

import "coprocessor.proto";
import "coprocessor_v2.proto";
import "kvrpcpb.proto";
import "mpp.proto";
import "raft_serverpb.proto";
Expand Down Expand Up @@ -69,6 +70,9 @@ service Tikv {
rpc CoprocessorStream(coprocessor.Request) returns (stream coprocessor.Response) {}
rpc BatchCoprocessor(coprocessor.BatchRequest) returns (stream coprocessor.BatchResponse) {}

// Command for executing custom user requests in TiKV coprocessor_v2.
rpc CoprocessorV2(coprocessor_v2.RawCoprocessorRequest) returns (coprocessor_v2.RawCoprocessorResponse) {}

// Raft commands (sent between TiKV nodes).
rpc Raft(stream raft_serverpb.RaftMessage) returns (raft_serverpb.Done) {}
rpc BatchRaft(stream BatchRaftMessage) returns (raft_serverpb.Done) {}
Expand Down Expand Up @@ -144,6 +148,8 @@ message BatchCommandsRequest {

kvrpcpb.CheckSecondaryLocksRequest CheckSecondaryLocks = 33;

coprocessor_v2.RawCoprocessorRequest CoprocessorV2 = 34;

// For some test cases.
BatchCommandsEmptyRequest Empty = 255;
}
Expand Down Expand Up @@ -197,6 +203,8 @@ message BatchCommandsResponse {

kvrpcpb.CheckSecondaryLocksResponse CheckSecondaryLocks = 33;

coprocessor_v2.RawCoprocessorResponse CoprocessorV2 = 34;

// For some test cases.
BatchCommandsEmptyResponse Empty = 255;
}
Expand Down

0 comments on commit 4ca54e1

Please sign in to comment.