mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(metanode): hybrid cloud fix bug when update extent key after migration
Signed-off-by: chihe <chi.he@oppo.com>
This commit is contained in:
parent
505015cd17
commit
5f4ee4eacb
@ -1050,21 +1050,16 @@ func (mp *metaPartition) fsmUpdateExtentKeyAfterMigration(ino *Inode) (resp *Ino
|
||||
}
|
||||
i := item.(*Inode)
|
||||
//only can migrate to HDD or ebs for now
|
||||
if ino.StorageClass == proto.StorageClass_BlobStore {
|
||||
//store old ek
|
||||
i.HybridCouldExtentsMigration.storageClass = i.StorageClass
|
||||
i.HybridCouldExtentsMigration.sortedEks = i.HybridCouldExtents.sortedEks
|
||||
i.StorageClass = ino.HybridCouldExtentsMigration.storageClass
|
||||
i.HybridCouldExtents.sortedEks = ino.HybridCouldExtentsMigration.sortedEks
|
||||
} else {
|
||||
tmpStorageClass := i.HybridCouldExtentsMigration.storageClass
|
||||
tmpSortedEks := i.HybridCouldExtentsMigration.sortedEks
|
||||
i.HybridCouldExtentsMigration.storageClass = i.StorageClass
|
||||
i.HybridCouldExtentsMigration.sortedEks = i.HybridCouldExtents.sortedEks
|
||||
i.StorageClass = tmpStorageClass
|
||||
i.HybridCouldExtentsMigration.sortedEks = tmpSortedEks
|
||||
}
|
||||
tmpStorageClass := i.HybridCouldExtentsMigration.storageClass
|
||||
tmpSortedEks := i.HybridCouldExtentsMigration.sortedEks
|
||||
// store old storage ek in HybridCouldExtentsMigration
|
||||
i.HybridCouldExtentsMigration.storageClass = i.StorageClass
|
||||
i.HybridCouldExtentsMigration.sortedEks = i.HybridCouldExtents.sortedEks
|
||||
// store new storage ek in HybridCouldExtents
|
||||
i.StorageClass = tmpStorageClass
|
||||
i.HybridCouldExtents.sortedEks = tmpSortedEks
|
||||
log.LogInfof("action[fsmForbiddenInodeMigration] inode %v storage class change from %v to %v", ino.Inode,
|
||||
ino.HybridCouldExtentsMigration.storageClass, ino.StorageClass)
|
||||
//TODO:chihe delete old ek
|
||||
return
|
||||
}
|
||||
|
||||
@ -1088,10 +1088,14 @@ func (mp *metaPartition) UpdateExtentKeyAfterMigration(req *proto.UpdateExtentKe
|
||||
p.PacketErrorWithBody(proto.OpErr, []byte(err.Error()))
|
||||
return
|
||||
}
|
||||
//store ek after migration in HybridCouldExtentsMigration
|
||||
ino.HybridCouldExtentsMigration.storageClass = req.StorageClass
|
||||
if req.StorageClass == proto.StorageClass_BlobStore {
|
||||
ino.HybridCouldExtentsMigration.sortedEks = NewSortedObjExtentsFromObjEks(req.NewObjExtentKeys)
|
||||
} else if req.StorageClass != proto.MediaType_HDD {
|
||||
} else if req.StorageClass == proto.MediaType_HDD {
|
||||
//do nothing, ek has been stored in ino.HybridCouldExtentsMigration before UpdateExtentKeyAfterMigration
|
||||
//is called
|
||||
} else {
|
||||
err = fmt.Errorf("mp %v inode %v unsupport new migration storage class %v",
|
||||
mp.config.PartitionId, ino.Inode, req.StorageClass)
|
||||
log.LogErrorf("action[UpdateExtentKeyAfterMigration] %v", err)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user