Add segment stats functions

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
bigsheeper 2020-09-22 11:47:25 +08:00 committed by yefu.chen
parent 62bee091d6
commit 41297f89b5
2 changed files with 6 additions and 5 deletions

View File

@ -88,7 +88,6 @@ func (s *Segment) CloseSegment(collection* Collection) error {
// Change segment status to indexed
s.SegmentStatus = SegmentIndexed
s.SegmentStatus = SegmentClosed
return nil
}

View File

@ -21,7 +21,7 @@ func (node *QueryNode) SegmentsManagement() {
// TODO: check segment status
if timeNow >= oldSegment.SegmentCloseTime {
// close old segment and move it into partition.ClosedSegments
if oldSegment.SegmentStatus == SegmentClosed {
if oldSegment.SegmentStatus != SegmentOpened {
log.Println("Never reach here, Opened segment cannot be closed")
continue
}
@ -66,14 +66,16 @@ func (node *QueryNode) SegmentStatistic(sleepMillisecondTime int) {
memIncreaseRate := float32((int64(currentMemSize))-(int64(segment.LastMemSize))) / (float32(sleepMillisecondTime) / 1000)
segment.LastMemSize = currentMemSize
//segmentStatus := segment.SegmentStatus
//segmentNumOfRows := segment.GetRowCount()
segmentStatus := segment.SegmentStatus
segmentNumOfRows := segment.GetRowCount()
stat := masterPb.SegmentStat{
// TODO: set master pb's segment id type from uint64 to int64
SegmentId: uint64(segmentID),
SegmentId: uint64(segmentID),
MemorySize: currentMemSize,
MemoryRate: memIncreaseRate,
Status: masterPb.SegmentStatus(segmentStatus),
Rows: segmentNumOfRows,
}
statisticData = append(statisticData, stat)