mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
feat(data): Support asynchronous deletion of expired partition lists.
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
f7f012de3d
commit
b3f3278e5a
@ -689,21 +689,15 @@ func (d *Disk) RestorePartition(visitor PartitionVisitor, allowDelay bool) (err
|
||||
close(loadCh)
|
||||
|
||||
if len(toDeleteExpiredPartitionNames) > 0 {
|
||||
log.LogInfof("action[RestorePartition] expiredPartitions %v, disk %v", toDeleteExpiredPartitionNames, d.Path)
|
||||
go func(toDeleteExpiredPartitions []string) {
|
||||
log.LogInfof("action[RestorePartition] expiredPartitions %v, disk %v", toDeleteExpiredPartitionNames, d.Path)
|
||||
notDeletedExpiredPartitionNames := d.deleteExpiredPartitions(toDeleteExpiredPartitionNames)
|
||||
|
||||
notDeletedExpiredPartitionNames := d.deleteExpiredPartitions(toDeleteExpiredPartitionNames)
|
||||
|
||||
if len(notDeletedExpiredPartitionNames) > 0 {
|
||||
go func(toDeleteExpiredPartitions []string) {
|
||||
ticker := time.NewTicker(ExpiredPartitionExistTime)
|
||||
log.LogInfof("action[RestorePartition] delete expiredPartitions automatically start, toDeleteExpiredPartitions %v", toDeleteExpiredPartitions)
|
||||
|
||||
<-ticker.C
|
||||
d.deleteExpiredPartitions(toDeleteExpiredPartitionNames)
|
||||
ticker.Stop()
|
||||
log.LogInfof("action[RestorePartition] delete expiredPartitions automatically finish")
|
||||
}(notDeletedExpiredPartitionNames)
|
||||
}
|
||||
time.Sleep(ExpiredPartitionExistTime)
|
||||
log.LogInfof("action[RestorePartition] delete expiredPartitions automatically start, toDeleteExpiredPartitions %v", notDeletedExpiredPartitionNames)
|
||||
d.deleteExpiredPartitions(notDeletedExpiredPartitionNames)
|
||||
log.LogInfof("action[RestorePartition] delete expiredPartitions automatically finish")
|
||||
}(toDeleteExpiredPartitionNames)
|
||||
}
|
||||
wg.Wait()
|
||||
return err
|
||||
@ -732,6 +726,7 @@ func (d *Disk) deleteExpiredPartitions(toDeleteExpiredPartitionNames []string) (
|
||||
continue
|
||||
}
|
||||
log.LogInfof("action[deleteExpiredPartitions] delete expiredPartition %v automatically", partitionName)
|
||||
time.Sleep(time.Second)
|
||||
} else {
|
||||
notDeletedExpiredPartitionNames = append(notDeletedExpiredPartitionNames, partitionName)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user