mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
fix: metacache should only rename entries during cleanup (#11503)
To avoid large delays in metacache cleanup, use rename instead of recursive delete calls, renames are cheaper move the content to minioMetaTmpBucket and then cleanup this folder once in 24hrs instead. If the new cache can replace an existing one, we should let it replace since that is currently being saved anyways, this avoids pile up of 1000's of metacache entires for same listing calls that are not necessary to be stored on disk.
This commit is contained in:
@@ -125,16 +125,8 @@ func formatErasureCleanupTmpLocalEndpoints(endpoints Endpoints) error {
|
||||
osErrToFileErr(err))
|
||||
}
|
||||
|
||||
// Move .minio.sys/buckets/.minio.sys/metacache transient list cache
|
||||
// folder to speed up startup routines.
|
||||
tmpMetacacheOld := pathJoin(epPath, minioMetaTmpBucket+"-old", mustGetUUID())
|
||||
if err := renameAll(pathJoin(epPath, minioMetaBucket, metacachePrefixForID(minioMetaBucket, "")),
|
||||
tmpMetacacheOld); err != nil && err != errFileNotFound {
|
||||
return fmt.Errorf("unable to rename (%s -> %s) %w",
|
||||
pathJoin(epPath, minioMetaBucket+metacachePrefixForID(minioMetaBucket, "")),
|
||||
tmpMetacacheOld,
|
||||
osErrToFileErr(err))
|
||||
}
|
||||
// Renames and schedules for puring all bucket metacache.
|
||||
renameAllBucketMetacache(epPath)
|
||||
|
||||
// Removal of tmp-old folder is backgrounded completely.
|
||||
go removeAll(pathJoin(epPath, minioMetaTmpBucket+"-old"))
|
||||
|
||||
Reference in New Issue
Block a user