mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -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:
parent
acc452b7ce
commit
89bb9f17d7
@ -32,6 +32,9 @@ import (
|
|||||||
"github.com/minio/minio/pkg/sync/errgroup"
|
"github.com/minio/minio/pkg/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Object was stored with additional erasure codes due to degraded system at upload time
|
||||||
|
const minIOErasureUpgraded = "x-minio-internal-erasure-upgraded"
|
||||||
|
|
||||||
const erasureAlgorithm = "rs-vandermonde"
|
const erasureAlgorithm = "rs-vandermonde"
|
||||||
|
|
||||||
// byObjectPartNumber is a collection satisfying sort.Interface.
|
// byObjectPartNumber is a collection satisfying sort.Interface.
|
||||||
|
@ -289,9 +289,10 @@ func (er erasureObjects) newMultipartUpload(ctx context.Context, bucket string,
|
|||||||
parityDrives = er.defaultParityCount
|
parityDrives = er.defaultParityCount
|
||||||
}
|
}
|
||||||
|
|
||||||
ecOrg := parityDrives
|
parityOrig := parityDrives
|
||||||
for _, disk := range onlineDisks {
|
for _, disk := range onlineDisks {
|
||||||
if parityDrives >= len(onlineDisks)/2 {
|
if parityDrives >= len(onlineDisks)/2 {
|
||||||
|
parityDrives = len(onlineDisks) / 2
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if disk == nil {
|
if disk == nil {
|
||||||
@ -303,8 +304,8 @@ func (er erasureObjects) newMultipartUpload(ctx context.Context, bucket string,
|
|||||||
parityDrives++
|
parityDrives++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ecOrg != parityDrives {
|
if parityOrig != parityDrives {
|
||||||
opts.UserDefined[xhttp.MinIOErasureUpgraded] = fmt.Sprintf("%d->%d", ecOrg, parityDrives)
|
opts.UserDefined[minIOErasureUpgraded] = strconv.Itoa(parityOrig) + "->" + strconv.Itoa(parityDrives)
|
||||||
}
|
}
|
||||||
|
|
||||||
dataDrives := len(onlineDisks) - parityDrives
|
dataDrives := len(onlineDisks) - parityDrives
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"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.
|
// If we have offline disks upgrade the number of erasure codes for this object.
|
||||||
ecOrg := parityDrives
|
parityOrig := parityDrives
|
||||||
for _, disk := range storageDisks {
|
for _, disk := range storageDisks {
|
||||||
if parityDrives >= len(storageDisks)/2 {
|
if parityDrives >= len(storageDisks)/2 {
|
||||||
|
parityDrives = len(storageDisks) / 2
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if disk == nil {
|
if disk == nil {
|
||||||
@ -614,8 +616,8 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st
|
|||||||
parityDrives++
|
parityDrives++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ecOrg != parityDrives {
|
if parityOrig != parityDrives {
|
||||||
opts.UserDefined[xhttp.MinIOErasureUpgraded] = fmt.Sprintf("%d->%d", ecOrg, parityDrives)
|
opts.UserDefined[minIOErasureUpgraded] = strconv.Itoa(parityOrig) + "->" + strconv.Itoa(parityDrives)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataDrives := len(storageDisks) - parityDrives
|
dataDrives := len(storageDisks) - parityDrives
|
||||||
|
@ -156,9 +156,6 @@ const (
|
|||||||
// Reports number of drives currently healing
|
// Reports number of drives currently healing
|
||||||
MinIOHealingDrives = "x-minio-healing-drives"
|
MinIOHealingDrives = "x-minio-healing-drives"
|
||||||
|
|
||||||
// Object was stored with additional erasure codes due to degraded system at upload time
|
|
||||||
MinIOErasureUpgraded = "x-minio-internal-erasure-upgraded"
|
|
||||||
|
|
||||||
// Header indicates if the delete marker should be preserved by client
|
// Header indicates if the delete marker should be preserved by client
|
||||||
MinIOSourceDeleteMarker = "x-minio-source-deletemarker"
|
MinIOSourceDeleteMarker = "x-minio-source-deletemarker"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user