@ -533,11 +533,11 @@ func (z *xlZones) DeleteObjects(ctx context.Context, bucket string, objects []st
return derrs , nil
return derrs , nil
}
}
func ( z * xlZones ) CopyObject ( ctx context . Context , srcBucket , srcObject , de stBucket , de stObject string , srcInfo ObjectInfo , srcOpts , dstOpts ObjectOptions ) ( objInfo ObjectInfo , err error ) {
func ( z * xlZones ) CopyObject ( ctx context . Context , srcBucket , srcObject , dstBucket , dstObject string , srcInfo ObjectInfo , srcOpts , dstOpts ObjectOptions ) ( objInfo ObjectInfo , err error ) {
// Check if this request is only metadata update.
// Check if this request is only metadata update.
cpSrcDstSame := isStringEqual ( pathJoin ( srcBucket , srcObject ) , pathJoin ( de stBucket , de stObject ) )
cpSrcDstSame := isStringEqual ( pathJoin ( srcBucket , srcObject ) , pathJoin ( dstBucket , dstObject ) )
if ! cpSrcDstSame {
if ! cpSrcDstSame {
lk := z . NewNSLock ( ctx , de stBucket , de stObject )
lk := z . NewNSLock ( ctx , dstBucket , dstObject )
if err := lk . GetLock ( globalObjectTimeout ) ; err != nil {
if err := lk . GetLock ( globalObjectTimeout ) ; err != nil {
return objInfo , err
return objInfo , err
}
}
@ -545,24 +545,30 @@ func (z *xlZones) CopyObject(ctx context.Context, srcBucket, srcObject, destBuck
}
}
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return z . zones [ 0 ] . CopyObject ( ctx , srcBucket , srcObject , de stBucket , de stObject , srcInfo , srcOpts , dstOpts )
return z . zones [ 0 ] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
}
}
if cpSrcDstSame && srcInfo . metadataOnly {
for _ , zone := range z . zones {
zoneIndex := - 1
objInfo , err = zone . CopyObject ( ctx , srcBucket , srcObject , destBucket ,
for i , zone := range z . zones {
destObject , srcInfo , srcOpts , dst Opts )
objInfo , err := zone . GetObjectInfo ( ctx , dstBucket , dstObject , src Opts)
if err != nil {
if err != nil {
if isErrObjectNotFound ( err ) {
if isErrObjectNotFound ( err ) {
continue
continue
}
}
return objInfo , err
return objInfo , err
}
}
return objInfo , nil
zoneIndex = i
break
}
}
return objInfo , ObjectNotFound { Bucket : srcBucket , Object : srcObject }
putOpts := ObjectOptions { ServerSideEncryption : dstOpts . ServerSideEncryption , UserDefined : srcInfo . UserDefined }
if zoneIndex >= 0 {
if cpSrcDstSame && srcInfo . metadataOnly {
return z . zones [ zoneIndex ] . CopyObject ( ctx , srcBucket , srcObject , dstBucket , dstObject , srcInfo , srcOpts , dstOpts )
}
}
return z . zones [ z . getAvailableZoneIdx ( ctx ) ] . CopyObject ( ctx , srcBucket , srcObject ,
return z . zones [ zoneIndex ] . PutObject ( ctx , dstBucket , dstObject , srcInfo . PutObjReader , putOpts )
destBucket , destObject , srcInfo , srcOpts , dstOpts )
}
return z . zones [ z . getAvailableZoneIdx ( ctx ) ] . PutObject ( ctx , dstBucket , dstObject , srcInfo . PutObjReader , putOpts )
}
}
func ( z * xlZones ) ListObjectsV2 ( ctx context . Context , bucket , prefix , continuationToken , delimiter string , maxKeys int , fetchOwner bool , startAfter string ) ( ListObjectsV2Info , error ) {
func ( z * xlZones ) ListObjectsV2 ( ctx context . Context , bucket , prefix , continuationToken , delimiter string , maxKeys int , fetchOwner bool , startAfter string ) ( ListObjectsV2Info , error ) {
@ -1050,6 +1056,7 @@ func (z *xlZones) PutObjectPart(ctx context.Context, bucket, object, uploadID st
if z . SingleZone ( ) {
if z . SingleZone ( ) {
return z . zones [ 0 ] . PutObjectPart ( ctx , bucket , object , uploadID , partID , data , opts )
return z . zones [ 0 ] . PutObjectPart ( ctx , bucket , object , uploadID , partID , data , opts )
}
}
for _ , zone := range z . zones {
for _ , zone := range z . zones {
_ , err := zone . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
_ , err := zone . GetMultipartInfo ( ctx , bucket , object , uploadID , opts )
if err == nil {
if err == nil {