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:
bigsheeper 2022-11-14 21:03:09 +08:00 committed by GitHub
parent 69481471ec
commit e73bdbe17d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View File

@ -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

View File

@ -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(