mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
refactor(meta): refactor delete migration eks log. #22869219
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
d6630cb0e9
commit
2cf7602bda
@ -302,8 +302,6 @@ func (mp *metaPartition) batchDeleteExtentsByPartition(partitionDeleteExtents ma
|
||||
log.LogWarnf("batchDeleteExtentsByPartition: deleteInode Inode(%v) error(%v)", inode.Inode, occurErrors[ek.PartitionId])
|
||||
return false
|
||||
}
|
||||
successDeleteExtentCnt++
|
||||
return true
|
||||
})
|
||||
if successDeleteExtentCnt == extents.Len() {
|
||||
shouldCommit = append(shouldCommit, inode)
|
||||
@ -334,6 +332,7 @@ func (mp *metaPartition) deleteMarkedInodes(inoSlice []uint64) {
|
||||
var (
|
||||
replicaInodes = make([]uint64, 0)
|
||||
ebsInodes = make([]uint64, 0)
|
||||
migrateReplicaInodes = make([]uint64, 0)
|
||||
shouldRePushToFreeList = make([]*Inode, 0)
|
||||
allInodes = make([]*Inode, 0)
|
||||
)
|
||||
@ -344,9 +343,9 @@ func (mp *metaPartition) deleteMarkedInodes(inoSlice []uint64) {
|
||||
log.LogDebugf("deleteMarkedInodes. mp %v inode [%v] not found", mp.config.PartitionId, ino)
|
||||
continue
|
||||
}
|
||||
if inode.NeedDeleteMigrationExtentKey() {
|
||||
allInodes = append(allInodes, inode)
|
||||
log.LogDebugf("deleteMarkedInodes. skip mp %v inode [%v] for deleting hybrid cloud extent key", mp.config.PartitionId, ino)
|
||||
if inode.NeedDeleteMigrationExtentKey() || inode.HybridCloudExtentsMigration.HasReplicaMigrationExts() {
|
||||
migrateReplicaInodes = append(migrateReplicaInodes, inode.Inode)
|
||||
log.LogDebugf("deleteMarkedInodes. mp %v inode [%v] delete migrate eks first", mp.config.PartitionId, ino)
|
||||
continue
|
||||
}
|
||||
if proto.IsStorageClassReplica(inode.StorageClass) {
|
||||
@ -355,7 +354,15 @@ func (mp *metaPartition) deleteMarkedInodes(inoSlice []uint64) {
|
||||
ebsInodes = append(ebsInodes, inode.Inode)
|
||||
}
|
||||
}
|
||||
// step1: delete inode by current storage class
|
||||
|
||||
// delete migrate eks first
|
||||
if len(migrateReplicaInodes) > 0 {
|
||||
shouldCommitReplicaInode, shouldRePushToFreeListReplicaInode := mp.deleteMarkedReplicaInodes(migrateReplicaInodes, false, true)
|
||||
allInodes = append(allInodes, shouldCommitReplicaInode...)
|
||||
shouldRePushToFreeList = append(shouldRePushToFreeList, shouldRePushToFreeListReplicaInode...)
|
||||
}
|
||||
|
||||
// delete inode by current storage class
|
||||
if len(replicaInodes) > 0 {
|
||||
shouldCommitReplicaInode, shouldRePushToFreeListReplicaInode := mp.deleteMarkedReplicaInodes(replicaInodes, false, false)
|
||||
allInodes = append(allInodes, shouldCommitReplicaInode...)
|
||||
@ -367,7 +374,7 @@ func (mp *metaPartition) deleteMarkedInodes(inoSlice []uint64) {
|
||||
shouldRePushToFreeList = append(shouldRePushToFreeList, shouldRePushToFreeListEbsInode...)
|
||||
}
|
||||
|
||||
// step2: delete inode by migration storage class
|
||||
// delete inode by migration storage class
|
||||
replicaInodes = make([]uint64, 0)
|
||||
ebsInodes = make([]uint64, 0)
|
||||
leftInodes := make([]*Inode, 0) //
|
||||
|
||||
@ -1247,28 +1247,17 @@ func (mp *metaPartition) fsmInternalBatchFreeMigrationExtentKey(val []byte) (err
|
||||
}
|
||||
ino := item.(*Inode)
|
||||
|
||||
if proto.IsStorageClassReplica(ino.HybridCloudExtentsMigration.storageClass) {
|
||||
if ino.HybridCloudExtentsMigration.sortedEks == nil {
|
||||
log.LogWarnf("[fsmInternalBatchFreeMigrationExtentKey] mpId(%v) inode(%v) storageClass(%v) migration sortedEks is nil",
|
||||
mp.config.PartitionId, ino.Inode, proto.StorageClassString(ino.StorageClass))
|
||||
} else {
|
||||
mp.putReplicaMigrationExtentKeyToDelChannel(ino)
|
||||
log.LogInfof("[fsmInternalBatchFreeMigrationExtentKey] mpId(%v) inode(%v) storageClass(%v) migration SortedExtents pushed into extDelCh",
|
||||
mp.config.PartitionId, ino.Inode, proto.StorageClassString(ino.StorageClass))
|
||||
}
|
||||
}
|
||||
|
||||
mp.internalDeleteInodeMigrationExtentKey(ino)
|
||||
}
|
||||
}
|
||||
|
||||
func (mp *metaPartition) internalDeleteInodeMigrationExtentKey(ino *Inode) {
|
||||
ino.Lock()
|
||||
ino.HybridCloudExtentsMigration.storageClass = proto.StorageClass_Unspecified
|
||||
ino.HybridCloudExtentsMigration.expiredTime = 0
|
||||
ino.HybridCloudExtentsMigration.sortedEks = nil
|
||||
ino.Flag ^= DeleteMigrationExtentKeyFlag // reset DeleteMigrationExtentKeyFlag for future deletion of inode
|
||||
ino.Unlock()
|
||||
if ino.NeedDeleteMigrationExtentKey() {
|
||||
ino.Flag ^= DeleteMigrationExtentKeyFlag // reset DeleteMigrationExtentKeyFlag for future deletion of inode
|
||||
}
|
||||
|
||||
mp.freeHybridList.Remove(ino.Inode)
|
||||
|
||||
@ -1312,12 +1301,3 @@ func (mp *metaPartition) fsmSetMigrationExtentKeyDeleteImmediately(inoParam *Ino
|
||||
mp.internalDeleteInodeMigrationExtentKey(i)
|
||||
return
|
||||
}
|
||||
|
||||
func (mp *metaPartition) putReplicaMigrationExtentKeyToDelChannel(ino *Inode) {
|
||||
if ino.HybridCloudExtentsMigration.sortedEks == nil {
|
||||
return
|
||||
}
|
||||
|
||||
migrateExtents := ino.HybridCloudExtentsMigration.sortedEks.(*SortedExtents)
|
||||
mp.extDelCh <- migrateExtents.CopyExtents()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user