query_coord.proto 13.2 KB
Newer Older
1 2 3 4
syntax = "proto3";

package milvus.proto.query;

X
Xiangyu Wang 已提交
5
option go_package = "github.com/milvus-io/milvus/internal/proto/querypb";
6 7

import "common.proto";
X
xige-16 已提交
8
import "milvus.proto";
9
import "internal.proto";
10
import "schema.proto";
11
import "data_coord.proto";
12

13
service QueryCoord {
14
  rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.ComponentStates) {}
G
godchen 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27
  rpc GetTimeTickChannel(internal.GetTimeTickChannelRequest) returns(milvus.StringResponse) {}
  rpc GetStatisticsChannel(internal.GetStatisticsChannelRequest) returns(milvus.StringResponse){}

  rpc ShowCollections(ShowCollectionsRequest) returns (ShowCollectionsResponse) {}
  rpc ShowPartitions(ShowPartitionsRequest) returns (ShowPartitionsResponse) {}

  rpc LoadPartitions(LoadPartitionsRequest) returns (common.Status) {}
  rpc ReleasePartitions(ReleasePartitionsRequest) returns (common.Status) {}
  rpc LoadCollection(LoadCollectionRequest) returns (common.Status) {}
  rpc ReleaseCollection(ReleaseCollectionRequest) returns (common.Status) {}

  rpc GetPartitionStates(GetPartitionStatesRequest) returns (GetPartitionStatesResponse) {}
  rpc GetSegmentInfo(GetSegmentInfoRequest) returns (GetSegmentInfoResponse) {}
B
bigsheeper 已提交
28
  rpc LoadBalance(LoadBalanceRequest) returns (common.Status) {}
29

30
  rpc ShowConfigurations(internal.ShowConfigurationsRequest) returns (internal.ShowConfigurationsResponse){}
31 32
  // https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
  rpc GetMetrics(milvus.GetMetricsRequest) returns (milvus.GetMetricsResponse) {}
33 34

  // https://wiki.lfaidata.foundation/display/MIL/MEP+23+--+Multiple+memory+replication+design
X
XuanYang-cn 已提交
35
  rpc GetReplicas(milvus.GetReplicasRequest) returns (milvus.GetReplicasResponse) {}
36
  rpc GetShardLeaders(GetShardLeadersRequest) returns (GetShardLeadersResponse) {}
37 38

  rpc CheckHealth(milvus.CheckHealthRequest) returns (milvus.CheckHealthResponse) {}
G
godchen 已提交
39 40 41
}

service QueryNode {
42
  rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.ComponentStates) {}
G
godchen 已提交
43 44 45 46
  rpc GetTimeTickChannel(internal.GetTimeTickChannelRequest) returns(milvus.StringResponse) {}
  rpc GetStatisticsChannel(internal.GetStatisticsChannelRequest) returns(milvus.StringResponse){}

  rpc WatchDmChannels(WatchDmChannelsRequest) returns (common.Status) {}
B
Bingyi Sun 已提交
47
  rpc UnsubDmChannel(UnsubDmChannelRequest) returns (common.Status) {}
G
godchen 已提交
48 49 50 51 52
  rpc LoadSegments(LoadSegmentsRequest) returns (common.Status) {}
  rpc ReleaseCollection(ReleaseCollectionRequest) returns (common.Status) {}
  rpc ReleasePartitions(ReleasePartitionsRequest) returns (common.Status) {}
  rpc ReleaseSegments(ReleaseSegmentsRequest) returns (common.Status) {}
  rpc GetSegmentInfo(GetSegmentInfoRequest) returns (GetSegmentInfoResponse) {}
53
  rpc SyncReplicaSegments(SyncReplicaSegmentsRequest) returns (common.Status) {}
54

55
  rpc GetStatistics(GetStatisticsRequest) returns (internal.GetStatisticsResponse) {}
56 57
  rpc Search(SearchRequest) returns (internal.SearchResults) {}
  rpc Query(QueryRequest) returns (internal.RetrieveResults) {}
58

59
  rpc ShowConfigurations(internal.ShowConfigurationsRequest) returns (internal.ShowConfigurationsResponse){}
60 61
  // https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
  rpc GetMetrics(milvus.GetMetricsRequest) returns (milvus.GetMetricsResponse) {}
B
Bingyi Sun 已提交
62 63 64

  rpc GetDataDistribution(GetDataDistributionRequest) returns (GetDataDistributionResponse) {}
  rpc SyncDistribution(SyncDistributionRequest) returns (common.Status) {}
G
godchen 已提交
65 66
}

X
xige-16 已提交
67
//--------------------QueryCoord grpc request and response proto------------------
G
godchen 已提交
68
message ShowCollectionsRequest {
69
  common.MsgBase base = 1;
70
  // Not useful for now
X
xige-16 已提交
71
  int64 dbID = 2;
72
  repeated int64 collectionIDs = 3;
73 74
}

G
godchen 已提交
75
message ShowCollectionsResponse {
X
xige-16 已提交
76 77
  common.Status status = 1;
  repeated int64 collectionIDs = 2;
78
  repeated int64 inMemory_percentages = 3;
79
  repeated bool query_service_available = 4;
80 81
}

82 83 84 85
message ShowPartitionsRequest {
  common.MsgBase base = 1;
  int64 dbID = 2;
  int64 collectionID = 3;
86
  repeated int64 partitionIDs = 4;
87 88 89 90 91
}

message ShowPartitionsResponse {
  common.Status status = 1;
  repeated int64 partitionIDs = 2;
92
  repeated int64 inMemory_percentages = 3;
93 94
}

95
message LoadCollectionRequest {
96
  common.MsgBase base = 1;
X
xige-16 已提交
97
  int64 dbID = 2;
98
  int64 collectionID = 3;
99
  schema.CollectionSchema schema = 4;
100
  int32 replica_number = 5;
C
cai.zhang 已提交
101 102
  // fieldID -> indexID
  map<int64, int64> field_indexID = 6;
103 104 105
}

message ReleaseCollectionRequest {
106
  common.MsgBase base = 1;
X
xige-16 已提交
107
  int64 dbID = 2;
108
  int64 collectionID = 3;
109
  int64 nodeID = 4;
110 111
}

112 113 114 115 116 117 118 119
message GetStatisticsRequest {
  internal.GetStatisticsRequest req = 1;
  repeated string dml_channels = 2;
  repeated int64 segmentIDs = 3;
  bool from_shard_leader = 4;
  DataScope scope = 5; // All, Streaming, Historical
}

120
message LoadPartitionsRequest {
121
  common.MsgBase base = 1;
X
xige-16 已提交
122 123
  int64 dbID = 2;
  int64 collectionID = 3;
124 125
  repeated int64 partitionIDs = 4;
  schema.CollectionSchema schema = 5;
126
  int32 replica_number = 6;
C
cai.zhang 已提交
127 128
  // fieldID -> indexID
  map<int64, int64> field_indexID = 7;
129 130
}

131 132 133 134 135
message ReleasePartitionsRequest {
  common.MsgBase base = 1;
  int64 dbID = 2;
  int64 collectionID = 3;
  repeated int64 partitionIDs = 4;
136
  int64 nodeID = 5;
137 138 139 140 141 142 143
}

message GetPartitionStatesRequest {
  common.MsgBase base = 1;
  int64 dbID = 2;
  int64 collectionID = 3;
  repeated int64 partitionIDs = 4;
144 145
}

G
godchen 已提交
146
message GetPartitionStatesResponse {
X
xige-16 已提交
147 148
  common.Status status = 1;
  repeated PartitionStates partition_descriptions = 2;
149 150
}

151
message GetSegmentInfoRequest {
152
  common.MsgBase base = 1;
153 154
  repeated int64 segmentIDs = 2; // deprecated
  int64 collectionID = 3;
155 156
}

157
message GetSegmentInfoResponse {
X
xige-16 已提交
158
  common.Status status = 1;
159
  repeated SegmentInfo infos = 2;
160 161
}

162 163 164 165 166 167
message GetShardLeadersRequest {
  common.MsgBase base = 1;
  int64 collectionID = 2;
}

message GetShardLeadersResponse {
168 169
  common.Status status = 1;
  repeated ShardLeadersList shards = 2;
170 171
}

172
message ShardLeadersList {  // All leaders of all replicas of one shard
173
  string channel_name = 1;
174 175
  repeated int64 node_ids = 2;
  repeated string node_addrs = 3;
176 177
}

X
xige-16 已提交
178
//-----------------query node grpc request and response proto----------------
179 180 181
message LoadMetaInfo {
  LoadType load_type = 1;
  int64 collectionID = 2;
182
  repeated int64 partitionIDs = 3;
183 184
}

G
godchen 已提交
185
message WatchDmChannelsRequest {
186
  common.MsgBase base = 1;
187 188
  int64 nodeID = 2;
  int64 collectionID = 3;
189
  repeated int64 partitionIDs = 4;
190
  repeated data.VchannelInfo infos = 5;
191
  schema.CollectionSchema schema = 6;
192
  repeated data.SegmentInfo exclude_infos = 7;
193
  LoadMetaInfo load_meta = 8;
194
  int64 replicaID = 9;
195
  map<int64, data.SegmentInfo> segment_infos = 10;
196 197
  // for node down load balance, need to remove offline node in time after every watchDmChannel finish.
  int64 offlineNodeID = 11;
198 199
}

B
Bingyi Sun 已提交
200 201 202 203 204 205 206
message UnsubDmChannelRequest {
    common.MsgBase base = 1;
    int64 nodeID = 2;
    int64 collectionID = 3;
    string channel_name = 4;
}

207 208 209 210 211 212
message SegmentLoadInfo {
  int64 segmentID = 1;
  int64 partitionID = 2;
  int64 collectionID = 3;
  int64 dbID = 4;
  int64 flush_time = 5;
213
  repeated data.FieldBinlog binlog_paths = 6;
214
  int64 num_of_rows = 7;
215
  repeated data.FieldBinlog statslogs = 8;
216
  repeated data.FieldBinlog deltalogs = 9;
217
  repeated int64 compactionFrom = 10; // segmentIDs compacted from
218
  repeated FieldIndexInfo index_infos = 11;
219
  int64 segment_size = 12;
220
  string insert_channel = 13;
221 222
}

223
message FieldIndexInfo {
224
  int64 fieldID =1;
225
  // deprecated
226 227 228 229 230 231 232
  bool enable_index = 2;
  string index_name = 3;
  int64 indexID = 4;
  int64 buildID = 5;
  repeated common.KeyValuePair index_params = 6;
  repeated string index_file_paths = 7;
  int64 index_size = 8;
233
  int64 index_version = 9;
234
  int64 num_rows = 10;
235 236
}

G
godchen 已提交
237
message LoadSegmentsRequest {
238
  common.MsgBase base = 1;
239
  int64 dst_nodeID = 2;
240 241
  repeated SegmentLoadInfo infos = 3;
  schema.CollectionSchema schema = 4;
X
xige-16 已提交
242 243
  int64 source_nodeID = 5;
  int64 collectionID = 6;
244
  LoadMetaInfo load_meta = 7;
245
  int64 replicaID = 8;
246
  repeated internal.MsgPosition delta_positions = 9;
B
Bingyi Sun 已提交
247 248
  int64 version = 10;
  bool need_transfer = 11;
249 250
}

G
godchen 已提交
251
message ReleaseSegmentsRequest {
252
  common.MsgBase base = 1;
253
  int64 nodeID = 2;
254
  // Not useful for now
255 256 257 258
  int64 dbID = 3;
  int64 collectionID = 4;
  repeated int64 partitionIDs = 5;
  repeated int64 segmentIDs = 6;
259
  DataScope scope = 7; // All, Streaming, Historical
B
Bingyi Sun 已提交
260 261
  string shard = 8;
  bool need_transfer = 11;
262 263
}

264
message SearchRequest {
265
  internal.SearchRequest req = 1;
266
  repeated string dml_channels = 2;
267
  repeated int64 segmentIDs = 3;
268 269
  bool from_shard_leader = 4;
  DataScope scope = 5; // All, Streaming, Historical
270 271 272
}

message QueryRequest {
273
  internal.RetrieveRequest req = 1;
274
  repeated string dml_channels = 2;
275
  repeated int64 segmentIDs = 3;
276 277
  bool from_shard_leader = 4;
  DataScope scope = 5; // All, Streaming, Historical
278 279
}

280 281 282 283 284 285 286 287 288 289
message SyncReplicaSegmentsRequest {
  common.MsgBase base = 1;
  string vchannel_name = 2;
  repeated ReplicaSegmentsInfo replica_segments = 3;
}

message ReplicaSegmentsInfo {
  int64 node_id = 1;
  int64 partition_id = 2;
  repeated int64 segment_ids = 3;
290
  repeated int64 versions = 4;
291 292
}

X
xige-16 已提交
293 294 295 296
//----------------request auto triggered by QueryCoord-----------------
message HandoffSegmentsRequest {
  common.MsgBase base = 1;
  repeated SegmentInfo segmentInfos = 2;
Y
yah01 已提交
297
  repeated int64 released_segments = 3;
X
xige-16 已提交
298 299 300 301 302 303 304 305
}

message LoadBalanceRequest {
  common.MsgBase base = 1;
  repeated int64 source_nodeIDs = 2;
  TriggerCondition balance_reason = 3;
  repeated int64 dst_nodeIDs = 4;
  repeated int64 sealed_segmentIDs = 5;
306
  int64 collectionID = 6;
X
xige-16 已提交
307 308 309
}

//-------------------- internal meta proto------------------
310 311 312 313 314 315 316 317

enum DataScope {
  UnKnown = 0;
  All = 1;
  Streaming = 2;
  Historical = 3;
}

X
xige-16 已提交
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
enum PartitionState {
  NotExist = 0;
  NotPresent = 1;
  OnDisk = 2;
  PartialInMemory = 3;
  InMemory = 4;
  PartialInGPU = 5;
  InGPU = 6;
}

enum TriggerCondition {
  UnKnowCondition = 0;
  Handoff = 1;
  LoadBalance = 2;
  GrpcRequest = 3;
  NodeDown = 4;
334 335
}

336
enum LoadType {
337
  UnKnownType = 0;
X
xige-16 已提交
338
  LoadPartition = 1;
339
  LoadCollection = 2;
340 341
}

X
xige-16 已提交
342 343
message DmChannelWatchInfo {
  int64 collectionID = 1;
344 345
  string dmChannel = 2;
  int64 nodeID_loaded = 3;
346
  int64 replicaID = 4;
347
  repeated int64 node_ids = 5;
348 349 350 351
}

message QueryChannelInfo {
  int64 collectionID = 1;
X
xige-16 已提交
352 353
  string query_channel = 2;
  string query_result_channel = 3;
354 355
  repeated SegmentInfo global_sealed_segments = 4;
  internal.MsgPosition seek_position = 5;
356 357
}

X
xige-16 已提交
358 359 360 361 362 363 364 365 366 367
message PartitionStates {
  int64 partitionID = 1;
  PartitionState state = 2;
  int64 inMemory_percentage = 3;
}

message SegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
368
  // deprecated, check node_ids(NodeIds) field
X
xige-16 已提交
369 370 371 372 373 374 375 376 377
  int64 nodeID = 4;
  int64 mem_size = 5;
  int64 num_rows = 6;
  string index_name = 7;
  int64 indexID = 8;
  string dmChannel = 9;
  repeated int64 compactionFrom = 10;
  bool createdByCompaction = 11;
  common.SegmentState segment_state = 12;
378
  repeated FieldIndexInfo index_infos = 13;
379 380
  repeated int64 replica_ids = 14;
  repeated int64 node_ids = 15;
381
  bool enable_index = 16;
X
xige-16 已提交
382 383
}

384 385 386
message CollectionInfo {
  int64 collectionID = 1;
  repeated int64 partitionIDs = 2;
387
  repeated PartitionStates partition_states = 3;
388 389 390 391
  LoadType load_type = 4;
  schema.CollectionSchema schema = 5;
  repeated int64 released_partitionIDs = 6;
  int64 inMemory_percentage = 7;
392
  repeated int64 replica_ids = 8;
393 394 395
  int32 replica_number = 9;
}

396 397 398 399 400 401 402 403 404 405
message UnsubscribeChannels {
  int64 collectionID = 1;
  repeated string channels = 2;
}

message UnsubscribeChannelInfo {
  int64 nodeID = 1;
  repeated UnsubscribeChannels collection_channels = 2;
}

X
xige-16 已提交
406
//---- synchronize messages proto between QueryCoord and QueryNode -----
407 408 409 410 411 412 413
message SegmentChangeInfo {
  int64 online_nodeID = 1;
  repeated SegmentInfo online_segments = 2;
  int64 offline_nodeID = 3;
  repeated SegmentInfo offline_segments = 4;
}

414 415
message SealedSegmentsChangeInfo {
  common.MsgBase base = 1;
416
  repeated SegmentChangeInfo infos = 2;
417
}
B
Bingyi Sun 已提交
418 419 420 421 422 423 424 425

message GetDataDistributionRequest {
  common.MsgBase base = 1;
}

message GetDataDistributionResponse {
  common.Status status = 1;
  int64 nodeID = 2;
426 427 428
  repeated SegmentVersionInfo segments = 3;
  repeated ChannelVersionInfo channels = 4;
  repeated LeaderView leader_views = 5;
B
Bingyi Sun 已提交
429 430 431 432 433
}

message LeaderView {
  int64 collection = 1;
  string channel = 2;
434
  map<int64, SegmentDist> segment_dist = 3;
435
  repeated int64 growing_segmentIDs = 4;
B
Bingyi Sun 已提交
436 437
}

438 439 440 441 442
message SegmentDist {
  int64 nodeID = 1;
  int64 version = 2;
}

B
Bingyi Sun 已提交
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468

message SegmentVersionInfo {
  int64 ID = 1;
  int64 collection = 2;
  int64 partition = 3;
  string channel = 4;
  int64 version = 5;
}

message ChannelVersionInfo {
  string channel = 1;
  int64 collection = 2;
  int64 version = 3;
}

enum LoadStatus {
  Invalid = 0;
  Loading = 1;
  Loaded = 2;
}

message CollectionLoadInfo {
  int64 collectionID = 1;
  repeated int64 released_partitions = 2;
  int32 replica_number = 3;
  LoadStatus status = 4;
469
  map<int64, int64> field_indexID = 5;
B
Bingyi Sun 已提交
470 471 472 473 474 475 476
}

message PartitionLoadInfo {
  int64 collectionID = 1;
  int64 partitionID = 2;
  int32 replica_number = 3;
  LoadStatus status = 4;
477
  map<int64, int64> field_indexID = 5;
B
Bingyi Sun 已提交
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
}

message Replica {
  int64 ID = 1;
  int64 collectionID = 2;
  repeated int64 nodes = 3;
}

enum SyncType {
  Remove = 0;
  Set = 1;
}

message SyncAction {
  SyncType type = 1;
  int64 partitionID = 2;
  int64 segmentID = 3;
  int64 nodeID = 4;
496
  int64 version = 5;
B
Bingyi Sun 已提交
497 498 499 500 501 502 503 504 505
}

message SyncDistributionRequest {
  common.MsgBase base = 1;
  int64 collectionID = 2;
  string channel = 3;
  repeated SyncAction actions = 4;
}