Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

perf(weed/topology): log writable-state changes, not every check (#10612)

Chris Lu4f0322af8665
diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go
index 6cc58f1b62..77821c1546 100644
--- a/weed/topology/volume_layout.go
+++ b/weed/topology/volume_layout.go
@@ -343,18 +343,22 @@ func (vl *VolumeLayout) ensureCorrectWritables(vid needle.VolumeId) {
isOversizedVolume := vl.oversizedVolumes.IsTrue(vid)
if isEnoughCopies && isAllWritable && !isOversizedVolume {
vl.setVolumeWritable(vid)
- } else {
- if !isEnoughCopies {
- glog.V(0).Infof("volume %d does not have enough copies", vid)
- }
- if !isAllWritable {
- glog.V(0).Infof("volume %d are not all writable", vid)
- }
- if isOversizedVolume {
- glog.V(1).Infof("volume %d are oversized", vid)
- }
- glog.V(0).Infof("volume %d remove from writable", vid)
- vl.removeFromWritable(vid)
+ return
+ }
+ // removeFromWritable reports the transition itself, and only when there is
+ // one. Explain it only then: every heartbeat re-runs this for every volume,
+ // so a volume that is simply staying read-only must not log.
+ if !vl.removeFromWritable(vid) {
+ return
+ }
+ if !isEnoughCopies {
+ glog.V(0).Infof("volume %d does not have enough copies", vid)
+ }
+ if !isAllWritable {
+ glog.V(0).Infof("volume %d is not fully writable", vid)
+ }
+ if isOversizedVolume {
+ glog.V(0).Infof("volume %d is oversized", vid)
}
}