Merge branch 'main' of https://github.com/taosdata/TDengine into fix/TD023101
This commit is contained in:
commit
6b8fd25894
|
@ -2,7 +2,7 @@
|
||||||
IF (DEFINED VERNUMBER)
|
IF (DEFINED VERNUMBER)
|
||||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||||
ELSE ()
|
ELSE ()
|
||||||
SET(TD_VER_NUMBER "3.0.3.0")
|
SET(TD_VER_NUMBER "3.0.3.1")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
IF (DEFINED VERCOMPATIBLE)
|
IF (DEFINED VERCOMPATIBLE)
|
||||||
|
|
|
@ -107,7 +107,7 @@ elif [ ${testFile} = "tools" ];then
|
||||||
originTdpPath="taosTools-${originversion}"
|
originTdpPath="taosTools-${originversion}"
|
||||||
packageName="${tdPath}-Linux-${cpuType}${packageLite}.${packageType}"
|
packageName="${tdPath}-Linux-${cpuType}${packageLite}.${packageType}"
|
||||||
originPackageName="${originTdpPath}-Linux-${cpuType}${packageLite}.${packageType}"
|
originPackageName="${originTdpPath}-Linux-${cpuType}${packageLite}.${packageType}"
|
||||||
installCmd="install-tools.sh"
|
installCmd="install-taostools.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ if [[ ${packageName} =~ "Lite" ]] || ([[ ${packageName} =~ "x64" ]] && [[ ${p
|
||||||
wgetFile taosTools-2.1.3-Linux-x64.tar.gz v2.1.3 web
|
wgetFile taosTools-2.1.3-Linux-x64.tar.gz v2.1.3 web
|
||||||
tar xf taosTools-2.1.3-Linux-x64.tar.gz
|
tar xf taosTools-2.1.3-Linux-x64.tar.gz
|
||||||
fi
|
fi
|
||||||
cd taosTools-2.1.3 && bash install-tools.sh
|
cd taosTools-2.1.3 && bash install-taostools.sh
|
||||||
elif ([[ ${packageName} =~ "arm64" ]] && [[ ${packageName} =~ "client" ]]);then
|
elif ([[ ${packageName} =~ "arm64" ]] && [[ ${packageName} =~ "client" ]]);then
|
||||||
echoColor G "===== install taos-tools arm when package is arm64-client ====="
|
echoColor G "===== install taos-tools arm when package is arm64-client ====="
|
||||||
cd ${installPath}
|
cd ${installPath}
|
||||||
|
@ -342,7 +342,7 @@ elif ([[ ${packageName} =~ "arm64" ]] && [[ ${packageName} =~ "client" ]]);then
|
||||||
tar xf taosTools-2.1.3-Linux-arm64.tar.gz
|
tar xf taosTools-2.1.3-Linux-arm64.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd taosTools-2.1.3 && bash install-tools.sh
|
cd taosTools-2.1.3 && bash install-taostools.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoColor G "===== start TDengine ====="
|
echoColor G "===== start TDengine ====="
|
||||||
|
@ -361,18 +361,18 @@ rm -rf ${installPath}/${tdPath}/
|
||||||
# cd ${installPath}
|
# cd ${installPath}
|
||||||
# wgetFile taosTools-2.1.2-Linux-x64.tar.gz .
|
# wgetFile taosTools-2.1.2-Linux-x64.tar.gz .
|
||||||
# tar xf taosTools-2.1.2-Linux-x64.tar.gz
|
# tar xf taosTools-2.1.2-Linux-x64.tar.gz
|
||||||
# cd taosTools-2.1.2 && bash install-tools.sh
|
# cd taosTools-2.1.2 && bash install-taostools.sh
|
||||||
# elif [[ ${packageName} =~ "Lite" ]] && [[ ${packageName} =~ "deb" ]] ;then
|
# elif [[ ${packageName} =~ "Lite" ]] && [[ ${packageName} =~ "deb" ]] ;then
|
||||||
# echoColor G "===== install taos-tools when package is lite or client ====="
|
# echoColor G "===== install taos-tools when package is lite or client ====="
|
||||||
# cd ${installPath}
|
# cd ${installPath}
|
||||||
# wgetFile taosTools-2.1.2-Linux-x64.tar.gz .
|
# wgetFile taosTools-2.1.2-Linux-x64.tar.gz .
|
||||||
# tar xf taosTools-2.1.2-Linux-x64.tar.gz
|
# tar xf taosTools-2.1.2-Linux-x64.tar.gz
|
||||||
# cd taosTools-2.1.2 && bash install-tools.sh
|
# cd taosTools-2.1.2 && bash install-taostools.sh
|
||||||
# elif [[ ${packageName} =~ "Lite" ]] && [[ ${packageName} =~ "rpm" ]] ;then
|
# elif [[ ${packageName} =~ "Lite" ]] && [[ ${packageName} =~ "rpm" ]] ;then
|
||||||
# echoColor G "===== install taos-tools when package is lite or client ====="
|
# echoColor G "===== install taos-tools when package is lite or client ====="
|
||||||
# cd ${installPath}
|
# cd ${installPath}
|
||||||
# wgetFile taosTools-2.1.2-Linux-x64.tar.gz .
|
# wgetFile taosTools-2.1.2-Linux-x64.tar.gz .
|
||||||
# tar xf taosTools-2.1.2-Linux-x64.tar.gz
|
# tar xf taosTools-2.1.2-Linux-x64.tar.gz
|
||||||
# cd taosTools-2.1.2 && bash install-tools.sh
|
# cd taosTools-2.1.2 && bash install-taostools.sh
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ typedef struct SSortSource {
|
||||||
void* param;
|
void* param;
|
||||||
bool onlyRef;
|
bool onlyRef;
|
||||||
};
|
};
|
||||||
|
int64_t fetchUs;
|
||||||
|
int64_t fetchNum;
|
||||||
} SSortSource;
|
} SSortSource;
|
||||||
|
|
||||||
typedef struct SMsortComparParam {
|
typedef struct SMsortComparParam {
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "thash.h"
|
#include "thash.h"
|
||||||
#include "ttypes.h"
|
#include "ttypes.h"
|
||||||
|
|
||||||
|
#define MULTI_READER_MAX_TABLE_NUM 5000
|
||||||
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
|
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
|
||||||
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
|
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ typedef struct STableMergeScanSortSourceParam {
|
||||||
int32_t readerIdx;
|
int32_t readerIdx;
|
||||||
uint64_t uid;
|
uint64_t uid;
|
||||||
SSDataBlock* inputBlock;
|
SSDataBlock* inputBlock;
|
||||||
|
bool multiReader;
|
||||||
|
STsdbReader* dataReader;
|
||||||
} STableMergeScanSortSourceParam;
|
} STableMergeScanSortSourceParam;
|
||||||
|
|
||||||
static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
|
static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
|
||||||
|
@ -2588,6 +2591,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
int32_t readIdx = source->readerIdx;
|
int32_t readIdx = source->readerIdx;
|
||||||
SSDataBlock* pBlock = source->inputBlock;
|
SSDataBlock* pBlock = source->inputBlock;
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
SQueryTableDataCond* pQueryCond = taosArrayGet(pInfo->queryConds, readIdx);
|
SQueryTableDataCond* pQueryCond = taosArrayGet(pInfo->queryConds, readIdx);
|
||||||
|
|
||||||
|
@ -2595,17 +2599,20 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
|
||||||
void* p = tableListGetInfo(pTaskInfo->pTableInfoList, readIdx + pInfo->tableStartIndex);
|
void* p = tableListGetInfo(pTaskInfo->pTableInfoList, readIdx + pInfo->tableStartIndex);
|
||||||
SReadHandle* pHandle = &pInfo->base.readHandle;
|
SReadHandle* pHandle = &pInfo->base.readHandle;
|
||||||
|
|
||||||
int32_t code =
|
if (NULL == source->dataReader || !source->multiReader) {
|
||||||
tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, pBlock, &pInfo->base.dataReader, GET_TASKID(pTaskInfo));
|
code = tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, pBlock, &source->dataReader, GET_TASKID(pTaskInfo));
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
T_LONG_JMP(pTaskInfo->env, code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pInfo->base.dataReader = source->dataReader;
|
||||||
STsdbReader* reader = pInfo->base.dataReader;
|
STsdbReader* reader = pInfo->base.dataReader;
|
||||||
qTrace("tsdb/read-table-data: %p, enter next reader", reader);
|
qTrace("tsdb/read-table-data: %p, enter next reader", reader);
|
||||||
while (tsdbNextDataBlock(reader)) {
|
while (tsdbNextDataBlock(reader)) {
|
||||||
if (isTaskKilled(pTaskInfo)) {
|
if (isTaskKilled(pTaskInfo)) {
|
||||||
tsdbReleaseDataBlock(reader);
|
tsdbReleaseDataBlock(reader);
|
||||||
|
pInfo->base.dataReader = NULL;
|
||||||
T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
|
T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2639,14 +2646,18 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
|
||||||
pInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0;
|
pInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0;
|
||||||
|
|
||||||
qTrace("tsdb/read-table-data: %p, close reader", reader);
|
qTrace("tsdb/read-table-data: %p, close reader", reader);
|
||||||
tsdbReaderClose(pInfo->base.dataReader);
|
if (!source->multiReader) {
|
||||||
|
tsdbReaderClose(pInfo->base.dataReader);
|
||||||
|
source->dataReader = NULL;
|
||||||
|
}
|
||||||
pInfo->base.dataReader = NULL;
|
pInfo->base.dataReader = NULL;
|
||||||
return pBlock;
|
return pBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("8");
|
if (!source->multiReader) {
|
||||||
|
tsdbReaderClose(pInfo->base.dataReader);
|
||||||
tsdbReaderClose(pInfo->base.dataReader);
|
source->dataReader = NULL;
|
||||||
|
}
|
||||||
pInfo->base.dataReader = NULL;
|
pInfo->base.dataReader = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2718,6 +2729,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
|
||||||
STableMergeScanSortSourceParam param = {0};
|
STableMergeScanSortSourceParam param = {0};
|
||||||
param.readerIdx = i;
|
param.readerIdx = i;
|
||||||
param.pOperator = pOperator;
|
param.pOperator = pOperator;
|
||||||
|
param.multiReader = (numOfTable <= MULTI_READER_MAX_TABLE_NUM) ? true : false;
|
||||||
param.inputBlock = createOneDataBlock(pInfo->pResBlock, false);
|
param.inputBlock = createOneDataBlock(pInfo->pResBlock, false);
|
||||||
blockDataEnsureCapacity(param.inputBlock, pOperator->resultInfo.capacity);
|
blockDataEnsureCapacity(param.inputBlock, pOperator->resultInfo.capacity);
|
||||||
|
|
||||||
|
@ -2761,6 +2773,8 @@ int32_t stopGroupTableMergeScan(SOperatorInfo* pOperator) {
|
||||||
for (int32_t i = 0; i < numOfTable; ++i) {
|
for (int32_t i = 0; i < numOfTable; ++i) {
|
||||||
STableMergeScanSortSourceParam* param = taosArrayGet(pInfo->sortSourceParams, i);
|
STableMergeScanSortSourceParam* param = taosArrayGet(pInfo->sortSourceParams, i);
|
||||||
blockDataDestroy(param->inputBlock);
|
blockDataDestroy(param->inputBlock);
|
||||||
|
tsdbReaderClose(param->dataReader);
|
||||||
|
param->dataReader = NULL;
|
||||||
}
|
}
|
||||||
taosArrayClear(pInfo->sortSourceParams);
|
taosArrayClear(pInfo->sortSourceParams);
|
||||||
|
|
||||||
|
@ -2803,9 +2817,6 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock*
|
||||||
qDebug("%s get sorted row block, rows:%d, limit:%" PRId64, GET_TASKID(pTaskInfo), pResBlock->info.rows,
|
qDebug("%s get sorted row block, rows:%d, limit:%" PRId64, GET_TASKID(pTaskInfo), pResBlock->info.rows,
|
||||||
pInfo->limitInfo.numOfOutputRows);
|
pInfo->limitInfo.numOfOutputRows);
|
||||||
|
|
||||||
if (limitReached) {
|
|
||||||
resetLimitInfoForNextGroup(&pInfo->limitInfo);
|
|
||||||
}
|
|
||||||
return (pResBlock->info.rows > 0) ? pResBlock : NULL;
|
return (pResBlock->info.rows > 0) ? pResBlock : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2858,6 +2869,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
|
||||||
pInfo->tableStartIndex = pInfo->tableEndIndex + 1;
|
pInfo->tableStartIndex = pInfo->tableEndIndex + 1;
|
||||||
pInfo->groupId = tableListGetInfo(pTaskInfo->pTableInfoList, pInfo->tableStartIndex)->groupId;
|
pInfo->groupId = tableListGetInfo(pTaskInfo->pTableInfoList, pInfo->tableStartIndex)->groupId;
|
||||||
startGroupTableMergeScan(pOperator);
|
startGroupTableMergeScan(pOperator);
|
||||||
|
resetLimitInfoForNextGroup(&pInfo->limitInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2873,15 +2885,17 @@ void destroyTableMergeScanOperatorInfo(void* param) {
|
||||||
for (int32_t i = 0; i < numOfTable; i++) {
|
for (int32_t i = 0; i < numOfTable; i++) {
|
||||||
STableMergeScanSortSourceParam* p = taosArrayGet(pTableScanInfo->sortSourceParams, i);
|
STableMergeScanSortSourceParam* p = taosArrayGet(pTableScanInfo->sortSourceParams, i);
|
||||||
blockDataDestroy(p->inputBlock);
|
blockDataDestroy(p->inputBlock);
|
||||||
|
tsdbReaderClose(p->dataReader);
|
||||||
|
p->dataReader = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tsdbReaderClose(pTableScanInfo->base.dataReader);
|
||||||
|
pTableScanInfo->base.dataReader = NULL;
|
||||||
|
|
||||||
taosArrayDestroy(pTableScanInfo->sortSourceParams);
|
taosArrayDestroy(pTableScanInfo->sortSourceParams);
|
||||||
tsortDestroySortHandle(pTableScanInfo->pSortHandle);
|
tsortDestroySortHandle(pTableScanInfo->pSortHandle);
|
||||||
pTableScanInfo->pSortHandle = NULL;
|
pTableScanInfo->pSortHandle = NULL;
|
||||||
|
|
||||||
tsdbReaderClose(pTableScanInfo->base.dataReader);
|
|
||||||
pTableScanInfo->base.dataReader = NULL;
|
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(pTableScanInfo->queryConds); i++) {
|
for (int i = 0; i < taosArrayGetSize(pTableScanInfo->queryConds); i++) {
|
||||||
SQueryTableDataCond* pCond = taosArrayGet(pTableScanInfo->queryConds, i);
|
SQueryTableDataCond* pCond = taosArrayGet(pTableScanInfo->queryConds, i);
|
||||||
taosMemoryFree(pCond->colList);
|
taosMemoryFree(pCond->colList);
|
||||||
|
@ -2898,8 +2912,6 @@ void destroyTableMergeScanOperatorInfo(void* param) {
|
||||||
taosArrayDestroy(pTableScanInfo->pSortInfo);
|
taosArrayDestroy(pTableScanInfo->pSortInfo);
|
||||||
cleanupExprSupp(&pTableScanInfo->base.pseudoSup);
|
cleanupExprSupp(&pTableScanInfo->base.pseudoSup);
|
||||||
|
|
||||||
tsdbReaderClose(pTableScanInfo->base.dataReader);
|
|
||||||
pTableScanInfo->base.dataReader = NULL;
|
|
||||||
taosLRUCacheCleanup(pTableScanInfo->base.metaCache.pTableMetaEntryCache);
|
taosLRUCacheCleanup(pTableScanInfo->base.metaCache.pTableMetaEntryCache);
|
||||||
|
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
|
|
|
@ -108,12 +108,18 @@ static int32_t sortComparCleanup(SMsortComparParam* cmpParam) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tsortClearOrderdSource(SArray* pOrderedSource) {
|
void tsortClearOrderdSource(SArray* pOrderedSource, int64_t *fetchUs, int64_t *fetchNum) {
|
||||||
for (size_t i = 0; i < taosArrayGetSize(pOrderedSource); i++) {
|
for (size_t i = 0; i < taosArrayGetSize(pOrderedSource); i++) {
|
||||||
SSortSource** pSource = taosArrayGet(pOrderedSource, i);
|
SSortSource** pSource = taosArrayGet(pOrderedSource, i);
|
||||||
if (NULL == *pSource) {
|
if (NULL == *pSource) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fetchUs) {
|
||||||
|
*fetchUs += (*pSource)->fetchUs;
|
||||||
|
*fetchNum += (*pSource)->fetchNum;
|
||||||
|
}
|
||||||
|
|
||||||
// release pageIdList
|
// release pageIdList
|
||||||
if ((*pSource)->pageIdList) {
|
if ((*pSource)->pageIdList) {
|
||||||
taosArrayDestroy((*pSource)->pageIdList);
|
taosArrayDestroy((*pSource)->pageIdList);
|
||||||
|
@ -147,7 +153,10 @@ void tsortDestroySortHandle(SSortHandle* pSortHandle) {
|
||||||
taosMemoryFreeClear(pSortHandle->idStr);
|
taosMemoryFreeClear(pSortHandle->idStr);
|
||||||
blockDataDestroy(pSortHandle->pDataBlock);
|
blockDataDestroy(pSortHandle->pDataBlock);
|
||||||
|
|
||||||
tsortClearOrderdSource(pSortHandle->pOrderedSource);
|
int64_t fetchUs = 0, fetchNum = 0;
|
||||||
|
tsortClearOrderdSource(pSortHandle->pOrderedSource, &fetchUs, &fetchNum);
|
||||||
|
qError("all source fetch time: %" PRId64 "us num:%" PRId64 " %s", fetchUs, fetchNum, pSortHandle->idStr);
|
||||||
|
|
||||||
taosArrayDestroy(pSortHandle->pOrderedSource);
|
taosArrayDestroy(pSortHandle->pOrderedSource);
|
||||||
taosMemoryFreeClear(pSortHandle);
|
taosMemoryFreeClear(pSortHandle);
|
||||||
}
|
}
|
||||||
|
@ -307,7 +316,7 @@ static int32_t sortComparInit(SMsortComparParam* pParam, SArray* pSources, int32
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t et = taosGetTimestampUs();
|
int64_t et = taosGetTimestampUs();
|
||||||
qDebug("init for merge sort completed, elapsed time:%.2f ms, %s", (et - st) / 1000.0, pHandle->idStr);
|
qError("init for merge sort completed, elapsed time:%.2f ms, %s", (et - st) / 1000.0, pHandle->idStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
@ -365,7 +374,10 @@ static int32_t adjustMergeTreeForNextTuple(SSortSource* pSource, SMultiwayMergeT
|
||||||
releaseBufPage(pHandle->pBuf, pPage);
|
releaseBufPage(pHandle->pBuf, pPage);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
int64_t st = taosGetTimestampUs();
|
||||||
pSource->src.pBlock = pHandle->fetchfp(((SSortSource*)pSource)->param);
|
pSource->src.pBlock = pHandle->fetchfp(((SSortSource*)pSource)->param);
|
||||||
|
pSource->fetchUs += taosGetTimestampUs() - st;
|
||||||
|
pSource->fetchNum++;
|
||||||
if (pSource->src.pBlock == NULL) {
|
if (pSource->src.pBlock == NULL) {
|
||||||
(*numOfCompleted) += 1;
|
(*numOfCompleted) += 1;
|
||||||
pSource->src.rowIndex = -1;
|
pSource->src.rowIndex = -1;
|
||||||
|
@ -602,7 +614,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tsortClearOrderdSource(pHandle->pOrderedSource);
|
tsortClearOrderdSource(pHandle->pOrderedSource, NULL, NULL);
|
||||||
taosArrayAddAll(pHandle->pOrderedSource, pResList);
|
taosArrayAddAll(pHandle->pOrderedSource, pResList);
|
||||||
taosArrayDestroy(pResList);
|
taosArrayDestroy(pResList);
|
||||||
|
|
||||||
|
@ -644,7 +656,7 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
|
||||||
SSortSource* source = *pSource;
|
SSortSource* source = *pSource;
|
||||||
*pSource = NULL;
|
*pSource = NULL;
|
||||||
|
|
||||||
tsortClearOrderdSource(pHandle->pOrderedSource);
|
tsortClearOrderdSource(pHandle->pOrderedSource, NULL, NULL);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
SSDataBlock* pBlock = pHandle->fetchfp(source->param);
|
SSDataBlock* pBlock = pHandle->fetchfp(source->param);
|
||||||
|
|
|
@ -361,11 +361,29 @@ static bool notRefByOrderBy(SColumnNode* pCol, SNodeList* pOrderByList) {
|
||||||
return !cxt.hasThisCol;
|
return !cxt.hasThisCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isSetUselessCol(SSetOperator* pSetOp, int32_t index, SExprNode* pProj) {
|
||||||
|
if (!isUselessCol(pProj)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SNodeList* pLeftProjs = getChildProjection(pSetOp->pLeft);
|
||||||
|
if (!isUselessCol((SExprNode*)nodesListGetNode(pLeftProjs, index))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SNodeList* pRightProjs = getChildProjection(pSetOp->pRight);
|
||||||
|
if (!isUselessCol((SExprNode*)nodesListGetNode(pRightProjs, index))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) {
|
static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) {
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
SNode* pProj = NULL;
|
SNode* pProj = NULL;
|
||||||
WHERE_EACH(pProj, pSetOp->pProjectionList) {
|
WHERE_EACH(pProj, pSetOp->pProjectionList) {
|
||||||
if (subquery && notRefByOrderBy((SColumnNode*)pProj, pSetOp->pOrderByList) && isUselessCol((SExprNode*)pProj)) {
|
if (subquery && notRefByOrderBy((SColumnNode*)pProj, pSetOp->pOrderByList) && isSetUselessCol(pSetOp, index, (SExprNode*)pProj)) {
|
||||||
ERASE_NODE(pSetOp->pProjectionList);
|
ERASE_NODE(pSetOp->pProjectionList);
|
||||||
eraseSetOpChildProjection(pSetOp, index);
|
eraseSetOpChildProjection(pSetOp, index);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1422,6 +1422,9 @@ static int32_t translateAggFunc(STranslateContext* pCxt, SFunctionNode* pFunc) {
|
||||||
if (isCountStar(pFunc)) {
|
if (isCountStar(pFunc)) {
|
||||||
return rewriteCountStar(pCxt, pFunc);
|
return rewriteCountStar(pCxt, pFunc);
|
||||||
}
|
}
|
||||||
|
if (isCountNotNullValue(pFunc)) {
|
||||||
|
return rewriteCountNotNullValue(pCxt, pFunc);
|
||||||
|
}
|
||||||
if (isCountTbname(pFunc)) {
|
if (isCountTbname(pFunc)) {
|
||||||
return rewriteCountTbname(pCxt, pFunc);
|
return rewriteCountTbname(pCxt, pFunc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,6 +853,7 @@
|
||||||
,,y,script,./test.sh -f tsim/parser/topbot.sim
|
,,y,script,./test.sh -f tsim/parser/topbot.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/union_sysinfo.sim
|
,,y,script,./test.sh -f tsim/parser/union_sysinfo.sim
|
||||||
,,y,script,./test.sh -f tsim/parser/slimit_limit.sim
|
,,y,script,./test.sh -f tsim/parser/slimit_limit.sim
|
||||||
|
,,y,script,./test.sh -f tsim/parser/table_merge_limit.sim
|
||||||
,,y,script,./test.sh -f tsim/query/tagLikeFilter.sim
|
,,y,script,./test.sh -f tsim/query/tagLikeFilter.sim
|
||||||
,,y,script,./test.sh -f tsim/query/charScalarFunction.sim
|
,,y,script,./test.sh -f tsim/query/charScalarFunction.sim
|
||||||
,,y,script,./test.sh -f tsim/query/explain.sim
|
,,y,script,./test.sh -f tsim/query/explain.sim
|
||||||
|
|
|
@ -68,8 +68,8 @@ docker run \
|
||||||
-v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \
|
-v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \
|
||||||
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
|
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
|
||||||
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
|
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
|
||||||
-v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
|
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=true;make -j || exit 1"
|
||||||
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
|
# -v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
|
||||||
|
|
||||||
if [[ -d ${WORKDIR}/debugNoSan ]] ;then
|
if [[ -d ${WORKDIR}/debugNoSan ]] ;then
|
||||||
echo "delete ${WORKDIR}/debugNoSan"
|
echo "delete ${WORKDIR}/debugNoSan"
|
||||||
|
@ -97,7 +97,7 @@ docker run \
|
||||||
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
|
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
|
||||||
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
|
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
|
||||||
-v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
|
-v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
|
||||||
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 "
|
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true -DJEMALLOC_ENABLED=true;make -j || exit 1 "
|
||||||
|
|
||||||
mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan
|
mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ fi
|
||||||
today=`date +"%Y%m%d"`
|
today=`date +"%Y%m%d"`
|
||||||
TDENGINE_DIR=/root/TDengine
|
TDENGINE_DIR=/root/TDengine
|
||||||
JDBC_DIR=/root/taos-connector-jdbc
|
JDBC_DIR=/root/taos-connector-jdbc
|
||||||
|
TAOSKEEPER_DIR=/root/taoskeeper
|
||||||
TDENGINE_COVERAGE_REPORT=$TDENGINE_DIR/tests/coverage-report-$today.log
|
TDENGINE_COVERAGE_REPORT=$TDENGINE_DIR/tests/coverage-report-$today.log
|
||||||
|
|
||||||
# Color setting
|
# Color setting
|
||||||
|
@ -171,6 +172,24 @@ function runJDBCCases() {
|
||||||
echo -e "### JDBC test result: $summary ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
echo -e "### JDBC test result: $summary ###" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function runTaosKeeperCases() {
|
||||||
|
echo "=== Run taoskeeper cases ==="
|
||||||
|
|
||||||
|
cd $TAOSKEEPER_DIR
|
||||||
|
git checkout -- .
|
||||||
|
git reset --hard HEAD
|
||||||
|
git checkout master
|
||||||
|
git pull
|
||||||
|
|
||||||
|
stopTaosd
|
||||||
|
stopTaosadapter
|
||||||
|
|
||||||
|
taosd -c /etc/taos >> /dev/null 2>&1 &
|
||||||
|
taosadapter >> /dev/null 2>&1 &
|
||||||
|
|
||||||
|
go mod tidy && go test -v ./...
|
||||||
|
}
|
||||||
|
|
||||||
function runTest() {
|
function runTest() {
|
||||||
echo "run Test"
|
echo "run Test"
|
||||||
|
|
||||||
|
@ -182,6 +201,7 @@ function runTest() {
|
||||||
runSimCases
|
runSimCases
|
||||||
runPythonCases
|
runPythonCases
|
||||||
runJDBCCases
|
runJDBCCases
|
||||||
|
runTaosKeeperCases
|
||||||
|
|
||||||
stopTaosd
|
stopTaosd
|
||||||
cd $TDENGINE_DIR/tests/script
|
cd $TDENGINE_DIR/tests/script
|
||||||
|
@ -199,7 +219,7 @@ function lcovFunc {
|
||||||
lcov -d . --capture --rc lcov_branch_coverage=1 --rc genhtml_branch_coverage=1 --no-external -b $TDENGINE_DIR -o coverage.info
|
lcov -d . --capture --rc lcov_branch_coverage=1 --rc genhtml_branch_coverage=1 --no-external -b $TDENGINE_DIR -o coverage.info
|
||||||
|
|
||||||
# remove exclude paths
|
# remove exclude paths
|
||||||
if [ "$branch" == "3.0" ]; then
|
if [ "$branch" == "main" ] ; then
|
||||||
lcov --remove coverage.info \
|
lcov --remove coverage.info \
|
||||||
'*/contrib/*' '*/tests/*' '*/test/*' '*/tools/*' '*/libs/sync/*'\
|
'*/contrib/*' '*/tests/*' '*/test/*' '*/tools/*' '*/libs/sync/*'\
|
||||||
'*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c' '*/tsdbDiskData.c'\
|
'*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c' '*/tsdbDiskData.c'\
|
||||||
|
@ -209,6 +229,8 @@ function lcovFunc {
|
||||||
'*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' '*/catalog.c'\
|
'*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' '*/catalog.c'\
|
||||||
'*/tqSnapshot.c' '*/tsdbSnapshot.c''*/metaSnapshot.c' '*/smaSnapshot.c' '*/tqOffsetSnapshot.c'\
|
'*/tqSnapshot.c' '*/tsdbSnapshot.c''*/metaSnapshot.c' '*/smaSnapshot.c' '*/tqOffsetSnapshot.c'\
|
||||||
'*/vnodeSnapshot.c' '*/metaSnapshot.c' '*/tsdbSnapshot.c' '*/mndGrant.c' '*/mndSnode.c' '*/streamRecover.c'\
|
'*/vnodeSnapshot.c' '*/metaSnapshot.c' '*/tsdbSnapshot.c' '*/mndGrant.c' '*/mndSnode.c' '*/streamRecover.c'\
|
||||||
|
'*/osAtomic.c' '*/osDir.c' '*/osFile.c' '*/osMath.c' '*/osSignal.c' '*/osSleep.c' '*/osString.c' '*/osSystem.c'\
|
||||||
|
'*/osThread.c' '*/osTime.c' '*/osTimezone.c' \
|
||||||
--rc lcov_branch_coverage=1 -o coverage.info
|
--rc lcov_branch_coverage=1 -o coverage.info
|
||||||
else
|
else
|
||||||
lcov --remove coverage.info \
|
lcov --remove coverage.info \
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
$dbPrefix = m_fl_db
|
||||||
|
$tbPrefix = m_fl_tb
|
||||||
|
$mtPrefix = m_fl_mt
|
||||||
|
$tbNum = 2
|
||||||
|
$rowNum = 513
|
||||||
|
$totalNum = $tbNum * $rowNum
|
||||||
|
$ts0 = 1537146000000
|
||||||
|
$delta = 600000
|
||||||
|
print ========== fill.sim
|
||||||
|
$i = 0
|
||||||
|
$db = $dbPrefix . $i
|
||||||
|
$mt = $mtPrefix . $i
|
||||||
|
|
||||||
|
sql drop database $db -x step1
|
||||||
|
step1:
|
||||||
|
sql create database $db vgroups 1
|
||||||
|
sql use $db
|
||||||
|
sql create table $mt (ts timestamp, c1 int) tags(tgcol int)
|
||||||
|
|
||||||
|
$i = 0
|
||||||
|
$ts = $ts0
|
||||||
|
while $i < $tbNum
|
||||||
|
$tb = $tbPrefix . $i
|
||||||
|
sql create table $tb using $mt tags( $i )
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
while $x < $rowNum
|
||||||
|
$xs = $x * $delta
|
||||||
|
$ts = $ts0 + $xs
|
||||||
|
sql insert into $tb values ( $ts , $x )
|
||||||
|
$x = $x + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
$i = $i + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
sql select * from $mt order by ts limit 10
|
||||||
|
if $rows != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -214,13 +214,13 @@ class TDTestCase:
|
||||||
sql=f"SELECT model,count(state_changed) FROM (SELECT _rowts,model,diff(broken_down) AS state_changed FROM (SELECT ts,model,tb,cast(cast(floor(2*(nzs)) as bool) as int) AS broken_down FROM (SELECT _wstart as ts,model,tbname as tb, sum(cast(cast(status as bool) as int))/count(cast(cast(status as bool) as int)) AS nzs FROM {dbname}.diagnostics WHERE ts >= 1451606400000 AND ts < 1451952001000 partition BY tbname,model interval(10m))order by ts) partition BY tb,model ) WHERE state_changed = 1 partition BY model;"
|
sql=f"SELECT model,count(state_changed) FROM (SELECT _rowts,model,diff(broken_down) AS state_changed FROM (SELECT ts,model,tb,cast(cast(floor(2*(nzs)) as bool) as int) AS broken_down FROM (SELECT _wstart as ts,model,tbname as tb, sum(cast(cast(status as bool) as int))/count(cast(cast(status as bool) as int)) AS nzs FROM {dbname}.diagnostics WHERE ts >= 1451606400000 AND ts < 1451952001000 partition BY tbname,model interval(10m))order by ts) partition BY tb,model ) WHERE state_changed = 1 partition BY model;"
|
||||||
tdSql.query(f"{sql}")
|
tdSql.query(f"{sql}")
|
||||||
tdSql.checkRows(46)
|
tdSql.checkRows(46)
|
||||||
# for i in range(2):
|
for i in range(2):
|
||||||
# tdSql.query("%s"%sql)
|
tdSql.query("%s"%sql)
|
||||||
# quertR1=tdSql.queryResult
|
quertR1=tdSql.queryResult
|
||||||
# for j in range(50):
|
for j in range(50):
|
||||||
# tdSql.query("%s"%sql)
|
tdSql.query("%s"%sql)
|
||||||
# quertR2=tdSql.queryResult
|
quertR2=tdSql.queryResult
|
||||||
# assert quertR1 == quertR2 , "%s != %s ,The results of multiple queries are different" %(quertR1,quertR2)
|
assert quertR1 == quertR2 , "%s != %s ,The results of multiple queries are different" %(quertR1,quertR2)
|
||||||
|
|
||||||
|
|
||||||
#it's already supported:
|
#it's already supported:
|
||||||
|
|
Loading…
Reference in New Issue