XL/Incompleteuploads: list should save the tree-walk go routine to the map if eof is not reached. (#1695)

master
Krishna Srinivas 9 years ago committed by Harshavardhana
parent 5b95f097d4
commit b83b87a7f6
  1. 16
      object-common-multipart.go

@ -357,6 +357,7 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa
// Following loop gathers and filters out special files inside // Following loop gathers and filters out special files inside
// minio meta volume. // minio meta volume.
outerLoop:
for { for {
walkResult, ok := <-walker.ch walkResult, ok := <-walker.ch
if !ok { if !ok {
@ -397,9 +398,9 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa
fileInfos = append(fileInfos, fileInfo) fileInfos = append(fileInfos, fileInfo)
newMaxKeys++ newMaxKeys++
// If we have reached the maxKeys, it means we have listed // If we have reached the maxKeys, it means we have listed
// everything that was requested. Return right here. // everything that was requested.
if newMaxKeys == maxKeys { if newMaxKeys == maxKeys {
return break outerLoop
} }
} }
} else { } else {
@ -415,13 +416,20 @@ func listMetaBucketMultipartFiles(layer ObjectLayer, prefixPath string, markerPa
fileInfos = append(fileInfos, fi) fileInfos = append(fileInfos, fi)
newMaxKeys++ newMaxKeys++
// If we have reached the maxKeys, it means we have listed // If we have reached the maxKeys, it means we have listed
// everything that was requested. Return right here. // everything that was requested.
if newMaxKeys == maxKeys { if newMaxKeys == maxKeys {
return break
} }
} }
} }
if !eof && len(fileInfos) != 0 {
// EOF has not reached, hence save the walker channel to the map so that the walker go routine
// can continue from where it left off for the next list request.
lastFileInfo := fileInfos[len(fileInfos)-1]
markerPath = lastFileInfo.Name
saveTreeWalk(layer, listParams{minioMetaBucket, recursive, markerPath, prefixPath}, walker)
}
// Return entries here. // Return entries here.
return fileInfos, eof, nil return fileInfos, eof, nil
} }

Loading…
Cancel
Save