Merge pull request #24842 from taosdata/fix/TD-28765
fix(vnd/query): not release reader if not initialized
This commit is contained in:
commit
20cd0d08bb
|
@ -13,8 +13,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vnd.h"
|
|
||||||
#include "tsdb.h"
|
#include "tsdb.h"
|
||||||
|
#include "vnd.h"
|
||||||
|
|
||||||
#define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType, tags) \
|
#define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType, tags) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -49,7 +49,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
// decode req
|
// decode req
|
||||||
if (tDeserializeSTableInfoReq(pMsg->pCont, pMsg->contLen, &infoReq) != 0) {
|
if (tDeserializeSTableInfoReq(pMsg->pCont, pMsg->contLen, &infoReq) != 0) {
|
||||||
code = TSDB_CODE_INVALID_MSG;
|
code = TSDB_CODE_INVALID_MSG;
|
||||||
goto _exit;
|
goto _exit4;
|
||||||
}
|
}
|
||||||
|
|
||||||
metaRsp.dbId = pVnode->config.dbId;
|
metaRsp.dbId = pVnode->config.dbId;
|
||||||
|
@ -59,7 +59,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
sprintf(tableFName, "%s.%s", infoReq.dbFName, infoReq.tbName);
|
sprintf(tableFName, "%s.%s", infoReq.dbFName, infoReq.tbName);
|
||||||
code = vnodeValidateTableHash(pVnode, tableFName);
|
code = vnodeValidateTableHash(pVnode, tableFName);
|
||||||
if (code) {
|
if (code) {
|
||||||
goto _exit;
|
goto _exit4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// query meta
|
// query meta
|
||||||
|
@ -67,7 +67,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
|
|
||||||
if (metaGetTableEntryByName(&mer1, infoReq.tbName) < 0) {
|
if (metaGetTableEntryByName(&mer1, infoReq.tbName) < 0) {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit3;
|
||||||
}
|
}
|
||||||
|
|
||||||
metaRsp.tableType = mer1.me.type;
|
metaRsp.tableType = mer1.me.type;
|
||||||
|
@ -81,7 +81,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
metaRsp.suid = mer1.me.uid;
|
metaRsp.suid = mer1.me.uid;
|
||||||
} else if (mer1.me.type == TSDB_CHILD_TABLE) {
|
} else if (mer1.me.type == TSDB_CHILD_TABLE) {
|
||||||
metaReaderDoInit(&mer2, pVnode->pMeta, META_READER_NOLOCK);
|
metaReaderDoInit(&mer2, pVnode->pMeta, META_READER_NOLOCK);
|
||||||
if (metaReaderGetTableEntryByUid(&mer2, mer1.me.ctbEntry.suid) < 0) goto _exit;
|
if (metaReaderGetTableEntryByUid(&mer2, mer1.me.ctbEntry.suid) < 0) goto _exit2;
|
||||||
|
|
||||||
strcpy(metaRsp.stbName, mer2.me.name);
|
strcpy(metaRsp.stbName, mer2.me.name);
|
||||||
metaRsp.suid = mer2.me.uid;
|
metaRsp.suid = mer2.me.uid;
|
||||||
|
@ -125,6 +125,12 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
tSerializeSTableMetaRsp(pRsp, rspLen, &metaRsp);
|
tSerializeSTableMetaRsp(pRsp, rspLen, &metaRsp);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
taosMemoryFree(metaRsp.pSchemas);
|
||||||
|
_exit2:
|
||||||
|
metaReaderClear(&mer2);
|
||||||
|
_exit3:
|
||||||
|
metaReaderClear(&mer1);
|
||||||
|
_exit4:
|
||||||
rpcMsg.info = pMsg->info;
|
rpcMsg.info = pMsg->info;
|
||||||
rpcMsg.pCont = pRsp;
|
rpcMsg.pCont = pRsp;
|
||||||
rpcMsg.contLen = rspLen;
|
rpcMsg.contLen = rspLen;
|
||||||
|
@ -141,9 +147,6 @@ _exit:
|
||||||
*pMsg = rpcMsg;
|
*pMsg = rpcMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFree(metaRsp.pSchemas);
|
|
||||||
metaReaderClear(&mer2);
|
|
||||||
metaReaderClear(&mer1);
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,5 +709,5 @@ void *vnodeGetIvtIdx(void *pVnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vnodeGetTableSchema(void *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid) {
|
int32_t vnodeGetTableSchema(void *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid) {
|
||||||
return tsdbGetTableSchema(((SVnode*)pVnode)->pMeta, uid, pSchema, suid);
|
return tsdbGetTableSchema(((SVnode *)pVnode)->pMeta, uid, pSchema, suid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue