Skip to content

Commit

Permalink
Push down precondition to TiKV (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangjinpeng87 authored Jan 21, 2019
1 parent d4fe6b3 commit be0b43e
Show file tree
Hide file tree
Showing 10 changed files with 3,116 additions and 1,440 deletions.
1,569 changes: 1,198 additions & 371 deletions pkg/kvrpcpb/kvrpcpb.pb.go

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions proto/kvrpcpb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,23 @@ message LockInfo {
uint64 lock_ttl = 4;
}

message AlreadyExist {
bytes key = 1;
}

message NotEqualTo {
bytes key = 1;
bytes value = 2;
bytes expected_value = 3;
}

message KeyError {
LockInfo locked = 1; // Client should backoff or cleanup the lock then retry.
string retryable = 2; // Client may restart the txn. e.g write conflict.
string abort = 3; // Client should abort the txn.
WriteConflict conflict = 4; // Write conflict is moved from retryable to here.
AlreadyExist already_exist = 5; // Key already exists
NotEqualTo not_equal_to = 6; // Value not equal to specified value
}

message WriteConflict {
Expand Down Expand Up @@ -121,10 +133,19 @@ enum Op {
Rollback = 3;
}

message Precondition {
// Should not exist
bool should_not_exist = 1;
// Value must equal to
bytes equal_to = 2;
}

message Mutation {
Op op = 1;
bytes key = 2;
bytes value = 3;
// Write only when the precondition satisfied
Precondition precondition = 4;
}

message PrewriteRequest {
Expand Down
2 changes: 1 addition & 1 deletion src/coprocessor.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/debugpb.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/errorpb.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/import_kvpb.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/import_sstpb.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit be0b43e

Please sign in to comment.