Merge branch 'master' into rustin-patch-fix

This commit is contained in:
二手掉包工程师 2021-04-15 09:11:08 +08:00 committed by GitHub
commit 4ca54e1db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 1 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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";
@ -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) {}
@ -144,6 +148,8 @@ message BatchCommandsRequest {
kvrpcpb.CheckSecondaryLocksRequest CheckSecondaryLocks = 33;
coprocessor_v2.RawCoprocessorRequest CoprocessorV2 = 34;
// For some test cases.
BatchCommandsEmptyRequest Empty = 255;
}
@ -197,6 +203,8 @@ message BatchCommandsResponse {
kvrpcpb.CheckSecondaryLocksResponse CheckSecondaryLocks = 33;
coprocessor_v2.RawCoprocessorResponse CoprocessorV2 = 34;
// For some test cases.
BatchCommandsEmptyResponse Empty = 255;
}