@ -51,7 +51,7 @@ func (z *erasureServerPools) SingleZone() bool {
return len ( z . serverPools ) == 1
return len ( z . serverPools ) == 1
}
}
// Initialize new zone of erasure sets.
// Initialize new pool of erasure sets.
func newErasureServerPools ( ctx context . Context , endpointServerPools EndpointServerPools ) ( ObjectLayer , error ) {
func newErasureServerPools ( ctx context . Context , endpointServerPools EndpointServerPools ) ( ObjectLayer , error ) {
var (
var (
deploymentID string
deploymentID string
@ -127,9 +127,9 @@ func (z *erasureServerPools) SetDriveCount() int {
return z . serverPools [ 0 ] . SetDriveCount ( )
return z . serverPools [ 0 ] . SetDriveCount ( )
}
}
type serverPoolsAvailableSpace [ ] zone AvailableSpace
type serverPoolsAvailableSpace [ ] pool AvailableSpace
type zone AvailableSpace struct {
type pool AvailableSpace struct {
Index int
Index int
Available uint64
Available uint64
}
}
@ -154,10 +154,10 @@ func (z *erasureServerPools) getAvailableZoneIdx(ctx context.Context, size int64
// choose when we reach this many
// choose when we reach this many
choose := rand . Uint64 ( ) % total
choose := rand . Uint64 ( ) % total
atTotal := uint64 ( 0 )
atTotal := uint64 ( 0 )
for _ , zone := range serverPools {
for _ , pool := range serverPools {
atTotal += zone . Available
atTotal += pool . Available
if atTotal > choose && zone . Available > 0 {
if atTotal > choose && pool . Available > 0 {
return zone . Index
return pool . Index
}
}
}
}
// Should not happen, but print values just in case.
// Should not happen, but print values just in case.
@ -165,8 +165,8 @@ func (z *erasureServerPools) getAvailableZoneIdx(ctx context.Context, size int64
return - 1
return - 1
}
}
// getServerPoolsAvailableSpace will return the available space of each zone after storing the content.
// getServerPoolsAvailableSpace will return the available space of each pool after storing the content.
// If there is not enough space the zone will return 0 bytes available.
// If there is not enough space the pool will return 0 bytes available.
// Negative sizes are seen as 0 bytes.
// Negative sizes are seen as 0 bytes.
func ( z * erasureServerPools ) getServerPoolsAvailableSpace ( ctx context . Context , size int64 ) serverPoolsAvailableSpace {
func ( z * erasureServerPools ) getServerPoolsAvailableSpace ( ctx context . Context , size int64 ) serverPoolsAvailableSpace {
if size < 0 {
if size < 0 {
@ -208,7 +208,7 @@ func (z *erasureServerPools) getServerPoolsAvailableSpace(ctx context.Context, s
available = 0
available = 0
}
}
}
}
serverPools [ i ] = zone AvailableSpace{
serverPools [ i ] = pool AvailableSpace{
Index : i ,
Index : i ,
Available : available ,
Available : available ,
}
}
@ -216,14 +216,14 @@ func (z *erasureServerPools) getServerPoolsAvailableSpace(ctx context.Context, s
return serverPools
return serverPools
}
}
// getZoneIdx returns the found previous object and its corresponding zone idx,
// getZoneIdx returns the found previous object and its corresponding pool idx,
// if none are found falls back to most available space zone .
// if none are found falls back to most available space pool .
func ( z * erasureServerPools ) getZoneIdx ( ctx context . Context , bucket , object string , opts ObjectOptions , size int64 ) ( idx int , err error ) {
func ( z * erasureServerPools ) getZoneIdx ( ctx context . Context , bucket , object string , opts ObjectOptions , size int64 ) ( idx int , err error ) {
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return 0 , nil
return 0 , nil
}
}
for i , zone := range z . serverPools {
for i , pool := range z . serverPools {
objInfo , err := zone . GetObjectInfo ( ctx , bucket , object , opts )
objInfo , err := pool . GetObjectInfo ( ctx , bucket , object , opts )
switch err . ( type ) {
switch err . ( type ) {
case ObjectNotFound :
case ObjectNotFound :
// VersionId was not specified but found delete marker or no versions exist.
// VersionId was not specified but found delete marker or no versions exist.
@ -236,7 +236,7 @@ func (z *erasureServerPools) getZoneIdx(ctx context.Context, bucket, object stri
}
}
}
}
// delete marker not specified means no versions
// delete marker not specified means no versions
// exist continue to next zone .
// exist continue to next pool .
if ! objInfo . DeleteMarker && err != nil {
if ! objInfo . DeleteMarker && err != nil {
continue
continue
}
}
@ -376,7 +376,7 @@ func (z *erasureServerPools) CrawlAndGetDataUsage(ctx context.Context, bf *bloom
defer updateTicker . Stop ( )
defer updateTicker . Stop ( )
var lastUpdate time . Time
var lastUpdate time . Time
// We need to merge since we will get the same buckets from each zone .
// We need to merge since we will get the same buckets from each pool .
// Therefore to get the exact bucket sizes we must merge before we can convert.
// Therefore to get the exact bucket sizes we must merge before we can convert.
var allMerged dataUsageCache
var allMerged dataUsageCache
@ -477,8 +477,8 @@ func (z *erasureServerPools) GetObjectNInfo(ctx context.Context, bucket, object
object = encodeDirObject ( object )
object = encodeDirObject ( object )
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
gr , err = zone . GetObjectNInfo ( ctx , bucket , object , rs , h , lockType , opts )
gr , err = pool . GetObjectNInfo ( ctx , bucket , object , rs , h , lockType , opts )
if err != nil {
if err != nil {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
continue
continue
@ -500,8 +500,8 @@ func (z *erasureServerPools) GetObject(ctx context.Context, bucket, object strin
object = encodeDirObject ( object )
object = encodeDirObject ( object )
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
if err := zone . GetObject ( ctx , bucket , object , startOffset , length , writer , etag , opts ) ; err != nil {
if err := pool . GetObject ( ctx , bucket , object , startOffset , length , writer , etag , opts ) ; err != nil {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
continue
continue
}
}
@ -521,8 +521,8 @@ func (z *erasureServerPools) GetObjectInfo(ctx context.Context, bucket, object s
}
}
object = encodeDirObject ( object )
object = encodeDirObject ( object )
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
objInfo , err = zone . GetObjectInfo ( ctx , bucket , object , opts )
objInfo , err = pool . GetObjectInfo ( ctx , bucket , object , opts )
if err != nil {
if err != nil {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
continue
continue
@ -538,7 +538,7 @@ func (z *erasureServerPools) GetObjectInfo(ctx context.Context, bucket, object s
return objInfo , ObjectNotFound { Bucket : bucket , Object : object }
return objInfo , ObjectNotFound { Bucket : bucket , Object : object }
}
}
// PutObject - writes an object to least used erasure zone .
// PutObject - writes an object to least used erasure pool .
func ( z * erasureServerPools ) PutObject ( ctx context . Context , bucket string , object string , data * PutObjReader , opts ObjectOptions ) ( ObjectInfo , error ) {
func ( z * erasureServerPools ) PutObject ( ctx context . Context , bucket string , object string , data * PutObjReader , opts ObjectOptions ) ( ObjectInfo , error ) {
// Validate put object input args.
// Validate put object input args.
if err := checkPutObjectArgs ( ctx , bucket , object , z ) ; err != nil {
if err := checkPutObjectArgs ( ctx , bucket , object , z ) ; err != nil {
@ -556,7 +556,7 @@ func (z *erasureServerPools) PutObject(ctx context.Context, bucket string, objec
return ObjectInfo { } , err
return ObjectInfo { } , err
}
}
// Overwrite the object at the right zone
// Overwrite the object at the right pool
return z . serverPools [ idx ] . PutObject ( ctx , bucket , object , data , opts )
return z . serverPools [ idx ] . PutObject ( ctx , bucket , object , data , opts )
}
}
@ -570,8 +570,8 @@ func (z *erasureServerPools) DeleteObject(ctx context.Context, bucket string, ob
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return z . serverPools [ 0 ] . DeleteObject ( ctx , bucket , object , opts )
return z . serverPools [ 0 ] . DeleteObject ( ctx , bucket , object , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
objInfo , err = zone . DeleteObject ( ctx , bucket , object , opts )
objInfo , err = pool . DeleteObject ( ctx , bucket , object , opts )
if err == nil {
if err == nil {
return objInfo , nil
return objInfo , nil
}
}
@ -608,8 +608,8 @@ func (z *erasureServerPools) DeleteObjects(ctx context.Context, bucket string, o
return z . serverPools [ 0 ] . DeleteObjects ( ctx , bucket , objects , opts )
return z . serverPools [ 0 ] . DeleteObjects ( ctx , bucket , objects , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
deletedObjects , errs := zone . DeleteObjects ( ctx , bucket , objects , opts )
deletedObjects , errs := pool . DeleteObjects ( ctx , bucket , objects , opts )
for i , derr := range errs {
for i , derr := range errs {
if derr != nil {
if derr != nil {
derrs [ i ] = derr
derrs [ i ] = derr
@ -626,7 +626,7 @@ func (z *erasureServerPools) CopyObject(ctx context.Context, srcBucket, srcObjec
cpSrcDstSame := isStringEqual ( pathJoin ( srcBucket , srcObject ) , pathJoin ( dstBucket , dstObject ) )
cpSrcDstSame := isStringEqual ( pathJoin ( srcBucket , srcObject ) , pathJoin ( dstBucket , dstObject ) )
zone Idx, err := z . getZoneIdx ( ctx , dstBucket , dstObject , dstOpts , srcInfo . Size )
pool Idx, err := z . getZoneIdx ( ctx , dstBucket , dstObject , dstOpts , srcInfo . Size )
if err != nil {
if err != nil {
return objInfo , err
return objInfo , err
}
}
@ -634,12 +634,12 @@ func (z *erasureServerPools) CopyObject(ctx context.Context, srcBucket, srcObjec
if cpSrcDstSame && srcInfo . metadataOnly {
if cpSrcDstSame && srcInfo . metadataOnly {
// Version ID is set for the destination and source == destination version ID.
// Version ID is set for the destination and source == destination version ID.
if dstOpts . VersionID != "" && srcOpts . VersionID == dstOpts . VersionID {
if dstOpts . VersionID != "" && srcOpts . VersionID == dstOpts . VersionID {
return z . serverPools [ zone Idx] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
return z . serverPools [ pool Idx] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
}
}
// Destination is not versioned and source version ID is empty
// Destination is not versioned and source version ID is empty
// perform an in-place update.
// perform an in-place update.
if ! dstOpts . Versioned && srcOpts . VersionID == "" {
if ! dstOpts . Versioned && srcOpts . VersionID == "" {
return z . serverPools [ zone Idx] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
return z . serverPools [ pool Idx] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
}
}
// Destination is versioned, source is not destination version,
// Destination is versioned, source is not destination version,
// as a special case look for if the source object is not legacy
// as a special case look for if the source object is not legacy
@ -649,7 +649,7 @@ func (z *erasureServerPools) CopyObject(ctx context.Context, srcBucket, srcObjec
// CopyObject optimization where we don't create an entire copy
// CopyObject optimization where we don't create an entire copy
// of the content, instead we add a reference.
// of the content, instead we add a reference.
srcInfo . versionOnly = true
srcInfo . versionOnly = true
return z . serverPools [ zone Idx] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
return z . serverPools [ pool Idx] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
}
}
}
}
@ -661,7 +661,7 @@ func (z *erasureServerPools) CopyObject(ctx context.Context, srcBucket, srcObjec
MTime : dstOpts . MTime ,
MTime : dstOpts . MTime ,
}
}
return z . serverPools [ zone Idx] . PutObject ( ctx , dstBucket , dstObject , srcInfo . PutObjReader , putOpts )
return z . serverPools [ pool Idx] . PutObject ( ctx , dstBucket , dstObject , srcInfo . PutObjReader , putOpts )
}
}
func ( z * erasureServerPools ) ListObjectsV2 ( ctx context . Context , bucket , prefix , continuationToken , delimiter string , maxKeys int , fetchOwner bool , startAfter string ) ( ListObjectsV2Info , error ) {
func ( z * erasureServerPools ) ListObjectsV2 ( ctx context . Context , bucket , prefix , continuationToken , delimiter string , maxKeys int , fetchOwner bool , startAfter string ) ( ListObjectsV2Info , error ) {
@ -783,20 +783,20 @@ func (z *erasureServerPools) ListMultipartUploads(ctx context.Context, bucket, p
return z . serverPools [ 0 ] . ListMultipartUploads ( ctx , bucket , prefix , keyMarker , uploadIDMarker , delimiter , maxUploads )
return z . serverPools [ 0 ] . ListMultipartUploads ( ctx , bucket , prefix , keyMarker , uploadIDMarker , delimiter , maxUploads )
}
}
var zone Result = ListMultipartsInfo { }
var pool Result = ListMultipartsInfo { }
zone Result. MaxUploads = maxUploads
pool Result. MaxUploads = maxUploads
zone Result. KeyMarker = keyMarker
pool Result. KeyMarker = keyMarker
zone Result. Prefix = prefix
pool Result. Prefix = prefix
zone Result. Delimiter = delimiter
pool Result. Delimiter = delimiter
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
result , err := zone . ListMultipartUploads ( ctx , bucket , prefix , keyMarker , uploadIDMarker ,
result , err := pool . ListMultipartUploads ( ctx , bucket , prefix , keyMarker , uploadIDMarker ,
delimiter , maxUploads )
delimiter , maxUploads )
if err != nil {
if err != nil {
return result , err
return result , err
}
}
zone Result. Uploads = append ( zone Result. Uploads , result . Uploads ... )
pool Result. Uploads = append ( pool Result. Uploads , result . Uploads ... )
}
}
return zone Result, nil
return pool Result, nil
}
}
// Initiate a new multipart upload on a hashedSet based on object name.
// Initiate a new multipart upload on a hashedSet based on object name.
@ -838,14 +838,14 @@ func (z *erasureServerPools) PutObjectPart(ctx context.Context, bucket, object,
return z . serverPools [ 0 ] . PutObjectPart ( ctx , bucket , object , uploadID , partID , data , opts )
return z . serverPools [ 0 ] . PutObjectPart ( ctx , bucket , object , uploadID , partID , data , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
_ , err := zone . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
_ , err := pool . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
if err == nil {
if err == nil {
return zone . PutObjectPart ( ctx , bucket , object , uploadID , partID , data , opts )
return pool . PutObjectPart ( ctx , bucket , object , uploadID , partID , data , opts )
}
}
switch err . ( type ) {
switch err . ( type ) {
case InvalidUploadID :
case InvalidUploadID :
// Look for information on the next zone
// Look for information on the next pool
continue
continue
}
}
// Any other unhandled errors such as quorum return.
// Any other unhandled errors such as quorum return.
@ -867,14 +867,14 @@ func (z *erasureServerPools) GetMultipartInfo(ctx context.Context, bucket, objec
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return z . serverPools [ 0 ] . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
return z . serverPools [ 0 ] . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
mi , err := zone . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
mi , err := pool . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
if err == nil {
if err == nil {
return mi , nil
return mi , nil
}
}
switch err . ( type ) {
switch err . ( type ) {
case InvalidUploadID :
case InvalidUploadID :
// upload id not found, continue to the next zone .
// upload id not found, continue to the next pool .
continue
continue
}
}
// any other unhandled error return right here.
// any other unhandled error return right here.
@ -897,10 +897,10 @@ func (z *erasureServerPools) ListObjectParts(ctx context.Context, bucket, object
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return z . serverPools [ 0 ] . ListObjectParts ( ctx , bucket , object , uploadID , partNumberMarker , maxParts , opts )
return z . serverPools [ 0 ] . ListObjectParts ( ctx , bucket , object , uploadID , partNumberMarker , maxParts , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
_ , err := zone . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
_ , err := pool . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
if err == nil {
if err == nil {
return zone . ListObjectParts ( ctx , bucket , object , uploadID , partNumberMarker , maxParts , opts )
return pool . ListObjectParts ( ctx , bucket , object , uploadID , partNumberMarker , maxParts , opts )
}
}
switch err . ( type ) {
switch err . ( type ) {
case InvalidUploadID :
case InvalidUploadID :
@ -925,14 +925,14 @@ func (z *erasureServerPools) AbortMultipartUpload(ctx context.Context, bucket, o
return z . serverPools [ 0 ] . AbortMultipartUpload ( ctx , bucket , object , uploadID , opts )
return z . serverPools [ 0 ] . AbortMultipartUpload ( ctx , bucket , object , uploadID , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
_ , err := zone . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
_ , err := pool . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
if err == nil {
if err == nil {
return zone . AbortMultipartUpload ( ctx , bucket , object , uploadID , opts )
return pool . AbortMultipartUpload ( ctx , bucket , object , uploadID , opts )
}
}
switch err . ( type ) {
switch err . ( type ) {
case InvalidUploadID :
case InvalidUploadID :
// upload id not found move to next zone
// upload id not found move to next pool
continue
continue
}
}
return err
return err
@ -955,17 +955,17 @@ func (z *erasureServerPools) CompleteMultipartUpload(ctx context.Context, bucket
}
}
// Purge any existing object.
// Purge any existing object.
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
zone . DeleteObject ( ctx , bucket , object , opts )
pool . DeleteObject ( ctx , bucket , object , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
result , err := zone . ListMultipartUploads ( ctx , bucket , object , "" , "" , "" , maxUploadsList )
result , err := pool . ListMultipartUploads ( ctx , bucket , object , "" , "" , "" , maxUploadsList )
if err != nil {
if err != nil {
return objInfo , err
return objInfo , err
}
}
if result . Lookup ( uploadID ) {
if result . Lookup ( uploadID ) {
return zone . CompleteMultipartUpload ( ctx , bucket , object , uploadID , uploadedParts , opts )
return pool . CompleteMultipartUpload ( ctx , bucket , object , uploadID , uploadedParts , opts )
}
}
}
}
return objInfo , InvalidUploadID {
return objInfo , InvalidUploadID {
@ -988,8 +988,8 @@ func (z *erasureServerPools) GetBucketInfo(ctx context.Context, bucket string) (
}
}
return bucketInfo , nil
return bucketInfo , nil
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
bucketInfo , err = zone . GetBucketInfo ( ctx , bucket )
bucketInfo , err = pool . GetBucketInfo ( ctx , bucket )
if err != nil {
if err != nil {
if isErrBucketNotFound ( err ) {
if isErrBucketNotFound ( err ) {
continue
continue
@ -1114,8 +1114,8 @@ func (z *erasureServerPools) ListBuckets(ctx context.Context) (buckets []BucketI
if z . SingleZone ( ) {
if z . SingleZone ( ) {
buckets , err = z . serverPools [ 0 ] . ListBuckets ( ctx )
buckets , err = z . serverPools [ 0 ] . ListBuckets ( ctx )
} else {
} else {
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
buckets , err = zone . ListBuckets ( ctx )
buckets , err = pool . ListBuckets ( ctx )
if err != nil {
if err != nil {
logger . LogIf ( ctx , err )
logger . LogIf ( ctx , err )
continue
continue
@ -1149,8 +1149,8 @@ func (z *erasureServerPools) HealFormat(ctx context.Context, dryRun bool) (madmi
}
}
var countNoHeal int
var countNoHeal int
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
result , err := zone . HealFormat ( ctx , dryRun )
result , err := pool . HealFormat ( ctx , dryRun )
if err != nil && ! errors . Is ( err , errNoHealRequired ) {
if err != nil && ! errors . Is ( err , errNoHealRequired ) {
logger . LogIf ( ctx , err )
logger . LogIf ( ctx , err )
continue
continue
@ -1183,8 +1183,8 @@ func (z *erasureServerPools) HealBucket(ctx context.Context, bucket string, opts
// Attempt heal on the bucket metadata, ignore any failures
// Attempt heal on the bucket metadata, ignore any failures
_ , _ = z . HealObject ( ctx , minioMetaBucket , pathJoin ( bucketConfigPrefix , bucket , bucketMetadataFile ) , "" , opts )
_ , _ = z . HealObject ( ctx , minioMetaBucket , pathJoin ( bucketConfigPrefix , bucket , bucketMetadataFile ) , "" , opts )
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
result , err := zone . HealBucket ( ctx , bucket , opts )
result , err := pool . HealBucket ( ctx , bucket , opts )
if err != nil {
if err != nil {
switch err . ( type ) {
switch err . ( type ) {
case BucketNotFound :
case BucketNotFound :
@ -1344,8 +1344,8 @@ func (z *erasureServerPools) HealObject(ctx context.Context, bucket, object, ver
defer lk . RUnlock ( )
defer lk . RUnlock ( )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
result , err := zone . HealObject ( ctx , bucket , object , versionID , opts )
result , err := pool . HealObject ( ctx , bucket , object , versionID , opts )
if err != nil {
if err != nil {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
continue
continue
@ -1374,12 +1374,12 @@ func (z *erasureServerPools) GetMetrics(ctx context.Context) (*Metrics, error) {
}
}
func ( z * erasureServerPools ) getZoneAndSet ( id string ) ( int , int , error ) {
func ( z * erasureServerPools ) getZoneAndSet ( id string ) ( int , int , error ) {
for zone Idx := range z . serverPools {
for pool Idx := range z . serverPools {
format := z . serverPools [ zone Idx] . format
format := z . serverPools [ pool Idx] . format
for setIdx , set := range format . Erasure . Sets {
for setIdx , set := range format . Erasure . Sets {
for _ , diskID := range set {
for _ , diskID := range set {
if diskID == id {
if diskID == id {
return zone Idx, setIdx , nil
return pool Idx, setIdx , nil
}
}
}
}
}
}
@ -1419,12 +1419,12 @@ func (z *erasureServerPools) Health(ctx context.Context, opts HealthOptions) Hea
for _ , localDiskIDs := range diskIDs {
for _ , localDiskIDs := range diskIDs {
for _ , id := range localDiskIDs {
for _ , id := range localDiskIDs {
zone Idx, setIdx , err := z . getZoneAndSet ( id )
pool Idx, setIdx , err := z . getZoneAndSet ( id )
if err != nil {
if err != nil {
logger . LogIf ( ctx , err )
logger . LogIf ( ctx , err )
continue
continue
}
}
erasureSetUpCount [ zone Idx] [ setIdx ] ++
erasureSetUpCount [ pool Idx] [ setIdx ] ++
}
}
}
}
@ -1461,16 +1461,16 @@ func (z *erasureServerPools) Health(ctx context.Context, opts HealthOptions) Hea
}
}
}
}
for zone Idx := range erasureSetUpCount {
for pool Idx := range erasureSetUpCount {
for setIdx := range erasureSetUpCount [ zone Idx] {
for setIdx := range erasureSetUpCount [ pool Idx] {
if erasureSetUpCount [ zone Idx] [ setIdx ] < writeQuorum {
if erasureSetUpCount [ pool Idx] [ setIdx ] < writeQuorum {
logger . LogIf ( logger . SetReqInfo ( ctx , reqInfo ) ,
logger . LogIf ( logger . SetReqInfo ( ctx , reqInfo ) ,
fmt . Errorf ( "Write quorum may be lost on zone : %d, set: %d, expected write quorum: %d" ,
fmt . Errorf ( "Write quorum may be lost on pool : %d, set: %d, expected write quorum: %d" ,
zone Idx, setIdx , writeQuorum ) )
pool Idx, setIdx , writeQuorum ) )
return HealthResult {
return HealthResult {
Healthy : false ,
Healthy : false ,
HealingDrives : len ( aggHealStateResult . HealDisks ) ,
HealingDrives : len ( aggHealStateResult . HealDisks ) ,
ZoneID : zone Idx,
ZoneID : pool Idx,
SetID : setIdx ,
SetID : setIdx ,
WriteQuorum : writeQuorum ,
WriteQuorum : writeQuorum ,
}
}
@ -1501,8 +1501,8 @@ func (z *erasureServerPools) PutObjectTags(ctx context.Context, bucket, object s
return z . serverPools [ 0 ] . PutObjectTags ( ctx , bucket , object , tags , opts )
return z . serverPools [ 0 ] . PutObjectTags ( ctx , bucket , object , tags , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
err := zone . PutObjectTags ( ctx , bucket , object , tags , opts )
err := pool . PutObjectTags ( ctx , bucket , object , tags , opts )
if err != nil {
if err != nil {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
continue
continue
@ -1530,8 +1530,8 @@ func (z *erasureServerPools) DeleteObjectTags(ctx context.Context, bucket, objec
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return z . serverPools [ 0 ] . DeleteObjectTags ( ctx , bucket , object , opts )
return z . serverPools [ 0 ] . DeleteObjectTags ( ctx , bucket , object , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
err := zone . DeleteObjectTags ( ctx , bucket , object , opts )
err := pool . DeleteObjectTags ( ctx , bucket , object , opts )
if err != nil {
if err != nil {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
continue
continue
@ -1559,8 +1559,8 @@ func (z *erasureServerPools) GetObjectTags(ctx context.Context, bucket, object s
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return z . serverPools [ 0 ] . GetObjectTags ( ctx , bucket , object , opts )
return z . serverPools [ 0 ] . GetObjectTags ( ctx , bucket , object , opts )
}
}
for _ , zone := range z . serverPools {
for _ , pool := range z . serverPools {
tags , err := zone . GetObjectTags ( ctx , bucket , object , opts )
tags , err := pool . GetObjectTags ( ctx , bucket , object , opts )
if err != nil {
if err != nil {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
if isErrObjectNotFound ( err ) || isErrVersionNotFound ( err ) {
continue
continue