allow configuring delete cleanup interval from default 10minutes (#11818)

This commit is contained in:
Harshavardhana 2021-03-17 15:15:58 -07:00 committed by GitHub
parent 60b0f2324e
commit add3cd4e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,7 @@ import (
"github.com/minio/minio/pkg/bpool" "github.com/minio/minio/pkg/bpool"
"github.com/minio/minio/pkg/console" "github.com/minio/minio/pkg/console"
"github.com/minio/minio/pkg/dsync" "github.com/minio/minio/pkg/dsync"
"github.com/minio/minio/pkg/env"
"github.com/minio/minio/pkg/madmin" "github.com/minio/minio/pkg/madmin"
"github.com/minio/minio/pkg/sync/errgroup" "github.com/minio/minio/pkg/sync/errgroup"
) )
@ -49,6 +50,8 @@ type diskConnectInfo struct {
setIndex int setIndex int
} }
const envMinioDeleteCleanupInterval = "MINIO_DELETE_CLEANUP_INTERVAL"
// erasureSets implements ObjectLayer combining a static list of erasure coded // erasureSets implements ObjectLayer combining a static list of erasure coded
// object sets. NOTE: There is no dynamic scaling allowed or intended in // object sets. NOTE: There is no dynamic scaling allowed or intended in
// current design. // current design.
@ -413,15 +416,18 @@ func newErasureSets(ctx context.Context, endpoints Endpoints, storageDisks []Sto
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, 10*time.Second), deletedCleanupSleeper: newDynamicSleeper(10, 2*time.Second),
nsMutex: mutex, nsMutex: mutex,
bp: bp, bp: bp,
mrfOpCh: make(chan partialOperation, 10000), mrfOpCh: make(chan partialOperation, 10000),
} }
} }
// cleanup ".trash/" folder every 30 minutes with sufficient sleep cycles. // cleanup ".trash/" folder every 10 minutes with sufficient sleep cycles.
const deletedObjectsCleanupInterval = 10 * time.Minute deletedObjectsCleanupInterval, err := time.ParseDuration(env.Get(envMinioDeleteCleanupInterval, "10m"))
if err != nil {
return nil, err
}
// start cleanup stale uploads go-routine. // start cleanup stale uploads go-routine.
go s.cleanupStaleUploads(ctx, GlobalStaleUploadsCleanupInterval, GlobalStaleUploadsExpiry) go s.cleanupStaleUploads(ctx, GlobalStaleUploadsCleanupInterval, GlobalStaleUploadsExpiry)