add additional logs for the decom during metadata save (#19288)

This commit is contained in:
Harshavardhana 2024-03-18 15:25:45 -07:00 committed by GitHub
parent d4aac7cd72
commit 7213bd7131
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,7 +97,7 @@ func (pd *PoolDecommissionInfo) Clone() *PoolDecommissionInfo {
// bucketPop should be called when a bucket is done decommissioning. // bucketPop should be called when a bucket is done decommissioning.
// Adds the bucket to the list of decommissioned buckets and updates resume numbers. // Adds the bucket to the list of decommissioned buckets and updates resume numbers.
func (pd *PoolDecommissionInfo) bucketPop(bucket string) { func (pd *PoolDecommissionInfo) bucketPop(bucket string) bool {
pd.DecommissionedBuckets = append(pd.DecommissionedBuckets, bucket) pd.DecommissionedBuckets = append(pd.DecommissionedBuckets, bucket)
for i, b := range pd.QueuedBuckets { for i, b := range pd.QueuedBuckets {
if b == bucket { if b == bucket {
@ -109,9 +109,10 @@ func (pd *PoolDecommissionInfo) bucketPop(bucket string) {
pd.Prefix = "" // empty this out for the next bucket pd.Prefix = "" // empty this out for the next bucket
pd.Object = "" // empty this out for next object pd.Object = "" // empty this out for next object
} }
return return true
} }
} }
return false
} }
func (pd *PoolDecommissionInfo) isBucketDecommissioned(bucket string) bool { func (pd *PoolDecommissionInfo) isBucketDecommissioned(bucket string) bool {
@ -222,12 +223,12 @@ func (p poolMeta) isBucketDecommissioned(idx int, bucket string) bool {
return p.Pools[idx].Decommission.isBucketDecommissioned(bucket) return p.Pools[idx].Decommission.isBucketDecommissioned(bucket)
} }
func (p *poolMeta) BucketDone(idx int, bucket decomBucketInfo) { func (p *poolMeta) BucketDone(idx int, bucket decomBucketInfo) bool {
if p.Pools[idx].Decommission == nil { if p.Pools[idx].Decommission == nil {
// Decommission not in progress. // Decommission not in progress.
return return false
} }
p.Pools[idx].Decommission.bucketPop(bucket.String()) return p.Pools[idx].Decommission.bucketPop(bucket.String())
} }
func (p poolMeta) ResumeBucketObject(idx int) (bucket, object string) { func (p poolMeta) ResumeBucketObject(idx int) (bucket, object string) {
@ -1055,8 +1056,10 @@ func (z *erasureServerPools) decommissionInBackground(ctx context.Context, idx i
} }
z.poolMetaMutex.Lock() z.poolMetaMutex.Lock()
z.poolMeta.BucketDone(idx, bucket) // remove from pendingBuckets and persist. if z.poolMeta.BucketDone(idx, bucket) {
z.poolMeta.save(ctx, z.serverPools) // remove from pendingBuckets and persist.
logger.LogIf(ctx, z.poolMeta.save(ctx, z.serverPools))
}
z.poolMetaMutex.Unlock() z.poolMetaMutex.Unlock()
continue continue
} }
@ -1071,8 +1074,9 @@ func (z *erasureServerPools) decommissionInBackground(ctx context.Context, idx i
stopFn(nil) stopFn(nil)
z.poolMetaMutex.Lock() z.poolMetaMutex.Lock()
z.poolMeta.BucketDone(idx, bucket) if z.poolMeta.BucketDone(idx, bucket) {
z.poolMeta.save(ctx, z.serverPools) logger.LogIf(ctx, z.poolMeta.save(ctx, z.serverPools))
}
z.poolMetaMutex.Unlock() z.poolMetaMutex.Unlock()
} }
return nil return nil