@ -64,7 +64,7 @@ func newBucketMetacache(bucket string, cleanup bool) *bucketMetacache {
ez , ok := objAPI . ( * erasureServerPools )
ez , ok := objAPI . ( * erasureServerPools )
if ok {
if ok {
ctx := context . Background ( )
ctx := context . Background ( )
ez . delet eAll( ctx , minioMetaBucket , metacachePrefixForID ( bucket , slashSeparator ) )
ez . renam eAll( ctx , minioMetaBucket , metacachePrefixForID ( bucket , slashSeparator ) )
}
}
}
}
return & bucketMetacache {
return & bucketMetacache {
@ -292,7 +292,7 @@ func (b *bucketMetacache) cleanup() {
caches , rootIdx := b . cloneCaches ( )
caches , rootIdx := b . cloneCaches ( )
for id , cache := range caches {
for id , cache := range caches {
if b . transient && time . Since ( cache . lastUpdate ) > 15 * time . Minute && time . Since ( cache . lastHandout ) > 15 * time . Minute {
if b . transient && time . Since ( cache . lastUpdate ) > 10 * time . Minute && time . Since ( cache . lastHandout ) > 10 * time . Minute {
// Keep transient caches only for 15 minutes.
// Keep transient caches only for 15 minutes.
remove [ id ] = struct { } { }
remove [ id ] = struct { } { }
continue
continue
@ -361,7 +361,7 @@ func (b *bucketMetacache) cleanup() {
} )
} )
// Keep first metacacheMaxEntries...
// Keep first metacacheMaxEntries...
for _ , cache := range remainCaches [ metacacheMaxEntries : ] {
for _ , cache := range remainCaches [ metacacheMaxEntries : ] {
if time . Since ( cache . lastHandout ) > time . Hour {
if time . Since ( cache . lastHandout ) > 30 * time . Minute {
remove [ cache . id ] = struct { } { }
remove [ cache . id ] = struct { } { }
}
}
}
}
@ -409,7 +409,6 @@ func (b *bucketMetacache) updateCacheEntry(update metacache) (metacache, error)
defer b . mu . Unlock ( )
defer b . mu . Unlock ( )
existing , ok := b . caches [ update . id ]
existing , ok := b . caches [ update . id ]
if ! ok {
if ! ok {
logger . Info ( "updateCacheEntry: bucket %s list id %v not found" , b . bucket , update . id )
return update , errFileNotFound
return update , errFileNotFound
}
}
existing . update ( update )
existing . update ( update )
@ -465,7 +464,7 @@ func (b *bucketMetacache) deleteAll() {
b . updated = true
b . updated = true
if ! b . transient {
if ! b . transient {
// Delete all.
// Delete all.
ez . delet eAll( ctx , minioMetaBucket , metacachePrefixForID ( b . bucket , slashSeparator ) )
ez . renam eAll( ctx , minioMetaBucket , metacachePrefixForID ( b . bucket , slashSeparator ) )
b . caches = make ( map [ string ] metacache , 10 )
b . caches = make ( map [ string ] metacache , 10 )
b . cachesRoot = make ( map [ string ] [ ] string , 10 )
b . cachesRoot = make ( map [ string ] [ ] string , 10 )
return
return
@ -477,7 +476,7 @@ func (b *bucketMetacache) deleteAll() {
wg . Add ( 1 )
wg . Add ( 1 )
go func ( cache metacache ) {
go func ( cache metacache ) {
defer wg . Done ( )
defer wg . Done ( )
ez . delet eAll( ctx , minioMetaBucket , metacachePrefixForID ( cache . bucket , cache . id ) )
ez . renam eAll( ctx , minioMetaBucket , metacachePrefixForID ( cache . bucket , cache . id ) )
} ( b . caches [ id ] )
} ( b . caches [ id ] )
}
}
wg . Wait ( )
wg . Wait ( )