query_coord.proto 15.0 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 "msg.proto";
12
import "data_coord.proto";
13

14
service QueryCoord {
15
  rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.ComponentStates) {}
G
godchen 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28
  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 已提交
29
  rpc LoadBalance(LoadBalanceRequest) returns (common.Status) {}
30

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

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

  rpc CheckHealth(milvus.CheckHealthRequest) returns (milvus.CheckHealthResponse) {}
W
wei liu 已提交
40 41 42 43 44 45 46

  rpc CreateResourceGroup(milvus.CreateResourceGroupRequest) returns (common.Status) {}
  rpc DropResourceGroup(milvus.DropResourceGroupRequest) returns (common.Status) {}
  rpc TransferNode(milvus.TransferNodeRequest) returns (common.Status) {}
  rpc TransferReplica(TransferReplicaRequest) returns (common.Status) {}
  rpc ListResourceGroups(milvus.ListResourceGroupsRequest) returns (milvus.ListResourceGroupsResponse) {}
  rpc DescribeResourceGroup(DescribeResourceGroupRequest) returns (DescribeResourceGroupResponse) {}
G
godchen 已提交
47 48 49
}

service QueryNode {
50
  rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.ComponentStates) {}
G
godchen 已提交
51 52 53 54
  rpc GetTimeTickChannel(internal.GetTimeTickChannelRequest) returns(milvus.StringResponse) {}
  rpc GetStatisticsChannel(internal.GetStatisticsChannelRequest) returns(milvus.StringResponse){}

  rpc WatchDmChannels(WatchDmChannelsRequest) returns (common.Status) {}
B
Bingyi Sun 已提交
55
  rpc UnsubDmChannel(UnsubDmChannelRequest) returns (common.Status) {}
G
godchen 已提交
56 57 58 59 60
  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) {}
61
  rpc SyncReplicaSegments(SyncReplicaSegmentsRequest) returns (common.Status) {}
62

63
  rpc GetStatistics(GetStatisticsRequest) returns (internal.GetStatisticsResponse) {}
64 65
  rpc Search(SearchRequest) returns (internal.SearchResults) {}
  rpc Query(QueryRequest) returns (internal.RetrieveResults) {}
66

67
  rpc ShowConfigurations(internal.ShowConfigurationsRequest) returns (internal.ShowConfigurationsResponse){}
68 69
  // https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
  rpc GetMetrics(milvus.GetMetricsRequest) returns (milvus.GetMetricsResponse) {}
B
Bingyi Sun 已提交
70 71 72

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

X
xige-16 已提交
75
//--------------------QueryCoord grpc request and response proto------------------
G
godchen 已提交
76
message ShowCollectionsRequest {
77
  common.MsgBase base = 1;
78
  // Not useful for now
X
xige-16 已提交
79
  int64 dbID = 2;
80
  repeated int64 collectionIDs = 3;
81 82
}

G
godchen 已提交
83
message ShowCollectionsResponse {
X
xige-16 已提交
84 85
  common.Status status = 1;
  repeated int64 collectionIDs = 2;
86
  repeated int64 inMemory_percentages = 3;
87
  repeated bool query_service_available = 4;
88 89
}

90 91 92 93
message ShowPartitionsRequest {
  common.MsgBase base = 1;
  int64 dbID = 2;
  int64 collectionID = 3;
94
  repeated int64 partitionIDs = 4;
95 96 97 98 99
}

message ShowPartitionsResponse {
  common.Status status = 1;
  repeated int64 partitionIDs = 2;
100
  repeated int64 inMemory_percentages = 3;
101 102
}

103
message LoadCollectionRequest {
104
  common.MsgBase base = 1;
X
xige-16 已提交
105
  int64 dbID = 2;
106
  int64 collectionID = 3;
107
  schema.CollectionSchema schema = 4;
108
  int32 replica_number = 5;
C
cai.zhang 已提交
109 110
  // fieldID -> indexID
  map<int64, int64> field_indexID = 6;
111
  bool refresh = 7;
W
wei liu 已提交
112 113
  // resource group names
  repeated string resource_groups = 8;
114 115 116
}

message ReleaseCollectionRequest {
117
  common.MsgBase base = 1;
X
xige-16 已提交
118
  int64 dbID = 2;
119
  int64 collectionID = 3;
120
  int64 nodeID = 4;
121 122
}

123 124 125 126 127 128 129 130
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
}

131
message LoadPartitionsRequest {
132
  common.MsgBase base = 1;
X
xige-16 已提交
133 134
  int64 dbID = 2;
  int64 collectionID = 3;
135 136
  repeated int64 partitionIDs = 4;
  schema.CollectionSchema schema = 5;
137
  int32 replica_number = 6;
C
cai.zhang 已提交
138 139
  // fieldID -> indexID
  map<int64, int64> field_indexID = 7;
140
  bool refresh = 8;
W
wei liu 已提交
141 142
  // resource group names
  repeated string resource_groups = 9;
143 144
}

145 146 147 148 149
message ReleasePartitionsRequest {
  common.MsgBase base = 1;
  int64 dbID = 2;
  int64 collectionID = 3;
  repeated int64 partitionIDs = 4;
150
  int64 nodeID = 5;
151 152 153 154 155 156 157
}

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

G
godchen 已提交
160
message GetPartitionStatesResponse {
X
xige-16 已提交
161 162
  common.Status status = 1;
  repeated PartitionStates partition_descriptions = 2;
163 164
}

165
message GetSegmentInfoRequest {
166
  common.MsgBase base = 1;
167 168
  repeated int64 segmentIDs = 2; // deprecated
  int64 collectionID = 3;
169 170
}

171
message GetSegmentInfoResponse {
X
xige-16 已提交
172
  common.Status status = 1;
173
  repeated SegmentInfo infos = 2;
174 175
}

176 177 178 179 180 181
message GetShardLeadersRequest {
  common.MsgBase base = 1;
  int64 collectionID = 2;
}

message GetShardLeadersResponse {
182 183
  common.Status status = 1;
  repeated ShardLeadersList shards = 2;
184 185
}

186
message ShardLeadersList {  // All leaders of all replicas of one shard
187
  string channel_name = 1;
188 189
  repeated int64 node_ids = 2;
  repeated string node_addrs = 3;
190 191
}

X
xige-16 已提交
192
//-----------------query node grpc request and response proto----------------
193 194 195
message LoadMetaInfo {
  LoadType load_type = 1;
  int64 collectionID = 2;
196
  repeated int64 partitionIDs = 3;
197 198
}

G
godchen 已提交
199
message WatchDmChannelsRequest {
200
  common.MsgBase base = 1;
201 202
  int64 nodeID = 2;
  int64 collectionID = 3;
203
  repeated int64 partitionIDs = 4;
204
  repeated data.VchannelInfo infos = 5;
205
  schema.CollectionSchema schema = 6;
206
  repeated data.SegmentInfo exclude_infos = 7;
207
  LoadMetaInfo load_meta = 8;
208
  int64 replicaID = 9;
209
  map<int64, data.SegmentInfo> segment_infos = 10;
210
  // Deprecated
211 212
  // for node down load balance, need to remove offline node in time after every watchDmChannel finish.
  int64 offlineNodeID = 11;
213
  int64 version = 12;
214 215
}

B
Bingyi Sun 已提交
216 217 218 219 220 221 222
message UnsubDmChannelRequest {
    common.MsgBase base = 1;
    int64 nodeID = 2;
    int64 collectionID = 3;
    string channel_name = 4;
}

223 224 225 226 227 228
message SegmentLoadInfo {
  int64 segmentID = 1;
  int64 partitionID = 2;
  int64 collectionID = 3;
  int64 dbID = 4;
  int64 flush_time = 5;
229
  repeated data.FieldBinlog binlog_paths = 6;
230
  int64 num_of_rows = 7;
231
  repeated data.FieldBinlog statslogs = 8;
232
  repeated data.FieldBinlog deltalogs = 9;
233
  repeated int64 compactionFrom = 10; // segmentIDs compacted from
234
  repeated FieldIndexInfo index_infos = 11;
235
  int64 segment_size = 12;
236
  string insert_channel = 13;
237
  msg.MsgPosition start_position = 14;
238 239
}

240
message FieldIndexInfo {
241
  int64 fieldID =1;
242
  // deprecated
243 244 245 246 247 248 249
  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;
250
  int64 index_version = 9;
251
  int64 num_rows = 10;
252 253
}

G
godchen 已提交
254
message LoadSegmentsRequest {
255
  common.MsgBase base = 1;
256
  int64 dst_nodeID = 2;
257 258
  repeated SegmentLoadInfo infos = 3;
  schema.CollectionSchema schema = 4;
X
xige-16 已提交
259 260
  int64 source_nodeID = 5;
  int64 collectionID = 6;
261
  LoadMetaInfo load_meta = 7;
262
  int64 replicaID = 8;
263
  repeated msg.MsgPosition delta_positions = 9;
B
Bingyi Sun 已提交
264 265
  int64 version = 10;
  bool need_transfer = 11;
266 267
}

G
godchen 已提交
268
message ReleaseSegmentsRequest {
269
  common.MsgBase base = 1;
270
  int64 nodeID = 2;
271
  // Not useful for now
272 273 274 275
  int64 dbID = 3;
  int64 collectionID = 4;
  repeated int64 partitionIDs = 5;
  repeated int64 segmentIDs = 6;
276
  DataScope scope = 7; // All, Streaming, Historical
B
Bingyi Sun 已提交
277 278
  string shard = 8;
  bool need_transfer = 11;
279 280
}

281
message SearchRequest {
282
  internal.SearchRequest req = 1;
283
  repeated string dml_channels = 2;
284
  repeated int64 segmentIDs = 3;
285 286
  bool from_shard_leader = 4;
  DataScope scope = 5; // All, Streaming, Historical
287 288 289
}

message QueryRequest {
290
  internal.RetrieveRequest req = 1;
291
  repeated string dml_channels = 2;
292
  repeated int64 segmentIDs = 3;
293 294
  bool from_shard_leader = 4;
  DataScope scope = 5; // All, Streaming, Historical
295 296
}

297 298 299 300 301 302 303 304 305 306
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;
307
  repeated int64 versions = 4;
308 309
}

X
xige-16 已提交
310 311 312 313
//----------------request auto triggered by QueryCoord-----------------
message HandoffSegmentsRequest {
  common.MsgBase base = 1;
  repeated SegmentInfo segmentInfos = 2;
Y
yah01 已提交
314
  repeated int64 released_segments = 3;
X
xige-16 已提交
315 316 317 318 319 320 321 322
}

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;
323
  int64 collectionID = 6;
X
xige-16 已提交
324 325 326
}

//-------------------- internal meta proto------------------
327 328 329 330 331 332 333 334

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

X
xige-16 已提交
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
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;
351 352
}

353
enum LoadType {
354
  UnKnownType = 0;
X
xige-16 已提交
355
  LoadPartition = 1;
356
  LoadCollection = 2;
357 358
}

X
xige-16 已提交
359 360
message DmChannelWatchInfo {
  int64 collectionID = 1;
361 362
  string dmChannel = 2;
  int64 nodeID_loaded = 3;
363
  int64 replicaID = 4;
364
  repeated int64 node_ids = 5;
365 366 367 368
}

message QueryChannelInfo {
  int64 collectionID = 1;
X
xige-16 已提交
369 370
  string query_channel = 2;
  string query_result_channel = 3;
371
  repeated SegmentInfo global_sealed_segments = 4;
372
  msg.MsgPosition seek_position = 5;
373 374
}

X
xige-16 已提交
375 376 377 378 379 380 381 382 383 384
message PartitionStates {
  int64 partitionID = 1;
  PartitionState state = 2;
  int64 inMemory_percentage = 3;
}

message SegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
385
  // deprecated, check node_ids(NodeIds) field
X
xige-16 已提交
386 387 388 389 390 391 392 393 394
  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;
395
  repeated FieldIndexInfo index_infos = 13;
396 397
  repeated int64 replica_ids = 14;
  repeated int64 node_ids = 15;
398
  bool enable_index = 16;
J
jaime 已提交
399
  bool is_fake = 17;
X
xige-16 已提交
400 401
}

402 403 404
message CollectionInfo {
  int64 collectionID = 1;
  repeated int64 partitionIDs = 2;
405
  repeated PartitionStates partition_states = 3;
406 407 408 409
  LoadType load_type = 4;
  schema.CollectionSchema schema = 5;
  repeated int64 released_partitionIDs = 6;
  int64 inMemory_percentage = 7;
410
  repeated int64 replica_ids = 8;
411 412 413
  int32 replica_number = 9;
}

414 415 416 417 418 419 420 421 422 423
message UnsubscribeChannels {
  int64 collectionID = 1;
  repeated string channels = 2;
}

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

X
xige-16 已提交
424
//---- synchronize messages proto between QueryCoord and QueryNode -----
425 426 427 428 429 430 431
message SegmentChangeInfo {
  int64 online_nodeID = 1;
  repeated SegmentInfo online_segments = 2;
  int64 offline_nodeID = 3;
  repeated SegmentInfo offline_segments = 4;
}

432 433
message SealedSegmentsChangeInfo {
  common.MsgBase base = 1;
434
  repeated SegmentChangeInfo infos = 2;
435
}
B
Bingyi Sun 已提交
436 437 438 439 440 441 442 443

message GetDataDistributionRequest {
  common.MsgBase base = 1;
}

message GetDataDistributionResponse {
  common.Status status = 1;
  int64 nodeID = 2;
444 445 446
  repeated SegmentVersionInfo segments = 3;
  repeated ChannelVersionInfo channels = 4;
  repeated LeaderView leader_views = 5;
B
Bingyi Sun 已提交
447 448 449 450 451
}

message LeaderView {
  int64 collection = 1;
  string channel = 2;
452
  map<int64, SegmentDist> segment_dist = 3;
453
  repeated int64 growing_segmentIDs = 4;
454
  map<int64, msg.MsgPosition> growing_segments = 5;
B
Bingyi Sun 已提交
455 456
}

457 458 459 460 461
message SegmentDist {
  int64 nodeID = 1;
  int64 version = 2;
}

B
Bingyi Sun 已提交
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487

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;
488
  map<int64, int64> field_indexID = 5;
B
Bingyi Sun 已提交
489 490 491 492 493 494 495
}

message PartitionLoadInfo {
  int64 collectionID = 1;
  int64 partitionID = 2;
  int32 replica_number = 3;
  LoadStatus status = 4;
496
  map<int64, int64> field_indexID = 5;
B
Bingyi Sun 已提交
497 498 499 500 501 502
}

message Replica {
  int64 ID = 1;
  int64 collectionID = 2;
  repeated int64 nodes = 3;
W
wei liu 已提交
503
  string resource_group = 4;
B
Bingyi Sun 已提交
504 505 506 507 508 509 510 511 512 513 514 515
}

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

message SyncAction {
  SyncType type = 1;
  int64 partitionID = 2;
  int64 segmentID = 3;
  int64 nodeID = 4;
516
  int64 version = 5;
B
Bingyi Sun 已提交
517 518 519 520 521 522 523 524 525
}

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

W
wei liu 已提交
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
message ResourceGroup {
  string name = 1;
  int32 capacity = 2;
  repeated int64 nodes = 3;
}

// transfer `replicaNum` replicas in `collectionID` from `source_resource_group` to `target_resource_groups`
message TransferReplicaRequest {
  common.MsgBase base = 1;
  string source_resource_group = 2;
  string target_resource_group = 3;
  int64  collectionID = 4;
  int64  num_replica = 5;
}

message DescribeResourceGroupRequest {
  common.MsgBase base = 1;
  string resource_group = 2;
}

message DescribeResourceGroupResponse {
  common.Status status = 1;
  ResourceGroupInfo resource_group = 2;
}

message ResourceGroupInfo {
  string name = 1;
  int32 capacity = 2;
  int32 num_available_node = 3;
  // collection id -> loaded replica num
  map<int64, int32> num_loaded_replica = 4;
  // collection id -> accessed other rg's node num 
  map<int64, int32> num_outgoing_node = 5;
   // collection id -> be accessed node num by other rg
  map<int64, int32> num_incoming_node = 6;
}