mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-17 20:57:27 +00:00
perf(weed/topology): log writable-state changes, not every check (#10612)
* perf(weed/topology): log writable-state changes, not every check ensureCorrectWritables ran its three diagnostics whenever it was asked, so a volume that had always been read-only re-announced that on every registration. A volume server reconnecting with 550k read-only volumes made the master format over a million log lines before it could serve anything, which is exactly when it is already at its memory peak rebuilding the topology. removeFromWritable already reports the transition, and only when there is one. Explain it only then. Dropped the separate 'remove from writable' line, which said nothing that 'becomes unwritable' does not. BenchmarkRegisterReadOnlyVolumes, 100k volumes 285791480 B/op 1902069 allocs/op -> 234592088 B/op 1302572 allocs/op * Update weed/topology/volume_layout.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
parent
1d8d9570eb
commit
4f0322af86
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user