Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: Show segment's Memory Size #265

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions models/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ func NewSegmentFromV2_1(info *datapb.SegmentInfo, key string) *Segment {
}

func NewSegmentFromV2_2(info *datapbv2.SegmentInfo, key string,
lazy func() ([]datapbv2.FieldBinlog, []datapbv2.FieldBinlog, []datapbv2.FieldBinlog, error)) *Segment {
lazy func() ([]datapbv2.FieldBinlog, []datapbv2.FieldBinlog, []datapbv2.FieldBinlog, error),
) *Segment {
s := newSegmentFromBase(info)
s.key = key
s.State = SegmentState(info.GetState())
Expand All @@ -108,7 +109,7 @@ func NewSegmentFromV2_2(info *datapbv2.SegmentInfo, key string,
r := &FieldBinlog{
FieldID: fbl.GetFieldID(),
Binlogs: lo.Map(fbl.GetBinlogs(), func(binlog *datapbv2.Binlog, _ int) *Binlog {
return newBinlog(binlog)
return newBinlogV2(binlog)
}),
}
return r
Expand Down Expand Up @@ -216,6 +217,7 @@ type Binlog struct {
TimestampTo uint64
LogPath string
LogSize int64
MemSize int64
}

func newBinlog[T interface {
Expand All @@ -233,3 +235,21 @@ func newBinlog[T interface {
LogSize: binlog.GetLogSize(),
}
}

func newBinlogV2[T interface {
GetEntriesNum() int64
GetTimestampFrom() uint64
GetTimestampTo() uint64
GetLogPath() string
GetLogSize() int64
GetMemorySize() int64
}](binlog T) *Binlog {
return &Binlog{
EntriesNum: binlog.GetEntriesNum(),
TimestampFrom: binlog.GetTimestampFrom(),
TimestampTo: binlog.GetTimestampTo(),
LogPath: binlog.GetLogPath(),
LogSize: binlog.GetLogSize(),
MemSize: binlog.GetMemorySize(),
}
}
27 changes: 26 additions & 1 deletion proto/v2.2/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ message Status {
int32 code = 3;
bool retriable = 4;
string detail = 5;
map<string, string> extra_info = 6;
}

message KeyValuePair {
Expand All @@ -130,14 +131,17 @@ enum PlaceholderType {
FloatVector = 101;
Float16Vector = 102;
BFloat16Vector = 103;
SparseFloatVector = 104;
Int64 = 5;
VarChar = 21;
}

message PlaceholderValue {
string tag = 1;
PlaceholderType type = 2;
// values is a 2d-array, every array contains a vector
// values is a 2d-array of nq rows, every row contains a query vector.
// for dense vector, all rows are of the same length; for sparse vector,
// the length of each row may vary depending on their number of non-zeros.
repeated bytes values = 3;
}

Expand Down Expand Up @@ -195,6 +199,7 @@ enum MsgType {
DescribeIndex = 301;
DropIndex = 302;
GetIndexStatistics = 303;
AlterIndex = 304;

/* MANIPULATION REQUESTS */
Insert = 400;
Expand Down Expand Up @@ -271,6 +276,7 @@ enum MsgType {
DescribeResourceGroup = 1703;
TransferNode = 1704;
TransferReplica = 1705;
UpdateResourceGroups = 1706;

/* Database group */
CreateDatabase = 1801;
Expand Down Expand Up @@ -381,6 +387,18 @@ enum ObjectPrivilege {
PrivilegeDropDatabase = 36;
PrivilegeListDatabases = 37;
PrivilegeFlushAll = 38;

PrivilegeCreatePartition = 39;
PrivilegeDropPartition = 40;
PrivilegeShowPartitions = 41;
PrivilegeHasPartition = 42;
PrivilegeGetFlushState = 43;
PrivilegeCreateAlias = 44;
PrivilegeDropAlias = 45;
PrivilegeDescribeAlias = 46;
PrivilegeListAliases = 47;

PrivilegeUpdateResourceGroups = 48;
}

message PrivilegeExt {
Expand Down Expand Up @@ -435,3 +453,10 @@ message ServerInfo {
// reserved for newly-added feature if necessary.
map<string, string> reserved = 6;
}

// NodeInfo is used to describe the node information.
message NodeInfo {
int64 nodeID = 1;
string address = 2;
string hostname = 3;
}
Loading
Loading