XL: Add new metadata for checksum. (#1743)

This commit is contained in:
Harshavardhana
2016-05-24 17:48:58 -07:00
committed by Harshavardhana
parent b38b9fea79
commit 1e393c6c5b
7 changed files with 48 additions and 31 deletions
+3 -6
View File
@@ -37,8 +37,6 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64) (io.Read
return nil, toObjectErr(err, bucket, object)
}
totalObjectSize := xlMeta.Stat.Size // Total object size.
// Hold a read lock once more which can be released after the following go-routine ends.
// We hold RLock once more because the current function would return before the go routine below
// executes and hence releasing the read lock (because of defer'ed nsMutex.RUnlock() call).
@@ -47,7 +45,7 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64) (io.Read
defer nsMutex.RUnlock(bucket, object)
for ; partIndex < len(xlMeta.Parts); partIndex++ {
part := xlMeta.Parts[partIndex]
r, err := xl.erasureDisk.ReadFile(bucket, pathJoin(object, part.Name), offset, totalObjectSize)
r, err := xl.erasureDisk.ReadFile(bucket, pathJoin(object, part.Name), offset, part.Size)
if err != nil {
fileWriter.CloseWithError(err)
return
@@ -96,8 +94,7 @@ func (xl xlObjects) getObjectInfo(bucket, object string) (objInfo ObjectInfo, er
// Count for errors encountered.
var xlJSONErrCount = 0
// Loop through and return the first success entry based on the
// selected random disk.
// Return the first success entry based on the selected random disk.
for xlJSONErrCount < len(xl.storageDisks) {
// Choose a random disk on each attempt, do not hit the same disk all the time.
disk := xl.getRandomDisk() // Pick a random disk.
@@ -314,7 +311,7 @@ func (xl xlObjects) deleteObject(bucket, object string) error {
wg.Wait()
var fileNotFoundCnt, deleteFileErr int
// Loop through all the concocted errors.
// Count for specific errors.
for _, err := range dErrs {
if err == nil {
continue