未验证 提交 221d044c 编写于 作者: B bigsheeper 提交者: GitHub

Disk quota only checks healthy segments (#20576)

Signed-off-by: Nbigsheeper <yihao.dai@zilliz.com>
Signed-off-by: Nbigsheeper <yihao.dai@zilliz.com>
上级 037f733c
......@@ -197,17 +197,23 @@ func (m *meta) GetNumRowsOfCollection(collectionID UniqueID) int64 {
return ret
}
// GetTotalBinlogSize returns the total size (bytes) of all segments in cluster.
// GetTotalBinlogSize returns the total size (bytes) of healthy segments in cluster.
func (m *meta) GetTotalBinlogSize() int64 {
m.RLock()
defer m.RUnlock()
var ret int64
var totalHealthySize int64
segments := m.segments.GetSegments()
sizes := make(map[commonpb.SegmentState]int64)
for _, segment := range segments {
ret += segment.getSegmentSize()
if isSegmentHealthy(segment) {
totalHealthySize += segment.getSegmentSize()
}
sizes[segment.GetState()] += segment.getSegmentSize()
}
metrics.DataCoordStoredBinlogSize.WithLabelValues().Set(float64(ret))
return ret
for state, size := range sizes {
metrics.DataCoordStoredBinlogSize.WithLabelValues(state.String()).Set(float64(size))
}
return totalHealthySize
}
// AddSegment records segment info, persisting info into kv store
......
......@@ -89,8 +89,8 @@ var (
Namespace: milvusNamespace,
Subsystem: typeutil.DataCoordRole,
Name: "stored_binlog_size",
Help: "binlog size of all collections/segments",
}, []string{})
Help: "binlog size of segments",
}, []string{segmentStateLabelName})
/* hard to implement, commented now
DataCoordSegmentSizeRatio = prometheus.NewHistogramVec(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册