fix ci
This commit is contained in:
parent
2b594e02d2
commit
e43580f71b
|
@ -193,8 +193,6 @@ typedef struct SUserAuthVersion {
|
|||
int32_t version;
|
||||
} SUserAuthVersion;
|
||||
|
||||
typedef struct {} STableTSMAVersion;
|
||||
|
||||
typedef SUserIndexRsp SIndexInfo;
|
||||
|
||||
typedef void (*catalogCallback)(SMetaData* pResult, void* param, int32_t code);
|
||||
|
|
|
@ -369,6 +369,7 @@ typedef struct SLogicSubplan {
|
|||
int32_t level;
|
||||
int32_t splitFlag;
|
||||
int32_t numOfComputeNodes;
|
||||
SNodeList* pTsmaChildren;
|
||||
} SLogicSubplan;
|
||||
|
||||
typedef struct SQueryLogicPlan {
|
||||
|
|
|
@ -555,6 +555,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
|||
if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, CFG_SCOPE_BOTH, CFG_DYN_NONE) != 0) return -1;
|
||||
|
||||
if (cfgAddBool(pCfg, "multiResultFunctionStarReturnTags", tsMultiResultFunctionStarReturnTags, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "countAlwaysReturnValue", tsCountAlwaysReturnValue, 0, 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -609,8 +611,6 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
|||
if (cfgAddInt32(pCfg, "minIntervalTime", tsMinIntervalTime, 1, 1000000, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT) != 0)
|
||||
return -1;
|
||||
|
||||
if (cfgAddInt32(pCfg, "countAlwaysReturnValue", tsCountAlwaysReturnValue, 0, 1, CFG_SCOPE_BOTH, CFG_DYN_CLIENT) != 0)
|
||||
return -1;
|
||||
if (cfgAddInt32(pCfg, "queryBufferSize", tsQueryBufferSize, -1, 500000000000, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0)
|
||||
return -1;
|
||||
if (cfgAddInt32(pCfg, "queryRspPolicy", tsQueryRspPolicy, 0, 1, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1;
|
||||
|
@ -1112,6 +1112,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
|
|||
if (taosSetSlowLogScope(cfgGetItem(pCfg, "slowLogScope")->str)) {
|
||||
return -1;
|
||||
}
|
||||
tsCountAlwaysReturnValue = cfgGetItem(pCfg, "countAlwaysReturnValue")->i32;
|
||||
|
||||
tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32;
|
||||
|
||||
|
@ -1156,7 +1157,6 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
|
|||
tsStatusInterval = cfgGetItem(pCfg, "statusInterval")->i32;
|
||||
tsMinSlidingTime = cfgGetItem(pCfg, "minSlidingTime")->i32;
|
||||
tsMinIntervalTime = cfgGetItem(pCfg, "minIntervalTime")->i32;
|
||||
tsCountAlwaysReturnValue = cfgGetItem(pCfg, "countAlwaysReturnValue")->i32;
|
||||
tsQueryBufferSize = cfgGetItem(pCfg, "queryBufferSize")->i32;
|
||||
|
||||
tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32;
|
||||
|
|
|
@ -1456,9 +1456,6 @@ static void mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
|||
pCxt->pCreateStreamReq->igUpdate = 0;
|
||||
pCxt->pCreateStreamReq->lastTs = pCxt->pCreateSmaReq->lastTs;
|
||||
pCxt->pCreateStreamReq->smaId = pCxt->pSma->uid;
|
||||
//TODO tsma remove this log
|
||||
mDebug("tsma create stream with last ts: %" PRId64 "vgversion size: %d", pCxt->pCreateSmaReq->lastTs,
|
||||
pCxt->pCreateStreamReq->pVgroupVerList ? pCxt->pCreateStreamReq->pVgroupVerList->size : 0);
|
||||
pCxt->pCreateStreamReq->ast = strdup(pCxt->pCreateSmaReq->ast);
|
||||
pCxt->pCreateStreamReq->sql = strdup(pCxt->pCreateSmaReq->sql);
|
||||
|
||||
|
|
|
@ -4002,7 +4002,7 @@ static int32_t mndDropTbAddTsmaResTbsForSingleVg(SMnode* pMnode, SMndDropTbsWith
|
|||
int32_t len = sprintf(buf, "%s", pSma->name);
|
||||
len = taosCreateMD5Hash(buf, len);
|
||||
sprintf(info.tsmaResTbDbFName, "%s", pSma->db);
|
||||
sprintf(info.tsmaResTbNamePrefix, "%s", buf);
|
||||
snprintf(info.tsmaResTbNamePrefix, TSDB_TABLE_NAME_LEN, "%s", buf);
|
||||
SMDropTbDbInfo* pDbInfo = taosHashGet(pCtx->pDbMap, pSma->db, TSDB_DB_FNAME_LEN);
|
||||
info.suid = pSma->dstTbUid;
|
||||
if (!pDbInfo) {
|
||||
|
|
|
@ -868,7 +868,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) {
|
|||
|
||||
_sum_over:
|
||||
if (numOfElem == 0) {
|
||||
if (pCtx->pExpr->pExpr->_function.pFunctNode->hasOriginalFunc &&
|
||||
if (tsCountAlwaysReturnValue && pCtx->pExpr->pExpr->_function.pFunctNode->hasOriginalFunc &&
|
||||
fmIsCountLikeFunc(pCtx->pExpr->pExpr->_function.pFunctNode->originalFuncId)) {
|
||||
numOfElem = 1;
|
||||
}
|
||||
|
|
|
@ -1793,6 +1793,7 @@ int32_t nodesListPushFront(SNodeList* pList, SNode* pNode) {
|
|||
p->pNext = pList->pHead;
|
||||
}
|
||||
pList->pHead = p;
|
||||
pList->pTail = pList->pTail ? pList->pTail : p;
|
||||
++(pList->length);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -3592,7 +3592,7 @@ static int32_t setNormalTableVgroupList(STranslateContext* pCxt, SName* pName, S
|
|||
}
|
||||
|
||||
static int32_t setTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
||||
if (0 && pCxt->pParseCxt->topicQuery) {
|
||||
if (pCxt->pParseCxt->topicQuery) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -5052,8 +5052,8 @@ static int32_t checkIntervalWindow(STranslateContext* pCxt, SIntervalWindo
|
|||
if (IS_CALENDAR_TIME_DURATION(pSliding->unit)) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_SLIDING_UNIT);
|
||||
}
|
||||
if ((pSliding->datum.i < convertTimePrecision(tsMinSlidingTime, TSDB_TIME_PRECISION_MILLI,
|
||||
precision)) ||
|
||||
if ((pSliding->datum.i <
|
||||
convertTimePrecision(tsMinSlidingTime, TSDB_TIME_PRECISION_MILLI, pSliding->node.resType.precision)) ||
|
||||
(pInter->datum.i / pSliding->datum.i > INTERVAL_SLIDING_FACTOR)) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL);
|
||||
}
|
||||
|
@ -12286,9 +12286,9 @@ static int32_t buildDropTableVgroupHashmap(STranslateContext* pCxt, SDropTableCl
|
|||
int32_t code = getTargetMeta(pCxt, name, &pTableMeta, false);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = collectUseTable(name, pCxt->pTargetTables);
|
||||
*tableType = pTableMeta->tableType;
|
||||
}
|
||||
|
||||
*tableType = pTableMeta->tableType;
|
||||
if (TSDB_CODE_SUCCESS == code && TSDB_SUPER_TABLE == pTableMeta->tableType) {
|
||||
goto over;
|
||||
}
|
||||
|
@ -12395,7 +12395,7 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
if (tableType == TSDB_SUPER_TABLE && LIST_LENGTH(pStmt->pTables) > 1) {
|
||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DROP_STABLE);
|
||||
}
|
||||
code = getTableTsmasFromCache(pCxt->pMetaCache, &name, &pTsmas);
|
||||
if (pCxt->pMetaCache) code = getTableTsmasFromCache(pCxt->pMetaCache, &name, &pTsmas);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
taosHashCleanup(pVgroupHashmap);
|
||||
return code;
|
||||
|
|
|
@ -806,6 +806,7 @@ static int32_t putDbDataToCache(const SArray* pDbReq, const SArray* pDbData, SHa
|
|||
}
|
||||
|
||||
static int32_t putDbTableDataToCache(const SArray* pDbReq, const SArray* pTableData, SHashObj** pTable) {
|
||||
if (!pTableData || pTableData->size == 0) return TSDB_CODE_SUCCESS;
|
||||
int32_t ndbs = taosArrayGetSize(pDbReq);
|
||||
int32_t tableNo = 0;
|
||||
for (int32_t i = 0; i < ndbs; ++i) {
|
||||
|
|
|
@ -756,6 +756,7 @@ void MockCatalogService::destoryCatalogReq(SCatalogReq* pReq) {
|
|||
taosArrayDestroy(pReq->pTableIndex);
|
||||
taosArrayDestroy(pReq->pTableCfg);
|
||||
taosArrayDestroyEx(pReq->pView, destoryTablesReq);
|
||||
taosArrayDestroyEx(pReq->pTableTSMAs, destoryTablesReq);
|
||||
delete pReq;
|
||||
}
|
||||
|
||||
|
|
|
@ -5927,6 +5927,43 @@ static bool tsmaOptCheckValidFuncs(const SArray* pTsmaFuncs, const SNodeList* pQ
|
|||
return found;
|
||||
}
|
||||
|
||||
typedef struct STsmaOptTagCheckCtx {
|
||||
const STableTSMAInfo* pTsma;
|
||||
bool ok;
|
||||
} STsmaOptTagCheckCtx;
|
||||
|
||||
static EDealRes tsmaOptTagCheck(SNode* pNode, void* pContext) {
|
||||
bool found = false;
|
||||
if (nodeType(pNode) == QUERY_NODE_COLUMN) {
|
||||
SColumnNode* pCol = (SColumnNode*)pNode;
|
||||
if (pCol->colType == COLUMN_TYPE_TAG) {
|
||||
STsmaOptTagCheckCtx* pCtx = pContext;
|
||||
for (int32_t i = 0; i < pCtx->pTsma->pTags->size; ++i) {
|
||||
SSchema* pSchema = taosArrayGet(pCtx->pTsma->pTags, i);
|
||||
if (pSchema->colId == pCol->colId) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
pCtx->ok = false;
|
||||
return DEAL_RES_END;
|
||||
}
|
||||
}
|
||||
}
|
||||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
|
||||
static bool tsmaOptCheckTags(STSMAOptCtx* pCtx, const STableTSMAInfo* pTsma) {
|
||||
const SScanLogicNode* pScan = pCtx->pScan;
|
||||
STsmaOptTagCheckCtx ctx = {.pTsma = pTsma, .ok = true};
|
||||
nodesWalkExpr(pScan->pTagCond, tsmaOptTagCheck, &ctx);
|
||||
if (!ctx.ok) return false;
|
||||
nodesWalkExprs(pScan->pScanPseudoCols, tsmaOptTagCheck, &ctx);
|
||||
if (!ctx.ok) return false;
|
||||
nodesWalkExprs(pScan->pGroupTags, tsmaOptTagCheck, &ctx);
|
||||
return ctx.ok;
|
||||
}
|
||||
|
||||
static int32_t tsmaOptFilterTsmas(STSMAOptCtx* pTsmaOptCtx) {
|
||||
STSMAOptUsefulTsma usefulTsma = {.pTsma = NULL, .scanRange = {.skey = TSKEY_MIN, .ekey = TSKEY_MAX}};
|
||||
SArray* pTsmaScanCols = NULL;
|
||||
|
@ -5939,8 +5976,6 @@ static int32_t tsmaOptFilterTsmas(STSMAOptCtx* pTsmaOptCtx) {
|
|||
|
||||
STableTSMAInfo* pTsma = taosArrayGetP(pTsmaOptCtx->pTsmas, i);
|
||||
if (!pTsma->fillHistoryFinished || tsMaxTsmaCalcDelay * 1000 < (pTsma->rspTs - pTsma->reqTs) + pTsma->delayDuration) {
|
||||
qInfo("tsma %s filtered out history: %d rspTs: %ld reqTs: %ld delay: %ld, rspTs - reqTs: %ld", pTsma->name,
|
||||
pTsma->fillHistoryFinished, pTsma->rspTs, pTsma->reqTs, pTsma->delayDuration, pTsma->rspTs - pTsma->reqTs);
|
||||
continue;
|
||||
}
|
||||
// filter with interval
|
||||
|
@ -5952,6 +5987,8 @@ static int32_t tsmaOptFilterTsmas(STSMAOptCtx* pTsmaOptCtx) {
|
|||
if (!tsmaOptCheckValidFuncs(pTsma->pFuncs, pTsmaOptCtx->pAggFuncs, pTsmaScanCols)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!tsmaOptCheckTags(pTsmaOptCtx, pTsma)) continue;
|
||||
usefulTsma.pTsma = pTsma;
|
||||
usefulTsma.pTsmaScanCols = pTsmaScanCols;
|
||||
pTsmaScanCols = NULL;
|
||||
|
@ -6623,7 +6660,7 @@ static int32_t tsmaOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan
|
|||
SLogicSubplan* pSubplan = tsmaOptCtx.generatedSubPlans[i];
|
||||
if (!pSubplan) continue;
|
||||
pSubplan->subplanType = SUBPLAN_TYPE_SCAN;
|
||||
nodesListMakeAppend(&pLogicSubplan->pChildren, (SNode*)pSubplan);
|
||||
nodesListMakeAppend(&pLogicSubplan->pTsmaChildren, (SNode*)pSubplan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -655,6 +655,7 @@ static int32_t stbSplCreateMergeNode(SSplitContext* pCxt, SLogicSubplan* pSubpla
|
|||
pMerge->needSort = needSort;
|
||||
pMerge->numOfChannels = stbSplGetNumOfVgroups(pPartChild);
|
||||
pMerge->srcGroupId = pCxt->groupId;
|
||||
pMerge->srcEndGroupId = pCxt->groupId;
|
||||
pMerge->node.precision = pPartChild->precision;
|
||||
pMerge->pMergeKeys = pMergeKeys;
|
||||
pMerge->groupSort = groupSort;
|
||||
|
@ -748,20 +749,23 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo
|
|||
if (code == TSDB_CODE_SUCCESS) {
|
||||
SNode* pNode;
|
||||
SMergeLogicNode* pMerge = (SMergeLogicNode*)pInfo->pSplitNode->pChildren->pHead->pNode;
|
||||
FOREACH(pNode, pInfo->pSubplan->pChildren) {
|
||||
++(pCxt->groupId);
|
||||
SLogicSubplan* pSubplan = (SLogicSubplan*)pNode;
|
||||
pSubplan->id.groupId = pCxt->groupId;
|
||||
pSubplan->id.queryId = pCxt->queryId;
|
||||
pSubplan->splitFlag = SPLIT_FLAG_STABLE_SPLIT;
|
||||
splSetSubplanVgroups(pSubplan, pSubplan->pNode);
|
||||
code = stbSplCreatePartWindowNode((SWindowLogicNode*)pSubplan->pNode, &pPartWindow);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
nodesDestroyNode((SNode*)pSubplan->pNode);
|
||||
pSubplan->pNode = pPartWindow;
|
||||
if (pInfo->pSubplan->pTsmaChildren && LIST_LENGTH(pInfo->pSubplan->pTsmaChildren) > 0) {
|
||||
FOREACH(pNode, pInfo->pSubplan->pTsmaChildren) {
|
||||
++(pCxt->groupId);
|
||||
SLogicSubplan* pSubplan = (SLogicSubplan*)pNode;
|
||||
pSubplan->id.groupId = pCxt->groupId;
|
||||
pSubplan->id.queryId = pCxt->queryId;
|
||||
pSubplan->splitFlag = SPLIT_FLAG_STABLE_SPLIT;
|
||||
splSetSubplanVgroups(pSubplan, pSubplan->pNode);
|
||||
code = stbSplCreatePartWindowNode((SWindowLogicNode*)pSubplan->pNode, &pPartWindow);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
nodesDestroyNode((SNode*)pSubplan->pNode);
|
||||
pSubplan->pNode = pPartWindow;
|
||||
}
|
||||
}
|
||||
code = nodesListMakeStrictAppendList(&pInfo->pSubplan->pChildren, pInfo->pSubplan->pTsmaChildren);
|
||||
pMerge->numOfSubplans = LIST_LENGTH(pInfo->pSubplan->pChildren) + 1;
|
||||
}
|
||||
pMerge->numOfSubplans = LIST_LENGTH(pInfo->pSubplan->pChildren) + 1;
|
||||
pMerge->srcEndGroupId = pCxt->groupId;
|
||||
}
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
|
@ -980,8 +984,7 @@ static int32_t stbSplSplitWindowForPartTable(SSplitContext* pCxt, SStableSplitIn
|
|||
}
|
||||
|
||||
static int32_t stbSplSplitWindowNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
|
||||
if (isPartTableWinodw((SWindowLogicNode*)pInfo->pSplitNode) &&
|
||||
(!pInfo->pSubplan->pChildren || LIST_LENGTH(pInfo->pSubplan->pChildren) == 0)) {
|
||||
if (isPartTableWinodw((SWindowLogicNode*)pInfo->pSplitNode) && (LIST_LENGTH(pInfo->pSubplan->pTsmaChildren) == 0)) {
|
||||
return stbSplSplitWindowForPartTable(pCxt, pInfo);
|
||||
} else {
|
||||
return stbSplSplitWindowForCrossTable(pCxt, pInfo);
|
||||
|
@ -1162,19 +1165,22 @@ static int32_t stbSplSplitAggNodeForCrossTableMulSubplan(SSplitContext* pCxt, SS
|
|||
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
SNode* pNode;
|
||||
FOREACH(pNode, pInfo->pSubplan->pChildren) {
|
||||
++(pCxt->groupId);
|
||||
SLogicSubplan* pSubplan = (SLogicSubplan*)pNode;
|
||||
pSubplan->id.groupId = pCxt->groupId;
|
||||
pSubplan->id.queryId = pCxt->queryId;
|
||||
pSubplan->splitFlag = SPLIT_FLAG_STABLE_SPLIT;
|
||||
splSetSubplanVgroups(pSubplan, pSubplan->pNode);
|
||||
code = stbSplCreatePartAggNode((SAggLogicNode*)pSubplan->pNode, &pPartAgg);
|
||||
if (code) break;
|
||||
nodesDestroyNode((SNode*)pSubplan->pNode);
|
||||
pSubplan->pNode = pPartAgg;
|
||||
if (pInfo->pSubplan->pTsmaChildren && LIST_LENGTH(pInfo->pSubplan->pTsmaChildren) >0) {
|
||||
FOREACH(pNode, pInfo->pSubplan->pTsmaChildren) {
|
||||
++(pCxt->groupId);
|
||||
SLogicSubplan* pSubplan = (SLogicSubplan*)pNode;
|
||||
pSubplan->id.groupId = pCxt->groupId;
|
||||
pSubplan->id.queryId = pCxt->queryId;
|
||||
pSubplan->splitFlag = SPLIT_FLAG_STABLE_SPLIT;
|
||||
splSetSubplanVgroups(pSubplan, pSubplan->pNode);
|
||||
code = stbSplCreatePartAggNode((SAggLogicNode*)pSubplan->pNode, &pPartAgg);
|
||||
if (code) break;
|
||||
nodesDestroyNode((SNode*)pSubplan->pNode);
|
||||
pSubplan->pNode = pPartAgg;
|
||||
}
|
||||
code = nodesListMakeStrictAppendList(&pInfo->pSubplan->pChildren, pInfo->pSubplan->pTsmaChildren);
|
||||
pMergeNode->numOfSubplans = LIST_LENGTH(pInfo->pSubplan->pChildren) + 1;
|
||||
}
|
||||
pMergeNode->numOfSubplans = LIST_LENGTH(pInfo->pSubplan->pChildren) + 1;
|
||||
pMergeNode->srcEndGroupId = pCxt->groupId;
|
||||
}
|
||||
|
||||
|
@ -1221,13 +1227,12 @@ static int32_t stbSplSplitAggNodeForCrossTable(SSplitContext* pCxt, SStableSplit
|
|||
}
|
||||
|
||||
static int32_t stbSplSplitAggNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
|
||||
if (isPartTableAgg((SAggLogicNode*)pInfo->pSplitNode) &&
|
||||
(!pInfo->pSubplan->pChildren || LIST_LENGTH(pInfo->pSubplan->pChildren) == 0)) {
|
||||
return stbSplSplitAggNodeForPartTable(pCxt, pInfo);
|
||||
}
|
||||
if (pInfo->pSubplan->pChildren && LIST_LENGTH(pInfo->pSubplan->pChildren) > 0) {
|
||||
if (LIST_LENGTH(pInfo->pSubplan->pTsmaChildren) > 0) {
|
||||
return stbSplSplitAggNodeForCrossTableMulSubplan(pCxt, pInfo);
|
||||
}
|
||||
if (isPartTableAgg((SAggLogicNode*)pInfo->pSplitNode)) {
|
||||
return stbSplSplitAggNodeForPartTable(pCxt, pInfo);
|
||||
}
|
||||
return stbSplSplitAggNodeForCrossTable(pCxt, pInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,10 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbname.py -Q 2
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbname.py -Q 3
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbname.py -Q 4
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsma.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsma.py -Q 2
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsma.py -Q 3
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsma.py -Q 4
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqShow.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeStb0.py
|
||||
|
|
|
@ -79,7 +79,7 @@ else
|
|||
endi
|
||||
|
||||
|
||||
|
||||
sql drop index sma_index_name1
|
||||
|
||||
print --> drop stb
|
||||
sql drop table stb;
|
||||
|
@ -120,6 +120,7 @@ else
|
|||
endi
|
||||
endi
|
||||
|
||||
sql drop index sma_index_name1
|
||||
print --> drop stb
|
||||
sql drop table stb;
|
||||
|
||||
|
|
|
@ -88,7 +88,13 @@ if $rows != 7 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
|
||||
$i = 0
|
||||
$smaPre = sma3
|
||||
while $i < 5
|
||||
$sma = $smaPre . $i
|
||||
$i = $i + 1
|
||||
sql drop index $sma
|
||||
endw
|
||||
|
||||
sql drop stable $mtPrefix
|
||||
sql select * from information_schema.ins_indexes
|
||||
|
@ -163,4 +169,4 @@ endi
|
|||
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -28,6 +28,20 @@ class TDTestCase:
|
|||
self.ttl_param = 1
|
||||
self.default_ttl = 100
|
||||
self.modify_ttl = 1
|
||||
|
||||
def wait_query(self, sql: str, expected_row_num: int, timeout_in_seconds: float):
|
||||
timeout = timeout_in_seconds
|
||||
tdSql.query(sql)
|
||||
while timeout > 0 and tdSql.getRows() != expected_row_num:
|
||||
tdLog.debug(f'start to wait query: {sql} to return {expected_row_num}, got: {tdSql.getRows()}, remain: {timeout_in_seconds - timeout}')
|
||||
time.sleep(1)
|
||||
timeout = timeout - 1
|
||||
tdSql.query(sql)
|
||||
if timeout <= 0:
|
||||
tdLog.exit(f'failed to wait query: {sql} to return {expected_row_num} rows timeout: {timeout_in_seconds}s')
|
||||
else:
|
||||
tdLog.debug(f'wait query succeed: {sql} to return {expected_row_num}, got: {tdSql.getRows()}')
|
||||
|
||||
def ttl_check_ntb(self):
|
||||
tdSql.prepare()
|
||||
|
||||
|
@ -36,17 +50,15 @@ class TDTestCase:
|
|||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(self.tbnum)
|
||||
tdSql.execute(f'flush database db')
|
||||
sleep(self.updatecfgDict['ttlUnit']*self.ttl_param+self.updatecfgDict['ttlPushInterval'] + 1)
|
||||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(0)
|
||||
timeout = self.updatecfgDict['ttlUnit']*self.ttl_param+self.updatecfgDict['ttlPushInterval']
|
||||
self.wait_query('show db.tables', 0, timeout + 5)
|
||||
for i in range(self.tbnum):
|
||||
tdSql.execute(f'create table db.{self.ntbname}_{i} (ts timestamp,c0 int) ttl {self.default_ttl}')
|
||||
for i in range(int(self.tbnum/2)):
|
||||
tdSql.execute(f'alter table db.{self.ntbname}_{i} ttl {self.modify_ttl}')
|
||||
tdSql.execute(f'flush database db')
|
||||
sleep(self.updatecfgDict['ttlUnit']*self.modify_ttl+self.updatecfgDict['ttlPushInterval'] + 1)
|
||||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(self.tbnum - int(self.tbnum/2))
|
||||
timeout = self.updatecfgDict['ttlUnit']*self.modify_ttl+self.updatecfgDict['ttlPushInterval']
|
||||
self.wait_query('show db.tables', self.tbnum - int(self.tbnum / 2), timeout + 10)
|
||||
tdSql.execute('drop database db')
|
||||
def ttl_check_ctb(self):
|
||||
tdSql.prepare()
|
||||
|
@ -57,9 +69,8 @@ class TDTestCase:
|
|||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(self.tbnum)
|
||||
tdSql.execute(f'flush database db')
|
||||
sleep(self.updatecfgDict['ttlUnit']*self.ttl_param+self.updatecfgDict['ttlPushInterval'] + 1)
|
||||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(0)
|
||||
timeout = self.updatecfgDict['ttlUnit']*self.ttl_param+self.updatecfgDict['ttlPushInterval'];
|
||||
self.wait_query('show db.tables', 0, timeout + 5)
|
||||
for i in range(self.tbnum):
|
||||
tdSql.execute(f'create table db.{self.stbname}_{i} using db.{self.stbname} tags({i}) ttl {self.default_ttl}')
|
||||
tdSql.query(f'show db.tables')
|
||||
|
@ -67,9 +78,8 @@ class TDTestCase:
|
|||
for i in range(int(self.tbnum/2)):
|
||||
tdSql.execute(f'alter table db.{self.stbname}_{i} ttl {self.modify_ttl}')
|
||||
tdSql.execute(f'flush database db')
|
||||
sleep(self.updatecfgDict['ttlUnit']*self.modify_ttl+self.updatecfgDict['ttlPushInterval'] + 1)
|
||||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(self.tbnum - int(self.tbnum/2))
|
||||
timeout = self.updatecfgDict['ttlUnit']*self.modify_ttl+self.updatecfgDict['ttlPushInterval'];
|
||||
self.wait_query('show db.tables', self.tbnum - int(self.tbnum / 2), timeout + 5)
|
||||
tdSql.execute('drop database db')
|
||||
|
||||
def ttl_check_insert(self):
|
||||
|
@ -80,9 +90,8 @@ class TDTestCase:
|
|||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(self.tbnum)
|
||||
tdSql.execute(f'flush database db')
|
||||
sleep(self.updatecfgDict['ttlUnit']*self.ttl_param+self.updatecfgDict['ttlPushInterval'] + 1)
|
||||
tdSql.query(f'show db.tables')
|
||||
tdSql.checkRows(0)
|
||||
timeout = self.updatecfgDict['ttlUnit']*self.ttl_param+self.updatecfgDict['ttlPushInterval'];
|
||||
self.wait_query('show db.tables', 0, timeout + 5)
|
||||
tdSql.execute('drop database db')
|
||||
def run(self):
|
||||
self.ttl_check_ntb()
|
||||
|
|
|
@ -1584,6 +1584,7 @@ class TDTestCase(TDTestCase):
|
|||
|
||||
self.dropandcreateDB_random("nested", 1)
|
||||
self.modify_tables()
|
||||
tdSql.execute('alter local "countAlwaysReturnValue" "0"')
|
||||
|
||||
for i in range(2):
|
||||
self.tag_count_all()
|
||||
|
|
|
@ -168,6 +168,7 @@ class TDTestCase:
|
|||
tdLog.printNoPrefix("==========step1:prepare data ==============")
|
||||
|
||||
self.prepare_data()
|
||||
tdSql.execute('alter local "countAlwaysReturnValue" "0"')
|
||||
|
||||
tdLog.printNoPrefix("==========step2:test results ==============")
|
||||
|
||||
|
|
|
@ -756,12 +756,33 @@ class TDTestCase:
|
|||
self.test_query_with_tsma_agg()
|
||||
self.test_recursive_tsma()
|
||||
# self.test_query_with_drop_tsma()
|
||||
# self.test_query_with_add_tag()
|
||||
# self.test_union()
|
||||
self.test_query_child_table()
|
||||
self.test_skip_tsma_hint()
|
||||
self.test_long_tsma_name()
|
||||
self.test_long_tb_name()
|
||||
self.test_add_tag_col()
|
||||
self.test_modify_col_name_value()
|
||||
|
||||
def test_modify_col_name_value(self):
|
||||
tdSql.execute('alter table norm_tb rename column c1 c1_new')
|
||||
sql = 'select avg(c1_new) from norm_tb'
|
||||
self.check([TSMAQCBuilder().with_sql(sql).should_query_with_tsma('tsma5').ignore_query_table().get_qc()])
|
||||
|
||||
## modify tag name
|
||||
tdSql.error('alter stable meters rename tag t1 t1_new;', -2147482637) ## stream must be dropped
|
||||
|
||||
def test_add_tag_col(self):
|
||||
## query with newly add tag will skip all tsmas not have this tag
|
||||
tdSql.execute('alter table meters add tag tag_new int', queryTimes=1)
|
||||
sql = 'select avg(c1) from meters partition by tag_new'
|
||||
self.check([TSMAQCBuilder().with_sql(sql).should_query_with_table('meters').get_qc()])
|
||||
sql = 'select avg(c1) from meters partition by abs(tag_new)'
|
||||
self.check([TSMAQCBuilder().with_sql(sql).should_query_with_table('meters').get_qc()])
|
||||
sql = 'select avg(c1) from meters where abs(tag_new) > 100'
|
||||
self.check([TSMAQCBuilder().with_sql(sql).should_query_with_table('meters').get_qc()])
|
||||
|
||||
tdSql.execute('alter table meters drop tag tag_new', queryTimes=1)
|
||||
|
||||
def generate_random_string(self, length):
|
||||
letters_and_digits = string.ascii_lowercase
|
||||
|
@ -784,10 +805,12 @@ class TDTestCase:
|
|||
tdSql.error(f'create tsma {name} on test.meters function({",".join(tsma_func_list)}) interval(1h)', -2147471087)
|
||||
|
||||
name = self.generate_random_string(178)
|
||||
self.create_recursive_tsma('tsma1', name, 'test', '30m', 'meters', ['avg(c1)','avg(c2)'])
|
||||
sql = 'select avg(c1) from meters interval(30m)'
|
||||
self.create_recursive_tsma('tsma1', name, 'test', '60m', 'meters', ['avg(c1)','avg(c2)'])
|
||||
sql = 'select avg(c1) from meters interval(60m)'
|
||||
self.check([TSMAQCBuilder().with_sql(sql).should_query_with_tsma(name).get_qc()])
|
||||
|
||||
tdSql.execute(f'drop tsma {name}')
|
||||
|
||||
def test_long_tb_name(self):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue