mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
Clean up targets properly on bucket deletion (#12565)
This commit is contained in:
parent
d40268d899
commit
ba6e9682e5
@ -84,6 +84,20 @@ func (sys *BucketTargetSys) ListBucketTargets(ctx context.Context, bucket string
|
||||
return nil, BucketRemoteTargetNotFound{Bucket: bucket}
|
||||
}
|
||||
|
||||
// Delete clears targets present for a bucket
|
||||
func (sys *BucketTargetSys) Delete(bucket string) {
|
||||
sys.Lock()
|
||||
defer sys.Unlock()
|
||||
tgts, ok := sys.targetsMap[bucket]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
for _, t := range tgts {
|
||||
delete(sys.arnRemotesMap, t.Arn)
|
||||
}
|
||||
delete(sys.targetsMap, bucket)
|
||||
}
|
||||
|
||||
// SetTarget - sets a new minio-go client target for this bucket.
|
||||
func (sys *BucketTargetSys) SetTarget(ctx context.Context, bucket string, tgt *madmin.BucketTarget, update bool) error {
|
||||
if globalIsGateway {
|
||||
|
@ -607,6 +607,7 @@ func (sys *NotificationSys) LoadBucketMetadata(ctx context.Context, bucketName s
|
||||
func (sys *NotificationSys) DeleteBucketMetadata(ctx context.Context, bucketName string) {
|
||||
globalReplicationStats.Delete(bucketName)
|
||||
globalBucketMetadataSys.Remove(bucketName)
|
||||
globalBucketTargetSys.Delete(bucketName)
|
||||
if localMetacacheMgr != nil {
|
||||
localMetacacheMgr.deleteBucketCache(bucketName)
|
||||
}
|
||||
|
@ -521,6 +521,7 @@ func (s *peerRESTServer) DeleteBucketMetadataHandler(w http.ResponseWriter, r *h
|
||||
|
||||
globalReplicationStats.Delete(bucketName)
|
||||
globalBucketMetadataSys.Remove(bucketName)
|
||||
globalBucketTargetSys.Delete(bucketName)
|
||||
if localMetacacheMgr != nil {
|
||||
localMetacacheMgr.deleteBucketCache(bucketName)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user