s3: Pick a pool with >85% if all other pools are in suspended state (#17826)

This commit is contained in:
Anis Eleuch 2023-08-10 19:06:31 +01:00 committed by GitHub
parent b1391d1991
commit 7fcfde7f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -263,8 +263,8 @@ type serverPoolsAvailableSpace []poolAvailableSpace
type poolAvailableSpace struct { type poolAvailableSpace struct {
Index int Index int
Available uint64 Available uint64 // in bytes
MaxUsedPct int // Used disk percentage of most filled disk, rounded down. MaxUsedPct int // Used disk percentage of most filled disk, rounded down.
} }
// TotalAvailable - total available space // TotalAvailable - total available space
@ -286,7 +286,7 @@ func (p serverPoolsAvailableSpace) FilterMaxUsed(max int) {
} }
var ok bool var ok bool
for _, z := range p { for _, z := range p {
if z.MaxUsedPct < max { if z.Available > 0 && z.MaxUsedPct < max {
ok = true ok = true
break break
} }
@ -299,7 +299,7 @@ func (p serverPoolsAvailableSpace) FilterMaxUsed(max int) {
// Remove entries that are above. // Remove entries that are above.
for i, z := range p { for i, z := range p {
if z.MaxUsedPct < max { if z.Available > 0 && z.MaxUsedPct < max {
continue continue
} }
p[i].Available = 0 p[i].Available = 0
@ -365,7 +365,7 @@ func (z *erasureServerPools) getServerPoolsAvailableSpace(ctx context.Context, b
} }
var available uint64 var available uint64
if !isMinioMetaBucketName(bucket) { if !isMinioMetaBucketName(bucket) {
if avail, err := hasSpaceFor(zinfo, size); err != nil && !avail { if avail, err := hasSpaceFor(zinfo, size); err != nil || !avail {
serverPools[i] = poolAvailableSpace{Index: i} serverPools[i] = poolAvailableSpace{Index: i}
continue continue
} }