make sure to delete data-usage cache upon bucket deletes (#9952)

This commit is contained in:
Harshavardhana 2020-07-01 10:55:28 -07:00 committed by GitHub
parent 2e338e84cb
commit 5388ae4acb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -319,9 +319,15 @@ func (b *BucketMetadata) Save(ctx context.Context, api ObjectLayer) error {
// deleteBucketMetadata deletes bucket metadata
// If config does not exist no error is returned.
func deleteBucketMetadata(ctx context.Context, obj ObjectLayer, bucket string) error {
configFile := path.Join(bucketConfigPrefix, bucket, bucketMetadataFile)
if err := deleteConfig(ctx, obj, configFile); err != nil && err != errConfigNotFound {
return err
metadataFiles := []string{
dataUsageCacheName,
bucketMetadataFile,
}
for _, metaFile := range metadataFiles {
configFile := path.Join(bucketConfigPrefix, bucket, metaFile)
if err := deleteConfig(ctx, obj, configFile); err != nil && err != errConfigNotFound {
return err
}
}
return nil
}