mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
Add more erasure codes on degraded systems. (#11852)
In cases where a cluster is degraded, we do not uphold our consistency guarantee and we will write fewer erasure codes and rely on healing to recreate the missing shards. In some cases replacing known bad disks in practice take days. We want to change the behavior of a known degraded system to keep the erasure code promise of the storage class for each object. This will create the objects with the same confidence as a fully functional cluster. The tradeoff will be that objects created during a partial outage will take up slightly more space. This means that when the storage class is EC:4, there should always be written 4 parity shards, even if some disks are unavailable. When an object is created on a set, the disks are immediately checked. If any disks are unavailable additional parity shards will be made for each offline disk, up to 50% of the number of disks. We add an internal metadata field with the actual and intended erasure code level, this can optionally be picked up later by the scanner if we decide that data like this should be re-sharded.
This commit is contained in:
@@ -599,6 +599,24 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st
|
||||
if parityDrives <= 0 {
|
||||
parityDrives = er.defaultParityCount
|
||||
}
|
||||
|
||||
// If we have offline disks upgrade the number of erasure codes for this object.
|
||||
ecOrg := parityDrives
|
||||
for _, disk := range storageDisks {
|
||||
if parityDrives >= len(storageDisks)/2 {
|
||||
break
|
||||
}
|
||||
if disk == nil {
|
||||
parityDrives++
|
||||
}
|
||||
di, err := disk.DiskInfo(ctx)
|
||||
if err != nil || di.ID == "" {
|
||||
parityDrives++
|
||||
}
|
||||
}
|
||||
if ecOrg != parityDrives {
|
||||
opts.UserDefined[xhttp.MinIOErasureUpgraded] = fmt.Sprintf("%d->%d", ecOrg, parityDrives)
|
||||
}
|
||||
}
|
||||
dataDrives := len(storageDisks) - parityDrives
|
||||
|
||||
|
||||
Reference in New Issue
Block a user