mirror of
https://github.com/minio/minio.git
synced 2025-01-12 23:43:22 -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.
|
||||
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 {
|
||||
if sum.Name == partName {
|
||||
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)
|
||||
|
||||
// Pick latest valid metadata.
|
||||
var xlMeta xlMetaV1
|
||||
for _, meta := range metaArr {
|
||||
if meta.IsValid() && meta.Stat.ModTime == modTime {
|
||||
xlMeta = meta
|
||||
break
|
||||
}
|
||||
}
|
||||
xlMeta := pickValidXLMeta(metaArr, modTime)
|
||||
|
||||
// Reorder online disks based on erasure distribution order.
|
||||
onlineDisks = getOrderedDisks(xlMeta.Erasure.Distribution, onlineDisks)
|
||||
|
||||
// Reorder parts metadata based on erasure distribution order.
|
||||
metaArr = getOrderedPartsMetadata(xlMeta.Erasure.Distribution, metaArr)
|
||||
|
||||
// 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.
|
||||
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)
|
||||
if err != nil {
|
||||
if err != nil { // FIXME - relook at returning error here.
|
||||
return toObjectErr(err, bucket, object)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user