From 98ba6226791a5e934272ebcec62d79798a6f5bad Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 22 Nov 2022 16:23:36 +0100 Subject: [PATCH] Reduce temporary file clean-up waits (#16110) --- cmd/erasure-multipart.go | 4 ++-- cmd/erasure-sets.go | 21 ++++++++++----------- cmd/erasure.go | 4 +--- cmd/globals.go | 4 ++++ 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cmd/erasure-multipart.go b/cmd/erasure-multipart.go index b7561e908..6b3bf1658 100644 --- a/cmd/erasure-multipart.go +++ b/cmd/erasure-multipart.go @@ -206,7 +206,7 @@ func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk Sto er.deleteAll(ctx, minioMetaMultipartBucket, uploadIDPath) return nil } - wait := er.deletedCleanupSleeper.Timer(ctx) + wait := deletedCleanupSleeper.Timer(ctx) if now.Sub(fi.ModTime) > expiry { er.deleteAll(ctx, minioMetaMultipartBucket, uploadIDPath) } @@ -223,7 +223,7 @@ func (er erasureObjects) cleanupStaleUploadsOnDisk(ctx context.Context, disk Sto if err != nil { return nil } - wait := er.deletedCleanupSleeper.Timer(ctx) + wait := deletedCleanupSleeper.Timer(ctx) if now.Sub(vi.Created) > expiry { er.deleteAll(ctx, minioMetaTmpBucket, tmpDir) } diff --git a/cmd/erasure-sets.go b/cmd/erasure-sets.go index 65695c280..17f53a68b 100644 --- a/cmd/erasure-sets.go +++ b/cmd/erasure-sets.go @@ -461,17 +461,16 @@ func newErasureSets(ctx context.Context, endpoints PoolEndpoints, storageDisks [ // Initialize erasure objects for a given set. s.sets[i] = &erasureObjects{ - setIndex: i, - poolIndex: poolIdx, - setDriveCount: setDriveCount, - defaultParityCount: defaultParityCount, - getDisks: s.GetDisks(i), - getLockers: s.GetLockers(i), - getEndpoints: s.GetEndpoints(i), - deletedCleanupSleeper: newDynamicSleeper(10, 2*time.Second, false), - nsMutex: mutex, - bp: bp, - bpOld: bpOld, + setIndex: i, + poolIndex: poolIdx, + setDriveCount: setDriveCount, + defaultParityCount: defaultParityCount, + getDisks: s.GetDisks(i), + getLockers: s.GetLockers(i), + getEndpoints: s.GetEndpoints(i), + nsMutex: mutex, + bp: bp, + bpOld: bpOld, } }(i) } diff --git a/cmd/erasure.go b/cmd/erasure.go index 5d431e62b..93c491d6f 100644 --- a/cmd/erasure.go +++ b/cmd/erasure.go @@ -66,8 +66,6 @@ type erasureObjects struct { // Byte pools used for temporary i/o buffers, // legacy objects. bpOld *bpool.BytePoolCap - - deletedCleanupSleeper *dynamicSleeper } // NewNSLock - initialize a new namespace RWLocker instance. @@ -338,7 +336,7 @@ func (er erasureObjects) cleanupDeletedObjects(ctx context.Context) { defer wg.Done() diskPath := disk.Endpoint().Path 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)) wait() return nil diff --git a/cmd/globals.go b/cmd/globals.go index 829b97388..b1096b962 100644 --- a/cmd/globals.go +++ b/cmd/globals.go @@ -381,6 +381,10 @@ var ( globalConnReadDeadline time.Duration globalConnWriteDeadline time.Duration + + // Controller for deleted file sweeper. + deletedCleanupSleeper = newDynamicSleeper(5, 25*time.Millisecond, false) + // Add new variable global values here. )