|
|
@ -71,7 +71,7 @@ func (er erasureObjects) removeObjectPart(bucket, object, uploadID, dataDir stri |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Clean-up the old multipart uploads. Should be run in a Go routine.
|
|
|
|
// Clean-up the old multipart uploads. Should be run in a Go routine.
|
|
|
|
func (er erasureObjects) cleanupStaleMultipartUploads(ctx context.Context, cleanupInterval, expiry time.Duration) { |
|
|
|
func (er erasureObjects) cleanupStaleUploads(ctx context.Context, cleanupInterval, expiry time.Duration) { |
|
|
|
ticker := time.NewTicker(cleanupInterval) |
|
|
|
ticker := time.NewTicker(cleanupInterval) |
|
|
|
defer ticker.Stop() |
|
|
|
defer ticker.Stop() |
|
|
|
|
|
|
|
|
|
|
@ -91,13 +91,13 @@ func (er erasureObjects) cleanupStaleMultipartUploads(ctx context.Context, clean |
|
|
|
if disk == nil { |
|
|
|
if disk == nil { |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
er.cleanupStaleMultipartUploadsOnDisk(ctx, disk, expiry) |
|
|
|
er.cleanupStaleUploadsOnDisk(ctx, disk, expiry) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Remove the old multipart uploads on the given disk.
|
|
|
|
// Remove the old multipart uploads on the given disk.
|
|
|
|
func (er erasureObjects) cleanupStaleMultipartUploadsOnDisk(ctx context.Context, disk StorageAPI, expiry time.Duration) { |
|
|
|
func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk StorageAPI, expiry time.Duration) { |
|
|
|
now := time.Now() |
|
|
|
now := time.Now() |
|
|
|
shaDirs, err := disk.ListDir(ctx, minioMetaMultipartBucket, "", -1) |
|
|
|
shaDirs, err := disk.ListDir(ctx, minioMetaMultipartBucket, "", -1) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -119,6 +119,19 @@ func (er erasureObjects) cleanupStaleMultipartUploadsOnDisk(ctx context.Context, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
tmpDirs, err := disk.ListDir(ctx, minioMetaTmpBucket, "", -1) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for _, tmpDir := range tmpDirs { |
|
|
|
|
|
|
|
fi, err := disk.ReadVersion(ctx, minioMetaTmpBucket, tmpDir, "") |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if now.Sub(fi.ModTime) > expiry { |
|
|
|
|
|
|
|
er.deleteObject(ctx, minioMetaTmpBucket, tmpDir, fi.Erasure.DataBlocks+1) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ListMultipartUploads - lists all the pending multipart
|
|
|
|
// ListMultipartUploads - lists all the pending multipart
|
|
|
|