mirror of https://github.com/minio/minio.git
Fix erasure block allocation (#8851)
Small blocks are undersized when file size isn't divisible by the shard could leading to allocation in *reedsolomon.Split()*
This commit is contained in:
parent
b849fd7a75
commit
8cb6184f1d
|
@ -353,7 +353,7 @@ func (xl xlObjects) PutObjectPart(ctx context.Context, bucket, object, uploadID
|
||||||
defer xl.bp.Put(buffer)
|
defer xl.bp.Put(buffer)
|
||||||
case size < blockSizeV1:
|
case size < blockSizeV1:
|
||||||
// No need to allocate fully blockSizeV1 buffer if the incoming data is smaller.
|
// No need to allocate fully blockSizeV1 buffer if the incoming data is smaller.
|
||||||
buffer = make([]byte, size, 2*size)
|
buffer = make([]byte, size, 2*size+int64(erasure.parityBlocks+erasure.dataBlocks-1))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(buffer) > int(xlMeta.Erasure.BlockSize) {
|
if len(buffer) > int(xlMeta.Erasure.BlockSize) {
|
||||||
|
|
|
@ -559,7 +559,7 @@ func (xl xlObjects) putObject(ctx context.Context, bucket string, object string,
|
||||||
defer xl.bp.Put(buffer)
|
defer xl.bp.Put(buffer)
|
||||||
case size < blockSizeV1:
|
case size < blockSizeV1:
|
||||||
// No need to allocate fully blockSizeV1 buffer if the incoming data is smaller.
|
// No need to allocate fully blockSizeV1 buffer if the incoming data is smaller.
|
||||||
buffer = make([]byte, size, 2*size)
|
buffer = make([]byte, size, 2*size+int64(erasure.parityBlocks+erasure.dataBlocks-1))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(buffer) > int(xlMeta.Erasure.BlockSize) {
|
if len(buffer) > int(xlMeta.Erasure.BlockSize) {
|
||||||
|
|
Loading…
Reference in New Issue