mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
fix: when parityDrives hits > len(storageDisks)/2, keep maxParity (#12387)
Additionally move out `x-minio-internal-erasure-upgraded` from HTTP headers list, as its an internal header, rename elsewhere accordingly.
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -601,9 +602,10 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st
|
||||
}
|
||||
|
||||
// If we have offline disks upgrade the number of erasure codes for this object.
|
||||
ecOrg := parityDrives
|
||||
parityOrig := parityDrives
|
||||
for _, disk := range storageDisks {
|
||||
if parityDrives >= len(storageDisks)/2 {
|
||||
parityDrives = len(storageDisks) / 2
|
||||
break
|
||||
}
|
||||
if disk == nil {
|
||||
@@ -614,8 +616,8 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st
|
||||
parityDrives++
|
||||
}
|
||||
}
|
||||
if ecOrg != parityDrives {
|
||||
opts.UserDefined[xhttp.MinIOErasureUpgraded] = fmt.Sprintf("%d->%d", ecOrg, parityDrives)
|
||||
if parityOrig != parityDrives {
|
||||
opts.UserDefined[minIOErasureUpgraded] = strconv.Itoa(parityOrig) + "->" + strconv.Itoa(parityDrives)
|
||||
}
|
||||
}
|
||||
dataDrives := len(storageDisks) - parityDrives
|
||||
|
||||
Reference in New Issue
Block a user