query_coord.proto 12.8 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 {
G
godchen 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27
  rpc GetComponentStates(internal.GetComponentStatesRequest) returns (internal.ComponentStates) {}
  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) {}
G
godchen 已提交
37 38 39 40 41 42 43 44
}

service QueryNode {
  rpc GetComponentStates(internal.GetComponentStatesRequest) returns (internal.ComponentStates) {}
  rpc GetTimeTickChannel(internal.GetTimeTickChannelRequest) returns(milvus.StringResponse) {}
  rpc GetStatisticsChannel(internal.GetStatisticsChannelRequest) returns(milvus.StringResponse){}

  rpc WatchDmChannels(WatchDmChannelsRequest) returns (common.Status) {}
B
Bingyi Sun 已提交
45
  rpc UnsubDmChannel(UnsubDmChannelRequest) returns (common.Status) {}
G
godchen 已提交
46 47 48 49 50
  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) {}
51
  rpc SyncReplicaSegments(SyncReplicaSegmentsRequest) returns (common.Status) {}
52

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

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

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

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

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

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

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

93
message LoadCollectionRequest {
94
  common.MsgBase base = 1;
X
xige-16 已提交
95
  int64 dbID = 2;
96
  int64 collectionID = 3;
97
  schema.CollectionSchema schema = 4;
98
  int32 replica_number = 5;
99 100 101
}

message ReleaseCollectionRequest {
102
  common.MsgBase base = 1;
X
xige-16 已提交
103
  int64 dbID = 2;
104
  int64 collectionID = 3;
105
  int64 nodeID = 4;
106 107
}

108 109 110 111 112 113 114 115
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
}

116
message LoadPartitionsRequest {
117
  common.MsgBase base = 1;
X
xige-16 已提交
118 119
  int64 dbID = 2;
  int64 collectionID = 3;
120 121
  repeated int64 partitionIDs = 4;
  schema.CollectionSchema schema = 5;
122
  int32 replica_number = 6;
123 124
}

125 126 127 128 129
message ReleasePartitionsRequest {
  common.MsgBase base = 1;
  int64 dbID = 2;
  int64 collectionID = 3;
  repeated int64 partitionIDs = 4;
130
  int64 nodeID = 5;
131 132 133 134 135 136 137
}

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

G
godchen 已提交
140
message GetPartitionStatesResponse {
X
xige-16 已提交
141 142
  common.Status status = 1;
  repeated PartitionStates partition_descriptions = 2;
143 144
}

145
message GetSegmentInfoRequest {
146
  common.MsgBase base = 1;
147 148
  repeated int64 segmentIDs = 2; // deprecated
  int64 collectionID = 3;
149 150
}

151
message GetSegmentInfoResponse {
X
xige-16 已提交
152
  common.Status status = 1;
153
  repeated SegmentInfo infos = 2;
154 155
}

156 157 158 159 160 161
message GetShardLeadersRequest {
  common.MsgBase base = 1;
  int64 collectionID = 2;
}

message GetShardLeadersResponse {
162 163
  common.Status status = 1;
  repeated ShardLeadersList shards = 2;
164 165
}

166
message ShardLeadersList {  // All leaders of all replicas of one shard
167
  string channel_name = 1;
168 169
  repeated int64 node_ids = 2;
  repeated string node_addrs = 3;
170 171
}

X
xige-16 已提交
172
//-----------------query node grpc request and response proto----------------
173 174 175
message LoadMetaInfo {
  LoadType load_type = 1;
  int64 collectionID = 2;
176
  repeated int64 partitionIDs = 3;
177 178
}

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

B
Bingyi Sun 已提交
194 195 196 197 198 199 200
message UnsubDmChannelRequest {
    common.MsgBase base = 1;
    int64 nodeID = 2;
    int64 collectionID = 3;
    string channel_name = 4;
}

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

217
message FieldIndexInfo {
218
  int64 fieldID =1;
219
  // deprecated
220 221 222 223 224 225 226
  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;
227 228
}

G
godchen 已提交
229
message LoadSegmentsRequest {
230
  common.MsgBase base = 1;
231
  int64 dst_nodeID = 2;
232 233
  repeated SegmentLoadInfo infos = 3;
  schema.CollectionSchema schema = 4;
X
xige-16 已提交
234 235
  int64 source_nodeID = 5;
  int64 collectionID = 6;
236
  LoadMetaInfo load_meta = 7;
237
  int64 replicaID = 8;
238
  repeated internal.MsgPosition delta_positions = 9;
B
Bingyi Sun 已提交
239 240
  int64 version = 10;
  bool need_transfer = 11;
241 242
}

G
godchen 已提交
243
message ReleaseSegmentsRequest {
244
  common.MsgBase base = 1;
245
  int64 nodeID = 2;
246
  // Not useful for now
247 248 249 250
  int64 dbID = 3;
  int64 collectionID = 4;
  repeated int64 partitionIDs = 5;
  repeated int64 segmentIDs = 6;
251
  DataScope scope = 7; // All, Streaming, Historical
B
Bingyi Sun 已提交
252 253
  string shard = 8;
  bool need_transfer = 11;
254 255
}

256
message SearchRequest {
257
  internal.SearchRequest req = 1;
258
  repeated string dml_channels = 2;
259
  repeated int64 segmentIDs = 3;
260 261
  bool from_shard_leader = 4;
  DataScope scope = 5; // All, Streaming, Historical
262 263 264
}

message QueryRequest {
265
  internal.RetrieveRequest 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 273 274 275 276 277 278 279 280 281 282 283
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;
}

X
xige-16 已提交
284 285 286 287
//----------------request auto triggered by QueryCoord-----------------
message HandoffSegmentsRequest {
  common.MsgBase base = 1;
  repeated SegmentInfo segmentInfos = 2;
Y
yah01 已提交
288
  repeated int64 released_segments = 3;
X
xige-16 已提交
289 290 291 292 293 294 295 296
}

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;
297
  int64 collectionID = 6;
X
xige-16 已提交
298 299 300
}

//-------------------- internal meta proto------------------
301 302 303 304 305 306 307 308

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

X
xige-16 已提交
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
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;
325 326
}

327
enum LoadType {
328
  UnKnownType = 0;
X
xige-16 已提交
329
  LoadPartition = 1;
330
  LoadCollection = 2;
331 332
}

X
xige-16 已提交
333 334
message DmChannelWatchInfo {
  int64 collectionID = 1;
335 336
  string dmChannel = 2;
  int64 nodeID_loaded = 3;
337
  int64 replicaID = 4;
338
  repeated int64 node_ids = 5;
339 340 341 342
}

message QueryChannelInfo {
  int64 collectionID = 1;
X
xige-16 已提交
343 344
  string query_channel = 2;
  string query_result_channel = 3;
345 346
  repeated SegmentInfo global_sealed_segments = 4;
  internal.MsgPosition seek_position = 5;
347 348
}

X
xige-16 已提交
349 350 351 352 353 354 355 356 357 358
message PartitionStates {
  int64 partitionID = 1;
  PartitionState state = 2;
  int64 inMemory_percentage = 3;
}

message SegmentInfo {
  int64 segmentID = 1;
  int64 collectionID = 2;
  int64 partitionID = 3;
359
  // deprecated, check node_ids(NodeIds) field
X
xige-16 已提交
360 361 362 363 364 365 366 367 368
  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;
369
  repeated FieldIndexInfo index_infos = 13;
370 371
  repeated int64 replica_ids = 14;
  repeated int64 node_ids = 15;
372
  bool enable_index = 16;
X
xige-16 已提交
373 374
}

375 376 377
message CollectionInfo {
  int64 collectionID = 1;
  repeated int64 partitionIDs = 2;
378
  repeated PartitionStates partition_states = 3;
379 380 381 382
  LoadType load_type = 4;
  schema.CollectionSchema schema = 5;
  repeated int64 released_partitionIDs = 6;
  int64 inMemory_percentage = 7;
383
  repeated int64 replica_ids = 8;
384 385 386
  int32 replica_number = 9;
}

387 388 389 390 391 392 393 394 395 396
message UnsubscribeChannels {
  int64 collectionID = 1;
  repeated string channels = 2;
}

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

X
xige-16 已提交
397
//---- synchronize messages proto between QueryCoord and QueryNode -----
398 399 400 401 402 403 404
message SegmentChangeInfo {
  int64 online_nodeID = 1;
  repeated SegmentInfo online_segments = 2;
  int64 offline_nodeID = 3;
  repeated SegmentInfo offline_segments = 4;
}

405 406
message SealedSegmentsChangeInfo {
  common.MsgBase base = 1;
407
  repeated SegmentChangeInfo infos = 2;
408
}
B
Bingyi Sun 已提交
409 410 411 412 413 414 415 416

message GetDataDistributionRequest {
  common.MsgBase base = 1;
}

message GetDataDistributionResponse {
  common.Status status = 1;
  int64 nodeID = 2;
417 418 419
  repeated SegmentVersionInfo segments = 3;
  repeated ChannelVersionInfo channels = 4;
  repeated LeaderView leader_views = 5;
B
Bingyi Sun 已提交
420 421 422 423 424
}

message LeaderView {
  int64 collection = 1;
  string channel = 2;
425 426
  map<int64, int64> segment_node_pairs = 3;
  repeated int64 growing_segmentIDs = 4;
B
Bingyi Sun 已提交
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 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 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
}


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;
}

message PartitionLoadInfo {
  int64 collectionID = 1;
  int64 partitionID = 2;
  int32 replica_number = 3;
  LoadStatus status = 4;
}

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;
}

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