Clean up metadata cache when deleting bucket (#10802)

Metadata caches were left behind when deleting a bucket.
This commit is contained in:
Klaus Post
2020-10-31 09:46:18 -07:00
committed by GitHub
parent b686bb9c83
commit 422898d9b3
3 changed files with 18 additions and 1 deletions

View File

@@ -128,6 +128,18 @@ func (m *metacacheManager) getBucket(ctx context.Context, bucket string) *bucket
return b
}
// deleteBucketCache will delete the bucket cache if it exists.
func (m *metacacheManager) deleteBucketCache(bucket string) {
m.mu.Lock()
defer m.mu.Unlock()
b, ok := m.buckets[bucket]
if !ok {
return
}
b.deleteAll()
delete(m.buckets, bucket)
}
// deleteAll will delete all caches.
func (m *metacacheManager) deleteAll() {
m.mu.Lock()