fix(sdk): check whether StorageClass allowed when remoteCacheAutoPrepare is opened.

. #1000083859

Signed-off-by: baihailong <baihailong@oppo.com>
This commit is contained in:
baihailong 2025-04-25 14:35:36 +08:00 committed by zhumingze1108
parent a1fe50c7be
commit dea4a5ecb6

View File

@ -612,13 +612,22 @@ func (eh *ExtentHandler) appendExtentKey() (err error) {
}
if eh.key.PartitionId > 0 && eh.stream.enableRemoteCacheAutoPrepare() {
prepareReq := &PrepareRemoteCacheRequest{
ctx: context.Background(),
ek: eh.key,
inode: eh.stream.inode,
inodeInfo, err := eh.stream.client.getInodeInfo(eh.inode)
if err != nil {
log.LogErrorf("appendExtentKey: getInodeInfo failed. ino(%v) eh(%v) err(%v)", eh.inode, eh, err)
return err
}
enableRemoteCacheStorageClass := !eh.stream.client.RemoteCache.remoteCacheOnlyForNotSSD ||
(eh.stream.client.RemoteCache.remoteCacheOnlyForNotSSD && inodeInfo.StorageClass != proto.StorageClass_Replica_SSD)
if enableRemoteCacheStorageClass {
prepareReq := &PrepareRemoteCacheRequest{
ctx: context.Background(),
ek: eh.key,
inode: eh.stream.inode,
}
eh.stream.sendToPrepareRomoteCacheChan(prepareReq)
}
eh.stream.sendToPrepareRomoteCacheChan(prepareReq)
// eh.stream.prepareRemoteCache(ctx, ek)
}
}
if err == nil {