mirror of
https://github.com/minio/minio.git
synced 2025-04-20 18:44:21 -04:00
parent
ac7a7cec20
commit
ad8e27a963
@ -1,6 +1,6 @@
|
|||||||
### xl.json
|
### file.json
|
||||||
|
|
||||||
``xl.json`` is a special file captured and written by XL storage API layer
|
``file.json`` is a special file captured and written by XL storage API layer
|
||||||
to interpret, manage and extract erasured data to multiple disks.
|
to interpret, manage and extract erasured data to multiple disks.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@ -9,6 +9,7 @@ to interpret, manage and extract erasured data to multiple disks.
|
|||||||
"stat": {
|
"stat": {
|
||||||
"size": 24256,
|
"size": 24256,
|
||||||
"modTime": "2016-04-28T00:11:37.843Z",
|
"modTime": "2016-04-28T00:11:37.843Z",
|
||||||
|
"delete": false,
|
||||||
"version": 0
|
"version": 0
|
||||||
},
|
},
|
||||||
"erasure": {
|
"erasure": {
|
||||||
@ -30,6 +31,7 @@ to interpret, manage and extract erasured data to multiple disks.
|
|||||||
|
|
||||||
- "size" // Size of the file.
|
- "size" // Size of the file.
|
||||||
- "modTime" // Modified time of the file.
|
- "modTime" // Modified time of the file.
|
||||||
|
- "deleted" // Field to track if the file is deleted when disks are down.
|
||||||
- "version" // File version tracked when disks are down.
|
- "version" // File version tracked when disks are down.
|
||||||
|
|
||||||
- "erasure" // Erasure metadata for the written file.
|
- "erasure" // Erasure metadata for the written file.
|
@ -112,7 +112,7 @@ func (xl XL) listOnlineDisks(volume, path string) (onlineDisks []StorageAPI, mda
|
|||||||
return onlineDisks, mdata, heal, nil
|
return onlineDisks, mdata, heal, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get xl.json metadata as a map slice.
|
// Get file.json metadata as a map slice.
|
||||||
// Returns error slice indicating the failed metadata reads.
|
// Returns error slice indicating the failed metadata reads.
|
||||||
// Read lockNS() should be done by caller.
|
// Read lockNS() should be done by caller.
|
||||||
func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) {
|
func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) {
|
||||||
@ -130,7 +130,7 @@ func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) {
|
|||||||
|
|
||||||
metadata, err := xlMetaV1Decode(metadataReader)
|
metadata, err := xlMetaV1Decode(metadataReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Unable to parse xl.json, set error.
|
// Unable to parse file.json, set error.
|
||||||
errs[index] = err
|
errs[index] = err
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -139,8 +139,8 @@ func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) {
|
|||||||
return metadataArray, errs
|
return metadataArray, errs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes/Updates `xl.json` for given file. updateParts carries
|
// Writes/Updates `file.json` for given file. updateParts carries
|
||||||
// index of disks where `xl.json` needs to be updated.
|
// index of disks where `file.json` needs to be updated.
|
||||||
//
|
//
|
||||||
// Returns collection of errors, indexed in accordance with input
|
// Returns collection of errors, indexed in accordance with input
|
||||||
// updateParts order.
|
// updateParts order.
|
||||||
|
@ -29,8 +29,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Part metadata file.
|
// XL erasure metadata file.
|
||||||
xlMetaV1File = "xl.json"
|
xlMetaV1File = "file.json"
|
||||||
// Maximum erasure blocks.
|
// Maximum erasure blocks.
|
||||||
maxErasureBlocks = 16
|
maxErasureBlocks = 16
|
||||||
)
|
)
|
||||||
@ -590,7 +590,7 @@ func listFiles(disk StorageAPI, volume, prefix, marker string, recursive bool, c
|
|||||||
markerPath = fsFilesInfo[len(fsFilesInfo)-1].Name
|
markerPath = fsFilesInfo[len(fsFilesInfo)-1].Name
|
||||||
}
|
}
|
||||||
if count == 0 && recursive && !strings.HasSuffix(markerPath, xlMetaV1File) {
|
if count == 0 && recursive && !strings.HasSuffix(markerPath, xlMetaV1File) {
|
||||||
// If last entry is not xl.json then loop once more to check if we have reached eof.
|
// If last entry is not file.json then loop once more to check if we have reached eof.
|
||||||
fsFilesInfo, eof, err = disk.ListFiles(volume, prefix, markerPath, recursive, 1)
|
fsFilesInfo, eof, err = disk.ListFiles(volume, prefix, markerPath, recursive, 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(logrus.Fields{
|
log.WithFields(logrus.Fields{
|
||||||
@ -603,17 +603,17 @@ func listFiles(disk StorageAPI, volume, prefix, marker string, recursive bool, c
|
|||||||
return nil, true, err
|
return nil, true, err
|
||||||
}
|
}
|
||||||
if !eof {
|
if !eof {
|
||||||
// file.N and xl.json are always in pairs and hence this
|
// file.N and file.json are always in pairs and hence this
|
||||||
// entry has to be xl.json. If not better to manually investigate
|
// entry has to be file.json. If not better to manually investigate
|
||||||
// and fix it.
|
// and fix it.
|
||||||
// For the next ListFiles() call we can safely assume that the
|
// For the next ListFiles() call we can safely assume that the
|
||||||
// marker is "object/xl.json"
|
// marker is "object/file.json"
|
||||||
if !strings.HasSuffix(fsFilesInfo[0].Name, xlMetaV1File) {
|
if !strings.HasSuffix(fsFilesInfo[0].Name, xlMetaV1File) {
|
||||||
log.WithFields(logrus.Fields{
|
log.WithFields(logrus.Fields{
|
||||||
"volume": volume,
|
"volume": volume,
|
||||||
"prefix": prefix,
|
"prefix": prefix,
|
||||||
"fsFileInfo.Name": fsFilesInfo[0].Name,
|
"fsFileInfo.Name": fsFilesInfo[0].Name,
|
||||||
}).Errorf("ListFiles failed with %s, expected %s to be a xl.json file.", err, fsFilesInfo[0].Name)
|
}).Errorf("ListFiles failed with %s, expected %s to be a file.json file.", err, fsFilesInfo[0].Name)
|
||||||
return nil, true, errUnexpected
|
return nil, true, errUnexpected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user