mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
Add number of versions in server info API (#14812)
The goal is to show the number of versions in the server info API.
This commit is contained in:
parent
f5d3313210
commit
df50eda811
@ -1699,6 +1699,7 @@ func getServerInfo(ctx context.Context, r *http.Request) madmin.InfoMessage {
|
|||||||
|
|
||||||
buckets := madmin.Buckets{}
|
buckets := madmin.Buckets{}
|
||||||
objects := madmin.Objects{}
|
objects := madmin.Objects{}
|
||||||
|
versions := madmin.Versions{}
|
||||||
usage := madmin.Usage{}
|
usage := madmin.Usage{}
|
||||||
|
|
||||||
objectAPI := newObjectLayerFn()
|
objectAPI := newObjectLayerFn()
|
||||||
@ -1710,6 +1711,7 @@ func getServerInfo(ctx context.Context, r *http.Request) madmin.InfoMessage {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
buckets = madmin.Buckets{Count: dataUsageInfo.BucketsCount}
|
buckets = madmin.Buckets{Count: dataUsageInfo.BucketsCount}
|
||||||
objects = madmin.Objects{Count: dataUsageInfo.ObjectsTotalCount}
|
objects = madmin.Objects{Count: dataUsageInfo.ObjectsTotalCount}
|
||||||
|
versions = madmin.Versions{Count: dataUsageInfo.VersionsTotalCount}
|
||||||
usage = madmin.Usage{Size: dataUsageInfo.ObjectsTotalSize}
|
usage = madmin.Usage{Size: dataUsageInfo.ObjectsTotalSize}
|
||||||
} else {
|
} else {
|
||||||
buckets = madmin.Buckets{Error: err.Error()}
|
buckets = madmin.Buckets{Error: err.Error()}
|
||||||
@ -1758,6 +1760,7 @@ func getServerInfo(ctx context.Context, r *http.Request) madmin.InfoMessage {
|
|||||||
DeploymentID: globalDeploymentID,
|
DeploymentID: globalDeploymentID,
|
||||||
Buckets: buckets,
|
Buckets: buckets,
|
||||||
Objects: objects,
|
Objects: objects,
|
||||||
|
Versions: versions,
|
||||||
Usage: usage,
|
Usage: usage,
|
||||||
Services: services,
|
Services: services,
|
||||||
Backend: backend,
|
Backend: backend,
|
||||||
|
@ -537,6 +537,7 @@ func (d *dataUsageCache) dui(path string, buckets []BucketInfo) DataUsageInfo {
|
|||||||
dui := DataUsageInfo{
|
dui := DataUsageInfo{
|
||||||
LastUpdate: d.Info.LastUpdate,
|
LastUpdate: d.Info.LastUpdate,
|
||||||
ObjectsTotalCount: flat.Objects,
|
ObjectsTotalCount: flat.Objects,
|
||||||
|
VersionsTotalCount: flat.Versions,
|
||||||
ObjectsTotalSize: uint64(flat.Size),
|
ObjectsTotalSize: uint64(flat.Size),
|
||||||
BucketsCount: uint64(len(e.Children)),
|
BucketsCount: uint64(len(e.Children)),
|
||||||
BucketsUsage: d.bucketsUsageInfo(buckets),
|
BucketsUsage: d.bucketsUsageInfo(buckets),
|
||||||
@ -788,6 +789,7 @@ func (d *dataUsageCache) bucketsUsageInfo(buckets []BucketInfo) map[string]Bucke
|
|||||||
flat := d.flatten(*e)
|
flat := d.flatten(*e)
|
||||||
bui := BucketUsageInfo{
|
bui := BucketUsageInfo{
|
||||||
Size: uint64(flat.Size),
|
Size: uint64(flat.Size),
|
||||||
|
VersionsCount: flat.Versions,
|
||||||
ObjectsCount: flat.Objects,
|
ObjectsCount: flat.Objects,
|
||||||
ObjectSizesHistogram: flat.ObjSizes.toMap(),
|
ObjectSizesHistogram: flat.ObjSizes.toMap(),
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ type BucketUsageInfo struct {
|
|||||||
|
|
||||||
ObjectsCount uint64 `json:"objectsCount"`
|
ObjectsCount uint64 `json:"objectsCount"`
|
||||||
ObjectSizesHistogram map[string]uint64 `json:"objectsSizesHistogram"`
|
ObjectSizesHistogram map[string]uint64 `json:"objectsSizesHistogram"`
|
||||||
|
VersionsCount uint64 `json:"versionsCount"`
|
||||||
ReplicaSize uint64 `json:"objectReplicaTotalSize"`
|
ReplicaSize uint64 `json:"objectReplicaTotalSize"`
|
||||||
ReplicationInfo map[string]BucketTargetUsageInfo `json:"objectsReplicationInfo"`
|
ReplicationInfo map[string]BucketTargetUsageInfo `json:"objectsReplicationInfo"`
|
||||||
}
|
}
|
||||||
@ -73,6 +74,9 @@ type DataUsageInfo struct {
|
|||||||
// Objects total count across all buckets
|
// Objects total count across all buckets
|
||||||
ObjectsTotalCount uint64 `json:"objectsCount"`
|
ObjectsTotalCount uint64 `json:"objectsCount"`
|
||||||
|
|
||||||
|
// Objects total count across all buckets
|
||||||
|
VersionsTotalCount uint64 `json:"versionsCount"`
|
||||||
|
|
||||||
// Objects total size across all buckets
|
// Objects total size across all buckets
|
||||||
ObjectsTotalSize uint64 `json:"objectsTotalSize"`
|
ObjectsTotalSize uint64 `json:"objectsTotalSize"`
|
||||||
ReplicationInfo map[string]BucketTargetUsageInfo `json:"objectsReplicationInfo"`
|
ReplicationInfo map[string]BucketTargetUsageInfo `json:"objectsReplicationInfo"`
|
||||||
|
@ -498,7 +498,7 @@ func (s *xlStorage) NSScanner(ctx context.Context, cache dataUsageCache, updates
|
|||||||
atomic.AddUint64(&globalScannerStats.accTotalVersions, 1)
|
atomic.AddUint64(&globalScannerStats.accTotalVersions, 1)
|
||||||
oi := version.ToObjectInfo(item.bucket, item.objectPath())
|
oi := version.ToObjectInfo(item.bucket, item.objectPath())
|
||||||
sz := item.applyActions(ctx, objAPI, oi, &sizeS)
|
sz := item.applyActions(ctx, objAPI, oi, &sizeS)
|
||||||
if !oi.DeleteMarker && sz == oi.Size {
|
if oi.VersionID != "" && sz == oi.Size {
|
||||||
sizeS.versions++
|
sizeS.versions++
|
||||||
}
|
}
|
||||||
sizeS.totalSize += sz
|
sizeS.totalSize += sz
|
||||||
|
Loading…
Reference in New Issue
Block a user