|
|
@ -46,6 +46,7 @@ func (er erasureObjects) CopyObject(ctx context.Context, srcBucket, srcObject, d |
|
|
|
if !srcInfo.metadataOnly { |
|
|
|
if !srcInfo.metadataOnly { |
|
|
|
return oi, NotImplemented{} |
|
|
|
return oi, NotImplemented{} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
defer ObjectPathUpdated(path.Join(dstBucket, dstObject)) |
|
|
|
defer ObjectPathUpdated(path.Join(dstBucket, dstObject)) |
|
|
|
lk := er.NewNSLock(ctx, dstBucket, dstObject) |
|
|
|
lk := er.NewNSLock(ctx, dstBucket, dstObject) |
|
|
|
if err := lk.GetLock(globalOperationTimeout); err != nil { |
|
|
|
if err := lk.GetLock(globalOperationTimeout); err != nil { |
|
|
@ -72,6 +73,8 @@ func (er erasureObjects) CopyObject(ctx context.Context, srcBucket, srcObject, d |
|
|
|
return oi, toObjectErr(err, srcBucket, srcObject) |
|
|
|
return oi, toObjectErr(err, srcBucket, srcObject) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onlineDisks, metaArr = shuffleDisksAndPartsMetadataByIndex(onlineDisks, metaArr, fi.Erasure.Distribution) |
|
|
|
|
|
|
|
|
|
|
|
if fi.Deleted { |
|
|
|
if fi.Deleted { |
|
|
|
if srcOpts.VersionID == "" { |
|
|
|
if srcOpts.VersionID == "" { |
|
|
|
return oi, toObjectErr(errFileNotFound, srcBucket, srcObject) |
|
|
|
return oi, toObjectErr(errFileNotFound, srcBucket, srcObject) |
|
|
@ -215,12 +218,10 @@ func (er erasureObjects) GetObject(ctx context.Context, bucket, object string, s |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (er erasureObjects) getObjectWithFileInfo(ctx context.Context, bucket, object string, startOffset int64, length int64, writer io.Writer, etag string, opts ObjectOptions, fi FileInfo, metaArr []FileInfo, onlineDisks []StorageAPI) error { |
|
|
|
func (er erasureObjects) getObjectWithFileInfo(ctx context.Context, bucket, object string, startOffset int64, length int64, writer io.Writer, etag string, opts ObjectOptions, fi FileInfo, metaArr []FileInfo, onlineDisks []StorageAPI) error { |
|
|
|
tmpDisks := onlineDisks |
|
|
|
|
|
|
|
// Reorder online disks based on erasure distribution order.
|
|
|
|
|
|
|
|
onlineDisks = shuffleDisksByIndex(tmpDisks, metaArr) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reorder online disks based on erasure distribution order.
|
|
|
|
// Reorder parts metadata based on erasure distribution order.
|
|
|
|
// Reorder parts metadata based on erasure distribution order.
|
|
|
|
metaArr = shufflePartsMetadataByIndex(tmpDisks, metaArr) |
|
|
|
onlineDisks, metaArr = shuffleDisksAndPartsMetadataByIndex(onlineDisks, metaArr, fi.Erasure.Distribution) |
|
|
|
|
|
|
|
|
|
|
|
// For negative length read everything.
|
|
|
|
// For negative length read everything.
|
|
|
|
if length < 0 { |
|
|
|
if length < 0 { |
|
|
@ -375,7 +376,6 @@ func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object s |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return fi, nil, nil, err |
|
|
|
return fi, nil, nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return fi, metaArr, onlineDisks, nil |
|
|
|
return fi, metaArr, onlineDisks, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -584,7 +584,8 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Order disks according to erasure distribution
|
|
|
|
// Order disks according to erasure distribution
|
|
|
|
onlineDisks := shuffleDisks(storageDisks, fi.Erasure.Distribution) |
|
|
|
var onlineDisks []StorageAPI |
|
|
|
|
|
|
|
onlineDisks, partsMetadata = shuffleDisksAndPartsMetadata(storageDisks, partsMetadata, fi.Erasure.Distribution) |
|
|
|
|
|
|
|
|
|
|
|
erasure, err := NewErasure(ctx, fi.Erasure.DataBlocks, fi.Erasure.ParityBlocks, fi.Erasure.BlockSize) |
|
|
|
erasure, err := NewErasure(ctx, fi.Erasure.DataBlocks, fi.Erasure.ParityBlocks, fi.Erasure.BlockSize) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -973,7 +974,7 @@ func (er erasureObjects) PutObjectTags(ctx context.Context, bucket, object strin |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// List all online disks.
|
|
|
|
// List all online disks.
|
|
|
|
_, modTime := listOnlineDisks(disks, metaArr, errs) |
|
|
|
onlineDisks, modTime := listOnlineDisks(disks, metaArr, errs) |
|
|
|
|
|
|
|
|
|
|
|
// Pick latest valid metadata.
|
|
|
|
// Pick latest valid metadata.
|
|
|
|
fi, err := pickValidFileInfo(ctx, metaArr, modTime, readQuorum) |
|
|
|
fi, err := pickValidFileInfo(ctx, metaArr, modTime, readQuorum) |
|
|
@ -981,6 +982,8 @@ func (er erasureObjects) PutObjectTags(ctx context.Context, bucket, object strin |
|
|
|
return toObjectErr(err, bucket, object) |
|
|
|
return toObjectErr(err, bucket, object) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onlineDisks, metaArr = shuffleDisksAndPartsMetadataByIndex(onlineDisks, metaArr, fi.Erasure.Distribution) |
|
|
|
|
|
|
|
|
|
|
|
if fi.Deleted { |
|
|
|
if fi.Deleted { |
|
|
|
if opts.VersionID == "" { |
|
|
|
if opts.VersionID == "" { |
|
|
|
return toObjectErr(errFileNotFound, bucket, object) |
|
|
|
return toObjectErr(errFileNotFound, bucket, object) |
|
|
@ -1006,12 +1009,12 @@ func (er erasureObjects) PutObjectTags(ctx context.Context, bucket, object strin |
|
|
|
tempObj := mustGetUUID() |
|
|
|
tempObj := mustGetUUID() |
|
|
|
|
|
|
|
|
|
|
|
// Write unique `xl.meta` for each disk.
|
|
|
|
// Write unique `xl.meta` for each disk.
|
|
|
|
if disks, err = writeUniqueFileInfo(ctx, disks, minioMetaTmpBucket, tempObj, metaArr, writeQuorum); err != nil { |
|
|
|
if onlineDisks, err = writeUniqueFileInfo(ctx, onlineDisks, minioMetaTmpBucket, tempObj, metaArr, writeQuorum); err != nil { |
|
|
|
return toObjectErr(err, bucket, object) |
|
|
|
return toObjectErr(err, bucket, object) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Atomically rename metadata from tmp location to destination for each disk.
|
|
|
|
// Atomically rename metadata from tmp location to destination for each disk.
|
|
|
|
if _, err = renameFileInfo(ctx, disks, minioMetaTmpBucket, tempObj, bucket, object, writeQuorum); err != nil { |
|
|
|
if _, err = renameFileInfo(ctx, onlineDisks, minioMetaTmpBucket, tempObj, bucket, object, writeQuorum); err != nil { |
|
|
|
return toObjectErr(err, bucket, object) |
|
|
|
return toObjectErr(err, bucket, object) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|