未验证 提交 bd2546a7 编写于 作者: H Hongze Cheng 提交者: GitHub

Merge pull request #17303 from taosdata/fix/TD-19482

fix(meta): META_READER_NOLOCK with inner meta readers
......@@ -95,6 +95,7 @@ typedef struct SMetaEntry SMetaEntry;
#define META_READER_NOLOCK 0x1
void metaReaderInit(SMetaReader *pReader, SMeta *pMeta, int32_t flags);
void metaReaderReleaseLock(SMetaReader *pReader);
void metaReaderClear(SMetaReader *pReader);
int32_t metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid);
int metaGetTableEntryByName(SMetaReader *pReader, const char *name);
......
......@@ -24,6 +24,13 @@ void metaReaderInit(SMetaReader *pReader, SMeta *pMeta, int32_t flags) {
}
}
void metaReaderReleaseLock(SMetaReader *pReader) {
if (pReader->pMeta && !(pReader->flags & META_READER_NOLOCK)) {
metaULock(pReader->pMeta);
pReader->flags |= META_READER_NOLOCK;
}
}
void metaReaderClear(SMetaReader *pReader) {
if (pReader->pMeta && !(pReader->flags & META_READER_NOLOCK)) {
metaULock(pReader->pMeta);
......
......@@ -74,7 +74,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
schemaTag = mer1.me.stbEntry.schemaTag;
metaRsp.suid = mer1.me.uid;
} else if (mer1.me.type == TSDB_CHILD_TABLE) {
metaReaderInit(&mer2, pVnode->pMeta, 0);
metaReaderInit(&mer2, pVnode->pMeta, META_READER_NOLOCK);
if (metaGetTableEntryByUid(&mer2, mer1.me.ctbEntry.suid) < 0) goto _exit;
strcpy(metaRsp.stbName, mer2.me.name);
......
......@@ -429,6 +429,8 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int
return terrno;
}
metaReaderReleaseLock(&mr);
for (int32_t j = 0; j < numOfPseudoExpr; ++j) {
SExprInfo* pExpr = &pPseudoExpr[j];
......@@ -2548,7 +2550,7 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
return NULL;
}
SMetaReader smrSuperTable = {0};
metaReaderInit(&smrSuperTable, pInfo->readHandle.meta, 0);
metaReaderInit(&smrSuperTable, pInfo->readHandle.meta, META_READER_NOLOCK);
metaGetTableEntryByUid(&smrSuperTable, smrChildTable.me.ctbEntry.suid);
sysTableUserTagsFillOneTableTags(pInfo, &smrSuperTable, &smrChildTable, dbname, tableName, &numOfRows, dataBlock);
metaReaderClear(&smrSuperTable);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册