Skip to content

Commit

Permalink
Merge pull request #29478 from taosdata/fix/TD-33440-3.0m
Browse files Browse the repository at this point in the history
fix: eliminate duplicated read locks in one thread
  • Loading branch information
guanshengliang authored Jan 6, 2025
2 parents db6e5ad + c692155 commit b81ade6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions source/dnode/vnode/src/vnd/vnodeQuery.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
code = TSDB_CODE_TDB_TABLE_NOT_EXIST;
goto _exit3;
}
char tbName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
TAOS_CHECK_GOTO(metaGetTableNameByUid(pVnode, tbUid, tbName), NULL, _exit3);
tstrncpy(metaRsp.tbName, varDataVal(tbName), TSDB_TABLE_NAME_LEN);
TAOS_CHECK_GOTO(metaGetTableEntryByName(&mer1, varDataVal(tbName)), NULL, _exit3);
SMetaReader mr3 = {0};
metaReaderDoInit(&mr3, ((SVnode *)pVnode)->pMeta, META_READER_NOLOCK);
if ((code = metaReaderGetTableEntryByUid(&mr3, tbUid)) < 0) {
metaReaderClear(&mr3);
TAOS_CHECK_GOTO(code, NULL, _exit3);
}
tstrncpy(metaRsp.tbName, mr3.me.name, TSDB_TABLE_NAME_LEN);
metaReaderClear(&mr3);
TAOS_CHECK_GOTO(metaGetTableEntryByName(&mer1, metaRsp.tbName), NULL, _exit3);
} else if (metaGetTableEntryByName(&mer1, infoReq.tbName) < 0) {
code = terrno;
goto _exit3;
Expand Down

0 comments on commit b81ade6

Please sign in to comment.