Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push down precondition to TiKV #343

Merged
merged 8 commits into from
Jan 21, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just NotEqual or NotMatch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer NotEqualTo, it's more clear.

bytes key = 1;
bytes value = 2;
bytes should_equal_to = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something like expected_value?

}

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No error code for the case that equal_to not satisfied?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we only use should_not_exist.

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