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:
Harshavardhana
2021-02-11 10:22:03 -08:00
committed by GitHub
parent 0ef3e359d8
commit b3c56b53fb
10 changed files with 110 additions and 68 deletions
+7 -7
View File
@@ -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.