aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-08-18 11:49:08 -0700
committerchrislu <chris.lu@gmail.com>2025-08-18 11:49:08 -0700
commit0748214c8e2f497a84b9392d2d7d4ec976bc84eb (patch)
tree808ec49e6270d04892a153fe209cd2df3ebf53dc
parente19940abca57be96f644b0859e02d9ff943aebca (diff)
downloadseaweedfs-0748214c8e2f497a84b9392d2d7d4ec976bc84eb.tar.xz
seaweedfs-0748214c8e2f497a84b9392d2d7d4ec976bc84eb.zip
logs
-rw-r--r--weed/admin/maintenance/maintenance_scanner.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/weed/admin/maintenance/maintenance_scanner.go b/weed/admin/maintenance/maintenance_scanner.go
index 3b83c7cb4..dfa892cca 100644
--- a/weed/admin/maintenance/maintenance_scanner.go
+++ b/weed/admin/maintenance/maintenance_scanner.go
@@ -329,11 +329,14 @@ func (ms *MaintenanceScanner) createECVolumeMetric(volumeID uint32) *VolumeHealt
// Assumes shard sizes are roughly equal
avgShardSize := totalShardSize / uint64(len(ecShardInfo.ShardSizes))
metric.Size = avgShardSize * uint64(erasure_coding.DataShardsCount)
+ glog.V(2).Infof("EC volume %d size calculated from %d shards: total=%d, avg=%d, estimated_original=%d",
+ volumeID, len(ecShardInfo.ShardSizes), totalShardSize, avgShardSize, metric.Size)
} else {
metric.Size = 0 // No shards, no size
+ glog.V(2).Infof("EC volume %d has no shard size information", volumeID)
}
- glog.V(3).Infof("Created EC volume metric for volume %d, size=%d", volumeID, metric.Size)
+ glog.V(2).Infof("Created EC volume metric for volume %d, size=%d", volumeID, metric.Size)
return nil // Found the volume, stop searching
}
}
@@ -409,7 +412,12 @@ func (ms *MaintenanceScanner) enrichECVolumeWithDeletionInfo(metric *VolumeHealt
if totalDeletedBytes > 0 {
metric.DeletedBytes = uint64(totalDeletedBytes)
- metric.GarbageRatio = float64(metric.DeletedBytes) / float64(metric.Size)
+ if metric.Size > 0 {
+ metric.GarbageRatio = float64(metric.DeletedBytes) / float64(metric.Size)
+ } else {
+ metric.GarbageRatio = 0.0 // Avoid division by zero
+ glog.V(1).Infof("EC volume %d has zero size - cannot calculate garbage ratio", metric.VolumeID)
+ }
glog.V(2).Infof("EC volume %d deletion info from %d servers: %d deleted bytes, garbage ratio: %.1f%%",
metric.VolumeID, len(serversWithShards), metric.DeletedBytes, metric.GarbageRatio*100)
}