mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 21:50:22 +03:00
fix: restrict SinglePool by the minimum free drive threshold (#21115)
This commit is contained in:
@@ -635,15 +635,18 @@ func (z *erasureServerPools) getPoolIdxNoLock(ctx context.Context, bucket, objec
|
|||||||
// if none are found falls back to most available space pool, this function is
|
// if none are found falls back to most available space pool, this function is
|
||||||
// designed to be only used by PutObject, CopyObject (newObject creation) and NewMultipartUpload.
|
// designed to be only used by PutObject, CopyObject (newObject creation) and NewMultipartUpload.
|
||||||
func (z *erasureServerPools) getPoolIdx(ctx context.Context, bucket, object string, size int64) (idx int, err error) {
|
func (z *erasureServerPools) getPoolIdx(ctx context.Context, bucket, object string, size int64) (idx int, err error) {
|
||||||
idx, err = z.getPoolIdxExistingWithOpts(ctx, bucket, object, ObjectOptions{
|
pinfo, _, err := z.getPoolInfoExistingWithOpts(ctx, bucket, object, ObjectOptions{
|
||||||
SkipDecommissioned: true,
|
SkipDecommissioned: true,
|
||||||
SkipRebalancing: true,
|
SkipRebalancing: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil && !isErrObjectNotFound(err) {
|
if err != nil && !isErrObjectNotFound(err) {
|
||||||
return idx, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if isErrObjectNotFound(err) {
|
idx = pinfo.Index
|
||||||
|
if isErrObjectNotFound(err) || pinfo.Err == nil {
|
||||||
|
// will generate a temp object
|
||||||
idx = z.getAvailablePoolIdx(ctx, bucket, object, size)
|
idx = z.getAvailablePoolIdx(ctx, bucket, object, size)
|
||||||
if idx < 0 {
|
if idx < 0 {
|
||||||
return -1, toObjectErr(errDiskFull)
|
return -1, toObjectErr(errDiskFull)
|
||||||
@@ -1089,6 +1092,10 @@ func (z *erasureServerPools) PutObject(ctx context.Context, bucket string, objec
|
|||||||
|
|
||||||
object = encodeDirObject(object)
|
object = encodeDirObject(object)
|
||||||
if z.SinglePool() {
|
if z.SinglePool() {
|
||||||
|
_, err := z.getPoolIdx(ctx, bucket, object, data.Size())
|
||||||
|
if err != nil {
|
||||||
|
return ObjectInfo{}, err
|
||||||
|
}
|
||||||
return z.serverPools[0].PutObject(ctx, bucket, object, data, opts)
|
return z.serverPools[0].PutObject(ctx, bucket, object, data, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1816,6 +1823,10 @@ func (z *erasureServerPools) PutObjectPart(ctx context.Context, bucket, object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if z.SinglePool() {
|
if z.SinglePool() {
|
||||||
|
_, err := z.getPoolIdx(ctx, bucket, object, data.Size())
|
||||||
|
if err != nil {
|
||||||
|
return PartInfo{}, err
|
||||||
|
}
|
||||||
return z.serverPools[0].PutObjectPart(ctx, bucket, object, uploadID, partID, data, opts)
|
return z.serverPools[0].PutObjectPart(ctx, bucket, object, uploadID, partID, data, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user