fix get table meta without meta lock
This commit is contained in:
parent
c87ced12b6
commit
876ea12bfa
|
@ -3226,14 +3226,24 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
// get tb cache
|
// get tb cache
|
||||||
pName = taosArrayGet(pList, i);
|
pName = taosArrayGet(pList, i);
|
||||||
pTbCache = taosHashAcquire(dbCache->tbCache, pName->tname, strlen(pName->tname));
|
pTbCache = taosHashAcquire(dbCache->tbCache, pName->tname, strlen(pName->tname));
|
||||||
if (!pTbCache || !pTbCache->pMeta) {
|
if (!pTbCache) {
|
||||||
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
|
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
|
||||||
ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL);
|
ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL);
|
||||||
taosArrayPush(pCtx->pResList, &(SMetaRes){0});
|
taosArrayPush(pCtx->pResList, &(SMetaRes){0});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
CTG_LOCK(CTG_READ, &pTbCache->metaLock);
|
||||||
|
if (!pTbCache->pMeta) {
|
||||||
|
CTG_UNLOCK(CTG_READ, &pTbCache->metaLock);
|
||||||
|
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
|
||||||
|
ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL);
|
||||||
|
taosArrayPush(pCtx->pResList, &(SMetaRes){0});
|
||||||
|
taosHashRelease(dbCache->tbCache, pTbCache);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
uint64_t suid = pTbCache->pMeta->suid;
|
uint64_t suid = pTbCache->pMeta->suid;
|
||||||
int8_t tbType = pTbCache->pMeta->tableType;
|
int8_t tbType = pTbCache->pMeta->tableType;
|
||||||
|
CTG_UNLOCK(CTG_READ, &pTbCache->metaLock);
|
||||||
taosHashRelease(dbCache->tbCache, pTbCache);
|
taosHashRelease(dbCache->tbCache, pTbCache);
|
||||||
SName tsmaSourceTbName = *pName;
|
SName tsmaSourceTbName = *pName;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue