mirror of
https://github.com/minio/minio.git
synced 2025-01-27 14:43:18 -05:00
XL/GetObject: When disk is not available, checksum should be empty. (#2276)
This commit is contained in:
parent
79bab6b561
commit
9212e11b90
@ -156,7 +156,7 @@ func (m *xlMetaV1) AddCheckSum(partName, algorithm, checkSum string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCheckSum - get checksum of a part.
|
// GetCheckSum - get checksum of a part.
|
||||||
func (m *xlMetaV1) GetCheckSum(partName string) (checkSum, algorithm string, err error) {
|
func (m xlMetaV1) GetCheckSum(partName string) (checkSum, algorithm string, err error) {
|
||||||
for _, sum := range m.Erasure.Checksum {
|
for _, sum := range m.Erasure.Checksum {
|
||||||
if sum.Name == partName {
|
if sum.Name == partName {
|
||||||
return sum.Hash, sum.Algorithm, nil
|
return sum.Hash, sum.Algorithm, nil
|
||||||
|
@ -79,14 +79,12 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64, length i
|
|||||||
onlineDisks, modTime := listOnlineDisks(xl.storageDisks, metaArr, errs)
|
onlineDisks, modTime := listOnlineDisks(xl.storageDisks, metaArr, errs)
|
||||||
|
|
||||||
// Pick latest valid metadata.
|
// Pick latest valid metadata.
|
||||||
var xlMeta xlMetaV1
|
xlMeta := pickValidXLMeta(metaArr, modTime)
|
||||||
for _, meta := range metaArr {
|
|
||||||
if meta.IsValid() && meta.Stat.ModTime == modTime {
|
// Reorder online disks based on erasure distribution order.
|
||||||
xlMeta = meta
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onlineDisks = getOrderedDisks(xlMeta.Erasure.Distribution, onlineDisks)
|
onlineDisks = getOrderedDisks(xlMeta.Erasure.Distribution, onlineDisks)
|
||||||
|
|
||||||
|
// Reorder parts metadata based on erasure distribution order.
|
||||||
metaArr = getOrderedPartsMetadata(xlMeta.Erasure.Distribution, metaArr)
|
metaArr = getOrderedPartsMetadata(xlMeta.Erasure.Distribution, metaArr)
|
||||||
|
|
||||||
// Reply back invalid range if the input offset and length fall out of range.
|
// Reply back invalid range if the input offset and length fall out of range.
|
||||||
@ -172,9 +170,14 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64, length i
|
|||||||
|
|
||||||
// Get the checksums of the current part.
|
// Get the checksums of the current part.
|
||||||
checkSums := make([]string, len(onlineDisks))
|
checkSums := make([]string, len(onlineDisks))
|
||||||
for index := range onlineDisks {
|
for index, disk := range onlineDisks {
|
||||||
|
// Disk is not found skip the checksum.
|
||||||
|
if disk == nil {
|
||||||
|
checkSums[index] = ""
|
||||||
|
continue
|
||||||
|
}
|
||||||
checkSums[index], _, err = metaArr[index].GetCheckSum(partName)
|
checkSums[index], _, err = metaArr[index].GetCheckSum(partName)
|
||||||
if err != nil {
|
if err != nil { // FIXME - relook at returning error here.
|
||||||
return toObjectErr(err, bucket, object)
|
return toObjectErr(err, bucket, object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user