mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 03:18:29 +08:00
Disk quota only checks healthy segments (#20574)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com> Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
parent
69481471ec
commit
e73bdbe17d
@ -209,17 +209,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
|
||||
|
@ -92,8 +92,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(
|
||||
|
Loading…
Reference in New Issue
Block a user