@@ -3226,14 +3226,24 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
3226
3226
// get tb cache
3227
3227
pName = taosArrayGet (pList , i );
3228
3228
pTbCache = taosHashAcquire (dbCache -> tbCache , pName -> tname , strlen (pName -> tname ));
3229
- if (!pTbCache || ! pTbCache -> pMeta ) {
3229
+ if (!pTbCache ) {
3230
3230
ctgDebug ("tb: %s.%s not in cache" , dbFName , pName -> tname );
3231
3231
ctgAddTSMAFetch (& pCtx -> pFetches , dbIdx , i , fetchIdx , baseResIdx + i , flag , FETCH_TSMA_SOURCE_TB_META , NULL );
3232
3232
taosArrayPush (pCtx -> pResList , & (SMetaRes ){0 });
3233
3233
continue ;
3234
3234
}
3235
+ CTG_LOCK (CTG_READ , & pTbCache -> metaLock );
3236
+ if (!pTbCache -> pMeta ) {
3237
+ CTG_UNLOCK (CTG_READ , & pTbCache -> metaLock );
3238
+ ctgDebug ("tb: %s.%s not in cache" , dbFName , pName -> tname );
3239
+ ctgAddTSMAFetch (& pCtx -> pFetches , dbIdx , i , fetchIdx , baseResIdx + i , flag , FETCH_TSMA_SOURCE_TB_META , NULL );
3240
+ taosArrayPush (pCtx -> pResList , & (SMetaRes ){0 });
3241
+ taosHashRelease (dbCache -> tbCache , pTbCache );
3242
+ continue ;
3243
+ }
3235
3244
uint64_t suid = pTbCache -> pMeta -> suid ;
3236
3245
int8_t tbType = pTbCache -> pMeta -> tableType ;
3246
+ CTG_UNLOCK (CTG_READ , & pTbCache -> metaLock );
3237
3247
taosHashRelease (dbCache -> tbCache , pTbCache );
3238
3248
SName tsmaSourceTbName = * pName ;
3239
3249
0 commit comments