Skip to content

Commit

Permalink
Add IndexCurrentVersion and SegmentLevel output
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Nov 25, 2023
1 parent 3d4a89b commit 74a1a9c
Show file tree
Hide file tree
Showing 29 changed files with 8,485 additions and 4,289 deletions.
3 changes: 3 additions & 0 deletions models/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Segment struct {
CreatedByCompaction bool
CompactionFrom []int64
DroppedAt uint64
Level SegmentLevel
// position
StartPosition *MsgPosition
DmlPosition *MsgPosition
Expand Down Expand Up @@ -74,6 +75,7 @@ func NewSegmentFromV2_1(info *datapb.SegmentInfo, key string) *Segment {
s.State = SegmentState(info.GetState())
s.StartPosition = NewMsgPosition(info.GetStartPosition())
s.DmlPosition = NewMsgPosition(info.GetDmlPosition())
s.Level = SegmentLevelLegacy

mFunc := func(fbl *datapb.FieldBinlog, _ int) *FieldBinlog {
r := &FieldBinlog{
Expand All @@ -99,6 +101,7 @@ func NewSegmentFromV2_2(info *datapbv2.SegmentInfo, key string,
s.State = SegmentState(info.GetState())
s.StartPosition = NewMsgPosition(info.GetStartPosition())
s.DmlPosition = NewMsgPosition(info.GetDmlPosition())
s.Level = SegmentLevel(info.GetLevel())

s.lazyLoad = func(s *Segment) {
mFunc := func(fbl datapbv2.FieldBinlog, _ int) *FieldBinlog {
Expand Down
24 changes: 24 additions & 0 deletions models/segment_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,27 @@ var SegmentStatevalue = map[string]int32{
func (x SegmentState) String() string {
return EnumName(SegmentStatename, int32(x))
}

type SegmentLevel int32

const (
SegmentLevelLegacy SegmentLevel = 0
SegmentLevelL0 SegmentLevel = 1
SegmentLevelL1 SegmentLevel = 2
)

var SegmentLevelName = map[int32]string{
0: "Legacy",
1: "L0",
2: "L1",
}

var SegmentLevelValue = map[string]int32{
"Legacy": 0,
"L0": 1,
"L1": 2,
}

func (x SegmentLevel) String() string {
return EnumName(SegmentLevelName, int32(x))
}
44 changes: 36 additions & 8 deletions proto/v2.2/common.proto
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
syntax = "proto3";
package milvus.protov2.common;

option go_package="github.com/milvus-io/milvus-proto/go-api/commonpb";
option go_package="github.com/milvus-io/milvus-proto/go-api/v2/commonpb";

option java_multiple_files = true;
option java_package = "io.milvus.grpc";
option java_outer_classname = "CommonProto";
option java_generate_equals_and_hash = true;

option csharp_namespace = "IO.Milvus.Grpc";
option csharp_namespace = "Milvus.Client.Grpc";

import "google/protobuf/descriptor.proto";

// Deprecated
enum ErrorCode {
option deprecated = true;
Success = 0;
UnexpectedError = 1;
ConnectFailed = 2;
Expand Down Expand Up @@ -69,11 +71,9 @@ enum ErrorCode {
DiskQuotaExhausted = 54;
TimeTickLongDelay = 55;
NotReadyServe = 56;
// Coord is switching from standby mode to active mode
// Coord is switching from standby mode to active mode
NotReadyCoordActivating = 57;

NotFoundTSafer = 58;

// Service availability.
// NA: Not Available.
DataCoordNA = 100;
Expand Down Expand Up @@ -103,8 +103,11 @@ enum SegmentState {
}

message Status {
ErrorCode error_code = 1;
ErrorCode error_code = 1 [deprecated=true];
string reason = 2;
int32 code = 3;
bool retriable = 4;
string detail = 5;
}

message KeyValuePair {
Expand All @@ -125,6 +128,10 @@ enum PlaceholderType {
None = 0;
BinaryVector = 100;
FloatVector = 101;
Float16Vector = 102;
BFloat16Vector = 103;
Int64 = 5;
VarChar = 21;
}

message PlaceholderValue {
Expand Down Expand Up @@ -160,6 +167,8 @@ enum MsgType {
AlterAlias = 110;
AlterCollection = 111;
RenameCollection = 112;
DescribeAlias = 113;
ListAliases = 114;

/* DEFINITION REQUESTS: PARTITION */
CreatePartition = 200;
Expand All @@ -178,17 +187,21 @@ enum MsgType {
HandoffSegments = 254;
LoadBalanceSegments = 255;
DescribeSegments = 256;
FederListIndexedSegment = 257;
FederDescribeSegmentIndexData = 258;

/* DEFINITION REQUESTS: INDEX */
CreateIndex = 300;
DescribeIndex = 301;
DropIndex = 302;
GetIndexStatistics = 303;

/* MANIPULATION REQUESTS */
Insert = 400;
Delete = 401;
Flush = 402;
ResendSegmentStats = 403;
Upsert = 404;

/* QUERY */
Search = 500;
Expand Down Expand Up @@ -230,6 +243,7 @@ enum MsgType {
DataNodeTt = 1208;
Connect = 1209;
ListClientInfos = 1210;
AllocTimestamp = 1211;

/* Credential */
CreateCredential = 1500;
Expand Down Expand Up @@ -270,6 +284,13 @@ message MsgBase {
uint64 timestamp = 3;
int64 sourceID = 4;
int64 targetID = 5;
map<string, string> properties = 6;
ReplicateInfo replicateInfo = 7;
}

message ReplicateInfo {
bool isReplicate = 1;
uint64 msgTimestamp = 2;
}

enum DslType {
Expand Down Expand Up @@ -306,7 +327,8 @@ enum ImportState {
ImportPending = 0; // the task in in pending list of rootCoord, waiting to be executed
ImportFailed = 1; // the task failed for some reason, get detail reason from GetImportStateResponse.infos
ImportStarted = 2; // the task has been sent to datanode to execute
ImportPersisted = 5; // all data files have been parsed and data already persisted
ImportPersisted = 5; // all data files have been parsed and all meta data already persisted, ready to be flushed.
ImportFlushed = 8; // all segments are successfully flushed.
ImportCompleted = 6; // all indexes are successfully built and segments are able to be compacted as normal.
ImportFailedAndCleaned = 7; // the task failed and all segments it generated are cleaned up.
}
Expand Down Expand Up @@ -344,7 +366,7 @@ enum ObjectPrivilege {
PrivilegeSelectOwnership = 22;
PrivilegeManageOwnership = 23;
PrivilegeSelectUser = 24;

PrivilegeUpsert = 25;
PrivilegeCreateResourceGroup = 26;
PrivilegeDropResourceGroup = 27;
PrivilegeDescribeResourceGroup = 28;
Expand All @@ -358,6 +380,7 @@ enum ObjectPrivilege {
PrivilegeCreateDatabase = 35;
PrivilegeDropDatabase = 36;
PrivilegeListDatabases = 37;
PrivilegeFlushAll = 38;
}

message PrivilegeExt {
Expand Down Expand Up @@ -386,6 +409,11 @@ enum LoadState {
LoadStateLoaded = 3;
}

message SegmentStats {
int64 SegmentID = 1;
int64 NumRows = 2;
}

message ClientInfo {
// sdk_type can be `python`, `golang`, `nodejs` and etc. It's not proper to make `sdk_type` an
// enumerate type, since we cannot always update the enum value everytime when newly sdk is supported.
Expand Down
Loading

0 comments on commit 74a1a9c

Please sign in to comment.