Merge pull request #27763 from taosdata/fix/3.0/TD-31976

fix tdb/client eating error codes caused creating tsma blocking
This commit is contained in:
Pan Wei 2024-09-10 15:28:22 +08:00 committed by GitHub
commit 9eeec14f7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View File

@ -1068,6 +1068,7 @@ static int32_t createResultBlock(TAOS_RES* pRes, int32_t numOfRows, SSDataBlock*
TAOS_ROW pRow = taos_fetch_row(pRes);
if (NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) {
tscError("invalid data from vnode");
blockDataDestroy(*pBlock);
return TSDB_CODE_TSC_INTERNAL_ERROR;
}
int64_t ts = *(int64_t*)pRow[0];
@ -1102,8 +1103,11 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) {
}
SSDataBlock* pBlock = NULL;
if (TSDB_CODE_SUCCESS != createResultBlock(res, rowNum, &pBlock)) {
tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
pRequest->code = createResultBlock(res, rowNum, &pBlock);
if (TSDB_CODE_SUCCESS != pRequest->code) {
tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId,
tstrerror(pRequest->code));
returnToUser(pRequest);
return;
}

View File

@ -54,8 +54,8 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u
STbDbKey tbDbKey = {.version = version, .uid = uid};
// query table.db
if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf) < 0) {
return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
if ((code = tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf)) < 0) {
return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code);
}
// decode the entry
@ -98,8 +98,9 @@ int metaReaderGetTableEntryByUidCache(SMetaReader *pReader, tb_uid_t uid) {
SMeta *pMeta = pReader->pMeta;
SMetaInfo info;
if (metaGetInfo(pMeta, uid, &info, pReader) == TSDB_CODE_NOT_FOUND) {
return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
int32_t code = metaGetInfo(pMeta, uid, &info, pReader);
if (TSDB_CODE_SUCCESS != code) {
return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code);
}
return metaGetTableEntryByVersion(pReader, info.version, uid);
@ -1584,10 +1585,9 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR
}
// search TDB
if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) {
if ((code = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData)) < 0) {
// not found
if (!lock) metaULock(pMeta);
code = TSDB_CODE_NOT_FOUND;
goto _exit;
}