mirror of https://github.com/milvus-io/milvus.git
parent
2017434509
commit
93b9a06b3b
|
@ -25,6 +25,37 @@ var _ = math.Inf
|
|||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type SegmentStatus int32
|
||||
|
||||
const (
|
||||
SegmentStatus_OPENED SegmentStatus = 0
|
||||
SegmentStatus_CLOSED SegmentStatus = 1
|
||||
SegmentStatus_INDEXING SegmentStatus = 2
|
||||
SegmentStatus_INDEXED SegmentStatus = 3
|
||||
)
|
||||
|
||||
var SegmentStatus_name = map[int32]string{
|
||||
0: "OPENED",
|
||||
1: "CLOSED",
|
||||
2: "INDEXING",
|
||||
3: "INDEXED",
|
||||
}
|
||||
|
||||
var SegmentStatus_value = map[string]int32{
|
||||
"OPENED": 0,
|
||||
"CLOSED": 1,
|
||||
"INDEXING": 2,
|
||||
"INDEXED": 3,
|
||||
}
|
||||
|
||||
func (x SegmentStatus) String() string {
|
||||
return proto.EnumName(SegmentStatus_name, int32(x))
|
||||
}
|
||||
|
||||
func (SegmentStatus) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_64c7f42561e95429, []int{0}
|
||||
}
|
||||
|
||||
type Collection struct {
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
|
@ -113,17 +144,19 @@ func (m *Collection) GetIndexes() []*message.IndexParam {
|
|||
}
|
||||
|
||||
type Segment struct {
|
||||
SegmentId uint64 `protobuf:"varint,1,opt,name=segment_id,json=segmentId,proto3" json:"segment_id,omitempty"`
|
||||
CollectionId uint64 `protobuf:"varint,2,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty"`
|
||||
PartitionTag string `protobuf:"bytes,3,opt,name=partition_tag,json=partitionTag,proto3" json:"partition_tag,omitempty"`
|
||||
ChannelStart int32 `protobuf:"varint,4,opt,name=channel_start,json=channelStart,proto3" json:"channel_start,omitempty"`
|
||||
ChannelEnd int32 `protobuf:"varint,5,opt,name=channel_end,json=channelEnd,proto3" json:"channel_end,omitempty"`
|
||||
OpenTimestamp uint64 `protobuf:"varint,6,opt,name=open_timestamp,json=openTimestamp,proto3" json:"open_timestamp,omitempty"`
|
||||
CloseTimestamp uint64 `protobuf:"varint,7,opt,name=close_timestamp,json=closeTimestamp,proto3" json:"close_timestamp,omitempty"`
|
||||
CollectionName string `protobuf:"bytes,8,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
SegmentId uint64 `protobuf:"varint,1,opt,name=segment_id,json=segmentId,proto3" json:"segment_id,omitempty"`
|
||||
CollectionId uint64 `protobuf:"varint,2,opt,name=collection_id,json=collectionId,proto3" json:"collection_id,omitempty"`
|
||||
PartitionTag string `protobuf:"bytes,3,opt,name=partition_tag,json=partitionTag,proto3" json:"partition_tag,omitempty"`
|
||||
ChannelStart int32 `protobuf:"varint,4,opt,name=channel_start,json=channelStart,proto3" json:"channel_start,omitempty"`
|
||||
ChannelEnd int32 `protobuf:"varint,5,opt,name=channel_end,json=channelEnd,proto3" json:"channel_end,omitempty"`
|
||||
OpenTimestamp uint64 `protobuf:"varint,6,opt,name=open_timestamp,json=openTimestamp,proto3" json:"open_timestamp,omitempty"`
|
||||
CloseTimestamp uint64 `protobuf:"varint,7,opt,name=close_timestamp,json=closeTimestamp,proto3" json:"close_timestamp,omitempty"`
|
||||
CollectionName string `protobuf:"bytes,8,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`
|
||||
Status SegmentStatus `protobuf:"varint,9,opt,name=status,proto3,enum=masterpb.SegmentStatus" json:"status,omitempty"`
|
||||
Rows int64 `protobuf:"varint,10,opt,name=rows,proto3" json:"rows,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Segment) Reset() { *m = Segment{} }
|
||||
|
@ -207,13 +240,29 @@ func (m *Segment) GetCollectionName() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *Segment) GetStatus() SegmentStatus {
|
||||
if m != nil {
|
||||
return m.Status
|
||||
}
|
||||
return SegmentStatus_OPENED
|
||||
}
|
||||
|
||||
func (m *Segment) GetRows() int64 {
|
||||
if m != nil {
|
||||
return m.Rows
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SegmentStat struct {
|
||||
SegmentId uint64 `protobuf:"varint,1,opt,name=segment_id,json=segmentId,proto3" json:"segment_id,omitempty"`
|
||||
MemorySize uint64 `protobuf:"varint,2,opt,name=memory_size,json=memorySize,proto3" json:"memory_size,omitempty"`
|
||||
MemoryRate float32 `protobuf:"fixed32,3,opt,name=memory_rate,json=memoryRate,proto3" json:"memory_rate,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
SegmentId uint64 `protobuf:"varint,1,opt,name=segment_id,json=segmentId,proto3" json:"segment_id,omitempty"`
|
||||
MemorySize uint64 `protobuf:"varint,2,opt,name=memory_size,json=memorySize,proto3" json:"memory_size,omitempty"`
|
||||
MemoryRate float32 `protobuf:"fixed32,3,opt,name=memory_rate,json=memoryRate,proto3" json:"memory_rate,omitempty"`
|
||||
Status SegmentStatus `protobuf:"varint,4,opt,name=status,proto3,enum=masterpb.SegmentStatus" json:"status,omitempty"`
|
||||
Rows int64 `protobuf:"varint,5,opt,name=rows,proto3" json:"rows,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SegmentStat) Reset() { *m = SegmentStat{} }
|
||||
|
@ -262,7 +311,22 @@ func (m *SegmentStat) GetMemoryRate() float32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (m *SegmentStat) GetStatus() SegmentStatus {
|
||||
if m != nil {
|
||||
return m.Status
|
||||
}
|
||||
return SegmentStatus_OPENED
|
||||
}
|
||||
|
||||
func (m *SegmentStat) GetRows() int64 {
|
||||
if m != nil {
|
||||
return m.Rows
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("masterpb.SegmentStatus", SegmentStatus_name, SegmentStatus_value)
|
||||
proto.RegisterType((*Collection)(nil), "masterpb.Collection")
|
||||
proto.RegisterType((*Segment)(nil), "masterpb.Segment")
|
||||
proto.RegisterType((*SegmentStat)(nil), "masterpb.SegmentStat")
|
||||
|
@ -273,39 +337,45 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_64c7f42561e95429 = []byte{
|
||||
// 504 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcd, 0x8e, 0xd3, 0x3e,
|
||||
0x14, 0xc5, 0xff, 0x49, 0xbf, 0xa6, 0x37, 0x6d, 0xff, 0xc8, 0x20, 0x11, 0x8d, 0x84, 0x26, 0xea,
|
||||
0x68, 0x44, 0x25, 0xa4, 0x64, 0xa6, 0x2c, 0x58, 0x21, 0x24, 0x46, 0x2c, 0x66, 0x31, 0x08, 0x25,
|
||||
0x5d, 0xb1, 0x89, 0xdc, 0xe4, 0x2a, 0xb5, 0x88, 0x9d, 0x28, 0x76, 0x47, 0xd0, 0x27, 0xe0, 0x75,
|
||||
0x78, 0x3c, 0x76, 0x28, 0x37, 0x49, 0x3f, 0x80, 0x11, 0x2b, 0x3b, 0xc7, 0x3f, 0x5f, 0x9f, 0x1c,
|
||||
0x5f, 0xc3, 0x65, 0xf9, 0x25, 0x0b, 0x24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0xdc, 0xfc, 0x87, 0x0d, 0xa3, 0xa8, 0x39, 0x88, 0xbd, 0x00, 0x38,
|
||||
0xd8, 0x68, 0x03, 0x18, 0xef, 0x5d, 0xb0, 0x4b, 0x98, 0x26, 0xfb, 0x94, 0x6a, 0xc2, 0x26, 0x62,
|
||||
0x72, 0x10, 0x1b, 0xe8, 0xc4, 0x29, 0xe5, 0x33, 0x0e, 0x27, 0xc7, 0x46, 0xa9, 0xd2, 0x86, 0x2b,
|
||||
0x85, 0x79, 0xac, 0x0d, 0xaf, 0x0c, 0x45, 0x32, 0x08, 0x27, 0xad, 0x18, 0xd5, 0x1a, 0xa5, 0xd6,
|
||||
0x42, 0xa8, 0x52, 0x77, 0x40, 0x08, 0xb4, 0xd2, 0x07, 0x95, 0xd6, 0xa1, 0x14, 0x25, 0x2a, 0x0a,
|
||||
0x55, 0x1b, 0x2e, 0x4b, 0x77, 0x48, 0x86, 0xa6, 0xb5, 0xba, 0xea, 0x44, 0xf6, 0x12, 0xfe, 0x4f,
|
||||
0xf2, 0x42, 0xe3, 0x11, 0x37, 0x22, 0x6e, 0x46, 0xf2, 0x29, 0x78, 0xf8, 0x3f, 0xba, 0xf2, 0x33,
|
||||
0x32, 0x3f, 0x3b, 0xc8, 0x1f, 0xb9, 0xc4, 0xb9, 0x02, 0xa7, 0x8d, 0x2c, 0x32, 0xfc, 0x9f, 0xb1,
|
||||
0x5d, 0x80, 0x23, 0x51, 0x16, 0xd5, 0xb7, 0x58, 0x8b, 0x1d, 0xb6, 0xa1, 0x41, 0x23, 0x45, 0x62,
|
||||
0x87, 0x47, 0x40, 0xc5, 0x0d, 0x52, 0x60, 0x76, 0x07, 0x84, 0xdc, 0xe0, 0xf2, 0xbb, 0x05, 0xc3,
|
||||
0x7b, 0xea, 0x62, 0xf6, 0x0e, 0x9e, 0xdc, 0x52, 0xdf, 0x1c, 0xf5, 0xeb, 0xb3, 0x93, 0x4b, 0xbe,
|
||||
0xe7, 0x65, 0x29, 0x54, 0x76, 0xfe, 0x5b, 0x47, 0x1a, 0x6e, 0xb6, 0x7a, 0xfe, 0x1f, 0x7b, 0x0b,
|
||||
0x4e, 0x53, 0x80, 0x9a, 0x81, 0x3d, 0xd6, 0x20, 0x8f, 0x6c, 0x7f, 0x7f, 0xf3, 0x39, 0xc8, 0x84,
|
||||
0xd9, 0x6c, 0xd7, 0x7e, 0x52, 0xc8, 0x20, 0xd9, 0xe9, 0xeb, 0xeb, 0x37, 0x81, 0xde, 0x3e, 0xe4,
|
||||
0x42, 0x06, 0x7f, 0x7f, 0x9b, 0xeb, 0x21, 0x3d, 0xb2, 0xd7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff,
|
||||
0x7c, 0x5f, 0xd4, 0x61, 0xbc, 0x03, 0x00, 0x00,
|
||||
// 594 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x61, 0x6b, 0xd3, 0x40,
|
||||
0x18, 0xc7, 0x97, 0xb4, 0x4d, 0xd7, 0x27, 0x6d, 0x2d, 0xa7, 0x60, 0x18, 0xc8, 0x42, 0xc7, 0x30,
|
||||
0x28, 0x34, 0xdb, 0x7c, 0xe1, 0x2b, 0x11, 0xb6, 0x16, 0x29, 0xb8, 0x6e, 0x24, 0x7b, 0x21, 0xbe,
|
||||
0x29, 0xb7, 0xe4, 0xc8, 0x0e, 0x73, 0x49, 0xc8, 0x5d, 0xa7, 0xee, 0x13, 0xf8, 0x7d, 0xfc, 0x6e,
|
||||
0x82, 0xef, 0xe4, 0x9e, 0xa4, 0x6b, 0xaa, 0x0e, 0xf1, 0x55, 0x9e, 0xfc, 0xef, 0x97, 0x7b, 0xfe,
|
||||
0xf9, 0xe7, 0xb9, 0xc0, 0x41, 0xf1, 0x29, 0xf1, 0x05, 0x95, 0x8a, 0x95, 0x7e, 0x52, 0x16, 0xd1,
|
||||
0xba, 0xae, 0x2e, 0x93, 0xa2, 0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x80, 0x8d, 0x8d, 0x3a, 0x80, 0xde, 0xbd, 0x0b, 0x72, 0x00, 0x83, 0xe8, 0x3e,
|
||||
0x25, 0x4d, 0x98, 0x48, 0xf4, 0x37, 0x62, 0x05, 0x6d, 0x39, 0xc5, 0x7c, 0x7a, 0x41, 0xbf, 0x69,
|
||||
0x14, 0x77, 0xba, 0xa1, 0x59, 0xc6, 0xd2, 0xa5, 0x54, 0xb4, 0x54, 0x18, 0x49, 0x27, 0xe8, 0xd7,
|
||||
0x62, 0xa8, 0x35, 0x4c, 0xad, 0x86, 0x58, 0x16, 0x3b, 0x1d, 0x44, 0xa0, 0x96, 0x66, 0x59, 0xac,
|
||||
0x43, 0xc9, 0x0b, 0x96, 0x61, 0xa8, 0x52, 0x51, 0x51, 0x38, 0x16, 0x1a, 0x1a, 0x68, 0xf5, 0x6a,
|
||||
0x2d, 0x92, 0xe7, 0xf0, 0x28, 0x4a, 0x73, 0xc9, 0x1a, 0x5c, 0x17, 0xb9, 0x21, 0xca, 0xdb, 0xe0,
|
||||
0xe6, 0xfd, 0xf0, 0x93, 0xef, 0xa2, 0xf9, 0xe1, 0x46, 0x5e, 0xe8, 0x8f, 0xef, 0x83, 0x25, 0x15,
|
||||
0x55, 0x2b, 0xe9, 0xf4, 0x5c, 0xc3, 0x1b, 0xea, 0x94, 0xeb, 0x89, 0x9b, 0xd4, 0x51, 0x86, 0xb8,
|
||||
0x1c, 0xd4, 0x98, 0x9e, 0xa0, 0x32, 0xff, 0x2c, 0x1d, 0x70, 0x0d, 0xaf, 0x15, 0x60, 0x3d, 0xfe,
|
||||
0x6e, 0x80, 0xdd, 0xa0, 0xff, 0x15, 0xfe, 0x3e, 0xd8, 0x82, 0x89, 0xbc, 0xfc, 0xba, 0x94, 0xfc,
|
||||
0x8e, 0xd5, 0xd1, 0x43, 0x25, 0x85, 0xfc, 0x8e, 0x35, 0x80, 0x92, 0x2a, 0x86, 0xb1, 0x9b, 0x6b,
|
||||
0x20, 0xa0, 0xaa, 0xe9, 0xba, 0xfd, 0x7f, 0xae, 0x3b, 0x1b, 0xd7, 0x2f, 0x4e, 0x61, 0xb0, 0x05,
|
||||
0x13, 0x00, 0xeb, 0xe2, 0x72, 0xb6, 0x98, 0x4d, 0x47, 0x3b, 0xba, 0x3e, 0x7b, 0x7f, 0x11, 0xce,
|
||||
0xa6, 0x23, 0x83, 0xf4, 0x61, 0x77, 0xbe, 0x98, 0xce, 0x3e, 0xcc, 0x17, 0xef, 0x46, 0x26, 0xb1,
|
||||
0xa1, 0x8b, 0x77, 0xb3, 0xe9, 0xa8, 0x75, 0xf2, 0xcd, 0x00, 0xeb, 0x1c, 0x5b, 0x93, 0xb7, 0x30,
|
||||
0x3a, 0xc3, 0x63, 0xd0, 0x38, 0x7e, 0x4f, 0xb6, 0x66, 0xf6, 0x9c, 0x16, 0x05, 0xcf, 0x92, 0xbd,
|
||||
0xdf, 0x0e, 0x18, 0x36, 0x1f, 0xef, 0x90, 0x37, 0x60, 0x57, 0x1b, 0xe0, 0x6c, 0x93, 0x87, 0xe6,
|
||||
0xfd, 0x81, 0xc7, 0x4f, 0x8f, 0x3f, 0xfa, 0x09, 0x57, 0x37, 0xab, 0xeb, 0x49, 0x94, 0x0b, 0x3f,
|
||||
0xba, 0x93, 0x47, 0x47, 0xaf, 0x7d, 0xb9, 0xba, 0x4d, 0xb9, 0xf0, 0xff, 0xfe, 0xab, 0xb9, 0xb6,
|
||||
0xf0, 0x9f, 0xf1, 0xea, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x1b, 0xc4, 0x72, 0x8b, 0x04,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
|
|
@ -4,12 +4,16 @@ import (
|
|||
"bytes"
|
||||
"encoding/gob"
|
||||
"time"
|
||||
|
||||
masterpb "github.com/czs007/suvlim/pkg/master/grpc/master"
|
||||
)
|
||||
|
||||
type SegmentStats struct {
|
||||
SegementID uint64
|
||||
MemorySize uint64
|
||||
MemoryRate float64
|
||||
Status masterpb.SegmentStatus
|
||||
Rows int64
|
||||
}
|
||||
|
||||
func SegmentMarshal(s SegmentStats) ([]byte, error) {
|
||||
|
@ -33,14 +37,16 @@ func SegmentUnMarshal(data []byte) (SegmentStats, error) {
|
|||
}
|
||||
|
||||
type Segment struct {
|
||||
SegmentID uint64 `json:"segment_id"`
|
||||
CollectionID uint64 `json:"collection_id"`
|
||||
PartitionTag string `json:"partition_tag"`
|
||||
ChannelStart int `json:"channel_start"`
|
||||
ChannelEnd int `json:"channel_end"`
|
||||
OpenTimeStamp uint64 `json:"open_timestamp"`
|
||||
CloseTimeStamp uint64 `json:"close_timestamp"`
|
||||
CollectionName string `json:"collection_name"`
|
||||
SegmentID uint64 `json:"segment_id"`
|
||||
CollectionID uint64 `json:"collection_id"`
|
||||
PartitionTag string `json:"partition_tag"`
|
||||
ChannelStart int `json:"channel_start"`
|
||||
ChannelEnd int `json:"channel_end"`
|
||||
OpenTimeStamp uint64 `json:"open_timestamp"`
|
||||
CloseTimeStamp uint64 `json:"close_timestamp"`
|
||||
CollectionName string `json:"collection_name"`
|
||||
Status masterpb.SegmentStatus `json:"segment_status"`
|
||||
Rows int64 `json:"rows"`
|
||||
}
|
||||
|
||||
func NewSegment(id uint64, collectioID uint64, cName string, ptag string, chStart int, chEnd int, openTime time.Time, closeTime time.Time) Segment {
|
||||
|
|
|
@ -47,6 +47,7 @@ func SegmentStatsController() {
|
|||
select {
|
||||
case ss := <-ssChan:
|
||||
ComputeCloseTime(ss, kvbase)
|
||||
UpdateSegmentStatus(ss, kvbase)
|
||||
case <-time.After(5 * time.Second):
|
||||
fmt.Println("timeout")
|
||||
return
|
||||
|
@ -103,6 +104,39 @@ func ComputeCloseTime(ss mock.SegmentStats, kvbase kv.Base) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func UpdateSegmentStatus(ss mock.SegmentStats, kvbase kv.Base) error {
|
||||
segmentData, err := kvbase.Load("segment/" + strconv.Itoa(int(ss.SegementID)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
seg, err := mock.JSON2Segment(segmentData)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var changed bool
|
||||
changed = false
|
||||
if seg.Status != ss.Status {
|
||||
changed = true
|
||||
seg.Status = ss.Status
|
||||
}
|
||||
if seg.Rows != ss.Rows {
|
||||
changed = true
|
||||
seg.Rows = ss.Rows
|
||||
}
|
||||
|
||||
if changed {
|
||||
segData, err := mock.Segment2JSON(*seg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = kvbase.Save("segment/"+strconv.Itoa(int(seg.CollectionID)), segData)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GRPCServer(ch chan *messagepb.Mapping) error {
|
||||
lis, err := net.Listen("tcp", common.DEFAULT_GRPC_PORT)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue