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 {
Index int
Available uint64
MaxUsedPct int // Used disk percentage of most filled disk, rounded down.
Available uint64 // in bytes
MaxUsedPct int // Used disk percentage of most filled disk, rounded down.
}
// TotalAvailable - total available space
@ -286,7 +286,7 @@ func (p serverPoolsAvailableSpace) FilterMaxUsed(max int) {
}
var ok bool
for _, z := range p {
if z.MaxUsedPct < max {
if z.Available > 0 && z.MaxUsedPct < max {
ok = true
break
}
@ -299,7 +299,7 @@ func (p serverPoolsAvailableSpace) FilterMaxUsed(max int) {
// Remove entries that are above.
for i, z := range p {
if z.MaxUsedPct < max {
if z.Available > 0 && z.MaxUsedPct < max {
continue
}
p[i].Available = 0
@ -365,7 +365,7 @@ func (z *erasureServerPools) getServerPoolsAvailableSpace(ctx context.Context, b
}
var available uint64
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}
continue
}