mirror of
https://github.com/minio/minio.git
synced 2025-04-29 06:08:00 -04:00
allow multipart uploads expiration to be dynamic (#20190)
allow multipart uploads expiration to be dyamic It would seem like the new values will take effect only after a restart for changes in multipart_expiration. This PR fixes this by making it dynamic as it should have been.
This commit is contained in:
parent
80ff907d08
commit
f13c04629b
@ -123,7 +123,7 @@ func (er erasureObjects) cleanupMultipartPath(ctx context.Context, paths ...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) cleanupStaleUploads(ctx context.Context, expiry time.Duration) {
|
func (er erasureObjects) cleanupStaleUploads(ctx context.Context) {
|
||||||
// run multiple cleanup's local to this server.
|
// run multiple cleanup's local to this server.
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for _, disk := range er.getLocalDisks() {
|
for _, disk := range er.getLocalDisks() {
|
||||||
@ -131,7 +131,7 @@ func (er erasureObjects) cleanupStaleUploads(ctx context.Context, expiry time.Du
|
|||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(disk StorageAPI) {
|
go func(disk StorageAPI) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
er.cleanupStaleUploadsOnDisk(ctx, disk, expiry)
|
er.cleanupStaleUploadsOnDisk(ctx, disk)
|
||||||
}(disk)
|
}(disk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ func (er erasureObjects) deleteAll(ctx context.Context, bucket, prefix string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the old multipart uploads on the given disk.
|
// Remove the old multipart uploads on the given disk.
|
||||||
func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk StorageAPI, expiry time.Duration) {
|
func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk StorageAPI) {
|
||||||
drivePath := disk.Endpoint().Path
|
drivePath := disk.Endpoint().Path
|
||||||
|
|
||||||
readDirFn(pathJoin(drivePath, minioMetaMultipartBucket), func(shaDir string, typ os.FileMode) error {
|
readDirFn(pathJoin(drivePath, minioMetaMultipartBucket), func(shaDir string, typ os.FileMode) error {
|
||||||
@ -183,7 +183,7 @@ func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk Sto
|
|||||||
modTime = fi.ModTime
|
modTime = fi.ModTime
|
||||||
wait()
|
wait()
|
||||||
}
|
}
|
||||||
if time.Since(modTime) < expiry {
|
if time.Since(modTime) < globalAPIConfig.getStaleUploadsExpiry() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
w := xioutil.NewDeadlineWorker(globalDriveConfig.GetMaxTimeout())
|
w := xioutil.NewDeadlineWorker(globalDriveConfig.GetMaxTimeout())
|
||||||
@ -202,7 +202,7 @@ func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk Sto
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Modtime is returned in the Created field. See (*xlStorage).StatVol
|
// Modtime is returned in the Created field. See (*xlStorage).StatVol
|
||||||
if time.Since(vi.Created) < expiry {
|
if time.Since(vi.Created) < globalAPIConfig.getStaleUploadsExpiry() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
w := xioutil.NewDeadlineWorker(globalDriveConfig.GetMaxTimeout())
|
w := xioutil.NewDeadlineWorker(globalDriveConfig.GetMaxTimeout())
|
||||||
@ -231,7 +231,7 @@ func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk Sto
|
|||||||
w := xioutil.NewDeadlineWorker(globalDriveConfig.GetMaxTimeout())
|
w := xioutil.NewDeadlineWorker(globalDriveConfig.GetMaxTimeout())
|
||||||
return w.Run(func() error {
|
return w.Run(func() error {
|
||||||
wait := deleteMultipartCleanupSleeper.Timer(ctx)
|
wait := deleteMultipartCleanupSleeper.Timer(ctx)
|
||||||
if time.Since(vi.Created) > expiry {
|
if time.Since(vi.Created) > globalAPIConfig.getStaleUploadsExpiry() {
|
||||||
pathUUID := mustGetUUID()
|
pathUUID := mustGetUUID()
|
||||||
targetPath := pathJoin(drivePath, minioMetaTmpDeletedBucket, pathUUID)
|
targetPath := pathJoin(drivePath, minioMetaTmpDeletedBucket, pathUUID)
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ func (s *erasureSets) cleanupStaleUploads(ctx context.Context) {
|
|||||||
if set == nil {
|
if set == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
set.cleanupStaleUploads(ctx, globalAPIConfig.getStaleUploadsExpiry())
|
set.cleanupStaleUploads(ctx)
|
||||||
}(set)
|
}(set)
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user