Reduce temporary file clean-up waits (#16110)

This commit is contained in:
Klaus Post 2022-11-22 16:23:36 +01:00 committed by GitHub
parent 08103870a5
commit 98ba622679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 16 deletions

View File

@ -206,7 +206,7 @@ func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk Sto
er.deleteAll(ctx, minioMetaMultipartBucket, uploadIDPath) er.deleteAll(ctx, minioMetaMultipartBucket, uploadIDPath)
return nil return nil
} }
wait := er.deletedCleanupSleeper.Timer(ctx) wait := deletedCleanupSleeper.Timer(ctx)
if now.Sub(fi.ModTime) > expiry { if now.Sub(fi.ModTime) > expiry {
er.deleteAll(ctx, minioMetaMultipartBucket, uploadIDPath) er.deleteAll(ctx, minioMetaMultipartBucket, uploadIDPath)
} }
@ -223,7 +223,7 @@ func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk Sto
if err != nil { if err != nil {
return nil return nil
} }
wait := er.deletedCleanupSleeper.Timer(ctx) wait := deletedCleanupSleeper.Timer(ctx)
if now.Sub(vi.Created) > expiry { if now.Sub(vi.Created) > expiry {
er.deleteAll(ctx, minioMetaTmpBucket, tmpDir) er.deleteAll(ctx, minioMetaTmpBucket, tmpDir)
} }

View File

@ -468,7 +468,6 @@ func newErasureSets(ctx context.Context, endpoints PoolEndpoints, storageDisks [
getDisks: s.GetDisks(i), getDisks: s.GetDisks(i),
getLockers: s.GetLockers(i), getLockers: s.GetLockers(i),
getEndpoints: s.GetEndpoints(i), getEndpoints: s.GetEndpoints(i),
deletedCleanupSleeper: newDynamicSleeper(10, 2*time.Second, false),
nsMutex: mutex, nsMutex: mutex,
bp: bp, bp: bp,
bpOld: bpOld, bpOld: bpOld,

View File

@ -66,8 +66,6 @@ type erasureObjects struct {
// Byte pools used for temporary i/o buffers, // Byte pools used for temporary i/o buffers,
// legacy objects. // legacy objects.
bpOld *bpool.BytePoolCap bpOld *bpool.BytePoolCap
deletedCleanupSleeper *dynamicSleeper
} }
// NewNSLock - initialize a new namespace RWLocker instance. // NewNSLock - initialize a new namespace RWLocker instance.
@ -338,7 +336,7 @@ func (er erasureObjects) cleanupDeletedObjects(ctx context.Context) {
defer wg.Done() defer wg.Done()
diskPath := disk.Endpoint().Path diskPath := disk.Endpoint().Path
readDirFn(pathJoin(diskPath, minioMetaTmpDeletedBucket), func(ddir string, typ os.FileMode) error { readDirFn(pathJoin(diskPath, minioMetaTmpDeletedBucket), func(ddir string, typ os.FileMode) error {
wait := er.deletedCleanupSleeper.Timer(ctx) wait := deletedCleanupSleeper.Timer(ctx)
removeAll(pathJoin(diskPath, minioMetaTmpDeletedBucket, ddir)) removeAll(pathJoin(diskPath, minioMetaTmpDeletedBucket, ddir))
wait() wait()
return nil return nil

View File

@ -381,6 +381,10 @@ var (
globalConnReadDeadline time.Duration globalConnReadDeadline time.Duration
globalConnWriteDeadline time.Duration globalConnWriteDeadline time.Duration
// Controller for deleted file sweeper.
deletedCleanupSleeper = newDynamicSleeper(5, 25*time.Millisecond, false)
// Add new variable global values here. // Add new variable global values here.
) )