2015-06-10 19:22:08 +03:00
|
|
|
// Data definitions for service vtgateservice.
|
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package vtgate;
|
|
|
|
|
2015-06-10 19:26:39 +03:00
|
|
|
import "query.proto";
|
2015-06-19 18:20:58 +03:00
|
|
|
import "topodata.proto";
|
2015-06-10 19:22:08 +03:00
|
|
|
import "vtrpc.proto";
|
|
|
|
|
|
|
|
// Session objects are session cookies and are invalidated on
|
|
|
|
// use. Query results will contain updated session values.
|
|
|
|
// Their content should be opaque to the user.
|
|
|
|
message Session {
|
|
|
|
bool in_transaction = 1;
|
|
|
|
|
|
|
|
message ShardSession {
|
2015-06-10 19:26:39 +03:00
|
|
|
query.Target target = 1;
|
2015-06-10 19:22:08 +03:00
|
|
|
int64 transaction_id = 2;
|
|
|
|
}
|
|
|
|
repeated ShardSession shard_sessions = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteRequest is the payload to Execute
|
|
|
|
message ExecuteRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 3;
|
2015-06-19 18:20:58 +03:00
|
|
|
topodata.TabletType TabletType = 4;
|
2015-06-10 19:22:08 +03:00
|
|
|
bool not_in_transaction = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteResponse is the returned value from Execute
|
|
|
|
message ExecuteResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteShardsRequest is the payload to ExecuteShards
|
|
|
|
message ExecuteShardsRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
string keyspace = 4;
|
|
|
|
repeated string shards = 5;
|
2015-06-19 18:20:58 +03:00
|
|
|
topodata.TabletType TabletType = 6;
|
2015-06-10 19:22:08 +03:00
|
|
|
bool not_in_transaction = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteShardsResponse is the returned value from ExecuteShards
|
|
|
|
message ExecuteShardsResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteKeyspaceIdsRequest is the payload to ExecuteKeyspaceIds
|
|
|
|
message ExecuteKeyspaceIdsRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
string keyspace = 4;
|
|
|
|
repeated bytes keyspace_ids = 5;
|
2015-06-19 18:20:58 +03:00
|
|
|
topodata.TabletType TabletType = 6;
|
2015-06-10 19:22:08 +03:00
|
|
|
bool not_in_transaction = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteKeyspaceIdsResponse is the returned value from ExecuteKeyspaceIds
|
|
|
|
message ExecuteKeyspaceIdsResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteKeyRangesRequest is the payload to ExecuteKeyRanges
|
|
|
|
message ExecuteKeyRangesRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
string keyspace = 4;
|
2015-06-19 18:20:58 +03:00
|
|
|
repeated topodata.KeyRange key_ranges = 5;
|
|
|
|
topodata.TabletType TabletType = 6;
|
2015-06-10 19:22:08 +03:00
|
|
|
bool not_in_transaction = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteKeyRangesResponse is the returned value from ExecuteKeyRanges
|
|
|
|
message ExecuteKeyRangesResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteEntityIdsRequest is the payload to ExecuteEntityIds
|
|
|
|
message ExecuteEntityIdsRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
string keyspace = 4;
|
|
|
|
string entity_column_name = 5;
|
|
|
|
message EntityId {
|
|
|
|
enum Type {
|
|
|
|
TYPE_NULL = 0;
|
|
|
|
TYPE_BYTES = 1;
|
|
|
|
TYPE_INT = 2;
|
|
|
|
TYPE_UINT = 3;
|
|
|
|
TYPE_FLOAT = 4;
|
|
|
|
}
|
|
|
|
Type xid_type = 1;
|
|
|
|
bytes xid_bytes = 2;
|
|
|
|
int64 xid_int = 3;
|
|
|
|
uint64 xid_uint = 4;
|
|
|
|
double xid_float = 5;
|
|
|
|
bytes keyspace_id = 6;
|
|
|
|
}
|
|
|
|
repeated EntityId entity_keyspace_ids = 6;
|
2015-06-19 18:20:58 +03:00
|
|
|
topodata.TabletType TabletType = 7;
|
2015-06-10 19:22:08 +03:00
|
|
|
bool not_in_transaction = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteEntityIdsResponse is the returned value from ExecuteEntityIds
|
|
|
|
message ExecuteEntityIdsResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
2015-07-10 20:38:09 +03:00
|
|
|
// BoundShardQuery represents a single query request for the
|
|
|
|
// specified list of shards. This is used in a list for
|
|
|
|
// ExecuteBatchShardsRequest.
|
|
|
|
message BoundShardQuery {
|
|
|
|
query.BoundQuery query = 1;
|
|
|
|
string keyspace = 2;
|
|
|
|
repeated string shards = 3;
|
|
|
|
}
|
|
|
|
|
2015-06-10 19:22:08 +03:00
|
|
|
// ExecuteBatchShardsRequest is the payload to ExecuteBatchShards
|
|
|
|
message ExecuteBatchShardsRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
2015-07-10 20:38:09 +03:00
|
|
|
repeated BoundShardQuery queries = 3;
|
vtgate batch API: Add AsTransaction flag
Batch requests in vttablet currently allow "begin" and "commit"
statements. They were treated as special cases where vttablet would
start a transaction if such statements were seen.
Initially, this looked flexible, but I realize that this has drawbacks.
For example, someone could issue a begin without a commit, or one could
issue begin inside begin, or a begin-commit-begin, or a "bEgIn", etc.
Checking for all these corner cases complicates the logic, and does not
add much value to the app.
This change adds an AsTransaction flag to the VTGate Batch
requests. If it's true, then the entire batch is executed in a
transaction. Otherwise, the statements are executed loosely.
Consequently, I'll be outlawing begin and commit as valid statements
inside batch requests.
The next change will be for vttablet.
2015-07-14 20:07:58 +03:00
|
|
|
topodata.TabletType TabletType = 4;
|
|
|
|
bool as_transaction = 5
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteBatchShardsResponse is the returned value from ExecuteBatchShards
|
|
|
|
message ExecuteBatchShardsResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
repeated query.QueryResult results = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
2015-07-10 20:38:09 +03:00
|
|
|
// BoundKeyspaceIdQuery represents a single query request for the
|
|
|
|
// specified list of keyspace ids. This is used in a list for
|
|
|
|
// ExecuteBatchKeyspaceIdsRequest.
|
|
|
|
message BoundKeyspaceIdQuery {
|
|
|
|
query.BoundQuery query = 1;
|
|
|
|
string keyspace = 2;
|
|
|
|
repeated bytes keyspace_ids = 3;
|
|
|
|
}
|
|
|
|
|
2015-06-10 19:22:08 +03:00
|
|
|
// ExecuteBatchKeyspaceIdsRequest is the payload to ExecuteBatchKeyspaceId
|
|
|
|
message ExecuteBatchKeyspaceIdsRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
2015-07-10 20:38:09 +03:00
|
|
|
repeated BoundKeyspaceIdQuery queries = 3;
|
|
|
|
topodata.TabletType TabletType = 4;
|
vtgate batch API: Add AsTransaction flag
Batch requests in vttablet currently allow "begin" and "commit"
statements. They were treated as special cases where vttablet would
start a transaction if such statements were seen.
Initially, this looked flexible, but I realize that this has drawbacks.
For example, someone could issue a begin without a commit, or one could
issue begin inside begin, or a begin-commit-begin, or a "bEgIn", etc.
Checking for all these corner cases complicates the logic, and does not
add much value to the app.
This change adds an AsTransaction flag to the VTGate Batch
requests. If it's true, then the entire batch is executed in a
transaction. Otherwise, the statements are executed loosely.
Consequently, I'll be outlawing begin and commit as valid statements
inside batch requests.
The next change will be for vttablet.
2015-07-14 20:07:58 +03:00
|
|
|
bool as_transaction = 5
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteBatchKeyspaceIdsResponse is the returned value from ExecuteBatchKeyspaceId
|
|
|
|
message ExecuteBatchKeyspaceIdsResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
repeated query.QueryResult results = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteRequest is the payload to StreamExecute
|
|
|
|
message StreamExecuteRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 2;
|
2015-06-19 18:20:58 +03:00
|
|
|
topodata.TabletType TabletType = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteResponse is the returned value from StreamExecute
|
|
|
|
message StreamExecuteResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteShardsRequest is the payload to StreamExecuteShards
|
|
|
|
message StreamExecuteShardsRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
string keyspace = 3;
|
|
|
|
repeated string shards = 4;
|
2015-06-19 18:20:58 +03:00
|
|
|
topodata.TabletType TabletType = 5;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteShardsResponse is the returned value from StreamExecuteShards
|
|
|
|
message StreamExecuteShardsResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteKeyspaceIdsRequest is the payload to StreamExecuteKeyspaceIds
|
|
|
|
message StreamExecuteKeyspaceIdsRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
string keyspace = 3;
|
|
|
|
repeated bytes keyspace_ids = 4;
|
2015-06-19 18:20:58 +03:00
|
|
|
topodata.TabletType TabletType = 5;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteKeyspaceIdsResponse is the returned value from StreamExecuteKeyspaceIds
|
|
|
|
message StreamExecuteKeyspaceIdsResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteKeyRangesRequest is the payload to StreamExecuteKeyRanges
|
|
|
|
message StreamExecuteKeyRangesRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
string keyspace = 3;
|
2015-06-19 18:20:58 +03:00
|
|
|
repeated topodata.KeyRange key_ranges = 4;
|
|
|
|
topodata.TabletType TabletType = 5;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// StreamExecuteKeyRangesResponse is the returned value from StreamExecuteKeyRanges
|
|
|
|
message StreamExecuteKeyRangesResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.QueryResult result = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// BeginRequest is the payload to Begin
|
|
|
|
message BeginRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// BeginResponse is the returned value from Begin
|
|
|
|
message BeginResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
Session session = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CommitRequest is the payload to Commit
|
|
|
|
message CommitRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CommitResponse is the returned value from Commit
|
|
|
|
message CommitResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// RollbackRequest is the payload to Rollback
|
|
|
|
message RollbackRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
Session session = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// RollbackResponse is the returned value from Rollback
|
|
|
|
message RollbackResponse {
|
|
|
|
vtrpc.RPCError error = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// SplitQueryRequest is the payload to SplitQuery
|
|
|
|
message SplitQueryRequest {
|
|
|
|
vtrpc.CallerID caller_id = 1;
|
|
|
|
string keyspace = 2;
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 3;
|
2015-06-10 19:22:08 +03:00
|
|
|
int64 split_count = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// SplitQueryResponse is the returned value from SplitQuery
|
|
|
|
message SplitQueryResponse {
|
|
|
|
message KeyRangePart {
|
|
|
|
string keyspace = 1;
|
2015-06-19 18:20:58 +03:00
|
|
|
repeated topodata.KeyRange key_ranges = 2;
|
2015-06-10 19:22:08 +03:00
|
|
|
}
|
|
|
|
message ShardPart {
|
|
|
|
string keyspace = 1;
|
|
|
|
repeated string shards = 2;
|
|
|
|
}
|
|
|
|
message Part {
|
2015-06-10 19:26:39 +03:00
|
|
|
query.BoundQuery query = 1;
|
2015-06-10 19:22:08 +03:00
|
|
|
KeyRangePart key_range_part = 2;
|
|
|
|
ShardPart shard_part = 3;
|
|
|
|
int64 size = 4;
|
|
|
|
}
|
|
|
|
repeated Part splits = 1;
|
|
|
|
}
|