mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-03 17:47:08 +01:00
master: charge assigned bytes only once the file id is recorded
An assignment that failed to record its file ids kept the bytes charged to the volume, which could mark a volume near its limit full for an upload that never came. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ffd040f1e
commit
c40e01786b
1 file changed
+4
-4
@@ -731,6 +731,10 @@ func (t *Topology) PickForWrite(requestedCount uint64, option *VolumeGrowOption,
|
||||
if volumeLocationList == nil || volumeLocationList.Length() == 0 {
|
||||
return "", 0, nil, shouldGrow, fmt.Errorf("%s available for collection:%s replication:%s ttl:%s", NoWritableVolumes, option.Collection, option.ReplicaPlacement.String(), option.Ttl.String())
|
||||
}
|
||||
nextFileId, err := t.nextFileId(requestedCount)
|
||||
if err != nil {
|
||||
return "", 0, nil, shouldGrow, fmt.Errorf("record file ids as handed out: %w", err)
|
||||
}
|
||||
// Track estimated assigned bytes to spread load between heartbeats. A flat
|
||||
// fallback overcharges a small-file workload enough to mark near-empty
|
||||
// volumes full, so prefer the volume's own average.
|
||||
@@ -746,10 +750,6 @@ func (t *Topology) PickForWrite(requestedCount uint64, option *VolumeGrowOption,
|
||||
if volumeLayout.RecordAssign(vid, int64(pendingBytes)) {
|
||||
volumeLayout.AdjustActiveVolumeCountForFull(vid)
|
||||
}
|
||||
nextFileId, err := t.nextFileId(requestedCount)
|
||||
if err != nil {
|
||||
return "", 0, nil, shouldGrow, fmt.Errorf("record file ids as handed out: %w", err)
|
||||
}
|
||||
fileId = needle.NewFileId(vid, nextFileId, rand.Uint32()).String()
|
||||
return fileId, count, volumeLocationList, shouldGrow, nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user