fix(query): check return value.
This commit is contained in:
parent
e0fc36ce97
commit
b21cc86ce3
|
@ -452,22 +452,25 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
|||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
bool hasRes = false;
|
||||
SArray* pRow = NULL;
|
||||
void** pRes = NULL;
|
||||
SCacheRowsReader* pr = pReader;
|
||||
pr->pReadSnap = NULL;
|
||||
int32_t pkBufLen = 0;
|
||||
|
||||
SArray* pRow = taosArrayInit(TARRAY_SIZE(pr->pCidList), sizeof(SLastCol));
|
||||
pr->pReadSnap = NULL;
|
||||
pRow = taosArrayInit(TARRAY_SIZE(pr->pCidList), sizeof(SLastCol));
|
||||
if (pRow == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
void** pRes = taosMemoryCalloc(pr->numOfCols, POINTER_BYTES);
|
||||
pRes = taosMemoryCalloc(pr->numOfCols, POINTER_BYTES);
|
||||
if (pRes == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
int32_t pkBufLen = (pr->rowKey.numOfPKs > 0) ? pr->pkColumn.bytes : 0;
|
||||
pkBufLen = (pr->rowKey.numOfPKs > 0) ? pr->pkColumn.bytes : 0;
|
||||
for (int32_t j = 0; j < pr->numOfCols; ++j) {
|
||||
int32_t bytes = (slotIds[j] == -1) ? 1 : pr->pSchema->columns[slotIds[j]].bytes;
|
||||
|
||||
|
|
|
@ -2434,21 +2434,25 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan
|
|||
|
||||
SSttDataInfoForTable info = {.pKeyRangeList = taosArrayInit(4, sizeof(SSttKeyRange))};
|
||||
if (info.pKeyRangeList == NULL) {
|
||||
pReader->code = terrno;
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t code = tMergeTreeOpen2(&pSttBlockReader->mergeTree, &conf, &info);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pReader->code = code;
|
||||
return false;
|
||||
}
|
||||
|
||||
code = initMemDataIterator(pScanInfo, pReader);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pReader->code = code;
|
||||
return false;
|
||||
}
|
||||
|
||||
code = initDelSkylineIterator(pScanInfo, pReader->info.order, &pReader->cost);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pReader->code = code;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -2461,7 +2465,7 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan
|
|||
for (int32_t i = 0; i < taosArrayGetSize(info.pKeyRangeList); ++i) {
|
||||
SSttKeyRange* pKeyRange = taosArrayGet(info.pKeyRangeList, i);
|
||||
if (pKeyRange == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pkCompEx(&pScanInfo->sttRange.skey, &pKeyRange->skey) > 0) {
|
||||
|
@ -2766,6 +2770,10 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
|||
|
||||
SBlockData* pBlockData = &pReader->status.fileBlockData;
|
||||
(void) initSttBlockReader(pSttBlockReader, pBlockScanInfo, pReader);
|
||||
if (pReader->code != 0) {
|
||||
code = pReader->code;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
bool hasBlockData = false;
|
||||
|
@ -3180,6 +3188,10 @@ static int32_t doLoadSttBlockSequentially(STsdbReader* pReader) {
|
|||
}
|
||||
|
||||
bool hasDataInSttFile = initSttBlockReader(pSttBlockReader, pScanInfo, pReader);
|
||||
if (pReader->code != TSDB_CODE_SUCCESS) {
|
||||
return pReader->code;
|
||||
}
|
||||
|
||||
if (!hasDataInSttFile) {
|
||||
bool hasNexTable = moveToNextTable(pUidList, pStatus);
|
||||
if (!hasNexTable) {
|
||||
|
@ -3273,6 +3285,9 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
|||
|
||||
if (pScanInfo->sttKeyInfo.status == STT_FILE_READER_UNINIT) {
|
||||
(void) initSttBlockReader(pSttBlockReader, pScanInfo, pReader);
|
||||
if (pReader->code != 0) {
|
||||
return pReader->code;
|
||||
}
|
||||
}
|
||||
|
||||
TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader);
|
||||
|
@ -3314,6 +3329,9 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
|||
|
||||
// let's load data from stt files, make sure clear the cleanStt block flag before load the data from stt files
|
||||
(void) initSttBlockReader(pSttBlockReader, pScanInfo, pReader);
|
||||
if (pReader->code != 0) {
|
||||
return pReader->code;
|
||||
}
|
||||
|
||||
// no data in stt block, no need to proceed.
|
||||
while (hasDataInSttBlock(pScanInfo)) {
|
||||
|
|
Loading…
Reference in New Issue