fix(query): return with error code if the table does not exist during creating tsdbReader

This commit is contained in:
Haojun Liao 2022-12-09 21:07:03 +08:00
parent 0c8bbf5496
commit 44dc2564eb
1 changed files with 9 additions and 3 deletions

View File

@ -3827,12 +3827,17 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->suid, -1, 1);
if (pReader->pSchema == NULL) {
tsdbError("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->suid, pReader->idStr);
// no valid error code set in metaGetTbTSchema, so let's set the error code here.
code = TSDB_CODE_PAR_TABLE_NOT_EXIST;
goto _err;
}
} else if (numOfTables > 0) {
STableKeyInfo* pKey = pTableList;
pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1);
if (pReader->pSchema == NULL) {
tsdbError("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
code = TSDB_CODE_PAR_TABLE_NOT_EXIST;
goto _err;
}
}
@ -3890,6 +3895,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
_err:
tsdbError("failed to create data reader, code:%s %s", tstrerror(code), idstr);
tsdbReaderClose(pReader);
return code;
}