-
Notifications
You must be signed in to change notification settings - Fork 222
/
Copy pathmpp.proto
83 lines (70 loc) · 2.61 KB
/
mpp.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
syntax = "proto3";
package mpp;
import "gogoproto/gogo.proto";
import "coprocessor.proto";
import "metapb.proto";
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option java_package = "org.tikv.kvproto";
// TaskMeta contains meta of a mpp plan, including query's ts and task address.
message TaskMeta {
uint64 start_ts = 1; // start ts of a query
int64 task_id = 2; // if task id is -1 , it indicates a tidb task.
int64 partition_id = 3; // Only used for hash partition
string address = 4; // target address of this task.
uint64 gather_id = 5; // used to distinguish different gathers in the mpp query.
uint64 query_ts = 6; // timestamp when start to execute query, used for TiFlash miniTSO schedule.
uint64 local_query_id = 7; // unique local query_id if tidb don't restart. So we can use query_ts + local_query_id + server_id to represent a global unique query.
uint64 server_id = 8; // TiDB server id
int64 mpp_version = 9; // mpp version
}
message IsAliveRequest {
}
message IsAliveResponse {
bool available = 1;
int64 mpp_version = 2;
}
// Dipsatch the task request to different tiflash servers.
message DispatchTaskRequest {
TaskMeta meta = 1;
bytes encoded_plan = 2;
int64 timeout = 3;
repeated coprocessor.RegionInfo regions = 4;
// If this task contains table scan, we still need their region info.
int64 schema_ver = 5;
// Used for partition table scan
repeated coprocessor.TableRegions table_regions = 6;
}
// Get response of DispatchTaskRequest.
message DispatchTaskResponse {
Error error = 1;
repeated metapb.Region retry_regions = 2;
}
// CancelTaskRequest closes the execution of a task.
message CancelTaskRequest {
TaskMeta meta = 1;
Error error = 2;
}
message CancelTaskResponse {
Error error = 1;
}
// build connection between different tasks. Data is sent by the tasks that are closer to the data sources.
message EstablishMPPConnectionRequest {
TaskMeta sender_meta = 1; // node closer to the source
TaskMeta receiver_meta = 2; // node closer to the tidb mpp gather.
}
// when TiFlash sends data to TiDB, Data packets wrap tipb.SelectResponse, i.e., serialize tipb.SelectResponse into data;
// when TiFlash sends data to TiFlash, data blocks are serialized into chunks, and the execution_summaries in tipb.SelectResponse are serialized into data only for the last packet.
message MPPDataPacket {
bytes data = 1;
Error error = 2;
repeated bytes chunks = 3;
repeated uint64 stream_ids = 4;
int64 version = 5; // version of data packet format
}
message Error {
int32 code = 1;
string msg = 2;
int64 mpp_version = 3;
}