refactor(client): hybrid cloud print warn log when OpMetaExtentsList returns proto.OpMismatchStorageClass

#22004328
Signed-off-by: true1064 <tangjingyu@oppo.com>
This commit is contained in:
true1064 2024-07-30 20:06:20 +08:00 committed by AmazingChi
parent 57c8f26829
commit cc025affe3
2 changed files with 9 additions and 4 deletions

View File

@ -486,8 +486,8 @@ func (mp *metaPartition) ExtentsList(req *proto.GetExtentsRequest, p *Packet) (e
if !(ino.HybridCouldExtentsMigration.storageClass == proto.StorageClass_Unspecified &&
ino.HybridCouldExtentsMigration.sortedEks == nil) {
status = proto.OpErr
reply = []byte(fmt.Sprintf("ino %v storage type %v not migrate to replica system",
ino.Inode, ino.HybridCouldExtentsMigration.storageClass))
reply = []byte(fmt.Sprintf("ino(%v) storageClass(%v) not migrate to replica system",
ino.Inode, proto.StorageClassString(ino.HybridCouldExtentsMigration.storageClass)))
p.PacketErrorWithBody(status, reply)
return
}

View File

@ -1315,7 +1315,7 @@ func (mw *MetaWrapper) getExtents(mp *MetaPartition, inode uint64, isCache bool,
defer func() {
metric.SetWithLabels(err, map[string]string{exporter.Vol: mw.volname})
}()
// TODO:chi delete this line when the bug fixed
// TODO:chi,tangjingyu: delete this line when the bug fixed
log.LogDebugf("getExtents req: id(%v) data(%v) stack[%v]", packet.GetReqID(), req, string(debug.Stack()))
packet, err = mw.sendToMetaPartition(mp, packet)
@ -1327,7 +1327,12 @@ func (mw *MetaWrapper) getExtents(mp *MetaPartition, inode uint64, isCache bool,
resp.Status = parseStatus(packet.ResultCode)
if resp.Status != statusOK {
err = errors.New(packet.GetResultMsg())
log.LogErrorf("getExtents: packet(%v) mp(%v) result(%v)", packet, mp, packet.GetResultMsg())
msg := fmt.Sprintf("getExtents: packet(%v) mp(%v) result(%v)", packet, mp, packet.GetResultMsg())
if packet.ResultCode == proto.OpMismatchStorageClass {
log.LogWarnf(msg)
} else {
log.LogError(msg)
}
return
}