2021-01-19 15:35:40 +08:00
|
|
|
package dataservice
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/zilliztech/milvus-distributed/internal/proto/internalpb2"
|
|
|
|
)
|
|
|
|
|
|
|
|
type statsHandler struct {
|
|
|
|
meta *meta
|
|
|
|
}
|
|
|
|
|
|
|
|
func newStatsHandler(meta *meta) *statsHandler {
|
|
|
|
return &statsHandler{
|
|
|
|
meta: meta,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-23 20:22:59 +08:00
|
|
|
func (handler *statsHandler) HandleSegmentStat(segStats *internalpb2.SegmentStatisticsUpdates) error {
|
2021-01-19 15:35:40 +08:00
|
|
|
segMeta, err := handler.meta.GetSegment(segStats.SegmentID)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-01-26 09:43:41 +08:00
|
|
|
if segStats.IsNewSegment {
|
|
|
|
segMeta.OpenTime = segStats.CreateTime
|
2021-02-04 11:19:48 +08:00
|
|
|
segMeta.StartPosition = segStats.StartPosition
|
2021-01-26 09:43:41 +08:00
|
|
|
}
|
|
|
|
segMeta.SealedTime = segStats.EndTime
|
2021-01-19 15:35:40 +08:00
|
|
|
segMeta.NumRows = segStats.NumRows
|
|
|
|
segMeta.MemSize = segStats.MemorySize
|
|
|
|
|
|
|
|
return handler.meta.UpdateSegment(segMeta)
|
|
|
|
}
|