mirror of
https://github.com/minio/minio.git
synced 2025-04-16 17:00:07 -04:00
xl: Heal format.json
properly on fresh disks.
This commit is contained in:
parent
9998e9ea19
commit
182109f0de
@ -524,6 +524,11 @@ func healFormatXLFreshDisks(storageDisks []StorageAPI) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize meta volume, if volume already exists ignores it.
|
||||||
|
if err := initMetaVolume(orderedDisks); err != nil {
|
||||||
|
return fmt.Errorf("Unable to initialize '.minio.sys' meta volume, %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Save new `format.json` across all disks, in JBOD order.
|
// Save new `format.json` across all disks, in JBOD order.
|
||||||
return saveFormatXL(orderedDisks, newFormatConfigs)
|
return saveFormatXL(orderedDisks, newFormatConfigs)
|
||||||
}
|
}
|
||||||
@ -872,7 +877,7 @@ func initFormatXL(storageDisks []StorageAPI) (err error) {
|
|||||||
|
|
||||||
// Initialize meta volume, if volume already exists ignores it.
|
// Initialize meta volume, if volume already exists ignores it.
|
||||||
if err := initMetaVolume(storageDisks); err != nil {
|
if err := initMetaVolume(storageDisks); err != nil {
|
||||||
return fmt.Errorf("Unable to initialize '.minio' meta volume, %s", err)
|
return fmt.Errorf("Unable to initialize '.minio.sys' meta volume, %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save formats `format.json` across all disks.
|
// Save formats `format.json` across all disks.
|
||||||
|
@ -221,7 +221,7 @@ func (fs fsObjects) ListMultipartUploads(bucket, prefix, keyMarker, uploadIDMark
|
|||||||
// request, returns back a unique upload id.
|
// request, returns back a unique upload id.
|
||||||
//
|
//
|
||||||
// Internally this function creates 'uploads.json' associated for the
|
// Internally this function creates 'uploads.json' associated for the
|
||||||
// incoming object at '.minio/multipart/bucket/object/uploads.json' on
|
// incoming object at '.minio.sys/multipart/bucket/object/uploads.json' on
|
||||||
// all the disks. `uploads.json` carries metadata regarding on going
|
// all the disks. `uploads.json` carries metadata regarding on going
|
||||||
// multipart operation on the object.
|
// multipart operation on the object.
|
||||||
func (fs fsObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) {
|
func (fs fsObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) {
|
||||||
@ -237,7 +237,7 @@ func (fs fsObjects) newMultipartUpload(bucket string, object string, meta map[st
|
|||||||
// used for instrumentation on locks.
|
// used for instrumentation on locks.
|
||||||
opsID := getOpsID()
|
opsID := getOpsID()
|
||||||
|
|
||||||
// This lock needs to be held for any changes to the directory contents of ".minio/multipart/object/"
|
// This lock needs to be held for any changes to the directory contents of ".minio.sys/multipart/object/"
|
||||||
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
||||||
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
||||||
|
|
||||||
@ -393,8 +393,8 @@ func appendParts(disk StorageAPI, bucket, object, uploadID, opsID string) {
|
|||||||
|
|
||||||
// PutObjectPart - reads incoming data until EOF for the part file on
|
// PutObjectPart - reads incoming data until EOF for the part file on
|
||||||
// an ongoing multipart transaction. Internally incoming data is
|
// an ongoing multipart transaction. Internally incoming data is
|
||||||
// written to '.minio/tmp' location and safely renamed to
|
// written to '.minio.sys/tmp' location and safely renamed to
|
||||||
// '.minio/multipart' for reach parts.
|
// '.minio.sys/multipart' for reach parts.
|
||||||
func (fs fsObjects) PutObjectPart(bucket, object, uploadID string, partID int, size int64, data io.Reader, md5Hex string) (string, error) {
|
func (fs fsObjects) PutObjectPart(bucket, object, uploadID string, partID int, size int64, data io.Reader, md5Hex string) (string, error) {
|
||||||
// Verify if bucket is valid.
|
// Verify if bucket is valid.
|
||||||
if !IsValidBucketName(bucket) {
|
if !IsValidBucketName(bucket) {
|
||||||
@ -513,8 +513,8 @@ func (fs fsObjects) PutObjectPart(bucket, object, uploadID string, partID int, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// listObjectParts - wrapper scanning through
|
// listObjectParts - wrapper scanning through
|
||||||
// '.minio/multipart/bucket/object/UPLOADID'. Lists all the parts
|
// '.minio.sys/multipart/bucket/object/UPLOADID'. Lists all the parts
|
||||||
// saved inside '.minio/multipart/bucket/object/UPLOADID'.
|
// saved inside '.minio.sys/multipart/bucket/object/UPLOADID'.
|
||||||
func (fs fsObjects) listObjectParts(bucket, object, uploadID string, partNumberMarker, maxParts int) (ListPartsInfo, error) {
|
func (fs fsObjects) listObjectParts(bucket, object, uploadID string, partNumberMarker, maxParts int) (ListPartsInfo, error) {
|
||||||
result := ListPartsInfo{}
|
result := ListPartsInfo{}
|
||||||
|
|
||||||
@ -787,7 +787,7 @@ func (fs fsObjects) CompleteMultipartUpload(bucket string, object string, upload
|
|||||||
|
|
||||||
// abortMultipartUpload - wrapper for purging an ongoing multipart
|
// abortMultipartUpload - wrapper for purging an ongoing multipart
|
||||||
// transaction, deletes uploadID entry from `uploads.json` and purges
|
// transaction, deletes uploadID entry from `uploads.json` and purges
|
||||||
// the directory at '.minio/multipart/bucket/object/uploadID' holding
|
// the directory at '.minio.sys/multipart/bucket/object/uploadID' holding
|
||||||
// all the upload parts.
|
// all the upload parts.
|
||||||
func (fs fsObjects) abortMultipartUpload(bucket, object, uploadID string) error {
|
func (fs fsObjects) abortMultipartUpload(bucket, object, uploadID string) error {
|
||||||
// Cleanup all uploaded parts.
|
// Cleanup all uploaded parts.
|
||||||
@ -813,7 +813,7 @@ func (fs fsObjects) abortMultipartUpload(bucket, object, uploadID string) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
} // No more pending uploads for the object, we purge the entire
|
} // No more pending uploads for the object, we purge the entire
|
||||||
// entry at '.minio/multipart/bucket/object'.
|
// entry at '.minio.sys/multipart/bucket/object'.
|
||||||
if err = fs.storage.DeleteFile(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object, uploadsJSONFile)); err != nil {
|
if err = fs.storage.DeleteFile(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object, uploadsJSONFile)); err != nil {
|
||||||
return toObjectErr(traceError(err), minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
return toObjectErr(traceError(err), minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ func newFSObjects(disk string) (ObjectLayer, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to create `.minio`.
|
// Attempt to create `.minio.sys`.
|
||||||
err = storage.MakeVol(minioMetaBucket)
|
err = storage.MakeVol(minioMetaBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -134,7 +134,7 @@ func initMetaVolume(storageDisks []StorageAPI) error {
|
|||||||
// Indicate this wait group is done.
|
// Indicate this wait group is done.
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
// Attempt to create `.minio`.
|
// Attempt to create `.minio.sys`.
|
||||||
err := disk.MakeVol(minioMetaBucket)
|
err := disk.MakeVol(minioMetaBucket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
@ -184,9 +184,13 @@ func xlHouseKeeping(storageDisks []StorageAPI) error {
|
|||||||
|
|
||||||
// Cleanup all temp entries upon start.
|
// Cleanup all temp entries upon start.
|
||||||
err := cleanupDir(disk, minioMetaBucket, tmpMetaPrefix)
|
err := cleanupDir(disk, minioMetaBucket, tmpMetaPrefix)
|
||||||
if err != nil && err != errDiskNotFound {
|
if err != nil {
|
||||||
|
switch errorCause(err) {
|
||||||
|
case errDiskNotFound, errVolumeNotFound:
|
||||||
|
default:
|
||||||
errs[index] = err
|
errs[index] = err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}(index, disk)
|
}(index, disk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ func (xl xlObjects) ListMultipartUploads(bucket, prefix, keyMarker, uploadIDMark
|
|||||||
// request, returns back a unique upload id.
|
// request, returns back a unique upload id.
|
||||||
//
|
//
|
||||||
// Internally this function creates 'uploads.json' associated for the
|
// Internally this function creates 'uploads.json' associated for the
|
||||||
// incoming object at '.minio/multipart/bucket/object/uploads.json' on
|
// incoming object at '.minio.sys/multipart/bucket/object/uploads.json' on
|
||||||
// all the disks. `uploads.json` carries metadata regarding on going
|
// all the disks. `uploads.json` carries metadata regarding on going
|
||||||
// multipart operation on the object.
|
// multipart operation on the object.
|
||||||
func (xl xlObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) {
|
func (xl xlObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) {
|
||||||
@ -282,7 +282,7 @@ func (xl xlObjects) newMultipartUpload(bucket string, object string, meta map[st
|
|||||||
// used for instrumentation on locks.
|
// used for instrumentation on locks.
|
||||||
opsID := getOpsID()
|
opsID := getOpsID()
|
||||||
|
|
||||||
// This lock needs to be held for any changes to the directory contents of ".minio/multipart/object/"
|
// This lock needs to be held for any changes to the directory contents of ".minio.sys/multipart/object/"
|
||||||
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
||||||
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object), opsID)
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload
|
|||||||
// Return success.
|
// Return success.
|
||||||
return s3MD5, nil
|
return s3MD5, nil
|
||||||
} // No more pending uploads for the object, proceed to delete
|
} // No more pending uploads for the object, proceed to delete
|
||||||
// object completely from '.minio/multipart'.
|
// object completely from '.minio.sys/multipart'.
|
||||||
if err = xl.deleteObject(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err != nil {
|
if err = xl.deleteObject(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err != nil {
|
||||||
return "", toObjectErr(err, minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
return "", toObjectErr(err, minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
||||||
}
|
}
|
||||||
@ -837,7 +837,7 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload
|
|||||||
|
|
||||||
// abortMultipartUpload - wrapper for purging an ongoing multipart
|
// abortMultipartUpload - wrapper for purging an ongoing multipart
|
||||||
// transaction, deletes uploadID entry from `uploads.json` and purges
|
// transaction, deletes uploadID entry from `uploads.json` and purges
|
||||||
// the directory at '.minio/multipart/bucket/object/uploadID' holding
|
// the directory at '.minio.sys/multipart/bucket/object/uploadID' holding
|
||||||
// all the upload parts.
|
// all the upload parts.
|
||||||
func (xl xlObjects) abortMultipartUpload(bucket, object, uploadID string) (err error) {
|
func (xl xlObjects) abortMultipartUpload(bucket, object, uploadID string) (err error) {
|
||||||
// Cleanup all uploaded parts.
|
// Cleanup all uploaded parts.
|
||||||
@ -870,7 +870,7 @@ func (xl xlObjects) abortMultipartUpload(bucket, object, uploadID string) (err e
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
} // No more pending uploads for the object, we purge the entire
|
} // No more pending uploads for the object, we purge the entire
|
||||||
// entry at '.minio/multipart/bucket/object'.
|
// entry at '.minio.sys/multipart/bucket/object'.
|
||||||
if err = xl.deleteObject(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err != nil {
|
if err = xl.deleteObject(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err != nil {
|
||||||
return toObjectErr(err, minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
return toObjectErr(err, minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user