mirror of
https://github.com/pgsty/minio.git
synced 2026-07-23 06:00:24 +03: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:
@@ -85,18 +85,18 @@ type FileInfoVersions struct {
|
||||
Versions []FileInfo
|
||||
}
|
||||
|
||||
// forwardPastVersion will truncate the result to only contain versions after 'v'.
|
||||
// If v is empty or the version isn't found no changes will be made.
|
||||
func (f *FileInfoVersions) forwardPastVersion(v string) {
|
||||
if v == "" {
|
||||
return
|
||||
// findVersionIndex will return the version index where the version
|
||||
// was found. Returns -1 if not found.
|
||||
func (f *FileInfoVersions) findVersionIndex(v string) int {
|
||||
if f == nil || v == "" {
|
||||
return -1
|
||||
}
|
||||
for i, ver := range f.Versions {
|
||||
if ver.VersionID == v {
|
||||
f.Versions = f.Versions[i+1:]
|
||||
return
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// FileInfo - represents file stat information.
|
||||
|
||||
Reference in New Issue
Block a user