query_coord.proto 12.9 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
  int64 index_version = 9;
228 229
}

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

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

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

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

273 274 275 276 277 278 279 280 281 282
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;
283
  repeated int64 versions = 4;
284 285
}

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

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

//-------------------- internal meta proto------------------
303 304 305 306 307 308 309 310

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

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

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

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

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

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

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

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

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

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

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

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

message GetDataDistributionRequest {
  common.MsgBase base = 1;
}

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

message LeaderView {
  int64 collection = 1;
  string channel = 2;
427
  map<int64, SegmentDist> segment_dist = 3;
428
  repeated int64 growing_segmentIDs = 4;
B
Bingyi Sun 已提交
429 430
}

431 432 433 434 435
message SegmentDist {
  int64 nodeID = 1;
  int64 version = 2;
}

B
Bingyi Sun 已提交
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

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

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