XL/bucket: Remove bucket should cleanup incomplete uploads as well. (#2173)

This behavior is in accordance with S3.

Fixes #2170
This commit is contained in:
Harshavardhana
2016-07-12 01:01:47 -07:00
committed by GitHub
parent 1c82b81408
commit 126865e8df
3 changed files with 24 additions and 12 deletions

View File

@@ -17,6 +17,7 @@
package main
import (
"path"
"sort"
"sync"
)
@@ -238,7 +239,14 @@ func (xl xlObjects) DeleteBucket(bucket string) error {
// Delete volume inside a go-routine.
go func(index int, disk StorageAPI) {
defer wg.Done()
// Attempt to delete bucket.
err := disk.DeleteVol(bucket)
if err != nil {
dErrs[index] = err
return
}
// Cleanup all the previously incomplete multiparts.
err = cleanupDir(disk, path.Join(minioMetaBucket, mpartMetaPrefix), bucket)
if err != nil {
dErrs[index] = err
}
@@ -248,8 +256,7 @@ func (xl xlObjects) DeleteBucket(bucket string) error {
// Wait for all the delete vols to finish.
wg.Wait()
// Count the errors for known errors, return quickly if we found
// an unknown error.
// Count the errors for known errors, return quickly if we found an unknown error.
for _, err := range dErrs {
if err != nil {
if isErrIgnored(err, objMetadataOpIgnoredErrs) {