未验证 提交 395926f7 编写于 作者: P plum-lihui 提交者: GitHub

Merge pull request #1408 from taosdata/hotfix_liaohj

hotfix a query crash.
......@@ -186,7 +186,7 @@ int32_t vnodeGetVnodeHeaderFileIdx(int32_t* fid, SQueryRuntimeEnv* pRuntimeEnv,
int32_t createDataBlocksInfoEx(SMeterDataInfo** pMeterDataInfo, int32_t numOfMeters,
SMeterDataBlockInfoEx** pDataBlockInfoEx, int32_t numOfCompBlocks,
int32_t* nAllocBlocksInfoSize, int64_t addr);
int32_t* nAllocBlocksInfoSize, int32_t* realBlocks, int64_t addr);
void freeMeterBlockInfoEx(SMeterDataBlockInfoEx* pDataBlockInfoEx, int32_t len);
void setExecutionContext(SMeterQuerySupportObj* pSupporter, SOutputRes* outputRes, int32_t meterIdx, int32_t groupIdx,
......
......@@ -6111,7 +6111,7 @@ void cleanBlockOrderSupporter(SBlockOrderSupporter* pSupporter, int32_t numOfTab
int32_t createDataBlocksInfoEx(SMeterDataInfo **pMeterDataInfo, int32_t numOfMeters,
SMeterDataBlockInfoEx **pDataBlockInfoEx, int32_t numOfCompBlocks,
int32_t *nAllocBlocksInfoSize, int64_t addr) {
int32_t *nAllocBlocksInfoSize, int32_t* realBlocks, int64_t addr) {
// release allocated memory first
freeDataBlockFieldInfo(*pDataBlockInfoEx, *nAllocBlocksInfoSize);
......@@ -6174,7 +6174,9 @@ int32_t createDataBlocksInfoEx(SMeterDataInfo **pMeterDataInfo, int32_t numOfMet
dTrace("QInfo %p create data blocks info struct completed", addr);
assert(cnt == numOfCompBlocks && numOfQualMeters <= numOfMeters); // the pMeterDataInfo[j]->numOfBlocks may be 0
assert(cnt <= numOfCompBlocks && numOfQualMeters <= numOfMeters); // the pMeterDataInfo[j]->numOfBlocks may be 0
*realBlocks = cnt;
supporter.numOfMeters = numOfQualMeters;
SLoserTreeInfo *pTree = NULL;
......
......@@ -345,8 +345,9 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
continue;
}
int32_t realBlocks = 0;
ret = createDataBlocksInfoEx(pReqMeterDataInfo, numOfQualifiedMeters, &pDataBlockInfoEx, numOfBlocks,
&nAllocBlocksInfoSize, (int64_t)pQInfo);
&nAllocBlocksInfoSize, &realBlocks, (int64_t)pQInfo);
if (ret != TSDB_CODE_SUCCESS) { // failed to create data blocks
dError("QInfo:%p build blockInfoEx failed, abort", pQInfo);
tfree(pReqMeterDataInfo);
......@@ -356,6 +357,15 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
return;
}
assert(realBlocks <= numOfBlocks);
numOfBlocks = realBlocks;
if (numOfBlocks == 0) {
fid += step;
tfree(pReqMeterDataInfo);
continue;
}
dTrace("QInfo:%p start to load %d blocks and check", pQInfo, numOfBlocks);
int64_t TRACE_OUTPUT_BLOCK_CNT = 10000;
int64_t stimeUnit = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册