From d4890ee20556148e49b59320de3be639134e5fbd Mon Sep 17 00:00:00 2001 From: tomchon Date: Mon, 27 Jun 2022 11:55:28 +0800 Subject: [PATCH 01/47] test:modify testcase of muti-monde --- .../system-test/6-cluster/5dnode3mnodeStop.py | 177 ------------------ 1 file changed, 177 deletions(-) diff --git a/tests/system-test/6-cluster/5dnode3mnodeStop.py b/tests/system-test/6-cluster/5dnode3mnodeStop.py index c1d5a99af2..1964858104 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStop.py @@ -45,179 +45,6 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - - def insert_data(self,count): - # fisrt add data : db\stable\childtable\general table - for couti in count: - tdSql.execute("drop database if exists db%d" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("use db%d" %couti) - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - - - def check3mnode(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - elif tdSql.queryResult[1][2]=='leader' : - if tdSql.queryResult[0][2]=='follower': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - elif tdSql.queryResult[2][2]=='leader' : - if tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[0][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - count+=1 - else: - tdLog.exit("three mnodes is not ready in 10s ") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode1off(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='offline' : - if tdSql.queryResult[1][2]=='leader': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - elif tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[2][2]=='leader': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 2 failed in 10s ") - - tdSql.error("drop mnode on dnode 1;") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,2,'offline') - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode2off(self): - count=0 - while count < 40: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[1][2]=='offline': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 2 failed in 10s ") - - tdSql.error("drop mnode on dnode 2;") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode3off(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[2][2]=='offline': - if tdSql.queryResult[1][2]=='follower': - tdLog.debug("stop mnodes on dnode 3 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 3 failed in 10s") - - tdSql.error("drop mnode on dnode 3;") - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,2,'leader') - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,2,'follower') - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,2,'offline') - tdSql.checkData(2,3,'ready') - - - def check_dnodes_status(self,dnodeNumbers): - count=0 - while count < 5: - tdSql.query("show dnodes") - # tdLog.debug(tdSql.queryResult) - status=0 - for i in range(dnodeNumbers): - if tdSql.queryResult[i][4] == "ready": - status+=1 - tdLog.debug(status) - - if status == dnodeNumbers: - tdLog.debug(" create cluster with %d dnode and check cluster dnode all ready within 5s! " %dnodeNumbers) - break - count+=1 - time.sleep(1) - else: - tdLog.exit("create cluster with %d dnode but check dnode not ready within 5s ! "%dnodeNumbers) def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): tdLog.printNoPrefix("======== test case 1: ") @@ -253,11 +80,7 @@ class TDTestCase: # fisr add three mnodes; tdLog.info("fisr add three mnodes and check mnode status") tdSql.execute("create mnode on dnode 2") -<<<<<<< HEAD clusterComCheck.checkMnodeStatus(2) -======= - time.sleep(10) ->>>>>>> e571567ec2ae0c7668ccf1b8aaaf949fc84bb44c tdSql.execute("create mnode on dnode 3") clusterComCheck.checkMnodeStatus(3) From 515109088f42922114555e1045d3c5869cd7d6e5 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 27 Jun 2022 15:08:13 +0800 Subject: [PATCH 02/47] feat(query): support mode function --- source/libs/function/inc/builtinsimpl.h | 5 +++++ source/libs/function/src/builtins.c | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h index 0820e884ce..f7e22cb151 100644 --- a/source/libs/function/inc/builtinsimpl.h +++ b/source/libs/function/inc/builtinsimpl.h @@ -191,6 +191,11 @@ bool getUniqueFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); bool uniqueFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo); int32_t uniqueFunction(SqlFunctionCtx *pCtx); +bool getModeFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); +bool modeFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo); +int32_t modeFunction(SqlFunctionCtx *pCtx); +int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock); + bool getTwaFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); bool twaFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo); int32_t twaFunction(SqlFunctionCtx *pCtx); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index d41bc89a5f..c8e39db90c 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1045,20 +1045,28 @@ static int32_t translateFirstLastMerge(SFunctionNode* pFunc, char* pErrBuf, int3 return translateFirstLastImpl(pFunc, pErrBuf, len, false); } -static int32_t translateUnique(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { +static int32_t translateUniqueMode(SFunctionNode* pFunc, char* pErrBuf, int32_t len, bool isUnique) { if (1 != LIST_LENGTH(pFunc->pParameterList)) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); if (!nodesExprHasColumn(pPara)) { - return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "The parameters of UNIQUE must contain columns"); + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "The parameters of %s must contain columns", isUnique ? "UNIQUE" : "MODE"); } pFunc->node.resType = ((SExprNode*)pPara)->resType; return TSDB_CODE_SUCCESS; } +static int32_t translateUnique(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + return translateUniqueMode(pFunc, pErrBuf, len, true); +} + +static int32_t translateMode(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + return translateUniqueMode(pFunc, pErrBuf, len, false); +} + static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); if (numOfParams == 0 || numOfParams > 2) { @@ -2109,7 +2117,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "unique", .type = FUNCTION_TYPE_UNIQUE, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_WINDOW_FUNC | FUNC_MGT_FORBID_GROUP_BY_FUNC, .translateFunc = translateUnique, .getEnvFunc = getUniqueFuncEnv, @@ -2117,6 +2125,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .processFunc = uniqueFunction, .finalizeFunc = NULL }, + { + .name = "mode", + .type = FUNCTION_TYPE_MODE, + .classification = FUNC_MGT_AGG_FUNC, + .translateFunc = translateMode, + .getEnvFunc = getUniqueFuncEnv, + .initFunc = uniqueFunctionSetup, + .processFunc = uniqueFunction, + .finalizeFunc = functionFinalize, + }, { .name = "abs", .type = FUNCTION_TYPE_ABS, From 8088b67dc905dc87da0479620b02890368c8acc8 Mon Sep 17 00:00:00 2001 From: slzhou Date: Mon, 27 Jun 2022 19:07:37 +0800 Subject: [PATCH 03/47] feat: add merge projects optimization --- source/libs/planner/src/planOptimizer.c | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index f1cad6010c..8420f40ec9 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1235,6 +1235,45 @@ static int32_t eliminateSetOpOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLo return eliminateSetOpOptimizeImpl(pCxt, pLogicSubplan, pSetOpNode); } +//=================================================================================================================== +// merge projects +static bool mergeProjectsMayBeOptimized(SLogicNode* pNode) { + if (QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(pNode) || 1 != LIST_LENGTH(pNode->pChildren)) { + return false; + } + SLogicNode *pChild = (SLogicNode*)nodesListGetNode(pNode->pChildren, 0); + if (QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(pChild) || 1 < LIST_LENGTH(pChild->pChildren) || + NULL != pChild->pConditions || NULL != pNode->pLimit || NULL != pNode->pSlimit) { + return false; + } + return true; +} + +typedef struct SMergeProjectionsContext { + +} SMergeProjectionsContext; + +static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { + return DEAL_RES_CONTINUE; +} + +static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pProjectNode) { + SProjectLogicNode* pProject = (SProjectLogicNode*)pProjectNode; + SProjectLogicNode* pChild = (SProjectLogicNode*)nodesListGetNode(pProjectNode->pChildren, 0); + SMergeProjectionsContext cxt = {}; + nodesRewriteExprs(pChild->pProjections, mergeProjectionsExpr, &cxt); + return TSDB_CODE_SUCCESS; +} + +static int32_t mergeProjectsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { + SLogicNode* pProjectNode = optFindPossibleNode(pLogicSubplan->pNode, mergeProjectsMayBeOptimized); + if (NULL == pProjectNode) { + return TSDB_CODE_SUCCESS; + } + + return mergeProjectsOptimizeImpl(pCxt, pLogicSubplan, pProjectNode); +} + // clang-format off static const SOptimizeRule optimizeRuleSet[] = { {.pName = "OptimizeScanData", .optimizeFunc = osdOptimize}, @@ -1242,8 +1281,11 @@ static const SOptimizeRule optimizeRuleSet[] = { {.pName = "OrderByPrimaryKey", .optimizeFunc = opkOptimize}, {.pName = "SmaIndex", .optimizeFunc = smaOptimize}, {.pName = "PartitionTags", .optimizeFunc = partTagsOptimize}, + {.pName = "MergeProjects", .optimizeFunc = mergeProjectsOptimize}, {.pName = "EliminateProject", .optimizeFunc = eliminateProjOptimize}, {.pName = "EliminateSetOperator", .optimizeFunc = eliminateSetOpOptimize} + {.pName = "EliminateSetOperator", .optimizeFunc = eliminateSetOpOptimize}, + {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize}, }; // clang-format on From f9e80a8e2b458e6c1b626294a370c042c113e0f7 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 27 Jun 2022 19:41:13 +0800 Subject: [PATCH 04/47] fix(query): add mode function --- include/util/taoserror.h | 4 +- source/libs/function/src/builtins.c | 8 +- source/libs/function/src/builtinsimpl.c | 104 ++++++++++++++++++++++-- 3 files changed, 104 insertions(+), 12 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 8af5945300..8565eea63b 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -25,7 +25,7 @@ extern "C" { // clang-format off #define TAOS_DEF_ERROR_CODE(mod, code) ((int32_t)((0x80000000 | ((mod)<<16) | (code)))) - + #define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code)) #define TAOS_SUCCEEDED(err) ((err) >= 0) #define TAOS_FAILED(err) ((err) < 0) @@ -35,7 +35,7 @@ const char* terrstr(); int32_t* taosGetErrno(); #define terrno (*taosGetErrno()) - + #define TSDB_CODE_SUCCESS 0 #define TSDB_CODE_FAILED -1 // unknown or needn't tell detail error diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index c8e39db90c..699a050aea 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2130,10 +2130,10 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .type = FUNCTION_TYPE_MODE, .classification = FUNC_MGT_AGG_FUNC, .translateFunc = translateMode, - .getEnvFunc = getUniqueFuncEnv, - .initFunc = uniqueFunctionSetup, - .processFunc = uniqueFunction, - .finalizeFunc = functionFinalize, + .getEnvFunc = getModeFuncEnv, + .initFunc = modeFunctionSetup, + .processFunc = modeFunction, + .finalizeFunc = modeFinalize, }, { .name = "abs", diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index c4d3a26ab4..ca663ff809 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -32,6 +32,7 @@ #define TAIL_MAX_OFFSET 100 #define UNIQUE_MAX_RESULT_SIZE (1024 * 1024 * 10) +#define MODE_MAX_RESULT_SIZE UNIQUE_MAX_RESULT_SIZE #define HLL_BUCKET_BITS 14 // The bits of the bucket #define HLL_DATA_BITS (64 - HLL_BUCKET_BITS) @@ -246,6 +247,19 @@ typedef struct SUniqueInfo { char pItems[]; } SUniqueInfo; +typedef struct SModeItem { + int64_t count; + char data[]; +} SModeItem; + +typedef struct SModeInfo { + int32_t numOfPoints; + uint8_t colType; + int16_t colBytes; + SHashObj* pHash; + char pItems[]; +} SModeInfo; + typedef struct SDerivInfo { double prevValue; // previous value TSKEY prevTs; // previous timestamp @@ -4694,21 +4708,99 @@ int32_t uniqueFunction(SqlFunctionCtx* pCtx) { return pInfo->numOfPoints; } -int32_t uniqueFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { +bool getModeFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { + pEnv->calcMemSize = sizeof(SModeInfo) + MODE_MAX_RESULT_SIZE; + return true; +} + +bool modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { + if (!functionSetup(pCtx, pResInfo)) { + return false; + } + + SModeInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + pInfo->numOfPoints = 0; + pInfo->colType = pCtx->resDataInfo.type; + pInfo->colBytes = pCtx->resDataInfo.bytes; + if (pInfo->pHash != NULL) { + taosHashClear(pInfo->pHash); + } else { + pInfo->pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + } + return true; +} + +static void doModeAdd(SModeInfo* pInfo, char* data, bool isNull) { + // ignore null elements + if (isNull) { + return; + } + + int32_t hashKeyBytes = IS_VAR_DATA_TYPE(pInfo->colType) ? varDataTLen(data) : pInfo->colBytes; + SModeItem* pHashItem = taosHashGet(pInfo->pHash, data, hashKeyBytes); + if (pHashItem == NULL) { + int32_t size = sizeof(SModeItem) + pInfo->colBytes; + SModeItem* pItem = (SModeItem*)(pInfo->pItems + pInfo->numOfPoints * size); + memcpy(pItem->data, data, pInfo->colBytes); + pItem->count += 1; + + taosHashPut(pInfo->pHash, data, hashKeyBytes, (char*)pItem, sizeof(SModeItem*)); + pInfo->numOfPoints++; + } else { + pHashItem->count += 1; + } +} + +int32_t modeFunction(SqlFunctionCtx* pCtx) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SUniqueInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + SModeInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + + SInputColumnInfoData* pInput = &pCtx->input; + + SColumnInfoData* pInputCol = pInput->pData[0]; + SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; + + int32_t startOffset = pCtx->offset; + for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { + char* data = colDataGetData(pInputCol, i); + doModeAdd(pInfo, data, colDataIsNull_s(pInputCol, i)); + + if (sizeof(SModeInfo) + pInfo->numOfPoints * (sizeof(SModeItem) + pInfo->colBytes) >= MODE_MAX_RESULT_SIZE) { + taosHashCleanup(pInfo->pHash); + return TSDB_CODE_OUT_OF_MEMORY; + } + } + + return TSDB_CODE_SUCCESS; +} + +int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + SModeInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); int32_t slotId = pCtx->pExpr->base.resSchema.slotId; SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); + int32_t currentRow = pBlock->info.rows; - for (int32_t i = 0; i < pResInfo->numOfRes; ++i) { - SUniqueItem* pItem = (SUniqueItem*)(pInfo->pItems + i * (sizeof(SUniqueItem) + pInfo->colBytes)); - colDataAppend(pCol, i, pItem->data, false); - // TODO: handle ts output + int32_t resIndex; + int32_t maxCount = 0; + for (int32_t i = 0; i < pInfo->numOfPoints; ++i) { + SModeItem* pItem = (SModeItem*)(pInfo->pItems + i * (sizeof(SModeItem) + pInfo->colBytes)); + if (pItem->count > maxCount) { + maxCount = pItem->count; + resIndex = i; + } else if (pItem->count == maxCount) { + colDataAppendNULL(pCol, currentRow); + return pResInfo->numOfRes; + } } + SModeItem* pResItem = (SModeItem*)(pInfo->pItems + resIndex * (sizeof(SModeItem) + pInfo->colBytes)); + colDataAppend(pCol, currentRow, pResItem->data, false); + return pResInfo->numOfRes; } + bool getTwaFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv) { pEnv->calcMemSize = sizeof(STwaInfo); return true; From cd36807faf56d46067e013bc1d937d33f2653aaa Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 27 Jun 2022 21:30:20 +0800 Subject: [PATCH 05/47] feat: refactor the plan implementation of unique function --- include/libs/nodes/plannodes.h | 1 + include/libs/nodes/querynodes.h | 1 + include/libs/planner/planner.h | 2 + include/libs/qcom/query.h | 6 +- source/libs/function/src/builtins.c | 26 +- source/libs/nodes/src/nodesCloneFuncs.c | 1 + source/libs/nodes/src/nodesUtilFuncs.c | 3 +- source/libs/parser/src/parTranslater.c | 101 +------ source/libs/planner/src/planLogicCreater.c | 45 +++- source/libs/planner/src/planOptimizer.c | 247 +++++++++++++++++- source/libs/planner/src/planSpliter.c | 2 +- source/libs/planner/src/planner.c | 5 + source/libs/planner/test/planBasicTest.cpp | 2 + source/libs/planner/test/planOptimizeTest.cpp | 6 +- tests/system-test/2-query/unique.py | 2 +- 15 files changed, 325 insertions(+), 125 deletions(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 0bd917a9c6..4671c8b81e 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -103,6 +103,7 @@ typedef struct SIndefRowsFuncLogicNode { SLogicNode node; SNodeList* pFuncs; bool isTailFunc; + bool isUniqueFunc; } SIndefRowsFuncLogicNode; typedef struct SInterpFuncLogicNode { diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 39c569acef..56d0a3f9b9 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -50,6 +50,7 @@ typedef struct SExprNode { char aliasName[TSDB_COL_NAME_LEN]; char userAlias[TSDB_COL_NAME_LEN]; SArray* pAssociation; + bool orderAlias; } SExprNode; typedef enum EColumnType { COLUMN_TYPE_COLUMN = 1, COLUMN_TYPE_TAG, COLUMN_TYPE_TBNAME } EColumnType; diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index b350837551..727cdd8ad6 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -48,6 +48,8 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo // @pSource one execution location of this group of datasource subplans int32_t qSetSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId, SDownstreamSourceNode* pSource); +int32_t qClearSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId); + // Convert to subplan to string for the scheduler to send to the executor int32_t qSubPlanToString(const SSubplan* pSubplan, char** pStr, int32_t* pLen); int32_t qStringToSubplan(const char* pStr, SSubplan** pSubplan); diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 0b767e96f6..9e8ce3ffb6 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -271,19 +271,19 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t #define qDebug(...) \ do { \ if (qDebugFlag & DEBUG_DEBUG) { \ - taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ + taosPrintLog("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ } \ } while (0) #define qTrace(...) \ do { \ if (qDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \ + taosPrintLog("QRY ", DEBUG_TRACE, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ } \ } while (0) #define qDebugL(...) \ do { \ if (qDebugFlag & DEBUG_DEBUG) { \ - taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \ + taosPrintLongString("QRY ", DEBUG_DEBUG, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \ } \ } while (0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index d41bc89a5f..168df674d0 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1220,19 +1220,19 @@ static int32_t translateSubstr(SFunctionNode* pFunc, char* pErrBuf, int32_t len) static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { // The number of parameters has been limited by the syntax definition - //uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + // uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; // The function return type has been set during syntax parsing uint8_t para2Type = pFunc->node.resType.type; - //if (para2Type != TSDB_DATA_TYPE_BIGINT && para2Type != TSDB_DATA_TYPE_UBIGINT && - // para2Type != TSDB_DATA_TYPE_VARCHAR && para2Type != TSDB_DATA_TYPE_NCHAR && - // para2Type != TSDB_DATA_TYPE_TIMESTAMP) { - // return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - //} - //if ((para2Type == TSDB_DATA_TYPE_TIMESTAMP && IS_VAR_DATA_TYPE(para1Type)) || - // (para2Type == TSDB_DATA_TYPE_BINARY && para1Type == TSDB_DATA_TYPE_NCHAR)) { - // return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); - //} + // if (para2Type != TSDB_DATA_TYPE_BIGINT && para2Type != TSDB_DATA_TYPE_UBIGINT && + // para2Type != TSDB_DATA_TYPE_VARCHAR && para2Type != TSDB_DATA_TYPE_NCHAR && + // para2Type != TSDB_DATA_TYPE_TIMESTAMP) { + // return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + // } + // if ((para2Type == TSDB_DATA_TYPE_TIMESTAMP && IS_VAR_DATA_TYPE(para1Type)) || + // (para2Type == TSDB_DATA_TYPE_BINARY && para1Type == TSDB_DATA_TYPE_NCHAR)) { + // return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + // } int32_t para2Bytes = pFunc->node.resType.bytes; if (IS_VAR_DATA_TYPE(para2Type)) { @@ -1882,7 +1882,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "first", .type = FUNCTION_TYPE_FIRST, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -1917,7 +1917,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last", .type = FUNCTION_TYPE_LAST, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -2109,7 +2109,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "unique", .type = FUNCTION_TYPE_UNIQUE, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | + .classification = FUNC_MGT_SELECT_FUNC | FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_WINDOW_FUNC | FUNC_MGT_FORBID_GROUP_BY_FUNC, .translateFunc = translateUnique, .getEnvFunc = getUniqueFuncEnv, diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 9d8baf472b..b372bf75fc 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -100,6 +100,7 @@ static int32_t exprNodeCopy(const SExprNode* pSrc, SExprNode* pDst) { COPY_OBJECT_FIELD(resType, sizeof(SDataType)); COPY_CHAR_ARRAY_FIELD(aliasName); COPY_CHAR_ARRAY_FIELD(userAlias); + COPY_SCALAR_FIELD(orderAlias); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index be6faa92cb..dc9d9b92ee 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1500,7 +1500,8 @@ typedef struct SCollectFuncsCxt { static EDealRes collectFuncs(SNode* pNode, void* pContext) { SCollectFuncsCxt* pCxt = (SCollectFuncsCxt*)pContext; - if (QUERY_NODE_FUNCTION == nodeType(pNode) && pCxt->classifier(((SFunctionNode*)pNode)->funcId)) { + if (QUERY_NODE_FUNCTION == nodeType(pNode) && pCxt->classifier(((SFunctionNode*)pNode)->funcId) && + !(((SExprNode*)pNode)->orderAlias)) { pCxt->errCode = nodesListStrictAppend(pCxt->pFuncs, nodesCloneNode(pNode)); return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 45240536e3..7106f8df96 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1355,25 +1355,6 @@ static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR; } -static EDealRes rewriteExprToGroupKeyFunc(STranslateContext* pCxt, SNode** pNode) { - SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); - if (NULL == pFunc) { - pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; - return DEAL_RES_ERROR; - } - - strcpy(pFunc->functionName, "_group_key"); - strcpy(pFunc->node.aliasName, ((SExprNode*)*pNode)->aliasName); - pCxt->errCode = nodesListMakeAppend(&pFunc->pParameterList, *pNode); - if (TSDB_CODE_SUCCESS == pCxt->errCode) { - *pNode = (SNode*)pFunc; - pCxt->errCode = fmGetFuncInfo(pFunc, pCxt->msgBuf.buf, pCxt->msgBuf.len); - } - pCxt->pCurrSelectStmt->hasAggFuncs = true; - - return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); -} - static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { SCheckExprForGroupByCxt* pCxt = (SCheckExprForGroupByCxt*)pContext; if (!nodesIsExprNode(*pNode) || isAliasColumn(*pNode)) { @@ -1393,7 +1374,13 @@ static EDealRes doCheckExprForGroupBy(SNode** pNode, void* pContext) { SNode* pGroupNode = NULL; FOREACH(pGroupNode, getGroupByList(pCxt->pTranslateCxt)) { if (nodesEqualNode(getGroupByNode(pGroupNode), *pNode)) { - return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode); + return DEAL_RES_IGNORE_CHILD; + } + } + SNode* pPartKey = NULL; + FOREACH(pPartKey, pCxt->pTranslateCxt->pCurrSelectStmt->pPartitionByList) { + if (nodesEqualNode(pPartKey, *pNode)) { + return DEAL_RES_IGNORE_CHILD; } } if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) { @@ -1451,25 +1438,6 @@ static int32_t rewriteColsToSelectValFunc(STranslateContext* pCxt, SSelectStmt* return pCxt->errCode; } -static EDealRes rewriteExprsToGroupKeyFuncImpl(SNode** pNode, void* pContext) { - STranslateContext* pCxt = pContext; - SNode* pPartKey = NULL; - FOREACH(pPartKey, pCxt->pCurrSelectStmt->pPartitionByList) { - if (nodesEqualNode(pPartKey, *pNode)) { - return rewriteExprToGroupKeyFunc(pCxt, pNode); - } - } - return DEAL_RES_CONTINUE; -} - -static int32_t rewriteExprsToGroupKeyFunc(STranslateContext* pCxt, SSelectStmt* pSelect) { - nodesRewriteExprs(pSelect->pProjectionList, rewriteExprsToGroupKeyFuncImpl, pCxt); - if (TSDB_CODE_SUCCESS == pCxt->errCode && !pSelect->isDistinct) { - nodesRewriteExprs(pSelect->pOrderByList, rewriteExprsToGroupKeyFuncImpl, pCxt); - } - return pCxt->errCode; -} - typedef struct CheckAggColCoexistCxt { STranslateContext* pTranslateCxt; bool existAggFunc; @@ -1529,9 +1497,6 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect) if (cxt.existIndefiniteRowsFunc && cxt.existCol) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } - if (cxt.existAggFunc && NULL != pSelect->pPartitionByList) { - return rewriteExprsToGroupKeyFunc(pCxt, pSelect); - } return TSDB_CODE_SUCCESS; } @@ -2408,54 +2373,6 @@ static EDealRes rewriteSeletcValueFunc(STranslateContext* pCxt, SNode** pNode) { return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR; } -static EDealRes rewriteUniqueFunc(SNode** pNode, void* pContext) { - SRwriteUniqueCxt* pCxt = pContext; - if (QUERY_NODE_FUNCTION == nodeType(*pNode)) { - SFunctionNode* pFunc = (SFunctionNode*)*pNode; - if (FUNCTION_TYPE_UNIQUE == pFunc->funcType) { - SNode* pExpr = nodesListGetNode(pFunc->pParameterList, 0); - NODES_CLEAR_LIST(pFunc->pParameterList); - strcpy(((SExprNode*)pExpr)->aliasName, ((SExprNode*)*pNode)->aliasName); - nodesDestroyNode(*pNode); - *pNode = pExpr; - pCxt->pExpr = pExpr; - return DEAL_RES_IGNORE_CHILD; - } else if (FUNCTION_TYPE_SELECT_VALUE == pFunc->funcType) { - return rewriteSeletcValueFunc(pCxt->pTranslateCxt, pNode); - } - } - return DEAL_RES_CONTINUE; -} - -static SNode* createGroupingSet(SNode* pExpr) { - SGroupingSetNode* pGroupingSet = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); - if (NULL == pGroupingSet) { - return NULL; - } - pGroupingSet->groupingSetType = GP_TYPE_NORMAL; - if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pGroupingSet->pParameterList, nodesCloneNode(pExpr))) { - nodesDestroyNode((SNode*)pGroupingSet); - return NULL; - } - return (SNode*)pGroupingSet; -} - -// from: select unique(expr), col1 + col2 from t where_clause partition_by_clause order_by_clause ... -// to: select expr, first(col1) + first(col2) from t where_clause partition_by_clause group by expr order_by_clause ... -static int32_t rewriteUniqueStmt(STranslateContext* pCxt, SSelectStmt* pSelect) { - if (!pSelect->hasUniqueFunc) { - return TSDB_CODE_SUCCESS; - } - - SRwriteUniqueCxt cxt = {.pTranslateCxt = pCxt, .pExpr = NULL}; - nodesRewriteExprs(pSelect->pProjectionList, rewriteUniqueFunc, &cxt); - if (TSDB_CODE_SUCCESS == cxt.pTranslateCxt->errCode) { - cxt.pTranslateCxt->errCode = nodesListMakeStrictAppend(&pSelect->pGroupByList, createGroupingSet(cxt.pExpr)); - } - pSelect->hasIndefiniteRowsFunc = false; - return cxt.pTranslateCxt->errCode; -} - typedef struct SReplaceOrderByAliasCxt { STranslateContext* pTranslateCxt; SNodeList* pProjectionList; @@ -2474,6 +2391,7 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { pCxt->pTranslateCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; return DEAL_RES_ERROR; } + ((SExprNode*)pNew)->orderAlias = true; nodesDestroyNode(*pNode); *pNode = pNew; return DEAL_RES_CONTINUE; @@ -2529,9 +2447,6 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { code = translateInterp(pCxt, pSelect); } - if (TSDB_CODE_SUCCESS == code) { - code = rewriteUniqueStmt(pCxt, pSelect); - } if (TSDB_CODE_SUCCESS == code) { code = rewriteTimelineFunc(pCxt, pSelect); } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 396a7b6193..ef8b109b62 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -437,6 +437,33 @@ static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr) return pCol; } +static SNode* createGroupingSetNode(SNode* pExpr) { + SGroupingSetNode* pGroupingSet = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); + if (NULL == pGroupingSet) { + return NULL; + } + pGroupingSet->groupingSetType = GP_TYPE_NORMAL; + if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pGroupingSet->pParameterList, nodesCloneNode(pExpr))) { + nodesDestroyNode((SNode*)pGroupingSet); + return NULL; + } + return (SNode*)pGroupingSet; +} + +static int32_t createGroupKeysFromPartKeys(SNodeList* pPartKeys, SNodeList** pOutput) { + SNodeList* pGroupKeys = NULL; + SNode* pPartKey = NULL; + FOREACH(pPartKey, pPartKeys) { + int32_t code = nodesListMakeStrictAppend(&pGroupKeys, createGroupingSetNode(pPartKey)); + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyList(pGroupKeys); + return code; + } + } + *pOutput = pGroupKeys; + return TSDB_CODE_SUCCESS; +} + static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { if (!pSelect->hasAggFuncs && NULL == pSelect->pGroupByList) { return TSDB_CODE_SUCCESS; @@ -459,10 +486,18 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, code = rewriteExprsForSelect(pAgg->pAggFuncs, pSelect, SQL_CLAUSE_GROUP_BY); } + if (NULL != pSelect->pPartitionByList) { + code = createGroupKeysFromPartKeys(pSelect->pPartitionByList, &pAgg->pGroupKeys); + } + if (NULL != pSelect->pGroupByList) { - pAgg->pGroupKeys = nodesCloneList(pSelect->pGroupByList); - if (NULL == pAgg->pGroupKeys) { - code = TSDB_CODE_OUT_OF_MEMORY; + if (NULL != pAgg->pGroupKeys) { + code = nodesListStrictAppendList(pAgg->pGroupKeys, nodesCloneList(pSelect->pGroupByList)); + } else { + pAgg->pGroupKeys = nodesCloneList(pSelect->pGroupByList); + if (NULL == pAgg->pGroupKeys) { + code = TSDB_CODE_OUT_OF_MEMORY; + } } } @@ -508,6 +543,7 @@ static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt } pIdfRowsFunc->isTailFunc = pSelect->hasTailFunc; + pIdfRowsFunc->isUniqueFunc = pSelect->hasUniqueFunc; // indefinite rows functions and _select_values functions int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_SELECT, fmIsVectorFunc, &pIdfRowsFunc->pFuncs); @@ -809,7 +845,8 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel } static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) { - if (NULL == pSelect->pPartitionByList) { + if (NULL == pSelect->pPartitionByList || (pSelect->hasAggFuncs && NULL == pSelect->pWindow) || + NULL != pSelect->pGroupByList) { return TSDB_CODE_SUCCESS; } diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 53c9ef8dd0..29e25d6311 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -987,6 +987,7 @@ static int32_t smaIndexOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogi code = smaIndexOptApplyIndex(pLogicSubplan, pScan, pIndex, pSmaCols, wstrartIndex); taosArrayDestroyEx(pScan->pSmaIndexes, smaIndexOptDestroySmaIndex); pScan->pSmaIndexes = NULL; + pCxt->optimized = true; break; } } @@ -1064,6 +1065,43 @@ static int32_t partTagsOptRebuildTbanme(SNodeList* pPartKeys) { return code; } +static SNode* partTagsCreateGroupKeyFunc(SNode* pNode) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return NULL; + } + + strcpy(pFunc->functionName, "_group_key"); + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + SColumnNode* pCol = (SColumnNode*)pNode; + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%s", pCol->tableAlias, pCol->colName); + } else { + strcpy(pFunc->node.aliasName, ((SExprNode*)pNode)->aliasName); + } + int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode(pNode)); + if (TSDB_CODE_SUCCESS == code) { + code = fmGetFuncInfo(pFunc, NULL, 0); + } + + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + return NULL; + } + + return (SNode*)pFunc; +} + +static int32_t partTagsRewriteGroupTagsToGroupKeyFuncs(SNodeList* pGroupTags, SNodeList* pAggFuncs) { + SNode* pNode = NULL; + FOREACH(pNode, pGroupTags) { + int32_t code = nodesListStrictAppend(pAggFuncs, partTagsCreateGroupKeyFunc(pNode)); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + } + return TSDB_CODE_SUCCESS; +} + static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { SLogicNode* pNode = optFindPossibleNode(pLogicSubplan->pNode, partTagsOptMayBeOptimized); if (NULL == pNode) { @@ -1080,15 +1118,17 @@ static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub nodesDestroyNode((SNode*)pNode); } } else { - SNode* pGroupKey = NULL; - FOREACH(pGroupKey, ((SAggLogicNode*)pNode)->pGroupKeys) { + SAggLogicNode* pAgg = (SAggLogicNode*)pNode; + SNode* pGroupKey = NULL; + FOREACH(pGroupKey, pAgg->pGroupKeys) { code = nodesListMakeStrictAppend( &pScan->pGroupTags, nodesCloneNode(nodesListGetNode(((SGroupingSetNode*)pGroupKey)->pParameterList, 0))); if (TSDB_CODE_SUCCESS != code) { break; } } - NODES_DESTORY_LIST(((SAggLogicNode*)pNode)->pGroupKeys); + NODES_DESTORY_LIST(pAgg->pGroupKeys); + code = partTagsRewriteGroupTagsToGroupKeyFuncs(pScan->pGroupTags, pAgg->pAggFuncs); } if (TSDB_CODE_SUCCESS == code) { code = partTagsOptRebuildTbanme(pScan->pGroupTags); @@ -1163,6 +1203,7 @@ static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* NODES_CLEAR_LIST(pProjectNode->node.pChildren); nodesDestroyNode((SNode*)pProjectNode); } + pCxt->optimized = true; return code; } @@ -1306,6 +1347,7 @@ static int32_t rewriteTailOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL nodesDestroyNode((SNode*)pSort); nodesDestroyNode((SNode*)pProject); } + pCxt->optimized = true; return code; } @@ -1344,6 +1386,7 @@ static int32_t eliminateSetOpOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pSetOpNode->pChildren = NULL; ERASE_NODE(pSetOpNode->pParent->pChildren); + pCxt->optimized = true; return TSDB_CODE_SUCCESS; } } @@ -1360,6 +1403,184 @@ static int32_t eliminateSetOpOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLo return eliminateSetOpOptimizeImpl(pCxt, pLogicSubplan, pSetOpNode); } +static bool rewriteUniqueOptMayBeOptimized(SLogicNode* pNode) { + return QUERY_NODE_LOGIC_PLAN_INDEF_ROWS_FUNC == nodeType(pNode) && ((SIndefRowsFuncLogicNode*)pNode)->isUniqueFunc; +} + +static SNode* rewriteUniqueOptCreateGroupingSet(SNode* pExpr) { + SGroupingSetNode* pGroupingSet = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); + if (NULL == pGroupingSet) { + return NULL; + } + pGroupingSet->groupingSetType = GP_TYPE_NORMAL; + SExprNode* pGroupExpr = (SExprNode*)nodesCloneNode(pExpr); + if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pGroupingSet->pParameterList, (SNode*)pGroupExpr)) { + nodesDestroyNode((SNode*)pGroupingSet); + return NULL; + } + return (SNode*)pGroupingSet; +} + +static SNode* rewriteUniqueOptCreateFirstFunc(SFunctionNode* pSelectValue, SNode* pCol) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (NULL == pFunc) { + return NULL; + } + + strcpy(pFunc->functionName, "first"); + if (NULL != pSelectValue) { + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s", pSelectValue->node.aliasName); + } else { + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%p", pFunc->functionName, pFunc); + } + int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode(pCol)); + if (TSDB_CODE_SUCCESS == code) { + code = fmGetFuncInfo(pFunc, NULL, 0); + } + + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + return NULL; + } + + return (SNode*)pFunc; +} + +static int32_t rewriteUniqueOptCreateAgg(SIndefRowsFuncLogicNode* pIndef, SLogicNode** pOutput) { + SAggLogicNode* pAgg = (SAggLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_AGG); + if (NULL == pAgg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + TSWAP(pAgg->node.pChildren, pIndef->node.pChildren); + pAgg->node.precision = pIndef->node.precision; + + int32_t code = TSDB_CODE_SUCCESS; + bool hasSelectPrimaryKey = false; + SNode* pPrimaryKey = NULL; + SNode* pNode = NULL; + FOREACH(pNode, pIndef->pFuncs) { + SFunctionNode* pFunc = (SFunctionNode*)pNode; + SNode* pExpr = nodesListGetNode(pFunc->pParameterList, 0); + if (FUNCTION_TYPE_UNIQUE == pFunc->funcType) { + pPrimaryKey = nodesListGetNode(pFunc->pParameterList, 1); + code = nodesListMakeStrictAppend(&pAgg->pGroupKeys, rewriteUniqueOptCreateGroupingSet(pExpr)); + } else if (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pExpr)->colId) { // _select_value(ts) => first(ts) + hasSelectPrimaryKey = true; + code = nodesListMakeStrictAppend(&pAgg->pAggFuncs, rewriteUniqueOptCreateFirstFunc(pFunc, pExpr)); + } else { // _select_value(other_col) + code = nodesListMakeStrictAppend(&pAgg->pAggFuncs, nodesCloneNode(pNode)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + code = createColumnByRewriteExprs(pAgg->pGroupKeys, &pAgg->node.pTargets); + } + if (TSDB_CODE_SUCCESS == code && NULL != pAgg->pAggFuncs) { + code = createColumnByRewriteExprs(pAgg->pAggFuncs, &pAgg->node.pTargets); + } + + if (TSDB_CODE_SUCCESS == code && !hasSelectPrimaryKey && NULL != pAgg->pAggFuncs) { + code = nodesListMakeStrictAppend(&pAgg->pAggFuncs, rewriteUniqueOptCreateFirstFunc(NULL, pPrimaryKey)); + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = (SLogicNode*)pAgg; + } else { + nodesDestroyNode((SNode*)pAgg); + } + return code; +} + +static SNode* rewriteUniqueOptCreateProjectCol(SFunctionNode* pFunc) { + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); + if (NULL == pCol) { + return NULL; + } + + pCol->node.resType = pFunc->node.resType; + if (FUNCTION_TYPE_UNIQUE == pFunc->funcType) { + SExprNode* pExpr = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0); + if (QUERY_NODE_COLUMN == nodeType(pExpr)) { + strcpy(pCol->tableAlias, ((SColumnNode*)pExpr)->tableAlias); + strcpy(pCol->colName, ((SColumnNode*)pExpr)->colName); + } else { + strcpy(pCol->colName, pExpr->aliasName); + } + } else { + strcpy(pCol->colName, pFunc->node.aliasName); + } + strcpy(pCol->node.aliasName, pFunc->node.aliasName); + + return (SNode*)pCol; +} + +static int32_t rewriteUniqueOptCreateProject(SIndefRowsFuncLogicNode* pIndef, SLogicNode** pOutput) { + SProjectLogicNode* pProject = (SProjectLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_PROJECT); + if (NULL == pProject) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + TSWAP(pProject->node.pTargets, pIndef->node.pTargets); + pProject->node.precision = pIndef->node.precision; + + int32_t code = TSDB_CODE_SUCCESS; + SNode* pNode = NULL; + FOREACH(pNode, pIndef->pFuncs) { + code = nodesListMakeStrictAppend(&pProject->pProjections, rewriteUniqueOptCreateProjectCol((SFunctionNode*)pNode)); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = (SLogicNode*)pProject; + } else { + nodesDestroyNode((SNode*)pProject); + } + return code; +} + +static int32_t rewriteUniqueOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, + SIndefRowsFuncLogicNode* pIndef) { + SLogicNode* pAgg = NULL; + SLogicNode* pProject = NULL; + int32_t code = rewriteUniqueOptCreateAgg(pIndef, &pAgg); + if (TSDB_CODE_SUCCESS == code) { + code = rewriteUniqueOptCreateProject(pIndef, &pProject); + } + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeAppend(&pProject->pChildren, (SNode*)pAgg); + pAgg->pParent = pProject; + pAgg = NULL; + } + if (TSDB_CODE_SUCCESS == code) { + code = replaceLogicNode(pLogicSubplan, (SLogicNode*)pIndef, pProject); + } + if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode((SNode*)pIndef); + } else { + nodesDestroyNode((SNode*)pAgg); + nodesDestroyNode((SNode*)pProject); + } + pCxt->optimized = true; + return code; +} + +static int32_t rewriteUniqueOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { + SIndefRowsFuncLogicNode* pIndef = + (SIndefRowsFuncLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, rewriteUniqueOptMayBeOptimized); + + if (NULL == pIndef) { + return TSDB_CODE_SUCCESS; + } + + return rewriteUniqueOptimizeImpl(pCxt, pLogicSubplan, pIndef); +} + // clang-format off static const SOptimizeRule optimizeRuleSet[] = { {.pName = "ScanPath", .optimizeFunc = scanPathOptimize}, @@ -1369,23 +1590,37 @@ static const SOptimizeRule optimizeRuleSet[] = { {.pName = "PartitionTags", .optimizeFunc = partTagsOptimize}, {.pName = "EliminateProject", .optimizeFunc = eliminateProjOptimize}, {.pName = "EliminateSetOperator", .optimizeFunc = eliminateSetOpOptimize}, - {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize} + {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize}, + {.pName = "RewriteUnique", .optimizeFunc = rewriteUniqueOptimize} }; // clang-format on static const int32_t optimizeRuleNum = (sizeof(optimizeRuleSet) / sizeof(SOptimizeRule)); +static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) { + char* pStr = NULL; + nodesNodeToString((SNode*)pSubplan, false, &pStr, NULL); + qDebugL("apply optimize %s rule: %s", pRuleName, pStr); + taosMemoryFree(pStr); +} + static int32_t applyOptimizeRule(SPlanContext* pCxt, SLogicSubplan* pLogicSubplan) { SOptimizeContext cxt = {.pPlanCxt = pCxt, .optimized = false}; + bool optimized = false; do { - cxt.optimized = false; + optimized = false; for (int32_t i = 0; i < optimizeRuleNum; ++i) { + cxt.optimized = false; int32_t code = optimizeRuleSet[i].optimizeFunc(&cxt, pLogicSubplan); if (TSDB_CODE_SUCCESS != code) { return code; } + if (cxt.optimized) { + optimized = true; + dumpLogicSubplan(optimizeRuleSet[i].pName, pLogicSubplan); + } } - } while (cxt.optimized); + } while (optimized); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 49ab50f913..9d23df5bda 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -1237,7 +1237,7 @@ static const int32_t splitRuleNum = (sizeof(splitRuleSet) / sizeof(SSplitRule)); static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) { char* pStr = NULL; nodesNodeToString((SNode*)pSubplan, false, &pStr, NULL); - qDebugL("apply %s rule: %s", pRuleName, pStr); + qDebugL("apply split %s rule: %s", pRuleName, pStr); taosMemoryFree(pStr); } diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index e75c8375fb..1b9d16311c 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -85,6 +85,11 @@ int32_t qSetSubplanExecutionNode(SSubplan* subplan, int32_t groupId, SDownstream return setSubplanExecutionNode(subplan->pNode, groupId, pSource); } +int32_t qClearSubplanExecutionNode(SSubplan* pSubplan, int32_t groupId) { + // todo + return TSDB_CODE_FAILED; +} + int32_t qSubPlanToString(const SSubplan* pSubplan, char** pStr, int32_t* pLen) { if (SUBPLAN_TYPE_MODIFY == pSubplan->subplanType && NULL == pSubplan->pNode) { SDataInserterNode* insert = (SDataInserterNode*)pSubplan->pDataSink; diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 8c19b52a09..094ecbe8e6 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -56,6 +56,8 @@ TEST_F(PlanBasicTest, uniqueFunc) { run("SELECT UNIQUE(c2 + 10) FROM t1 WHERE c1 > 10"); + run("SELECT UNIQUE(c2 + 10), c2 FROM t1 WHERE c1 > 10"); + run("SELECT UNIQUE(c2 + 10), ts, c2 FROM t1 WHERE c1 > 10"); run("SELECT UNIQUE(c1) a FROM t1 ORDER BY a"); diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 9bd95a79f9..5d964dd94a 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -20,7 +20,7 @@ using namespace std; class PlanOptimizeTest : public PlannerTestBase {}; -TEST_F(PlanOptimizeTest, optimizeScanData) { +TEST_F(PlanOptimizeTest, scanPath) { useDb("root", "test"); run("SELECT COUNT(*) FROM t1"); @@ -32,7 +32,7 @@ TEST_F(PlanOptimizeTest, optimizeScanData) { run("SELECT PERCENTILE(c1, 40), COUNT(*) FROM t1"); } -TEST_F(PlanOptimizeTest, ConditionPushDown) { +TEST_F(PlanOptimizeTest, pushDownCondition) { useDb("root", "test"); run("SELECT ts, c1 FROM st1 WHERE tag1 > 4"); @@ -44,7 +44,7 @@ TEST_F(PlanOptimizeTest, ConditionPushDown) { run("SELECT ts, c1 FROM st1 WHERE tag1 > 4 AND tag2 = 'hello' AND c1 > 10"); } -TEST_F(PlanOptimizeTest, orderByPrimaryKey) { +TEST_F(PlanOptimizeTest, sortPrimaryKey) { useDb("root", "test"); run("SELECT c1 FROM t1 ORDER BY ts"); diff --git a/tests/system-test/2-query/unique.py b/tests/system-test/2-query/unique.py index f910ff1439..aeebf2425a 100644 --- a/tests/system-test/2-query/unique.py +++ b/tests/system-test/2-query/unique.py @@ -266,7 +266,7 @@ class TDTestCase: tdSql.query("select unique(c1) from ct4") tdSql.checkRows(10) - tdSql.error("select unique(c1),tbname from ct1") + #tdSql.error("select unique(c1),tbname from ct1") #support #tdSql.error("select unique(c1),t1 from ct1") #support # unique with common col From 77206e3a319f7953589a5af1a0088e2114ef9076 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 28 Jun 2022 09:36:00 +0800 Subject: [PATCH 06/47] fix: clean up expired parser unit tests --- source/libs/parser/test/parSelectTest.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index f8b8dc58fc..82e07b71af 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -232,8 +232,6 @@ TEST_F(ParserSelectTest, groupBySemanticCheck) { run("SELECT COUNT(*) cnt, c1 FROM t1 WHERE c1 > 0", TSDB_CODE_PAR_NOT_SINGLE_GROUP); run("SELECT COUNT(*) cnt, c2 FROM t1 WHERE c1 > 0 GROUP BY c1", TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION); - run("SELECT COUNT(*) cnt, c2 FROM t1 WHERE c1 > 0 PARTITION BY c2 GROUP BY c1", - TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION); } TEST_F(ParserSelectTest, orderBy) { From a7a5dac1fdef1d7334ac90f2b67d6eb45cd6288d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 09:43:30 +0800 Subject: [PATCH 07/47] test: case for alter db --- tests/script/jenkins/basic.txt | 4 ++-- tests/script/tsim/db/alter_replica_31.sim | 23 ++++++++++---------- tests/script/tsim/dnode/balance_replica3.sim | 3 --- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index d3a6a0d102..df174aa950 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -11,7 +11,7 @@ ./test.sh -f tsim/db/create_all_options.sim ./test.sh -f tsim/db/alter_option.sim ./test.sh -f tsim/db/alter_replica_13.sim -#./test.sh -f tsim/db/alter_replica_31.sim +./test.sh -f tsim/db/alter_replica_31.sim ./test.sh -f tsim/db/basic1.sim ./test.sh -f tsim/db/basic2.sim ./test.sh -f tsim/db/basic3.sim @@ -22,7 +22,7 @@ # ---- dnode ./test.sh -f tsim/dnode/balance_replica1.sim -#./test.sh -f tsim/dnode/balance_replica3.sim +./test.sh -f tsim/dnode/balance_replica3.sim ./test.sh -f tsim/dnode/create_dnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim diff --git a/tests/script/tsim/db/alter_replica_31.sim b/tests/script/tsim/db/alter_replica_31.sim index cbd4183b5e..e9a295820c 100644 --- a/tests/script/tsim/db/alter_replica_31.sim +++ b/tests/script/tsim/db/alter_replica_31.sim @@ -89,13 +89,13 @@ step2: endi sql show db.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 -if $data(2)[3] != 4 then +if $data(2)[3] != 2 then return -1 endi if $data(2)[5] != 3 then return -1 endi -if $data(2)[7] != 2 then +if $data(2)[7] != 4 then return -1 endi if $data(2)[4] == leader then @@ -118,7 +118,7 @@ sql insert into db.ctb values(now, 1, "2") sql show db.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 -sleep 1000 +sleep 100 sql select * from db.ctb print ===> $data00 $data01 $data02 $data03 $data04 $data05 @@ -126,10 +126,9 @@ if $rows != 1 then return -1 endi -sleep 3000 - print ============= step3: alter database sql alter database db replica 1 +$hasleader = 0 $x = 0 step3: @@ -144,18 +143,20 @@ print ===> rows: $rows if $rows != 1 then goto step3 endi -if $data(2)[3] != 4 then - goto step3 +if $data(2)[4] == leader then + $hasleader = 1 endi -if $data(2)[5] != NULL then - goto step3 +if $data(2)[6] == leader then + $hasleader = 1 endi -if $data(2)[7] != NULL then +if $data(2)[8] == leader then + $hasleader = 1 +endi +if $hasleader != 1 then goto step3 endi print ============= step5: stop dnode 2 -return sql select * from db.stb if $rows != 1 then return -1 diff --git a/tests/script/tsim/dnode/balance_replica3.sim b/tests/script/tsim/dnode/balance_replica3.sim index b8996e259d..276621cfcc 100644 --- a/tests/script/tsim/dnode/balance_replica3.sim +++ b/tests/script/tsim/dnode/balance_replica3.sim @@ -347,10 +347,7 @@ if $leaderExist != 1 then goto step65 endi - - print =============== step7: select data - sql show d1.tables print rows $rows if $rows != 6 then From 24a9d3e51617046fc43e1b8fb7e5b03e29cf7b11 Mon Sep 17 00:00:00 2001 From: jiacy-jcy Date: Tue, 28 Jun 2022 10:05:37 +0800 Subject: [PATCH 08/47] update alter_table.py and common.py --- tests/pytest/util/common.py | 10 +- tests/system-test/1-insert/alter_table.py | 515 +++++++++++----------- 2 files changed, 266 insertions(+), 259 deletions(-) diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index b43f87be29..e9db4a5da3 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -637,5 +637,13 @@ class TDCom: column_value_str = ", ".join(str(v) for v in column_value_list) insert_sql = f'insert into {dbname}.{tbname} values ({column_value_str});' tsql.execute(insert_sql) - + def getOneRow(self, location, containElm): + res_list = list() + if 0 <= location < tdSql.queryRows: + for row in tdSql.queryResult: + if row[location] == containElm: + res_list.append(row) + return res_list + else: + tdLog.exit(f"getOneRow out of range: row_index={location} row_count={self.query_row}") tdCom = TDCom() diff --git a/tests/system-test/1-insert/alter_table.py b/tests/system-test/1-insert/alter_table.py index a4e40d1b0b..0f7a830634 100644 --- a/tests/system-test/1-insert/alter_table.py +++ b/tests/system-test/1-insert/alter_table.py @@ -16,273 +16,272 @@ import string from util.log import * from util.cases import * from util.sql import * +from util import constant +from util.common import * +from util.sqlset import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) + self.setsql = TDSetSql() + self.ntbname = 'ntb' + self.stbname = 'stb' + self.binary_length = 20 # the length of binary for column_dict + self.nchar_length = 20 # the length of nchar for column_dict + self.column_dict = { + 'ts' : 'timestamp', + 'col1': 'tinyint', + 'col2': 'smallint', + 'col3': 'int', + 'col4': 'bigint', + 'col5': 'tinyint unsigned', + 'col6': 'smallint unsigned', + 'col7': 'int unsigned', + 'col8': 'bigint unsigned', + 'col9': 'float', + 'col10': 'double', + 'col11': 'bool', + 'col12': f'binary({self.binary_length})', + 'col13': f'nchar({self.nchar_length})' + } + self.tag_dict = { + 'ts_tag' : 'timestamp', + 't1': 'tinyint', + 't2': 'smallint', + 't3': 'int', + 't4': 'bigint', + 't5': 'tinyint unsigned', + 't6': 'smallint unsigned', + 't7': 'int unsigned', + 't8': 'bigint unsigned', + 't9': 'float', + 't10': 'double', + 't11': 'bool', + 't12': f'binary({self.binary_length})', + 't13': f'nchar({self.nchar_length})' + } + self.tag_list = [ + f'now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据"' + ] + self.tbnum = 1 + self.values_list = [ + f'now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据"' + ] + self.column_add_dict = { + 'col_time' : 'timestamp', + 'col_tinyint' : 'tinyint', + 'col_smallint' : 'smallint', + 'col_int' : 'int', + 'col_bigint' : 'bigint', + 'col_untinyint' : 'tinyint unsigned', + 'col_smallint' : 'smallint unsigned', + 'col_int' : 'int unsigned', + 'col_bigint' : 'bigint unsigned', + 'col_bool' : 'bool', + 'col_float' : 'float', + 'col_double' : 'double', + 'col_binary' : f'binary({constant.BINARY_LENGTH_MAX})', + 'col_nchar' : f'nchar({constant.NCAHR_LENGTH_MAX})' - def get_long_name(self, length, mode="mixed"): - """ - generate long name - mode could be numbers/letters/letters_mixed/mixed - """ - if mode == "numbers": - population = string.digits - elif mode == "letters": - population = string.ascii_letters.lower() - elif mode == "letters_mixed": - population = string.ascii_letters.upper() + string.ascii_letters.lower() - else: - population = string.ascii_letters.lower() + string.digits - return "".join(random.choices(population, k=length)) - - def alter_tb_tag_check(self): - tag_tinyint = random.randint(-127,129) - tag_int = random.randint(-2147483648,2147483647) - tag_smallint = random.randint(-32768,32768) - tag_bigint = random.randint(-2147483648,2147483647) - tag_untinyint = random.randint(0,256) - tag_unsmallint = random.randint(0,65536) - tag_unint = random.randint(0,4294967296) - tag_unbigint = random.randint(0,2147483647) - tag_binary = self.get_long_name(length=10, mode="letters") - tag_nchar = self.get_long_name(length=10, mode="letters") - dbname = self.get_long_name(length=10, mode="letters") - tdSql.execute(f'create database if not exists {dbname}') - stbname = self.get_long_name(length=3, mode="letters") - tbname = self.get_long_name(length=3, mode="letters") - tdSql.execute(f'create stable if not exists {dbname}.{stbname} (col_ts timestamp, c1 int) tags (tag_ts timestamp, t1 tinyint, t2 smallint, t3 int, \ - t4 bigint, t5 tinyint unsigned, t6 smallint unsigned, t7 int unsigned, t8 bigint unsigned, t9 float, t10 double, t11 bool,t12 binary(20),t13 nchar(20))') - tdSql.execute(f'create table if not exists {dbname}.{tbname} using {dbname}.{stbname} tags(now, 1, 2, 3, 4, 5, 6, 7, 8, 9.9, 10.1, True,"abc123","涛思数据")') - tdSql.execute(f'insert into {dbname}.{tbname} values(now, 1)') - tdSql.execute(f'alter table {dbname}.{tbname} set tag tag_ts = 1640966400000') - tdSql.execute(f'alter table {dbname}.{tbname} set tag `t1` = 11') - tdSql.query(f'select * from {dbname}.{stbname}') - tdSql.checkData(0,3,11) - tdSql.execute(f'alter table {dbname}.{tbname} set tag t1 = {tag_tinyint}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t2 = {tag_smallint}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t3 = {tag_int}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t4 = {tag_bigint}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t5 = {tag_untinyint}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t6 = {tag_unsmallint}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t7 = {tag_unint}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t8 = {tag_unbigint}') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t11 = false') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t12 = "{tag_binary}"') - tdSql.execute(f'alter table {dbname}.{tbname} set tag t13 = "{tag_nchar}"') - tdSql.query(f'select * from {dbname}.{stbname}') - # bug TD-15899 - tdSql.checkData(0,2,'2022-01-01 00:00:00.000') - tdSql.checkData(0,3,tag_tinyint) - tdSql.checkData(0,4,tag_smallint) - tdSql.checkData(0,5,tag_int) - tdSql.checkData(0,6,tag_bigint) - tdSql.checkData(0,7,tag_untinyint) - tdSql.checkData(0,8,tag_unsmallint) - tdSql.checkData(0,9,tag_unint) - tdSql.checkData(0,10,tag_unbigint) + } + def alter_check_ntb(self): - tdSql.checkData(0,13,False) - tdSql.checkData(0,14,tag_binary) - tdSql.checkData(0,15,tag_nchar) + tdSql.prepare() + tdSql.execute(self.setsql.set_create_normaltable_sql(self.ntbname,self.column_dict)) + for i in self.values_list: + tdSql.execute(f'insert into {self.ntbname} values({i})') + for key,values in self.column_add_dict.items(): + tdSql.execute(f'alter table {self.ntbname} add column {key} {values}') + tdSql.query(f'describe {self.ntbname}') + tdSql.checkRows(len(self.column_dict)+1) + tdSql.query(f'select {key} from {self.ntbname}') + tdSql.checkRows(len(self.values_list)) + tdSql.execute(f'alter table {self.ntbname} drop column {key}') + tdSql.query(f'describe {self.ntbname}') + tdSql.checkRows(len(self.column_dict)) + tdSql.error(f'select {key} from {self.ntbname} ') + for key,values in self.column_dict.items(): + if 'binary' in values.lower(): + v = f'binary({self.binary_length+1})' + v_error = f'binary({self.binary_length-1})' + tdSql.error(f'alter table {self.ntbname} modify column {key} {v_error}') + tdSql.execute(f'alter table {self.ntbname} modify column {key} {v}') + tdSql.query(f'describe {self.ntbname}') + result = tdCom.getOneRow(1,'VARCHAR') + tdSql.checkEqual(result[0][2],self.binary_length+1) + elif 'nchar' in values.lower(): + v = f'nchar({self.binary_length+1})' + v_error = f'nchar({self.binary_length-1})' + tdSql.error(f'alter table {self.ntbname} modify column {key} {v_error}') + tdSql.execute(f'alter table {self.ntbname} modify column {key} {v}') + tdSql.query(f'describe {self.ntbname}') + result = tdCom.getOneRow(1,'NCHAR') + tdSql.checkEqual(result[0][2],self.binary_length+1) + else: + for v in self.column_dict.values(): + tdSql.error(f'alter table {self.ntbname} modify column {key} {v}') + for key,values in self.column_dict.items(): + rename_str = f'{tdCom.getLongName(constant.COL_NAME_LENGTH_MAX,"letters")}' + tdSql.execute(f'alter table {self.ntbname} rename column {key} {rename_str}') + tdSql.query(f'select {rename_str} from {self.ntbname}') + tdSql.checkRows(1) + + def alter_check_tb(self): + tag_tinyint = random.randint(constant.TINYINT_MIN,constant.TINYINT_MAX) + tag_smallint = random.randint(constant.SMALLINT_MIN,constant.SMALLINT_MAX) + tag_int = random.randint(constant.INT_MIN,constant.INT_MAX) + tag_bigint = random.randint(constant.BIGINT_MIN,constant.BIGINT_MAX) + tag_untinyint = random.randint(constant.TINYINT_UN_MIN,constant.TINYINT_UN_MAX) + tag_unsmallint = random.randint(constant.SMALLINT_UN_MIN,constant.SMALLINT_UN_MAX) + tag_unint = random.randint(constant.INT_UN_MIN,constant.INT_MAX) + tag_unbigint = random.randint(constant.BIGINT_UN_MIN,constant.BIGINT_UN_MAX) + tag_bool = random.randint(0,100)%2 + tag_float = random.uniform(constant.FLOAT_MIN,constant.FLOAT_MAX) + tag_double = random.uniform(constant.DOUBLE_MIN*(1E-300),constant.DOUBLE_MAX*(1E-300)) + tag_binary = tdCom.getLongName(self.binary_length) + tag_nchar = tdCom.getLongName(self.binary_length) + modify_column_dict = { + 'ts1' : 'timestamp', + 'c1': 'tinyint', + 'c2': 'smallint', + 'c3': 'int', + 'c4': 'bigint', + 'c5': 'tinyint unsigned', + 'c6': 'smallint unsigned', + 'c7': 'int unsigned', + 'c8': 'bigint unsigned', + 'c9': 'float', + 'c10': 'double', + 'c11': 'bool', + 'c12': f'binary({self.binary_length})', + 'c13': f'nchar({self.nchar_length})' + } + tdSql.prepare() + tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) + for i in range(self.tbnum): + tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_list[i]})') + for j in self.values_list: + tdSql.execute(f'insert into {self.stbname}_{i} values({j})') + for i in range(self.tbnum): + for k,v in modify_column_dict.items(): + tdSql.error(f'alter table {self.stbname}_{i} add column {k} {v}') + for k in self.column_dict.keys(): + tdSql.error(f'alter table {self.stbname}_{i} drop column {k}') + for k,v in self.column_dict.items(): + if 'binary' in v.lower(): + values = [f'binary({self.binary_length+1})', f'binary({self.binary_length-1})'] + for j in values: + tdSql.error(f'alter table {self.stbname}_{i} modify {k} {j}') + elif 'nchar' in v.lower(): + values = [f'nchar({self.nchar_length+1})', f'binary({self.nchar_length-1})'] + for j in values: + tdSql.error(f'alter table {self.stbname}_{i} modify {k} {j}') + else: + for values in self.column_dict.values(): + tdSql.error(f'alter table {self.stbname}_{i} modify column {k} {values}') + for k,v in self.tag_dict.items(): + if v.lower() == 'tinyint': + self.tag_check(i,k,tag_tinyint) + elif v.lower() == 'smallint': + self.tag_check(i,k,tag_smallint) + elif v.lower() == 'int': + self.tag_check(i,k,tag_int) + elif v.lower() == 'bigint': + self.tag_check(i,k,tag_bigint) + elif v.lower() == 'tinyint unsigned': + self.tag_check(i,k,tag_untinyint) + elif v.lower() == 'smallint unsigned': + self.tag_check(i,k,tag_unsmallint) + elif v.lower() == 'int unsigned': + self.tag_check(i,k,tag_unint) + elif v.lower() == 'bigint unsigned': + self.tag_check(i,k,tag_unbigint) + elif v.lower() == 'bool': + self.tag_check(i,k,tag_bool) + elif v.lower() == 'float': + tdSql.execute(f'alter table {self.stbname}_{i} set tag {k} = {tag_float}') + tdSql.query(f'select {k} from {self.stbname}_{i}') + if abs(tdSql.queryResult[0][0] - tag_float)/tag_float<=0.0001: + tdSql.checkEqual(tdSql.queryResult[0][0],tdSql.queryResult[0][0]) + else: + tdLog.exit(f'select {k} from {self.stbname}_{i},data check failure') + elif v.lower() == 'double': + tdSql.execute(f'alter table {self.stbname}_{i} set tag {k} = {tag_double}') + tdSql.query(f'select {k} from {self.stbname}_{i}') + if abs(tdSql.queryResult[0][0] - tag_double)/tag_double<=0.0001: + tdSql.checkEqual(tdSql.queryResult[0][0],tdSql.queryResult[0][0]) + else: + tdLog.exit(f'select {k} from {self.stbname}_{i},data check failure') + elif 'binary' in v.lower(): + tdSql.execute(f'alter table {self.stbname}_{i} set tag {k} = "{tag_binary}"') + tdSql.query(f'select {k} from {self.stbname}_{i}') + tdSql.checkData(0,0,tag_binary) + elif 'nchar' in v.lower(): + tdSql.execute(f'alter table {self.stbname}_{i} set tag {k} = "{tag_nchar}"') + tdSql.query(f'select {k} from {self.stbname}_{i}') + tdSql.checkData(0,0,tag_nchar) + + def tag_check(self,tb_no,tag,values): + tdSql.execute(f'alter table {self.stbname}_{tb_no} set tag {tag} = {values}') + tdSql.query(f'select {tag} from {self.stbname}_{tb_no}') + tdSql.checkData(0,0,values) + def alter_check_stb(self): + tdSql.prepare() + tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict)) + for i in range(self.tbnum): + tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_list[i]})') + for j in self.values_list: + tdSql.execute(f'insert into {self.stbname}_{i} values({j})') + for key,values in self.column_add_dict.items(): + tdSql.execute(f'alter table {self.stbname} add column {key} {values}') + tdSql.query(f'describe {self.stbname}') + tdSql.checkRows(len(self.column_dict)+len(self.tag_dict)+1) + for i in range(self.tbnum): + tdSql.query(f'describe {self.stbname}_{i}') + tdSql.checkRows(len(self.column_dict)+len(self.tag_dict)+1) + tdSql.query(f'select {key} from {self.stbname}_{i}') + tdSql.checkRows(len(self.values_list)) + tdSql.execute(f'alter table {self.stbname} drop column {key}') + tdSql.query(f'describe {self.stbname}') + tdSql.checkRows(len(self.column_dict)+len(self.tag_dict)) + for i in range(self.tbnum): + tdSql.query(f'describe {self.stbname}_{i}') + tdSql.checkRows(len(self.column_dict)+len(self.tag_dict)) + tdSql.error(f'select {key} from {self.stbname} ') + for key,values in self.column_dict.items(): + if 'binary' in values.lower(): + v = f'binary({self.binary_length+1})' + v_error = f'binary({self.binary_length-1})' + tdSql.error(f'alter table {self.stbname} modify column {key} {v_error}') + tdSql.execute(f'alter table {self.stbname} modify column {key} {v}') + tdSql.query(f'describe {self.stbname}') + result = tdCom.getOneRow(1,'VARCHAR') + tdSql.checkEqual(result[0][2],self.binary_length+1) + for i in range(self.tbnum): + tdSql.query(f'describe {self.stbname}_{i}') + result = tdCom.getOneRow(1,'VARCHAR') + tdSql.checkEqual(result[0][2],self.binary_length+1) + elif 'nchar' in values.lower(): + v = f'nchar({self.binary_length+1})' + v_error = f'nchar({self.binary_length-1})' + tdSql.error(f'alter table {self.stbname} modify column {key} {v_error}') + tdSql.execute(f'alter table {self.stbname} modify column {key} {v}') + tdSql.query(f'describe {self.stbname}') + result = tdCom.getOneRow(1,'NCHAR') + tdSql.checkEqual(result[0][2],self.binary_length+1) + for i in range(self.tbnum): + tdSql.query(f'describe {self.stbname}') + result = tdCom.getOneRow(1,'NCHAR') + tdSql.checkEqual(result[0][2],self.binary_length+1) + else: + for v in self.column_dict.values(): + tdSql.error(f'alter table {self.stbname} modify column {key} {v}') - # bug TD-16211 insert length more than setting binary and nchar - # error_tag_binary = self.get_long_name(length=21, mode="letters") - # error_tag_nchar = self.get_long_name(length=21, mode="letters") - # tdSql.error(f'alter table {dbname}.{tbname} set tag t12 = "{error_tag_binary}"') - # tdSql.error(f'alter table {dbname}.{tbname} set tag t13 = "{error_tag_nchar}"') - error_tag_binary = self.get_long_name(length=25, mode="letters") - error_tag_nchar = self.get_long_name(length=25, mode="letters") - tdSql.error(f'alter table {dbname}.{tbname} set tag t12 = "{error_tag_binary}"') - tdSql.error(f'alter table {dbname}.{tbname} set tag t13 = "{error_tag_nchar}"') - # bug TD-16210 modify binary to nchar - tdSql.error(f'alter table {dbname}.{tbname} modify tag t12 nchar(10)') - tdSql.execute(f"drop database {dbname}") - def alter_ntb_column_check(self): - ''' - alter ntb column check - ''' - dbname = self.get_long_name(length=10, mode="letters") - tdSql.execute(f'create database if not exists {dbname}') - tbname = self.get_long_name(length=3, mode="letters") - tdLog.info('------------------normal table column check---------------------') - tdLog.info(f'-----------------create normal table {tbname}-------------------') - tdSql.execute(f'create table if not exists {dbname}.{tbname} (ts timestamp, c1 tinyint, c2 smallint, c3 int, \ - c4 bigint, c5 tinyint unsigned, c6 smallint unsigned, c7 int unsigned, c8 bigint unsigned, c9 float, c10 double, c11 bool,c12 binary(20),c13 nchar(20))') - tdSql.execute(f'insert into {dbname}.{tbname} values (now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据")') - # bug TD-15757 - tdSql.execute(f'alter table {dbname}.{tbname} add column c14 int') - tdSql.query(f'select c14 from {dbname}.{tbname}') - tdSql.checkRows(1) - tdSql.execute(f'alter table {dbname}.{tbname} add column `c15` int') - tdSql.query(f'select c15 from {dbname}.{tbname}') - tdSql.checkRows(1) - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkRows(16) - tdSql.execute(f'alter table {dbname}.{tbname} drop column c14') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkRows(15) - tdSql.execute(f'alter table {dbname}.{tbname} drop column `c15`') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkRows(14) - #! TD-16422 - # tdSql.execute(f'alter table {dbname}.{tbname} add column c16 binary(10)') - # tdSql.query(f'describe {dbname}.{tbname}') - # tdSql.checkRows(15) - # tdSql.checkEqual(tdSql.queryResult[14][2],10) - # tdSql.execute(f'alter table {dbname}.{tbname} drop column c16') - - # tdSql.execute(f'alter table {dbname}.{tbname} add column c16 nchar(10)') - # tdSql.query(f'describe {dbname}.{tbname}') - # tdSql.checkRows(15) - # tdSql.checkEqual(tdSql.queryResult[14][2],10) - # tdSql.execute(f'alter table {dbname}.{tbname} drop column c16') - - - tdSql.execute(f'alter table {dbname}.{tbname} modify column c12 binary(30)') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkData(12,2,30) - tdSql.execute(f'alter table {dbname}.{tbname} modify column `c12` binary(35)') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkData(12,2,35) - tdSql.error(f'alter table {dbname}.{tbname} modify column c12 binary(34)') - tdSql.error(f'alter table {dbname}.{tbname} modify column c12 nchar(10)') - tdSql.error(f'alter table {dbname}.{tbname} modify column c12 int') - tdSql.execute(f'alter table {dbname}.{tbname} modify column c13 nchar(30)') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkData(13,2,30) - tdSql.execute(f'alter table {dbname}.{tbname} modify column `c13` nchar(35)') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkData(13,2,35) - tdSql.error(f'alter table {dbname}.{tbname} modify column c13 nchar(34)') - tdSql.error(f'alter table {dbname}.{tbname} modify column c13 binary(10)') - tdSql.execute(f'alter table {dbname}.{tbname} rename column c1 c21') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkData(1,0,'c21') - # !bug TD-16423 - # tdSql.error(f'select c1 from {dbname}.{tbname}') - # tdSql.query(f'select c21 from {dbname}.{tbname}') - # tdSql.checkData(0,1,1) - tdSql.execute(f'alter table {dbname}.{tbname} rename column `c21` c1') - tdSql.query(f'describe {dbname}.{tbname}') - tdSql.checkData(1,0,'c1') - # !bug TD-16423 - # tdSql.error(f'select c1 from {dbname}.{tbname}') - # tdSql.query(f'select c1 from {dbname}.{tbname}') - # tdSql.checkData(0,1,1) - tdSql.error(f'alter table {dbname}.{tbname} modify column c1 bigint') - tdSql.error(f'alter table {dbname}.{tbname} modify column c1 double') - tdSql.error(f'alter table {dbname}.{tbname} modify column c4 int') - tdSql.error(f'alter table {dbname}.{tbname} modify column `c1` double') - tdSql.error(f'alter table {dbname}.{tbname} modify column c9 double') - tdSql.error(f'alter table {dbname}.{tbname} modify column c10 float') - tdSql.error(f'alter table {dbname}.{tbname} modify column c1 bool') - tdSql.error(f'alter table {dbname}.{tbname} modify column c1 binary(10)') - tdSql.execute(f'drop database {dbname}') - def alter_stb_column_check(self): - dbname = self.get_long_name(length=10, mode="letters") - tdSql.execute(f'create database if not exists {dbname}') - stbname = self.get_long_name(length=3, mode="letters") - tbname = self.get_long_name(length=3, mode="letters") - tdSql.execute(f'create database if not exists {dbname}') - tdSql.execute(f'use {dbname}') - tdSql.execute( - f'create table {stbname} (ts timestamp, c1 tinyint, c2 smallint, c3 int, \ - c4 bigint, c5 tinyint unsigned, c6 smallint unsigned, c7 int unsigned, c8 bigint unsigned, c9 float, c10 double, c11 bool,c12 binary(20),c13 nchar(20)) tags(t0 int) ') - tdSql.execute(f'create table {tbname} using {stbname} tags(1)') - tdSql.execute(f'insert into {tbname} values (now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据")') - tdSql.execute(f'alter table {stbname} add column c14 int') - tdSql.query(f'select c14 from {stbname}') - tdSql.checkRows(1) - tdSql.execute(f'alter table {stbname} add column `c15` int') - tdSql.query(f'select c15 from {stbname}') - tdSql.checkRows(1) - tdSql.query(f'describe {stbname}') - tdSql.checkRows(17) - tdSql.execute(f'alter table {stbname} drop column c14') - tdSql.query(f'describe {stbname}') - tdSql.checkRows(16) - tdSql.execute(f'alter table {stbname} drop column `c15`') - tdSql.query(f'describe {stbname}') - tdSql.checkRows(15) - tdSql.execute(f'alter table {stbname} modify column c12 binary(30)') - tdSql.query(f'describe {stbname}') - tdSql.checkData(12,2,30) - tdSql.execute(f'alter table {stbname} modify column `c12` binary(35)') - tdSql.query(f'describe {stbname}') - tdSql.checkData(12,2,35) - tdSql.error(f'alter table {stbname} modify column `c12` binary(34)') - tdSql.execute(f'alter table {stbname} modify column c13 nchar(30)') - tdSql.query(f'describe {stbname}') - tdSql.checkData(13,2,30) - tdSql.error(f'alter table {stbname} modify column c13 nchar(29)') - tdSql.error(f'alter table {stbname} rename column c1 c21') - tdSql.error(f'alter table {stbname} modify column c1 int') - tdSql.error(f'alter table {stbname} modify column c4 int') - tdSql.error(f'alter table {stbname} modify column c8 int') - tdSql.error(f'alter table {stbname} modify column c1 unsigned int') - tdSql.error(f'alter table {stbname} modify column c9 double') - tdSql.error(f'alter table {stbname} modify column c10 float') - tdSql.error(f'alter table {stbname} modify column c11 int') - tdSql.execute(f'drop database {dbname}') - def alter_stb_tag_check(self): - dbname = self.get_long_name(length=10, mode="letters") - tdSql.execute(f'create database if not exists {dbname}') - stbname = self.get_long_name(length=3, mode="letters") - tbname = self.get_long_name(length=3, mode="letters") - tdSql.execute(f'create database if not exists {dbname}') - tdSql.execute(f'use {dbname}') - tdSql.execute( - f'create table {stbname} (ts timestamp, c1 int) tags(ts_tag timestamp, t1 tinyint, t2 smallint, t3 int, \ - t4 bigint, t5 tinyint unsigned, t6 smallint unsigned, t7 int unsigned, t8 bigint unsigned, t9 float, t10 double, t11 bool,t12 binary(20),t13 nchar(20)) ') - tdSql.execute(f'create table {tbname} using {stbname} tags(now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据")') - tdSql.execute(f'insert into {tbname} values(now,1)') - - tdSql.execute(f'alter table {stbname} add tag t14 int') - tdSql.query(f'select t14 from {stbname}') - tdSql.checkRows(1) - tdSql.execute(f'alter table {stbname} add tag `t15` int') - tdSql.query(f'select t14 from {stbname}') - tdSql.checkRows(1) - tdSql.query(f'describe {stbname}') - tdSql.checkRows(18) - tdSql.execute(f'alter table {stbname} drop tag t14') - tdSql.query(f'describe {stbname}') - tdSql.checkRows(17) - tdSql.execute(f'alter table {stbname} drop tag `t15`') - tdSql.query(f'describe {stbname}') - tdSql.checkRows(16) - tdSql.execute(f'alter table {stbname} modify tag t12 binary(30)') - tdSql.query(f'describe {stbname}') - tdSql.checkData(14,2,30) - tdSql.execute(f'alter table {stbname} modify tag `t12` binary(35)') - tdSql.query(f'describe {stbname}') - tdSql.checkData(14,2,35) - tdSql.error(f'alter table {stbname} modify tag `t12` binary(34)') - tdSql.execute(f'alter table {stbname} modify tag t13 nchar(30)') - tdSql.query(f'describe {stbname}') - tdSql.checkData(15,2,30) - tdSql.error(f'alter table {stbname} modify tag t13 nchar(29)') - tdSql.execute(f'alter table {stbname} rename tag t1 t21') - tdSql.query(f'describe {stbname}') - tdSql.checkData(3,0,'t21') - tdSql.execute(f'alter table {stbname} rename tag `t21` t1') - tdSql.query(f'describe {stbname}') - tdSql.checkData(3,0,'t1') - - for i in ['bigint','unsigned int','float','double','binary(10)','nchar(10)']: - for j in [1,2,3]: - tdSql.error(f'alter table {stbname} modify tag t{j} {i}') - for i in ['int','unsigned int','float','binary(10)','nchar(10)']: - tdSql.error(f'alter table {stbname} modify tag t8 {i}') - tdSql.error(f'alter table {stbname} modify tag t4 int') - tdSql.execute(f'drop database {dbname}') def run(self): - self.alter_tb_tag_check() - self.alter_ntb_column_check() - self.alter_stb_column_check() - self.alter_stb_tag_check() + self.alter_check_ntb() + self.alter_check_tb() + self.alter_check_stb() def stop(self): tdSql.close() From 0c5342730c6d0d072e788abfce39fbef24cf0de8 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 28 Jun 2022 10:34:51 +0800 Subject: [PATCH 09/47] feat: refactor rpc code --- source/libs/transport/inc/transComm.h | 2 +- source/libs/transport/src/transCli.c | 10 +++++----- source/libs/transport/src/transComm.c | 2 +- source/libs/transport/src/transSvr.c | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index 963a85922f..55db0b129a 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -229,7 +229,7 @@ typedef struct { SAsyncPool* transCreateAsyncPool(uv_loop_t* loop, int sz, void* arg, AsyncCB cb); void transDestroyAsyncPool(SAsyncPool* pool); -int transSendAsync(SAsyncPool* pool, queue* mq); +int transAsyncSend(SAsyncPool* pool, queue* mq); #define TRANS_DESTROY_ASYNC_POOL_MSG(pool, msgType, freeFunc) \ do { \ diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index ab08ce82a8..aba2e6957b 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -967,7 +967,7 @@ void cliSendQuit(SCliThrd* thrd) { // cli can stop gracefully SCliMsg* msg = taosMemoryCalloc(1, sizeof(SCliMsg)); msg->type = Quit; - transSendAsync(thrd->asyncPool, &msg->q); + transAsyncSend(thrd->asyncPool, &msg->q); } void cliWalkCb(uv_handle_t* handle, void* arg) { if (!uv_is_closing(handle)) { @@ -1138,7 +1138,7 @@ void transReleaseCliHandle(void* handle) { cmsg->msg = tmsg; cmsg->type = Release; - transSendAsync(pThrd->asyncPool, &cmsg->q); + transAsyncSend(pThrd->asyncPool, &cmsg->q); return; } @@ -1171,7 +1171,7 @@ void transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra STraceId* trace = &pReq->info.traceId; tGTrace("%s send request at thread:%08" PRId64 ", dst: %s:%d, app:%p", transLabel(pTransInst), pThrd->pid, EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle); - ASSERT(transSendAsync(pThrd->asyncPool, &(cliMsg->q)) == 0); + ASSERT(transAsyncSend(pThrd->asyncPool, &(cliMsg->q)) == 0); return; } @@ -1205,7 +1205,7 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM tGTrace("%s send request at thread:%08" PRId64 ", dst: %s:%d, app:%p", transLabel(pTransInst), pThrd->pid, EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle); - transSendAsync(pThrd->asyncPool, &(cliMsg->q)); + transAsyncSend(pThrd->asyncPool, &(cliMsg->q)); tsem_wait(sem); tsem_destroy(sem); taosMemoryFree(sem); @@ -1234,7 +1234,7 @@ void transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { SCliThrd* thrd = ((SCliObj*)pTransInst->tcphandle)->pThreadObj[i]; tDebug("%s update epset at thread:%08" PRId64 "", pTransInst->label, thrd->pid); - transSendAsync(thrd->asyncPool, &(cliMsg->q)); + transAsyncSend(thrd->asyncPool, &(cliMsg->q)); } } #endif diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index bff7d79bd3..fbe0951a46 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -202,7 +202,7 @@ void transDestroyAsyncPool(SAsyncPool* pool) { taosMemoryFree(pool->asyncs); taosMemoryFree(pool); } -int transSendAsync(SAsyncPool* pool, queue* q) { +int transAsyncSend(SAsyncPool* pool, queue* q) { int idx = pool->index; idx = idx % pool->nAsync; // no need mutex here diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 892d32696e..08363b3c7c 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -999,7 +999,7 @@ void sendQuitToWorkThrd(SWorkThrd* pThrd) { SSvrMsg* msg = taosMemoryCalloc(1, sizeof(SSvrMsg)); msg->type = Quit; tDebug("server send quit msg to work thread"); - transSendAsync(pThrd->asyncPool, &msg->q); + transAsyncSend(pThrd->asyncPool, &msg->q); } void transCloseServer(void* arg) { @@ -1070,7 +1070,7 @@ void transReleaseSrvHandle(void* handle) { m->type = Release; tTrace("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle); - transSendAsync(pThrd->asyncPool, &m->q); + transAsyncSend(pThrd->asyncPool, &m->q); transReleaseExHandle(refMgt, refId); return; _return1: @@ -1099,7 +1099,7 @@ void transSendResponse(const STransMsg* msg) { STraceId* trace = (STraceId*)&msg->info.traceId; tGTrace("conn %p start to send resp (1/2)", exh->handle); - transSendAsync(pThrd->asyncPool, &m->q); + transAsyncSend(pThrd->asyncPool, &m->q); transReleaseExHandle(refMgt, refId); return; _return1: @@ -1128,7 +1128,7 @@ void transRegisterMsg(const STransMsg* msg) { m->type = Register; tTrace("%s conn %p start to register brokenlink callback", transLabel(pThrd->pTransInst), exh->handle); - transSendAsync(pThrd->asyncPool, &m->q); + transAsyncSend(pThrd->asyncPool, &m->q); transReleaseExHandle(refMgt, refId); return; From 4d05053e66f86cc1322d0d53c0a0ff0e511bd925 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 27 Jun 2022 19:41:13 +0800 Subject: [PATCH 10/47] fix(query): add mode function --- source/libs/function/src/builtinsimpl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index ca663ff809..06f24f39e7 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -4737,17 +4737,17 @@ static void doModeAdd(SModeInfo* pInfo, char* data, bool isNull) { } int32_t hashKeyBytes = IS_VAR_DATA_TYPE(pInfo->colType) ? varDataTLen(data) : pInfo->colBytes; - SModeItem* pHashItem = taosHashGet(pInfo->pHash, data, hashKeyBytes); + SModeItem** pHashItem = taosHashGet(pInfo->pHash, data, hashKeyBytes); if (pHashItem == NULL) { int32_t size = sizeof(SModeItem) + pInfo->colBytes; SModeItem* pItem = (SModeItem*)(pInfo->pItems + pInfo->numOfPoints * size); memcpy(pItem->data, data, pInfo->colBytes); pItem->count += 1; - taosHashPut(pInfo->pHash, data, hashKeyBytes, (char*)pItem, sizeof(SModeItem*)); + taosHashPut(pInfo->pHash, data, hashKeyBytes, &pItem, sizeof(SModeItem*)); pInfo->numOfPoints++; } else { - pHashItem->count += 1; + (*pHashItem)->count += 1; } } @@ -4771,6 +4771,8 @@ int32_t modeFunction(SqlFunctionCtx* pCtx) { } } + SET_VAL(pResInfo, 1, 1); + return TSDB_CODE_SUCCESS; } @@ -4789,13 +4791,12 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { maxCount = pItem->count; resIndex = i; } else if (pItem->count == maxCount) { - colDataAppendNULL(pCol, currentRow); - return pResInfo->numOfRes; + resIndex = -1; } } SModeItem* pResItem = (SModeItem*)(pInfo->pItems + resIndex * (sizeof(SModeItem) + pInfo->colBytes)); - colDataAppend(pCol, currentRow, pResItem->data, false); + colDataAppend(pCol, currentRow, pResItem->data, (resIndex == -1) ? true : false); return pResInfo->numOfRes; } From f80af20d3b864fb5941b4a3e0f7c243c680115e0 Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 28 Jun 2022 10:55:34 +0800 Subject: [PATCH 11/47] fix: add merge parent project and child project optimization --- source/libs/planner/src/planOptimizer.c | 48 ++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 9481c26d7a..eb0f02c92c 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1375,19 +1375,57 @@ static bool mergeProjectsMayBeOptimized(SLogicNode* pNode) { } typedef struct SMergeProjectionsContext { - + SProjectLogicNode* pChildProj; + int32_t errCode; } SMergeProjectionsContext; static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { + SMergeProjectionsContext* pCxt = pContext; + SProjectLogicNode* pChildProj = pCxt->pChildProj; + if (QUERY_NODE_COLUMN == nodeType(*pNode)) { + SNode* pTarget; + FOREACH(pTarget, ((SLogicNode*)pChildProj)->pTargets) { + if (nodesEqualNode(pTarget, *pNode)) { + SNode* pProjection; + FOREACH(pProjection, pChildProj->pProjections) { + if (0 == strcmp(((SColumnNode*)pTarget)->colName, ((SExprNode*)pProjection)->aliasName)) { + SNode* pExpr = nodesCloneNode(pProjection); + if (pExpr == NULL) { + pCxt->errCode = terrno; + return DEAL_RES_ERROR; + } + nodesDestroyNode(*pNode); + *pNode = pExpr; + } + } + } + } + return DEAL_RES_IGNORE_CHILD; + } return DEAL_RES_CONTINUE; } static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pProjectNode) { SProjectLogicNode* pProject = (SProjectLogicNode*)pProjectNode; - SProjectLogicNode* pChild = (SProjectLogicNode*)nodesListGetNode(pProjectNode->pChildren, 0); - SMergeProjectionsContext cxt = {}; - nodesRewriteExprs(pChild->pProjections, mergeProjectionsExpr, &cxt); - return TSDB_CODE_SUCCESS; + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->pChildren, 0); + SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild}; + + nodesRewriteExprs(pProject->pProjections, mergeProjectionsExpr, &cxt); + int32_t code = cxt.errCode; + if (TSDB_CODE_SUCCESS == code) { + if (1 == LIST_LENGTH(pChild->pChildren)) { + SLogicNode* pGrandChild = (SLogicNode*)nodesListGetNode(pChild->pChildren, 0); + code = replaceLogicNode(pLogicSubplan, pChild, pGrandChild); + } else { // no grand child + NODES_CLEAR_LIST(pProjectNode->pChildren); + } + } + + if (TSDB_CODE_SUCCESS == code) { + NODES_CLEAR_LIST(pChild->pChildren); + } + nodesDestroyNode((SNode*)pChild); + return code; } static int32_t mergeProjectsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { From 97bddc916edd99dd6f6bf0d7f389e888de88b81e Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Tue, 28 Jun 2022 11:00:45 +0800 Subject: [PATCH 12/47] test: sim test timeout --- tests/script/test-all.bat | 2 +- tests/script/wtest.bat | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/script/test-all.bat b/tests/script/test-all.bat index 81c1f21c04..1c698449c6 100644 --- a/tests/script/test-all.bat +++ b/tests/script/test-all.bat @@ -19,7 +19,7 @@ for /F "usebackq tokens=*" %%i in (!caseFile!) do ( call :GetTimeSeconds !time! set time1=!_timeTemp! echo Start at !time! - call !line:./test.sh=wtest.bat! > result_!a!.txt 2>error_!a!.txt + call !line:./test.sh=wtest.bat! > result_!a!.txt 2>error_!a!.txt || set /a errorlevel=8 if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && set /a exitNum=8 && echo %%i >>failed.txt ) else ( call :colorEcho 0a "Success" &echo. ) ) ) diff --git a/tests/script/wtest.bat b/tests/script/wtest.bat index 79daf01295..25c344577a 100644 --- a/tests/script/wtest.bat +++ b/tests/script/wtest.bat @@ -56,8 +56,14 @@ echo charset UTF-8 >> %TAOS_CFG% set "FILE_NAME=testSuite.sim" if "%1" == "-f" set "FILE_NAME=%2" +set FILE_NAME=%FILE_NAME:/=\% + +start cmd /k "timeout /t 600 && taskkill /f /im tsim.exe & exit /b" rem echo FILE_NAME: %FILE_NAME% echo ExcuteCmd: %tsim% -c %CFG_DIR% -f %FILE_NAME% +set result=false +%TSIM% -c %CFG_DIR% -f %FILE_NAME% && set result=true -%TSIM% -c %CFG_DIR% -f %FILE_NAME% \ No newline at end of file +tasklist | grep timeout && taskkill /f /im timeout.exe +if "%result%" == "true" ( exit /b ) else ( exit /b 8 ) \ No newline at end of file From 341c91fd7d8ff9877279d65891108ca27fd7feb8 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 28 Jun 2022 11:02:37 +0800 Subject: [PATCH 13/47] fix: fix show stables issue --- source/libs/executor/src/scanoperator.c | 2 -- tests/script/tsim/db/basic7.sim | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 4eec81281f..07212bc018 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1530,13 +1530,11 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) { int64_t startTs = taosGetTimestampUs(); strncpy(pInfo->req.tb, tNameGetTableName(&pInfo->name), tListLen(pInfo->req.tb)); -/* if (pInfo->showRewrite) { char dbName[TSDB_DB_NAME_LEN] = {0}; getDBNameFromCondition(pInfo->pCondition, dbName); sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName); } -*/ int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &pInfo->req); char* buf1 = taosMemoryCalloc(1, contLen); diff --git a/tests/script/tsim/db/basic7.sim b/tests/script/tsim/db/basic7.sim index 73651eed2f..9b809c35f0 100644 --- a/tests/script/tsim/db/basic7.sim +++ b/tests/script/tsim/db/basic7.sim @@ -44,4 +44,4 @@ if $rows != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT From ef975798fdc343295743bf7574bd53ee8a75295b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 28 Jun 2022 11:28:16 +0800 Subject: [PATCH 14/47] feat: refactor the plan implementation of unique function --- source/libs/planner/src/planOptimizer.c | 56 +++++++++++++++---- source/libs/planner/test/planBasicTest.cpp | 10 ++++ tests/system-test/0-others/udfTest.py | 12 ++-- tests/system-test/0-others/udf_create.py | 12 ++-- .../system-test/0-others/udf_restart_taosd.py | 12 ++-- tools/taos-tools | 2 +- 6 files changed, 74 insertions(+), 30 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 29e25d6311..a8747e0583 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1034,12 +1034,30 @@ static SNodeList* partTagsGetPartKeys(SLogicNode* pNode) { } } +static SNodeList* partTagsGetFuncs(SLogicNode* pNode) { + if (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode)) { + return NULL; + } else { + return ((SAggLogicNode*)pNode)->pAggFuncs; + } +} + +static bool partTagsOptAreSupportedFuncs(SNodeList* pFuncs) { + SNode* pFunc = NULL; + FOREACH(pFunc, pFuncs) { + if (fmIsIndefiniteRowsFunc(((SFunctionNode*)pFunc)->funcId) && !fmIsSelectFunc(((SFunctionNode*)pFunc)->funcId)) { + return false; + } + } + return true; +} + static bool partTagsOptMayBeOptimized(SLogicNode* pNode) { if (!partTagsIsOptimizableNode(pNode)) { return false; } - return !partTagsOptHasCol(partTagsGetPartKeys(pNode)); + return !partTagsOptHasCol(partTagsGetPartKeys(pNode)) && partTagsOptAreSupportedFuncs(partTagsGetFuncs(pNode)); } static EDealRes partTagsOptRebuildTbanmeImpl(SNode** pNode, void* pContext) { @@ -1065,13 +1083,13 @@ static int32_t partTagsOptRebuildTbanme(SNodeList* pPartKeys) { return code; } -static SNode* partTagsCreateGroupKeyFunc(SNode* pNode) { +static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) { SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return NULL; } - strcpy(pFunc->functionName, "_group_key"); + strcpy(pFunc->functionName, pFuncName); if (QUERY_NODE_COLUMN == nodeType(pNode)) { SColumnNode* pCol = (SColumnNode*)pNode; snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%s", pCol->tableAlias, pCol->colName); @@ -1091,15 +1109,31 @@ static SNode* partTagsCreateGroupKeyFunc(SNode* pNode) { return (SNode*)pFunc; } -static int32_t partTagsRewriteGroupTagsToGroupKeyFuncs(SNodeList* pGroupTags, SNodeList* pAggFuncs) { - SNode* pNode = NULL; - FOREACH(pNode, pGroupTags) { - int32_t code = nodesListStrictAppend(pAggFuncs, partTagsCreateGroupKeyFunc(pNode)); - if (TSDB_CODE_SUCCESS != code) { - return code; +static bool partTagsHasIndefRowsSelectFunc(SNodeList* pFuncs) { + SNode* pFunc = NULL; + FOREACH(pFunc, pFuncs) { + if (fmIsIndefiniteRowsFunc(((SFunctionNode*)pFunc)->funcId)) { + return true; } } - return TSDB_CODE_SUCCESS; + return false; +} + +static int32_t partTagsRewriteGroupTagsToFuncs(SNodeList* pGroupTags, SNodeList* pAggFuncs) { + bool hasIndefRowsSelectFunc = partTagsHasIndefRowsSelectFunc(pAggFuncs); + int32_t code = TSDB_CODE_SUCCESS; + SNode* pNode = NULL; + FOREACH(pNode, pGroupTags) { + if (hasIndefRowsSelectFunc) { + code = nodesListStrictAppend(pAggFuncs, partTagsCreateWrapperFunc("_select_value", pNode)); + } else { + code = nodesListStrictAppend(pAggFuncs, partTagsCreateWrapperFunc("_group_key", pNode)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + return code; } static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { @@ -1128,7 +1162,7 @@ static int32_t partTagsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub } } NODES_DESTORY_LIST(pAgg->pGroupKeys); - code = partTagsRewriteGroupTagsToGroupKeyFuncs(pScan->pGroupTags, pAgg->pAggFuncs); + code = partTagsRewriteGroupTagsToFuncs(pScan->pGroupTags, pAgg->pAggFuncs); } if (TSDB_CODE_SUCCESS == code) { code = partTagsOptRebuildTbanme(pScan->pGroupTags); diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 094ecbe8e6..dbedb2d787 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -99,6 +99,16 @@ TEST_F(PlanBasicTest, lastRowFunc) { run("SELECT LAST_ROW(c1) FROM st1"); } +TEST_F(PlanBasicTest, sampleFunc) { + useDb("root", "test"); + + run("SELECT SAMPLE(c1, 10) FROM t1"); + + run("SELECT SAMPLE(c1, 10) FROM st1"); + + run("SELECT SAMPLE(c1, 10) FROM st1 PARTITION BY TBNAME"); +} + TEST_F(PlanBasicTest, withoutFrom) { useDb("root", "test"); diff --git a/tests/system-test/0-others/udfTest.py b/tests/system-test/0-others/udfTest.py index 9b145e9093..375b7a6272 100644 --- a/tests/system-test/0-others/udfTest.py +++ b/tests/system-test/0-others/udfTest.py @@ -301,13 +301,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , first(num1) from tb;") + tdSql.query("select udf1(num1) , first(num1) from tb;") - tdSql.error("select abs(num1) , first(num1) from tb;") + tdSql.query("select abs(num1) , first(num1) from tb;") - tdSql.error("select udf1(num1) , last(num1) from tb;") + tdSql.query("select udf1(num1) , last(num1) from tb;") - tdSql.error("select round(num1) , last(num1) from tb;") + tdSql.query("select round(num1) , last(num1) from tb;") tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) @@ -327,9 +327,9 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , first(c1) from stb1;") + tdSql.query("select udf1(c1) , first(c1) from stb1;") - tdSql.error("select udf1(c1) , last(c1) from stb1;") + tdSql.query("select udf1(c1) , last(c1) from stb1;") tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) diff --git a/tests/system-test/0-others/udf_create.py b/tests/system-test/0-others/udf_create.py index 11ad8e1584..5f3ab2e863 100644 --- a/tests/system-test/0-others/udf_create.py +++ b/tests/system-test/0-others/udf_create.py @@ -303,13 +303,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , first(num1) from tb;") + tdSql.query("select udf1(num1) , first(num1) from tb;") - tdSql.error("select abs(num1) , first(num1) from tb;") + tdSql.query("select abs(num1) , first(num1) from tb;") - tdSql.error("select udf1(num1) , last(num1) from tb;") + tdSql.query("select udf1(num1) , last(num1) from tb;") - tdSql.error("select round(num1) , last(num1) from tb;") + tdSql.query("select round(num1) , last(num1) from tb;") tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) @@ -329,9 +329,9 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , first(c1) from stb1;") + tdSql.query("select udf1(c1) , first(c1) from stb1;") - tdSql.error("select udf1(c1) , last(c1) from stb1;") + tdSql.query("select udf1(c1) , last(c1) from stb1;") tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) diff --git a/tests/system-test/0-others/udf_restart_taosd.py b/tests/system-test/0-others/udf_restart_taosd.py index c9eb22cf15..857921e32c 100644 --- a/tests/system-test/0-others/udf_restart_taosd.py +++ b/tests/system-test/0-others/udf_restart_taosd.py @@ -300,13 +300,13 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , first(num1) from tb;") + tdSql.query("select udf1(num1) , first(num1) from tb;") - tdSql.error("select abs(num1) , first(num1) from tb;") + tdSql.query("select abs(num1) , first(num1) from tb;") - tdSql.error("select udf1(num1) , last(num1) from tb;") + tdSql.query("select udf1(num1) , last(num1) from tb;") - tdSql.error("select round(num1) , last(num1) from tb;") + tdSql.query("select round(num1) , last(num1) from tb;") tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) @@ -326,9 +326,9 @@ class TDTestCase: tdSql.checkRows(1) tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , first(c1) from stb1;") + tdSql.query("select udf1(c1) , first(c1) from stb1;") - tdSql.error("select udf1(c1) , last(c1) from stb1;") + tdSql.query("select udf1(c1) , last(c1) from stb1;") tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) diff --git a/tools/taos-tools b/tools/taos-tools index a875a057d1..28a49b447f 160000 --- a/tools/taos-tools +++ b/tools/taos-tools @@ -1 +1 @@ -Subproject commit a875a057d1225d85c6323b9edaccc2b1a9641987 +Subproject commit 28a49b447f71c4f014ebbac858b7215b897d57fd From 4c410bd5eceda845ed6850d986cbe516f7a4cc80 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 28 Jun 2022 11:33:14 +0800 Subject: [PATCH 15/47] refactor(sync): refactor snapshot code --- source/libs/sync/inc/syncSnapshot.h | 4 +- source/libs/sync/src/syncAppendEntriesReply.c | 28 +- source/libs/sync/src/syncSnapshot.c | 247 ++++++++++++------ 3 files changed, 168 insertions(+), 111 deletions(-) diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index 55e0755a89..14688f8912 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -57,7 +57,7 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI void snapshotSenderDestroy(SSyncSnapshotSender *pSender); bool snapshotSenderIsStart(SSyncSnapshotSender *pSender); void snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshot snapshot, void *pReader); -void snapshotSenderStop(SSyncSnapshotSender *pSender); +void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish); int32_t snapshotSend(SSyncSnapshotSender *pSender); int32_t snapshotReSend(SSyncSnapshotSender *pSender); @@ -82,7 +82,7 @@ SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId from void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver); void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncTerm privateTerm, SyncSnapshotSend *pBeginMsg); bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver); -void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver, bool apply); +void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver); cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver); char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver); diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index b7122b9c52..10f2745651 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -240,7 +240,10 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(ths, &(pMsg->srcId)); ASSERT(pSender != NULL); - SSnapshot snapshot; + SSnapshot snapshot = {.data = NULL, + .lastApplyIndex = SYNC_INDEX_INVALID, + .lastApplyTerm = 0, + .lastConfigIndex = SYNC_INDEX_INVALID}; void* pReader = NULL; ths->pFsm->FpGetSnapshot(ths->pFsm, &snapshot, NULL, &pReader); if (snapshot.lastApplyIndex >= SYNC_INDEX_BEGIN && nextIndex <= snapshot.lastApplyIndex + 1 && @@ -249,10 +252,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries ASSERT(pReader != NULL); snapshotSenderStart(pSender, snapshot, pReader); - char* eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender start"); - syncNodeEventLog(ths, eventLog); - taosMemoryFree(eventLog); - } else { // no snapshot if (pReader != NULL) { @@ -260,23 +259,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries } } - /* - bool hasSnapshot = syncNodeHasSnapshot(ths); - SSnapshot snapshot; - ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot); - - // start sending snapshot first time - // start here, stop by receiver - if (hasSnapshot && nextIndex <= snapshot.lastApplyIndex + 1 && !snapshotSenderIsStart(pSender) && - pMsg->privateTerm < pSender->privateTerm) { - snapshotSenderStart(pSender); - - char* eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender start"); - syncNodeEventLog(ths, eventLog); - taosMemoryFree(eventLog); - } - */ - SyncIndex sentryIndex = pSender->snapshot.lastApplyIndex + 1; // update nextIndex to sentryIndex @@ -300,5 +282,5 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries syncIndexMgrLog2("recv sync-append-entries-reply, after pNextIndex:", ths->pNextIndex); syncIndexMgrLog2("recv sync-append-entries-reply, after pMatchIndex:", ths->pMatchIndex); - return ret; + return 0; } \ No newline at end of file diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 39e972c4c4..7b15be2d14 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -24,6 +24,7 @@ //---------------------------------- static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncTerm privateTerm, SyncSnapshotSend *pBeginMsg); +static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg); //---------------------------------- SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex) { @@ -50,7 +51,7 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &(pSender->snapshot)); pSender->finish = false; } else { - sError("vgId:%d cannot create snapshot sender", pSyncNode->vgId); + sError("vgId:%d, cannot create snapshot sender", pSyncNode->vgId); } return pSender; @@ -127,7 +128,7 @@ void snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshot snapshot, void syncEntryDestory(pEntry); } else { if (pSender->snapshot.lastConfigIndex == pSender->pSyncNode->pRaftCfg->lastConfigIndex) { - sTrace("vgId:%d sync sender get cfg from local", pSender->pSyncNode->vgId); + sTrace("vgId:%d, sync sender get cfg from local", pSender->pSyncNode->vgId); pSender->lastConfig = pSender->pSyncNode->pRaftCfg->cfg; getLastConfig = true; } @@ -176,13 +177,13 @@ void snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshot snapshot, void // event log do { - char *eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender send"); + char *eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender start"); syncNodeEventLog(pSender->pSyncNode, eventLog); taosMemoryFree(eventLog); } while (0); } -void snapshotSenderStop(SSyncSnapshotSender *pSender) { +void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { // close reader if (pSender->pReader != NULL) { int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); @@ -199,6 +200,14 @@ void snapshotSenderStop(SSyncSnapshotSender *pSender) { // update flag pSender->start = false; + pSender->finish = finish; + + // event log + do { + char *eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender stop"); + syncNodeEventLog(pSender->pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); } // when sender receive ack, call this function to send msg from seq @@ -386,7 +395,7 @@ SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId from pReceiver->snapshot.lastConfigIndex = SYNC_INDEX_INVALID; } else { - sError("vgId:%d cannot create snapshot receiver", pSyncNode->vgId); + sError("vgId:%d, cannot create snapshot receiver", pSyncNode->vgId); } return pReceiver; @@ -409,9 +418,9 @@ void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) { bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver) { return pReceiver->start; } -// static do start +// static do start by privateTerm, pBeginMsg // receive first snapshot data -// privateTerm, pBeginMsg +// write first block data static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncTerm privateTerm, SyncSnapshotSend *pBeginMsg) { // update state @@ -419,6 +428,7 @@ static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncTerm p pReceiver->privateTerm = privateTerm; pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; pReceiver->fromId = pBeginMsg->srcId; + pReceiver->start = true; // update snapshot pReceiver->snapshot.lastApplyIndex = pBeginMsg->lastIndex; @@ -429,8 +439,16 @@ static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncTerm p ASSERT(pReceiver->pWriter == NULL); int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, &(pReceiver->pWriter)); ASSERT(ret == 0); + + // event log + do { + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver start"); + syncNodeEventLog(pReceiver->pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); } +// force stop static void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { // force close, abandon incomplete data if (pReceiver->pWriter != NULL) { @@ -441,33 +459,35 @@ static void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { } pReceiver->start = false; + + // event log + do { + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver force stop"); + syncNodeEventLog(pReceiver->pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); } // if receiver receive msg from seq = SYNC_SNAPSHOT_SEQ_BEGIN, start receiver // if already start, force close, start again void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncTerm privateTerm, SyncSnapshotSend *pBeginMsg) { if (!snapshotReceiverIsStart(pReceiver)) { - // start + // first start snapshotReceiverDoStart(pReceiver, privateTerm, pBeginMsg); - pReceiver->start = true; } else { // already start - sInfo("snapshot recv, receiver already start"); + sInfo("vgId:%d, snapshot recv, receiver already start", pReceiver->pSyncNode->vgId); // force close, abandon incomplete data - int32_t ret = - pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false); - ASSERT(ret == 0); - pReceiver->pWriter = NULL; + snapshotReceiverForceStop(pReceiver); // start again snapshotReceiverDoStart(pReceiver, privateTerm, pBeginMsg); - pReceiver->start = true; } } -void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver, bool apply) { +void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false); @@ -477,8 +497,69 @@ void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver, bool apply) { pReceiver->start = false; - if (apply) { - // ++(pReceiver->privateTerm); + // event log + do { + SSnapshot snapshot; + pReceiver->pSyncNode->pFsm->FpGetSnapshotInfo(pReceiver->pSyncNode->pFsm, &snapshot); + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver stop"); + syncNodeEventLog(pReceiver->pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); +} + +static void snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { + ASSERT(pMsg->seq == SYNC_SNAPSHOT_SEQ_END); + + if (pReceiver->pWriter != NULL) { + int32_t code = 0; + if (pMsg->dataLen > 0) { + code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, + pMsg->dataLen); + ASSERT(code == 0); + } + + code = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, true); + ASSERT(code == 0); + pReceiver->pWriter = NULL; + } + + pReceiver->ack = SYNC_SNAPSHOT_SEQ_END; + + // update commit index + if (pReceiver->snapshot.lastApplyIndex > pReceiver->pSyncNode->commitIndex) { + pReceiver->pSyncNode->commitIndex = pReceiver->snapshot.lastApplyIndex; + } + + // reset wal + pReceiver->pSyncNode->pLogStore->syncLogRestoreFromSnapshot(pReceiver->pSyncNode->pLogStore, pMsg->lastIndex); + + // event log + do { + SSnapshot snapshot; + pReceiver->pSyncNode->pFsm->FpGetSnapshotInfo(pReceiver->pSyncNode->pFsm, &snapshot); + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver got last data, finish, apply snapshot"); + syncNodeEventLog(pReceiver->pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); +} + +static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { + ASSERT(pMsg->seq == pReceiver->ack + 1); + + if (pReceiver->pWriter != NULL) { + if (pMsg->dataLen > 0) { + int32_t code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, + pMsg->data, pMsg->dataLen); + ASSERT(code == 0); + } + pReceiver->ack = pMsg->seq; + + // event log + do { + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver receiving"); + syncNodeEventLog(pReceiver->pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); } } @@ -560,33 +641,20 @@ int32_t syncNodeOnSnapshotSendCb(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { // get receiver SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver; bool needRsp = false; - int32_t writeCode = 0; // state, term, seq/ack if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) { if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) { - // begin + // begin, no data snapshotReceiverStart(pReceiver, pMsg->privateTerm, pMsg); - pReceiver->ack = pMsg->seq; needRsp = true; - char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver begin"); - syncNodeEventLog(pSyncNode, eventLog); - taosMemoryFree(eventLog); - } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) { // end, finish FSM - writeCode = pSyncNode->pFsm->FpSnapshotDoWrite(pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, pMsg->dataLen); - ASSERT(writeCode == 0); - - pSyncNode->pFsm->FpSnapshotStopWrite(pSyncNode->pFsm, pReceiver->pWriter, true); - if (pReceiver->snapshot.lastApplyIndex > pReceiver->pSyncNode->commitIndex) { - pReceiver->pSyncNode->commitIndex = pReceiver->snapshot.lastApplyIndex; - } - - // pSyncNode->pLogStore->syncLogSetBeginIndex(pSyncNode->pLogStore, pMsg->lastIndex + 1); - pSyncNode->pLogStore->syncLogRestoreFromSnapshot(pSyncNode->pLogStore, pMsg->lastIndex); + snapshotReceiverFinish(pReceiver, pMsg); + snapshotReceiverStop(pReceiver); + needRsp = true; // maybe update lastconfig if (pMsg->lastConfigIndex >= SYNC_INDEX_BEGIN) { @@ -601,89 +669,74 @@ int32_t syncNodeOnSnapshotSendCb(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { syncNodeDoConfigChange(pSyncNode, &newSyncCfg, pMsg->lastConfigIndex); } - SSnapshot snapshot; - pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - - do { - char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver finish, apply snapshot"); - syncNodeEventLog(pSyncNode, eventLog); - taosMemoryFree(eventLog); - } while (0); - - pReceiver->pWriter = NULL; - snapshotReceiverStop(pReceiver, true); - pReceiver->ack = pMsg->seq; - needRsp = true; - - do { - char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver stop"); - syncNodeEventLog(pSyncNode, eventLog); - taosMemoryFree(eventLog); - } while (0); - } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_FORCE_CLOSE) { - pSyncNode->pFsm->FpSnapshotStopWrite(pSyncNode->pFsm, pReceiver->pWriter, false); - snapshotReceiverStop(pReceiver, false); + // force close + snapshotReceiverForceStop(pReceiver); needRsp = false; - do { - char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver force close"); - syncNodeEventLog(pSyncNode, eventLog); - taosMemoryFree(eventLog); - } while (0); - } else if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) { // transfering if (pMsg->seq == pReceiver->ack + 1) { - writeCode = - pSyncNode->pFsm->FpSnapshotDoWrite(pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, pMsg->dataLen); - ASSERT(writeCode == 0); - pReceiver->ack = pMsg->seq; + snapshotReceiverGotData(pReceiver, pMsg); } needRsp = true; - do { - char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver receiving"); - syncNodeEventLog(pSyncNode, eventLog); - taosMemoryFree(eventLog); - } while (0); - } else { ASSERT(0); } + // send ack if (needRsp) { + // build msg SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId); pRspMsg->srcId = pSyncNode->myRaftId; pRspMsg->destId = pMsg->srcId; pRspMsg->term = pSyncNode->pRaftStore->currentTerm; pRspMsg->lastIndex = pMsg->lastIndex; pRspMsg->lastTerm = pMsg->lastTerm; - pRspMsg->ack = pReceiver->ack; - pRspMsg->code = writeCode; - pRspMsg->privateTerm = pReceiver->privateTerm; + pRspMsg->ack = pReceiver->ack; // receiver maybe already closed + pRspMsg->code = 0; + pRspMsg->privateTerm = pReceiver->privateTerm; // receiver maybe already closed + // send msg SRpcMsg rpcMsg; syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg); syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg); - syncSnapshotRspDestroy(pRspMsg); } + } else { + // error log + do { + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver term not equal"); + syncNodeErrorLog(pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); } } else { - syncNodeLog2("syncNodeOnSnapshotSendCb not follower", pSyncNode); + // error log + do { + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver not follower"); + syncNodeErrorLog(pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); } return 0; } +static void snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { + ASSERT(pMsg->ack == pSender->seq); + pSender->ack = pMsg->ack; + ++(pSender->seq); +} + // sender receives ack, set seq = ack + 1, send msg from seq // if ack == SYNC_SNAPSHOT_SEQ_END, stop sender int32_t syncNodeOnSnapshotRspCb(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { // if already drop replica, do not process if (!syncNodeInRaftGroup(pSyncNode, &(pMsg->srcId)) && pSyncNode->state == TAOS_SYNC_STATE_LEADER) { - sInfo("recv SyncSnapshotRsp maybe replica already dropped"); - return 0; + sError("vgId:%d, recv sync-snapshot-rsp, maybe replica already dropped", pSyncNode->vgId); + return -1; } // get sender @@ -695,27 +748,49 @@ int32_t syncNodeOnSnapshotRspCb(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { if (pMsg->term == pSyncNode->pRaftStore->currentTerm) { // receiver ack is finish, close sender if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { - pSender->finish = true; - snapshotSenderStop(pSender); + snapshotSenderStop(pSender, true); return 0; } // send next msg if (pMsg->ack == pSender->seq) { // update sender ack - pSender->ack = pMsg->ack; - (pSender->seq)++; + snapshotSenderUpdateProgress(pSender, pMsg); snapshotSend(pSender); } else if (pMsg->ack == pSender->seq - 1) { snapshotReSend(pSender); } else { - ASSERT(0); + do { + char logBuf[64]; + snprintf(logBuf, sizeof(logBuf), "error ack, recv ack:%d, my seq:%d", pMsg->ack, pSender->seq); + char *eventLog = snapshotSender2SimpleStr(pSender, logBuf); + syncNodeErrorLog(pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); + + return -1; } + } else { + // error log + do { + char *eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender term not equal"); + syncNodeErrorLog(pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); + + return -1; } } else { - syncNodeLog2("syncNodeOnSnapshotRspCb not leader", pSyncNode); + // error log + do { + char *eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender not leader"); + syncNodeErrorLog(pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); + + return -1; } return 0; From acb7f040aa04f9cd795dc4e802f9c9245fb32e50 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 28 Jun 2022 11:48:10 +0800 Subject: [PATCH 16/47] fix(stream): taosd crash when partition by tbname --- source/libs/executor/src/executorimpl.c | 3 +-- tests/script/jenkins/basic.txt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 17e5482b60..ad0d5c1447 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -273,8 +273,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR } // 1. close current opened time window - if (pResultRowInfo->cur.pageId != -1 && ((pResult == NULL) || (pResult->pageId != pResultRowInfo->cur.pageId && - pResult->offset != pResultRowInfo->cur.offset))) { + if (pResultRowInfo->cur.pageId != -1 && ((pResult == NULL) || (pResult->pageId != pResultRowInfo->cur.pageId))) { SResultRowPosition pos = pResultRowInfo->cur; SFilePage* pPage = getBufPage(pResultBuf, pos.pageId); releaseBufPage(pResultBuf, pPage); diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index d3a6a0d102..ab5117ced8 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -85,6 +85,7 @@ ./test.sh -f tsim/stream/basic1.sim ./test.sh -f tsim/stream/basic2.sim ./test.sh -f tsim/stream/distributeInterval0.sim +# ./test.sh -f tsim/stream/distributeIntervalRetrive0.sim # ./test.sh -f tsim/stream/distributesession0.sim # ./test.sh -f tsim/stream/session0.sim ./test.sh -f tsim/stream/session1.sim From 20533da6d09d267246838e5bc1000d48f1be8a3e Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Tue, 28 Jun 2022 11:52:46 +0800 Subject: [PATCH 17/47] test: sim test timeout --- tests/script/wtest.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/wtest.bat b/tests/script/wtest.bat index 25c344577a..e3bbff9db5 100644 --- a/tests/script/wtest.bat +++ b/tests/script/wtest.bat @@ -58,7 +58,7 @@ set "FILE_NAME=testSuite.sim" if "%1" == "-f" set "FILE_NAME=%2" set FILE_NAME=%FILE_NAME:/=\% -start cmd /k "timeout /t 600 && taskkill /f /im tsim.exe & exit /b" +start cmd /k "timeout /t 600 /NOBREAK && taskkill /f /im tsim.exe & exit /b" rem echo FILE_NAME: %FILE_NAME% echo ExcuteCmd: %tsim% -c %CFG_DIR% -f %FILE_NAME% From 9540d1eac9df7d577ced628bb11b3ea0860ff1b1 Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 28 Jun 2022 11:54:16 +0800 Subject: [PATCH 18/47] feat: udf can be compiled outside TDengine --- include/libs/function/taosudf.h | 266 +++++++++++++++++++++++++++++++ include/libs/function/tudf.h | 228 +------------------------- source/libs/function/test/udf1.c | 6 +- source/libs/function/test/udf2.c | 8 +- 4 files changed, 276 insertions(+), 232 deletions(-) create mode 100644 include/libs/function/taosudf.h diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h new file mode 100644 index 0000000000..5e84b87a81 --- /dev/null +++ b/include/libs/function/taosudf.h @@ -0,0 +1,266 @@ +/* +* Copyright (c) 2019 TAOS Data, Inc. +* +* This program is free software: you can use, redistribute, and/or modify +* it under the terms of the GNU Affero General Public License, version 3 +* or later ("AGPL"), as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +*/ + +#ifndef TDENGINE_TAOSUDF_H +#define TDENGINE_TAOSUDF_H + +#include +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__GNUC__) +#define FORCE_INLINE inline __attribute__((always_inline)) +#else +#define FORCE_INLINE +#endif +typedef struct SUdfColumnMeta { + int16_t type; + int32_t bytes; + uint8_t precision; + uint8_t scale; +} SUdfColumnMeta; + +typedef struct SUdfColumnData { + int32_t numOfRows; + int32_t rowsAlloc; + union { + struct { + int32_t nullBitmapLen; + char *nullBitmap; + int32_t dataLen; + char *data; + } fixLenCol; + + struct { + int32_t varOffsetsLen; + int32_t *varOffsets; + int32_t payloadLen; + char *payload; + int32_t payloadAllocLen; + } varLenCol; + }; +} SUdfColumnData; + + +typedef struct SUdfColumn { + SUdfColumnMeta colMeta; + bool hasNull; + SUdfColumnData colData; +} SUdfColumn; + +typedef struct SUdfDataBlock { + int32_t numOfRows; + int32_t numOfCols; + SUdfColumn **udfCols; +} SUdfDataBlock; + +typedef struct SUdfInterBuf { + int32_t bufLen; + char* buf; + int8_t numOfResult; //zero or one +} SUdfInterBuf; +typedef void *UdfcFuncHandle; + +// dynamic lib init and destroy +typedef int32_t (*TUdfInitFunc)(); +typedef int32_t (*TUdfDestroyFunc)(); + +#define UDF_MEMORY_EXP_GROWTH 1.5 +#define NBIT (3u) +#define BitPos(_n) ((_n) & ((1 << NBIT) - 1)) +#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT]) +#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT) + +#define udfColDataIsNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] == -1) +#define udfColDataIsNull_f(pColumn, row) ((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row)))) +#define udfColDataSetNull_f(pColumn, row) \ + do { \ + BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) |= (1u << (7u - BitPos(row))); \ + } while (0) + +#define udfColDataSetNotNull_f(pColumn, r_) \ + do { \ + BMCharPos(pColumn->colData.fixLenCol.nullBitmap, r_) &= ~(1u << (7u - BitPos(r_))); \ + } while (0) +#define udfColDataSetNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] = -1) + +typedef uint16_t VarDataLenT; // maxVarDataLen: 32767 +#define VARSTR_HEADER_SIZE sizeof(VarDataLenT) +#define varDataLen(v) ((VarDataLenT *)(v))[0] +#define varDataVal(v) ((char *)(v) + VARSTR_HEADER_SIZE) +#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v)) +#define varDataCopy(dst, v) memcpy((dst), (void *)(v), varDataTLen(v)) +#define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE)) +#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len)) +#define IS_VAR_DATA_TYPE(t) \ + (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON)) +#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) + + +static FORCE_INLINE char* udfColDataGetData(const SUdfColumn* pColumn, int32_t row) { + if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { + return pColumn->colData.varLenCol.payload + pColumn->colData.varLenCol.varOffsets[row]; + } else { + return pColumn->colData.fixLenCol.data + pColumn->colMeta.bytes * row; + } +} + +static FORCE_INLINE bool udfColDataIsNull(const SUdfColumn* pColumn, int32_t row) { + if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { + if (pColumn->colMeta.type == TSDB_DATA_TYPE_JSON) { + if (udfColDataIsNull_var(pColumn, row)) { + return true; + } + char* data = udfColDataGetData(pColumn, row); + return (*data == TSDB_DATA_TYPE_NULL); + } else { + return udfColDataIsNull_var(pColumn, row); + } + } else { + return udfColDataIsNull_f(pColumn, row); + } +} + +static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t newCapacity) { + SUdfColumnMeta *meta = &pColumn->colMeta; + SUdfColumnData *data = &pColumn->colData; + + if (newCapacity== 0 || newCapacity <= data->rowsAlloc) { + return TSDB_CODE_SUCCESS; + } + + int allocCapacity = (data->rowsAlloc< 8) ? 8 : data->rowsAlloc; + while (allocCapacity < newCapacity) { + allocCapacity *= UDF_MEMORY_EXP_GROWTH; + } + + if (IS_VAR_DATA_TYPE(meta->type)) { + char* tmp = (char*)realloc(data->varLenCol.varOffsets, sizeof(int32_t) * allocCapacity); + if (tmp == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + data->varLenCol.varOffsets = (int32_t*)tmp; + data->varLenCol.varOffsetsLen = sizeof(int32_t) * allocCapacity; + // for payload, add data in udfColDataAppend + } else { + char* tmp = (char*)realloc(data->fixLenCol.nullBitmap, BitmapLen(allocCapacity)); + if (tmp == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + data->fixLenCol.nullBitmap = tmp; + data->fixLenCol.nullBitmapLen = BitmapLen(allocCapacity); + if (meta->type == TSDB_DATA_TYPE_NULL) { + return TSDB_CODE_SUCCESS; + } + + tmp = (char*)realloc(data->fixLenCol.data, allocCapacity* meta->bytes); + if (tmp == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + data->fixLenCol.data = tmp; + data->fixLenCol.dataLen = allocCapacity* meta->bytes; + } + + data->rowsAlloc = allocCapacity; + + return TSDB_CODE_SUCCESS; +} + +static FORCE_INLINE void udfColDataSetNull(SUdfColumn* pColumn, int32_t row) { + udfColEnsureCapacity(pColumn, row+1); + if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { + udfColDataSetNull_var(pColumn, row); + } else { + udfColDataSetNull_f(pColumn, row); + } + pColumn->hasNull = true; +} + +static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentRow, const char* pData, bool isNull) { + SUdfColumnMeta *meta = &pColumn->colMeta; + SUdfColumnData *data = &pColumn->colData; + udfColEnsureCapacity(pColumn, currentRow+1); + bool isVarCol = IS_VAR_DATA_TYPE(meta->type); + if (isNull) { + udfColDataSetNull(pColumn, currentRow); + } else { + if (!isVarCol) { + udfColDataSetNotNull_f(pColumn, currentRow); + memcpy(data->fixLenCol.data + meta->bytes * currentRow, pData, meta->bytes); + } else { + int32_t dataLen = varDataTLen(pData); + if (meta->type == TSDB_DATA_TYPE_JSON) { + if (*pData == TSDB_DATA_TYPE_NULL) { + dataLen = 0; + } else if (*pData == TSDB_DATA_TYPE_NCHAR) { + dataLen = varDataTLen(pData + sizeof(char)); + } else if (*pData == TSDB_DATA_TYPE_BIGINT || *pData == TSDB_DATA_TYPE_DOUBLE) { + dataLen = sizeof(int64_t); + } else if (*pData == TSDB_DATA_TYPE_BOOL) { + dataLen = sizeof(char); + } + dataLen += sizeof(char); + } + + if (data->varLenCol.payloadAllocLen < data->varLenCol.payloadLen + dataLen) { + uint32_t newSize = data->varLenCol.payloadAllocLen; + if (newSize <= 1) { + newSize = 8; + } + + while (newSize < data->varLenCol.payloadLen + dataLen) { + newSize = newSize * UDF_MEMORY_EXP_GROWTH; + } + + char *buf = (char*)realloc(data->varLenCol.payload, newSize); + if (buf == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + data->varLenCol.payload = buf; + data->varLenCol.payloadAllocLen = newSize; + } + + uint32_t len = data->varLenCol.payloadLen; + data->varLenCol.varOffsets[currentRow] = len; + + memcpy(data->varLenCol.payload + len, pData, dataLen); + data->varLenCol.payloadLen += dataLen; + } + } + data->numOfRows = (currentRow + 1 > data->numOfRows) ? (currentRow+1) : data->numOfRows; + return 0; +} + +typedef int32_t (*TUdfScalarProcFunc)(SUdfDataBlock* block, SUdfColumn *resultCol); + +typedef int32_t (*TUdfAggStartFunc)(SUdfInterBuf *buf); +typedef int32_t (*TUdfAggProcessFunc)(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf); +typedef int32_t (*TUdfAggFinishFunc)(SUdfInterBuf* buf, SUdfInterBuf *resultData); + +#ifdef __cplusplus +} +#endif + +#endif // TDENGINE_TAOSUDF_H diff --git a/include/libs/function/tudf.h b/include/libs/function/tudf.h index 28b1fbe8ce..b4c05fea87 100644 --- a/include/libs/function/tudf.h +++ b/include/libs/function/tudf.h @@ -16,6 +16,13 @@ #ifndef TDENGINE_TUDF_H #define TDENGINE_TUDF_H +#undef malloc +#define malloc malloc +#undef free +#define free free +#undef realloc +#define alloc alloc +#include #include #include @@ -36,56 +43,6 @@ extern "C" { #endif #define UDF_DNODE_ID_ENV_NAME "DNODE_ID" -//====================================================================================== -//begin API to taosd and qworker - -typedef struct SUdfColumnMeta { - int16_t type; - int32_t bytes; - uint8_t precision; - uint8_t scale; -} SUdfColumnMeta; - -typedef struct SUdfColumnData { - int32_t numOfRows; - int32_t rowsAlloc; - union { - struct { - int32_t nullBitmapLen; - char *nullBitmap; - int32_t dataLen; - char *data; - } fixLenCol; - - struct { - int32_t varOffsetsLen; - int32_t *varOffsets; - int32_t payloadLen; - char *payload; - int32_t payloadAllocLen; - } varLenCol; - }; -} SUdfColumnData; - - -typedef struct SUdfColumn { - SUdfColumnMeta colMeta; - bool hasNull; - SUdfColumnData colData; -} SUdfColumn; - -typedef struct SUdfDataBlock { - int32_t numOfRows; - int32_t numOfCols; - SUdfColumn **udfCols; -} SUdfDataBlock; - -typedef struct SUdfInterBuf { - int32_t bufLen; - char* buf; - int8_t numOfResult; //zero or one -} SUdfInterBuf; -typedef void *UdfcFuncHandle; //low level APIs /** @@ -127,177 +84,6 @@ int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock* pBlock); int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols, SScalarParam *output); int32_t cleanUpUdfs(); -// end API to taosd and qworker -//============================================================================================================================= -// begin API to UDF writer. - -// dynamic lib init and destroy -typedef int32_t (*TUdfInitFunc)(); -typedef int32_t (*TUdfDestroyFunc)(); - -//TODO: add API to check function arguments type, number etc. - -#define UDF_MEMORY_EXP_GROWTH 1.5 - -#define udfColDataIsNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] == -1) -#define udfColDataIsNull_f(pColumn, row) ((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row)))) -#define udfColDataSetNull_f(pColumn, row) \ - do { \ - BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) |= (1u << (7u - BitPos(row))); \ - } while (0) - -#define udfColDataSetNotNull_f(pColumn, r_) \ - do { \ - BMCharPos(pColumn->colData.fixLenCol.nullBitmap, r_) &= ~(1u << (7u - BitPos(r_))); \ - } while (0) -#define udfColDataSetNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] = -1) - - -static FORCE_INLINE char* udfColDataGetData(const SUdfColumn* pColumn, int32_t row) { - if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { - return pColumn->colData.varLenCol.payload + pColumn->colData.varLenCol.varOffsets[row]; - } else { - return pColumn->colData.fixLenCol.data + pColumn->colMeta.bytes * row; - } -} - -static FORCE_INLINE bool udfColDataIsNull(const SUdfColumn* pColumn, int32_t row) { - if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { - if (pColumn->colMeta.type == TSDB_DATA_TYPE_JSON) { - if (udfColDataIsNull_var(pColumn, row)) { - return true; - } - char* data = udfColDataGetData(pColumn, row); - return (*data == TSDB_DATA_TYPE_NULL); - } else { - return udfColDataIsNull_var(pColumn, row); - } - } else { - return udfColDataIsNull_f(pColumn, row); - } -} - -static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t newCapacity) { - SUdfColumnMeta *meta = &pColumn->colMeta; - SUdfColumnData *data = &pColumn->colData; - - if (newCapacity== 0 || newCapacity <= data->rowsAlloc) { - return TSDB_CODE_SUCCESS; - } - - int allocCapacity = TMAX(data->rowsAlloc, 8); - while (allocCapacity < newCapacity) { - allocCapacity *= UDF_MEMORY_EXP_GROWTH; - } - - if (IS_VAR_DATA_TYPE(meta->type)) { - char* tmp = taosMemoryRealloc(data->varLenCol.varOffsets, sizeof(int32_t) * allocCapacity); - if (tmp == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - data->varLenCol.varOffsets = (int32_t*)tmp; - data->varLenCol.varOffsetsLen = sizeof(int32_t) * allocCapacity; - // for payload, add data in udfColDataAppend - } else { - char* tmp = taosMemoryRealloc(data->fixLenCol.nullBitmap, BitmapLen(allocCapacity)); - if (tmp == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - data->fixLenCol.nullBitmap = tmp; - data->fixLenCol.nullBitmapLen = BitmapLen(allocCapacity); - if (meta->type == TSDB_DATA_TYPE_NULL) { - return TSDB_CODE_SUCCESS; - } - - tmp = taosMemoryRealloc(data->fixLenCol.data, allocCapacity* meta->bytes); - if (tmp == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - data->fixLenCol.data = tmp; - data->fixLenCol.dataLen = allocCapacity* meta->bytes; - } - - data->rowsAlloc = allocCapacity; - - return TSDB_CODE_SUCCESS; -} - -static FORCE_INLINE void udfColDataSetNull(SUdfColumn* pColumn, int32_t row) { - udfColEnsureCapacity(pColumn, row+1); - if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) { - udfColDataSetNull_var(pColumn, row); - } else { - udfColDataSetNull_f(pColumn, row); - } - pColumn->hasNull = true; -} - -static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentRow, const char* pData, bool isNull) { - SUdfColumnMeta *meta = &pColumn->colMeta; - SUdfColumnData *data = &pColumn->colData; - udfColEnsureCapacity(pColumn, currentRow+1); - bool isVarCol = IS_VAR_DATA_TYPE(meta->type); - if (isNull) { - udfColDataSetNull(pColumn, currentRow); - } else { - if (!isVarCol) { - colDataSetNotNull_f(data->fixLenCol.nullBitmap, currentRow); - memcpy(data->fixLenCol.data + meta->bytes * currentRow, pData, meta->bytes); - } else { - int32_t dataLen = varDataTLen(pData); - if (meta->type == TSDB_DATA_TYPE_JSON) { - if (*pData == TSDB_DATA_TYPE_NULL) { - dataLen = 0; - } else if (*pData == TSDB_DATA_TYPE_NCHAR) { - dataLen = varDataTLen(pData + CHAR_BYTES); - } else if (*pData == TSDB_DATA_TYPE_BIGINT || *pData == TSDB_DATA_TYPE_DOUBLE) { - dataLen = LONG_BYTES; - } else if (*pData == TSDB_DATA_TYPE_BOOL) { - dataLen = CHAR_BYTES; - } - dataLen += CHAR_BYTES; - } - - if (data->varLenCol.payloadAllocLen < data->varLenCol.payloadLen + dataLen) { - uint32_t newSize = data->varLenCol.payloadAllocLen; - if (newSize <= 1) { - newSize = 8; - } - - while (newSize < data->varLenCol.payloadLen + dataLen) { - newSize = newSize * UDF_MEMORY_EXP_GROWTH; - } - - char *buf = taosMemoryRealloc(data->varLenCol.payload, newSize); - if (buf == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - data->varLenCol.payload = buf; - data->varLenCol.payloadAllocLen = newSize; - } - - uint32_t len = data->varLenCol.payloadLen; - data->varLenCol.varOffsets[currentRow] = len; - - memcpy(data->varLenCol.payload + len, pData, dataLen); - data->varLenCol.payloadLen += dataLen; - } - } - data->numOfRows = TMAX(currentRow + 1, data->numOfRows); - return 0; -} - -typedef int32_t (*TUdfScalarProcFunc)(SUdfDataBlock* block, SUdfColumn *resultCol); - -typedef int32_t (*TUdfAggStartFunc)(SUdfInterBuf *buf); -typedef int32_t (*TUdfAggProcessFunc)(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf); -typedef int32_t (*TUdfAggFinishFunc)(SUdfInterBuf* buf, SUdfInterBuf *resultData); - - -// end API to UDF writer -//======================================================================================================================= #ifdef __cplusplus } diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c index 9443d5cb94..dfbae357ef 100644 --- a/source/libs/function/test/udf1.c +++ b/source/libs/function/test/udf1.c @@ -2,12 +2,8 @@ #include #include -#include "tudf.h" +#include "taosudf.h" -#undef malloc -#define malloc malloc -#undef free -#define free free DLL_EXPORT int32_t udf1_init() { return 0; diff --git a/source/libs/function/test/udf2.c b/source/libs/function/test/udf2.c index 1c270f5cf4..975832209e 100644 --- a/source/libs/function/test/udf2.c +++ b/source/libs/function/test/udf2.c @@ -1,13 +1,9 @@ #include #include #include +#include -#include "tudf.h" - -#undef malloc -#define malloc malloc -#undef free -#define free free +#include "taosudf.h" DLL_EXPORT int32_t udf2_init() { return 0; From 4110c0049739804159c6c66fff8b10c67598dd58 Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 28 Jun 2022 11:58:39 +0800 Subject: [PATCH 19/47] fix: initialize errCode of SMergeProjectsContext --- source/libs/planner/src/planOptimizer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index eb0f02c92c..638e3f5604 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1405,19 +1405,19 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { return DEAL_RES_CONTINUE; } -static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pProjectNode) { - SProjectLogicNode* pProject = (SProjectLogicNode*)pProjectNode; - SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->pChildren, 0); - SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild}; +static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pSelfNode) { + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSelfNode->pChildren, 0); + SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS}; - nodesRewriteExprs(pProject->pProjections, mergeProjectionsExpr, &cxt); + nodesRewriteExprs(((SProjectLogicNode*)pSelfNode)->pProjections, mergeProjectionsExpr, &cxt); int32_t code = cxt.errCode; + if (TSDB_CODE_SUCCESS == code) { if (1 == LIST_LENGTH(pChild->pChildren)) { SLogicNode* pGrandChild = (SLogicNode*)nodesListGetNode(pChild->pChildren, 0); code = replaceLogicNode(pLogicSubplan, pChild, pGrandChild); } else { // no grand child - NODES_CLEAR_LIST(pProjectNode->pChildren); + NODES_CLEAR_LIST(pSelfNode->pChildren); } } From e330eccbf53719cbde19ff39d983328562fae26f Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 28 Jun 2022 13:45:20 +0800 Subject: [PATCH 20/47] feat: refactor the plan implementation of unique function --- source/libs/planner/src/planOptimizer.c | 9 +++++---- source/libs/planner/test/planOptimizeTest.cpp | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index a8747e0583..eb87397f3b 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1092,7 +1092,7 @@ static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) { strcpy(pFunc->functionName, pFuncName); if (QUERY_NODE_COLUMN == nodeType(pNode)) { SColumnNode* pCol = (SColumnNode*)pNode; - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%s", pCol->tableAlias, pCol->colName); + sprintf(pFunc->node.aliasName, "%s.%s", pCol->tableAlias, pCol->colName); } else { strcpy(pFunc->node.aliasName, ((SExprNode*)pNode)->aliasName); } @@ -1199,7 +1199,8 @@ static bool eliminateProjOptMayBeOptimized(SLogicNode* pNode) { } SProjectLogicNode* pProjectNode = (SProjectLogicNode*)pNode; - if (NULL != pProjectNode->node.pLimit || NULL != pProjectNode->node.pSlimit) { + if (NULL != pProjectNode->node.pLimit || NULL != pProjectNode->node.pSlimit || + NULL != pProjectNode->node.pConditions) { return false; } @@ -1463,9 +1464,9 @@ static SNode* rewriteUniqueOptCreateFirstFunc(SFunctionNode* pSelectValue, SNode strcpy(pFunc->functionName, "first"); if (NULL != pSelectValue) { - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s", pSelectValue->node.aliasName); + sprintf(pFunc->node.aliasName, "%s", pSelectValue->node.aliasName); } else { - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s.%p", pFunc->functionName, pFunc); + sprintf(pFunc->node.aliasName, "%s.%p", pFunc->functionName, pFunc); } int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode(pCol)); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 5d964dd94a..6a9a711dac 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -42,6 +42,8 @@ TEST_F(PlanOptimizeTest, pushDownCondition) { run("SELECT ts, c1 FROM st1 WHERE tag1 > 4 AND tag2 = 'hello'"); run("SELECT ts, c1 FROM st1 WHERE tag1 > 4 AND tag2 = 'hello' AND c1 > 10"); + + run("SELECT ts, c1 FROM (SELECT * FROM st1) WHERE tag1 > 4"); } TEST_F(PlanOptimizeTest, sortPrimaryKey) { From 5be089b888fb35efc4536d8abdcd26a5a37feffc Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 28 Jun 2022 14:11:44 +0800 Subject: [PATCH 21/47] refactor: rsma restore --- source/dnode/vnode/src/inc/sma.h | 23 +- source/dnode/vnode/src/inc/vnodeInt.h | 2 +- source/dnode/vnode/src/sma/smaOpen.c | 8 +- source/dnode/vnode/src/sma/smaRollup.c | 631 +++++++++++++------------ source/dnode/vnode/src/sma/smaUtil.c | 42 +- source/dnode/vnode/src/vnd/vnodeOpen.c | 4 +- 6 files changed, 357 insertions(+), 353 deletions(-) diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h index 4b42ab5263..63ac6397bd 100644 --- a/source/dnode/vnode/src/inc/sma.h +++ b/source/dnode/vnode/src/inc/sma.h @@ -28,7 +28,8 @@ extern "C" { #define smaError(...) do { if (smaDebugFlag & DEBUG_ERROR) { taosPrintLog("SMA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) #define smaWarn(...) do { if (smaDebugFlag & DEBUG_WARN) { taosPrintLog("SMA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) #define smaInfo(...) do { if (smaDebugFlag & DEBUG_INFO) { taosPrintLog("SMA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -#define smaDebug(...) do { if (smaDebugFlag & DEBUG_DEBUG) { taosPrintLog("SMA ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) +// #define smaDebug(...) do { if (smaDebugFlag & DEBUG_DEBUG) { taosPrintLog("SMA ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) +#define smaDebug(...) do { if (smaDebugFlag & DEBUG_WARN) { taosPrintLog("SMA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) #define smaTrace(...) do { if (smaDebugFlag & DEBUG_TRACE) { taosPrintLog("SMA ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) // clang-format on @@ -205,16 +206,16 @@ struct STFile { uint8_t state; }; -#define TD_FILE_F(tf) (&((tf)->f)) -#define TD_FILE_PFILE(tf) ((tf)->pFile) -#define TD_FILE_OPENED(tf) (TD_FILE_PFILE(tf) != NULL) -#define TD_FILE_FULL_NAME(tf) (TD_FILE_F(tf)->aname) -#define TD_FILE_REL_NAME(tf) (TD_FILE_F(tf)->rname) -#define TD_FILE_OPENED(tf) (TD_FILE_PFILE(tf) != NULL) -#define TD_FILE_CLOSED(tf) (!TD_FILE_OPENED(tf)) -#define TD_FILE_SET_CLOSED(f) (TD_FILE_PFILE(f) = NULL) -#define TD_FILE_SET_STATE(tf, s) ((tf)->state = (s)) -#define TD_FILE_DID(tf) (TD_FILE_F(tf)->did) +#define TD_TFILE_F(tf) (&((tf)->f)) +#define TD_TFILE_PFILE(tf) ((tf)->pFile) +#define TD_TFILE_OPENED(tf) (TD_TFILE_PFILE(tf) != NULL) +#define TD_TFILE_FULL_NAME(tf) (TD_TFILE_F(tf)->aname) +#define TD_TFILE_REL_NAME(tf) (TD_TFILE_F(tf)->rname) +#define TD_TFILE_OPENED(tf) (TD_TFILE_PFILE(tf) != NULL) +#define TD_TFILE_CLOSED(tf) (!TD_TFILE_OPENED(tf)) +#define TD_TFILE_SET_CLOSED(f) (TD_TFILE_PFILE(f) = NULL) +#define TD_TFILE_SET_STATE(tf, s) ((tf)->state = (s)) +#define TD_TFILE_DID(tf) (TD_TFILE_F(tf)->did) int32_t tdInitTFile(STFile *pTFile, STfs *pTfs, const char *fname); int32_t tdCreateTFile(STFile *pTFile, STfs *pTfs, bool updateHeader, int8_t fType); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 68ed6dde51..baead763ad 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -64,6 +64,7 @@ typedef struct STsdbSnapshotReader STsdbSnapshotReader; #define VNODE_TQ_DIR "tq" #define VNODE_WAL_DIR "wal" #define VNODE_TSMA_DIR "tsma" +#define VNODE_RSMA_DIR "rsma" #define VNODE_RSMA0_DIR "tsdb" #define VNODE_RSMA1_DIR "rsma1" #define VNODE_RSMA2_DIR "rsma2" @@ -161,7 +162,6 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pSchema, bool // sma int32_t smaOpen(SVnode* pVnode); -int32_t smaClose(SSma* pSma); int32_t smaCloseEnv(SSma* pSma); int32_t smaCloseEx(SSma* pSma); diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index 88ed7426f7..641b8c7934 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -123,7 +123,7 @@ int32_t smaOpen(SVnode *pVnode) { } // restore the rsma -#if 0 +#if 1 if (rsmaRestore(pSma) < 0) { goto _err; } @@ -154,12 +154,6 @@ int32_t smaCloseEx(SSma *pSma) { return 0; } -int32_t smaClose(SSma *pSma) { - smaCloseEnv(pSma); - smaCloseEx(pSma); - return 0; -} - /** * @brief rsma env restore * diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index ed5b6f4055..8423654eee 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -15,13 +15,14 @@ #include "sma.h" -#define RSMA_QTASKINFO_PERSIST_MS 7200000 +#define RSMA_QTASKINFO_PERSIST_MS 5000 // 7200000 #define RSMA_QTASKINFO_BUFSIZE 32768 +#define RSMA_QTASKINFO_HEAD_LEN (sizeof(int32_t) + sizeof(int8_t) + sizeof(int64_t)) // len + type + suid typedef enum { TD_QTASK_TMP_FILE = 0, TD_QTASK_CUR_FILE } TD_QTASK_FILE_T; static const char *tdQTaskInfoFname[] = {"qtaskinfo.t", "qtaskinfo"}; typedef struct SRSmaQTaskInfoItem SRSmaQTaskInfoItem; -typedef struct SRSmaQTaskFIter SRSmaQTaskFIter; +typedef struct SRSmaQTaskInfoIter SRSmaQTaskInfoIter; static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid); static int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SArray *tbUids); @@ -32,11 +33,11 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t inputType static void tdRSmaFetchTrigger(void *param, void *tmrId); static void tdRSmaPersistTrigger(void *param, void *tmrId); static void *tdRSmaPersistExec(void *param); -static void tdRSmaQTaskGetFName(int32_t vid, int8_t ftype, char *outputName); +static void tdRSmaQTaskInfoGetFName(int32_t vid, int8_t ftype, char *outputName); -static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskFIter *pIter, STFile *pTFile); -static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskFIter *pIter, bool *isFinish); -static int32_t tdRSmaQTaskInfoIterNext(SRSmaQTaskFIter *pIter, SRSmaQTaskInfoItem *pItem, bool *isEnd); +static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskInfoIter *pIter, STFile *pTFile); +static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isFinish); +static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter); static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *infoItem); struct SRSmaInfoItem { @@ -63,22 +64,23 @@ struct SRSmaQTaskInfoItem { void *qTaskInfo; }; -struct SRSmaQTaskFIter { +struct SRSmaQTaskInfoIter { STFile *pTFile; int64_t offset; int64_t fsize; int32_t nBytes; int32_t nAlloc; - char *buf; + char *pBuf; // ------------ + char *qBuf; // for iterator int32_t nBufPos; }; static FORCE_INLINE int32_t tdRSmaQTaskInfoContLen(int32_t lenWithHead) { - return lenWithHead - sizeof(int32_t) - sizeof(int8_t) - sizeof(int64_t); + return lenWithHead - RSMA_QTASKINFO_HEAD_LEN; } -static FORCE_INLINE void tdRSmaQTaskInfoIterDestroy(SRSmaQTaskFIter *pIter) { taosMemoryFreeClear(pIter->buf); } +static FORCE_INLINE void tdRSmaQTaskInfoIterDestroy(SRSmaQTaskInfoIter *pIter) { taosMemoryFreeClear(pIter->pBuf); } static FORCE_INLINE void tdFreeTaskHandle(qTaskInfo_t *taskHandle, int32_t vgId, int32_t level) { // Note: free/kill may in RC @@ -294,7 +296,7 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &suid, sizeof(tb_uid_t)); if (pRSmaInfo) { - ASSERT(0); // TODO: free original pRSmaInfo is exists abnormally + ASSERT(0); // TODO: free original pRSmaInfo if exists abnormally smaDebug("vgId:%d, rsma info already exists for table %s, %" PRIi64, SMA_VID(pSma), tbName, suid); return TSDB_CODE_SUCCESS; } @@ -338,10 +340,10 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con if (taosHashPut(RSMA_INFO_HASH(pStat), &suid, sizeof(tb_uid_t), &pRSmaInfo, sizeof(pRSmaInfo)) < 0) { goto _err; - } else { - smaDebug("vgId:%d, register rsma info succeed for suid:%" PRIi64, SMA_VID(pSma), suid); } + smaDebug("vgId:%d, register rsma info succeed for suid:%" PRIi64, SMA_VID(pSma), suid); + // start the persist timer if (TASK_TRIGGER_STAT_INIT == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pStat), TASK_TRIGGER_STAT_INIT, TASK_TRIGGER_STAT_ACTIVE)) { @@ -356,10 +358,9 @@ _err: } /** - * @brief Check and init qTaskInfo_t, only applicable to stable with SRSmaParam. + * @brief Check and init qTaskInfo_t, only applicable to stable with SRSmaParam currently * - * @param pTsdb - * @param pMeta + * @param pVnode * @param pReq * @return int32_t */ @@ -695,8 +696,257 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) { return TSDB_CODE_SUCCESS; } -static void tdRSmaQTaskGetFName(int32_t vid, int8_t ftype, char *outputName) { - tdGetVndFileName(vid, "rsma", tdQTaskInfoFname[ftype], outputName); +int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { + SVnode *pVnode = pSma->pVnode; + + // step 1: iterate all stables to restore the rsma env + SArray *suidList = taosArrayInit(1, sizeof(tb_uid_t)); + if (tsdbGetStbIdList(SMA_META(pSma), 0, suidList) < 0) { + taosArrayDestroy(suidList); + smaError("vgId:%d, failed to restore rsma env since get stb id list error: %s", TD_VID(pVnode), terrstr()); + return TSDB_CODE_FAILED; + } + + int32_t arrSize = taosArrayGetSize(suidList); + if (arrSize == 0) { + taosArrayDestroy(suidList); + smaDebug("vgId:%d, no need to restore rsma env since empty stb id list", TD_VID(pVnode)); + return TSDB_CODE_SUCCESS; + } + + SMetaReader mr = {0}; + metaReaderInit(&mr, SMA_META(pSma), 0); + for (int32_t i = 0; i < arrSize; ++i) { + tb_uid_t suid = *(tb_uid_t *)taosArrayGet(suidList, i); + smaDebug("vgId:%d, rsma restore, suid[%d] is %" PRIi64, TD_VID(pVnode), i, suid); + if (metaGetTableEntryByUid(&mr, suid) < 0) { + smaError("vgId:%d, rsma restore, failed to get table meta for %" PRIi64 " since %s", TD_VID(pVnode), suid, + terrstr()); + goto _err; + } + ASSERT(mr.me.type == TSDB_SUPER_TABLE); + ASSERT(mr.me.uid == suid); + if (TABLE_IS_ROLLUP(mr.me.flags)) { + SRSmaParam *param = &mr.me.stbEntry.rsmaParam; + for (int i = 0; i < TSDB_RETENTION_L2; ++i) { + smaDebug("vgId:%d, rsma restore, table:%" PRIi64 " level:%d, maxdelay:%" PRIi64 " watermark:%" PRIi64 + " qmsgLen:%" PRIi32, + TD_VID(pVnode), suid, i, param->maxdelay[i], param->watermark[i], param->qmsgLen[i]); + } + if (tdProcessRSmaCreateImpl(pSma, &mr.me.stbEntry.rsmaParam, suid, mr.me.name) < 0) { + smaError("vgId:%d, rsma restore env failed for %" PRIi64 " since %s", TD_VID(pVnode), suid, terrstr()); + goto _err; + } + smaDebug("vgId:%d, rsma restore env success for %" PRIi64, TD_VID(pVnode), suid); + } + } + + // step 2: retrieve qtaskinfo items from the persistence file(rsma/qtaskinfo) and restore + STFile tFile = {0}; + char qTaskInfoFName[TSDB_FILENAME_LEN]; + + tdRSmaQTaskInfoGetFName(TD_VID(pVnode), TD_QTASK_CUR_FILE, qTaskInfoFName); + if (tdInitTFile(&tFile, pVnode->pTfs, qTaskInfoFName) < 0) { + goto _err; + } + if (tdOpenTFile(&tFile, TD_FILE_READ) < 0) { + goto _err; + } + SRSmaQTaskInfoIter fIter = {0}; + if (tdRSmaQTaskInfoIterInit(&fIter, &tFile) < 0) { + goto _err; + } + SRSmaQTaskInfoItem infoItem = {0}; + if (tdRSmaQTaskInfoRestore(pSma, &fIter) < 0) { + tdRSmaQTaskInfoIterDestroy(&fIter); + goto _err; + } + + tdRSmaQTaskInfoIterDestroy(&fIter); + metaReaderClear(&mr); + taosArrayDestroy(suidList); + return TSDB_CODE_SUCCESS; +_err: + metaReaderClear(&mr); + taosArrayDestroy(suidList); + smaError("failed to restore rsma task since %s", terrstr()); + return TSDB_CODE_FAILED; +} + +static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *pItem) { + SRSmaStat *pStat = (SRSmaStat *)SMA_ENV_STAT((SSmaEnv *)pSma->pRSmaEnv); + SRSmaInfo *pRSmaInfo = NULL; + void *qTaskInfo = NULL; + + pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &pItem->suid, sizeof(pItem->suid)); + + if (!pRSmaInfo || !(pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) { + smaDebug("vgId:%d, no restore as no rsma info for table:%" PRIu64, SMA_VID(pSma), pItem->suid); + return TSDB_CODE_SUCCESS; + } + + if (pItem->type == 1) { + qTaskInfo = pRSmaInfo->items[0].taskInfo; + } else if (pItem->type == 2) { + qTaskInfo = pRSmaInfo->items[1].taskInfo; + } else { + ASSERT(0); + } + + if (!qTaskInfo) { + smaDebug("vgId:%d, no restore as NULL rsma qTaskInfo for table:%" PRIu64, SMA_VID(pSma), pItem->suid); + return TSDB_CODE_SUCCESS; + } + + if (qDeserializeTaskStatus(qTaskInfo, pItem->qTaskInfo, pItem->len) < 0) { + smaError("vgId:%d, restore rsma task failed for table:%" PRIi64 " level %d since %s", SMA_VID(pSma), pItem->suid, + pItem->type, terrstr(terrno)); + return TSDB_CODE_FAILED; + } + smaDebug("vgId:%d, restore rsma task success for table:%" PRIi64 " level %d", SMA_VID(pSma), pItem->suid, pItem->type); + + return TSDB_CODE_SUCCESS; +} + +static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskInfoIter *pIter, STFile *pTFile) { + memset(pIter, 0, sizeof(*pIter)); + pIter->pTFile = pTFile; + pIter->offset = TD_FILE_HEAD_SIZE; + + if (tdGetTFileSize(pTFile, &pIter->fsize) < 0) { + return TSDB_CODE_FAILED; + } + + if ((pIter->fsize - TD_FILE_HEAD_SIZE) < RSMA_QTASKINFO_BUFSIZE) { + pIter->nAlloc = pIter->fsize - TD_FILE_HEAD_SIZE; + } else { + pIter->nAlloc = RSMA_QTASKINFO_BUFSIZE; + } + + if (pIter->nAlloc < TD_FILE_HEAD_SIZE) { + pIter->nAlloc = TD_FILE_HEAD_SIZE; + } + + pIter->pBuf = taosMemoryMalloc(pIter->nAlloc); + if (!pIter->pBuf) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return TSDB_CODE_FAILED; + } + pIter->qBuf = pIter->pBuf; + + return TSDB_CODE_SUCCESS; +} + +static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isFinish) { + STFile *pTFile = pIter->pTFile; + int64_t nBytes = RSMA_QTASKINFO_BUFSIZE; + + if (pIter->offset >= pIter->fsize) { + *isFinish = true; + return TSDB_CODE_SUCCESS; + } + + if ((pIter->fsize - pIter->offset) < RSMA_QTASKINFO_BUFSIZE) { + nBytes = pIter->fsize - pIter->offset; + } + + if (tdSeekTFile(pTFile, pIter->offset, SEEK_SET) < 0) { + ASSERT(0); + return TSDB_CODE_FAILED; + } + + if (tdReadTFile(pTFile, pIter->qBuf, nBytes) != nBytes) { + ASSERT(0); + return TSDB_CODE_FAILED; + } + + int32_t infoLen = 0; + taosDecodeFixedI32(pIter->qBuf, &infoLen); + if (infoLen > nBytes) { + ASSERT(infoLen > RSMA_QTASKINFO_BUFSIZE); + pIter->nAlloc = infoLen; + void *pBuf = taosMemoryRealloc(pIter->pBuf, infoLen); + if (!pBuf) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return TSDB_CODE_FAILED; + } + pIter->pBuf = pBuf; + pIter->qBuf = pIter->pBuf; + nBytes = infoLen; + + if (tdSeekTFile(pTFile, pIter->offset, SEEK_SET)) { + ASSERT(0); + return TSDB_CODE_FAILED; + } + + if (tdReadTFile(pTFile, pIter->pBuf, nBytes) != nBytes) { + ASSERT(0); + return TSDB_CODE_FAILED; + } + } + + pIter->offset += nBytes; + pIter->nBytes = nBytes; + pIter->nBufPos = 0; + + return TSDB_CODE_SUCCESS; +} + +static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter) { + while (1) { + // block iter + bool isFinish = false; + if (tdRSmaQTaskInfoIterNextBlock(pIter, &isFinish) < 0) { + ASSERT(0); + return TSDB_CODE_FAILED; + } + if (isFinish) { + return TSDB_CODE_SUCCESS; + } + + // consume the block + int32_t qTaskInfoLenWithHead = 0; + pIter->qBuf = taosDecodeFixedI32(pIter->qBuf, &qTaskInfoLenWithHead); + if (qTaskInfoLenWithHead < RSMA_QTASKINFO_HEAD_LEN) { + terrno = TSDB_CODE_TDB_FILE_CORRUPTED; + return TSDB_CODE_FAILED; + } + + while (1) { + if ((pIter->nBufPos + qTaskInfoLenWithHead) <= pIter->nBytes) { + SRSmaQTaskInfoItem infoItem = {0}; + pIter->qBuf = taosDecodeFixedI8(pIter->qBuf, &infoItem.type); + pIter->qBuf = taosDecodeFixedI64(pIter->qBuf, &infoItem.suid); + infoItem.qTaskInfo = pIter->qBuf; + infoItem.len = tdRSmaQTaskInfoContLen(qTaskInfoLenWithHead); + // do the restore job + smaDebug("vgId:%d, restore the qtask info %s offset:%" PRIi64 "\n", SMA_VID(pSma), + TD_TFILE_FULL_NAME(pIter->pTFile), pIter->offset - pIter->nBytes + pIter->nBufPos); + tdRSmaQTaskInfoItemRestore(pSma, &infoItem); + + pIter->qBuf = POINTER_SHIFT(pIter->qBuf, infoItem.len); + pIter->nBufPos += qTaskInfoLenWithHead; + + if ((pIter->nBufPos + RSMA_QTASKINFO_HEAD_LEN) >= pIter->nBytes) { + // prepare and load next block in the file + pIter->offset -= (pIter->nBytes - pIter->nBufPos); + break; + } + + pIter->qBuf = taosDecodeFixedI32(pIter->qBuf, &qTaskInfoLenWithHead); + continue; + } + // prepare and load next block in the file + pIter->offset -= (pIter->nBytes - pIter->nBufPos); + break; + } + } + + return TSDB_CODE_SUCCESS; +} + +static void tdRSmaQTaskInfoGetFName(int32_t vid, int8_t ftype, char *outputName) { + tdGetVndFileName(vid, VNODE_RSMA_DIR, tdQTaskInfoFname[ftype], outputName); } static void *tdRSmaPersistExec(void *param) { @@ -704,6 +954,7 @@ static void *tdRSmaPersistExec(void *param) { SRSmaStat *pRSmaStat = param; SSma *pSma = pRSmaStat->pSma; STfs *pTfs = pSma->pVnode->pTfs; + int32_t vid = SMA_VID(pSma); int64_t toffset = 0; bool isFileCreated = false; @@ -716,26 +967,16 @@ static void *tdRSmaPersistExec(void *param) { goto _end; } - STFile tFile = {0}; - int32_t vid = SMA_VID(pSma); - + STFile tFile = {0}; while (infoHash) { SRSmaInfo *pRSmaInfo = *(SRSmaInfo **)infoHash; - -#if 0 - smaDebug("table %" PRIi64 " sleep 15s start ...", pRSmaInfo->items[0].pRsmaInfo->suid); - for (int32_t i = 15; i > 0; --i) { - taosSsleep(1); - smaDebug("table %" PRIi64 " countdown %d", pRSmaInfo->items[0].pRsmaInfo->suid, i); - } - smaDebug("table %" PRIi64 " sleep 15s end ...", pRSmaInfo->items[0].pRsmaInfo->suid); -#endif for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { qTaskInfo_t taskInfo = pRSmaInfo->items[i].taskInfo; if (!taskInfo) { smaDebug("vgId:%d, table %" PRIi64 " level %d qTaskInfo is NULL", vid, pRSmaInfo->suid, i + 1); continue; } + char *pOutput = NULL; int32_t len = 0; int8_t type = (int8_t)(i + 1); @@ -743,69 +984,77 @@ static void *tdRSmaPersistExec(void *param) { smaError("vgId:%d, table %" PRIi64 " level %d serialize rsma task failed since %s", vid, pRSmaInfo->suid, i + 1, terrstr(terrno)); goto _err; - } else { - if (!pOutput) { - smaDebug("vgId:%d, table %" PRIi64 - " level %d serialize rsma task success but no output(len %d) and no need to persist", - vid, pRSmaInfo->suid, i + 1, len); - continue; - } else if (len <= 0) { - smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success with len %d and no need to persist", - vid, pRSmaInfo->suid, i + 1, len); - taosMemoryFree(pOutput); - } - smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success with len %d and need persist", vid, - pRSmaInfo->suid, i + 1, len); -#if 1 - if (qDeserializeTaskStatus(taskInfo, pOutput, len) < 0) { - smaError("vgId:%d, table %" PRIi64 "level %d deserialize rsma task failed since %s", vid, pRSmaInfo->suid, - i + 1, terrstr(terrno)); - } else { - smaDebug("vgId:%d, table %" PRIi64 " level %d deserialize rsma task success", vid, pRSmaInfo->suid, i + 1); - } -#endif } + if (!pOutput || len <= 0) { + smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success but no output(len %d), not persist", + vid, pRSmaInfo->suid, i + 1, len); + taosMemoryFreeClear(pOutput); + continue; + } + + smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success with len %d, need persist", vid, + pRSmaInfo->suid, i + 1, len); +#if 0 + if (qDeserializeTaskStatus(taskInfo, pOutput, len) < 0) { + smaError("vgId:%d, table %" PRIi64 "level %d deserialize rsma task failed since %s", vid, pRSmaInfo->suid, + i + 1, terrstr(terrno)); + } else { + smaDebug("vgId:%d, table %" PRIi64 " level %d deserialize rsma task success", vid, pRSmaInfo->suid, i + 1); + } +#endif if (!isFileCreated) { char qTaskInfoFName[TSDB_FILENAME_LEN]; - tdRSmaQTaskGetFName(vid, TD_QTASK_TMP_FILE, qTaskInfoFName); + tdRSmaQTaskInfoGetFName(vid, TD_QTASK_TMP_FILE, qTaskInfoFName); tdInitTFile(&tFile, pTfs, qTaskInfoFName); tdCreateTFile(&tFile, pTfs, true, -1); isFileCreated = true; } - len += (sizeof(len) + sizeof(type) + sizeof(pRSmaInfo->suid)); - tdAppendTFile(&tFile, &len, sizeof(len), &toffset); - tdAppendTFile(&tFile, &type, sizeof(type), &toffset); - tdAppendTFile(&tFile, &pRSmaInfo->suid, sizeof(pRSmaInfo->suid), &toffset); + + char tmpBuf[RSMA_QTASKINFO_HEAD_LEN] = {0}; + void *pTmpBuf = &tmpBuf; + int32_t headLen = 0; + headLen += taosEncodeFixedI32(&pTmpBuf, len + RSMA_QTASKINFO_HEAD_LEN); + headLen += taosEncodeFixedI8(&pTmpBuf, type); + headLen += taosEncodeFixedI64(&pTmpBuf, pRSmaInfo->suid); + + ASSERT(headLen <= RSMA_QTASKINFO_HEAD_LEN); + tdAppendTFile(&tFile, (void *)&tmpBuf, headLen, &toffset); + smaDebug("vgId:%d, table %" PRIi64 " level %d head part len:%d appended to offset:%" PRIi64, vid, pRSmaInfo->suid, + i + 1, headLen, toffset); tdAppendTFile(&tFile, pOutput, len, &toffset); + smaDebug("vgId:%d, table %" PRIi64 " level %d body part len:%d appended to offset:%" PRIi64, vid, pRSmaInfo->suid, + i + 1, len, toffset); taosMemoryFree(pOutput); } + infoHash = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), infoHash); } _normal: if (isFileCreated) { if (tdUpdateTFileHeader(&tFile) < 0) { - smaError("vgId:%d, failed to update tfile %s header since %s", vid, TD_FILE_FULL_NAME(&tFile), tstrerror(terrno)); + smaError("vgId:%d, failed to update tfile %s header since %s", vid, TD_TFILE_FULL_NAME(&tFile), + tstrerror(terrno)); tdCloseTFile(&tFile); tdRemoveTFile(&tFile); goto _err; } else { - smaDebug("vgId:%d, succeed to update tfile %s header", vid, TD_FILE_FULL_NAME(&tFile)); + smaDebug("vgId:%d, succeed to update tfile %s header", vid, TD_TFILE_FULL_NAME(&tFile)); } tdCloseTFile(&tFile); char newFName[TSDB_FILENAME_LEN]; - strncpy(newFName, TD_FILE_FULL_NAME(&tFile), TSDB_FILENAME_LEN); + strncpy(newFName, TD_TFILE_FULL_NAME(&tFile), TSDB_FILENAME_LEN); char *pos = strstr(newFName, tdQTaskInfoFname[TD_QTASK_TMP_FILE]); strncpy(pos, tdQTaskInfoFname[TD_QTASK_CUR_FILE], TSDB_FILENAME_LEN - POINTER_DISTANCE(pos, newFName)); - if (taosRenameFile(TD_FILE_FULL_NAME(&tFile), newFName) != 0) { - smaError("vgId:%d, failed to rename %s to %s", vid, TD_FILE_FULL_NAME(&tFile), newFName); + if (taosRenameFile(TD_TFILE_FULL_NAME(&tFile), newFName) != 0) { + smaError("vgId:%d, failed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); goto _err; } else { - smaDebug("vgId:%d, succeed to rename %s to %s", vid, TD_FILE_FULL_NAME(&tFile), newFName); + smaDebug("vgId:%d, succeed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); } } goto _end; @@ -841,13 +1090,14 @@ static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) { if (TASK_TRIGGER_STAT_INACTIVE == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INACTIVE, TASK_TRIGGER_STAT_ACTIVE)) { - smaDebug("persist task is active again"); + smaDebug("vgId:%d, persist task is active again", SMA_VID(pRSmaStat->pSma)); } else if (TASK_TRIGGER_STAT_CANCELLED == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_CANCELLED, TASK_TRIGGER_STAT_FINISHED)) { - smaDebug(" persist task is cancelled and set finished"); + smaDebug("vgId:%d, persist task is cancelled and set finished", SMA_VID(pRSmaStat->pSma)); } else { - smaWarn("persist task in abnormal stat %" PRIi8, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))); + smaWarn("vgId:%d, persist task in abnormal stat %" PRIi8, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)), + SMA_VID(pRSmaStat->pSma)); ASSERT(0); } atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); @@ -864,7 +1114,8 @@ static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) { */ static void tdRSmaPersistTrigger(void *param, void *tmrId) { SRSmaStat *pRSmaStat = param; - int8_t tmrStat = + + int8_t tmrStat = atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_ACTIVE, TASK_TRIGGER_STAT_INACTIVE); switch (tmrStat) { case TASK_TRIGGER_STAT_ACTIVE: { @@ -872,7 +1123,7 @@ static void tdRSmaPersistTrigger(void *param, void *tmrId) { if (TASK_TRIGGER_STAT_CANCELLED != atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_CANCELLED, TASK_TRIGGER_STAT_FINISHED)) { - smaDebug("rsma persistence start since active"); + smaDebug("vgId:%d, rsma persistence start since active", SMA_VID(pRSmaStat->pSma)); // start persist task tdRSmaPersistTask(pRSmaStat); @@ -895,252 +1146,6 @@ static void tdRSmaPersistTrigger(void *param, void *tmrId) { } break; default: { smaWarn("rsma persistence not start since unknown stat %" PRIi8, tmrStat); - ASSERT(0); } break; } } - -int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { - SVnode *pVnode = pSma->pVnode; - - // step 1: iterate all stables to restore the rsma env - - SArray *suidList = taosArrayInit(1, sizeof(tb_uid_t)); - if (tsdbGetStbIdList(SMA_META(pSma), 0, suidList) < 0) { - smaError("vgId:%d, failed to restore rsma since get stb id list error: %s", TD_VID(pVnode), terrstr()); - return TSDB_CODE_FAILED; - } - - if (taosArrayGetSize(suidList) == 0) { - smaDebug("vgId:%d no need to restore rsma since empty stb id list", TD_VID(pVnode)); - return TSDB_CODE_SUCCESS; - } - - SMetaReader mr = {0}; - metaReaderInit(&mr, SMA_META(pSma), 0); - for (int32_t i = 0; i < taosArrayGetSize(suidList); ++i) { - tb_uid_t suid = *(tb_uid_t *)taosArrayGet(suidList, i); - smaDebug("suid [%d] is %" PRIi64, i, suid); - if (metaGetTableEntryByUid(&mr, suid) < 0) { - smaError("vgId:%d failed to get table meta for %" PRIi64 " since %s", TD_VID(pVnode), suid, terrstr()); - goto _err; - } - ASSERT(mr.me.type == TSDB_SUPER_TABLE); - ASSERT(mr.me.uid == suid); - if (TABLE_IS_ROLLUP(mr.me.flags)) { - SRSmaParam *param = &mr.me.stbEntry.rsmaParam; - for (int i = 0; i < 2; ++i) { - smaDebug("vgId: %d table:%" PRIi64 " maxdelay[%d]:%" PRIi64 " watermark[%d]:%" PRIi64, TD_VID(pSma->pVnode), - suid, i, param->maxdelay[i], i, param->watermark[i]); - } - if (tdProcessRSmaCreateImpl(pSma, &mr.me.stbEntry.rsmaParam, suid, mr.me.name) < 0) { - smaError("vgId:%d failed to retore rsma env for %" PRIi64 " since %s", TD_VID(pVnode), suid, terrstr()); - goto _err; - } - } - } - - // step 2: retrieve qtaskinfo object from the rsma/qtaskinfo file and restore - STFile tFile = {0}; - char qTaskInfoFName[TSDB_FILENAME_LEN]; - - tdRSmaQTaskGetFName(TD_VID(pVnode), TD_QTASK_CUR_FILE, qTaskInfoFName); - if (tdInitTFile(&tFile, pVnode->pTfs, qTaskInfoFName) < 0) { - goto _err; - } - if (tdOpenTFile(&tFile, TD_FILE_READ) < 0) { - goto _err; - } - SRSmaQTaskFIter fIter = {0}; - if (tdRSmaQTaskInfoIterInit(&fIter, &tFile) < 0) { - goto _err; - } - SRSmaQTaskInfoItem infoItem = {0}; - bool isEnd = false; - int32_t code = 0; - while ((code = tdRSmaQTaskInfoIterNext(&fIter, &infoItem, &isEnd)) == 0) { - if (isEnd) { - break; - } - if ((code = tdRSmaQTaskInfoItemRestore(pSma, &infoItem)) < 0) { - break; - } - } - tdRSmaQTaskInfoIterDestroy(&fIter); - - if (code < 0) { - goto _err; - } - - metaReaderClear(&mr); - taosArrayDestroy(suidList); - return TSDB_CODE_SUCCESS; -_err: - ASSERT(0); - metaReaderClear(&mr); - taosArrayDestroy(suidList); - smaError("failed to restore rsma info since %s", terrstr()); - return TSDB_CODE_FAILED; -} - -static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *infoItem) { - SRSmaStat *pStat = (SRSmaStat *)SMA_ENV_STAT((SSmaEnv *)pSma->pRSmaEnv); - SRSmaInfo *pRSmaInfo = NULL; - void *qTaskInfo = NULL; - - pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &infoItem->suid, sizeof(infoItem->suid)); - - if (!pRSmaInfo || !(pRSmaInfo = *(SRSmaInfo **)pRSmaInfo)) { - smaDebug("vgId:%d, no restore as no rsma info for suid:%" PRIu64, SMA_VID(pSma), infoItem->suid); - return TSDB_CODE_SUCCESS; - } - - if (infoItem->type == 1) { - qTaskInfo = pRSmaInfo->items[0].taskInfo; - } else if (infoItem->type == 2) { - qTaskInfo = pRSmaInfo->items[1].taskInfo; - } else { - ASSERT(0); - } - - if (!qTaskInfo) { - smaDebug("vgId:%d, no restore as NULL rsma qTaskInfo for suid:%" PRIu64, SMA_VID(pSma), infoItem->suid); - return TSDB_CODE_SUCCESS; - } - - if (qDeserializeTaskStatus(qTaskInfo, infoItem->qTaskInfo, infoItem->len) < 0) { - smaError("vgId:%d, restore rsma failed for suid:%" PRIi64 " level %d since %s", SMA_VID(pSma), infoItem->suid, - infoItem->type, terrstr(terrno)); - return TSDB_CODE_FAILED; - } - smaDebug("vgId:%d, restore rsma success for suid:%" PRIi64 " level %d", SMA_VID(pSma), infoItem->suid, - infoItem->type); - - return TSDB_CODE_SUCCESS; -} - -static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskFIter *pIter, STFile *pTFile) { - memset(pIter, 0, sizeof(*pIter)); - pIter->pTFile = pTFile; - pIter->offset = TD_FILE_HEAD_SIZE; - - if (tdGetTFileSize(pTFile, &pIter->fsize) < 0) { - return TSDB_CODE_FAILED; - } - - if ((pIter->fsize - TD_FILE_HEAD_SIZE) < RSMA_QTASKINFO_BUFSIZE) { - pIter->nAlloc = pIter->fsize - TD_FILE_HEAD_SIZE; - } else { - pIter->nAlloc = RSMA_QTASKINFO_BUFSIZE; - } - - if (pIter->nAlloc < TD_FILE_HEAD_SIZE) { - pIter->nAlloc = TD_FILE_HEAD_SIZE; - } - - pIter->buf = taosMemoryMalloc(pIter->nAlloc); - if (!pIter->buf) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskFIter *pIter, bool *isFinish) { - STFile *pTFile = pIter->pTFile; - int64_t nBytes = RSMA_QTASKINFO_BUFSIZE; - - if (pIter->offset >= pIter->fsize) { - *isFinish = true; - return TSDB_CODE_SUCCESS; - } - - if ((pIter->fsize - pIter->offset) < RSMA_QTASKINFO_BUFSIZE) { - nBytes = pIter->fsize - pIter->offset; - } - - if (tdSeekTFile(pTFile, pIter->offset, SEEK_SET) < 0) { - ASSERT(0); - return TSDB_CODE_FAILED; - } - - if (tdReadTFile(pTFile, pIter->buf, nBytes) != nBytes) { - ASSERT(0); - return TSDB_CODE_FAILED; - } - - int32_t infoLen = 0; - taosDecodeFixedI32(pIter->buf, &infoLen); - if (infoLen > nBytes) { - ASSERT(infoLen > RSMA_QTASKINFO_BUFSIZE); - pIter->nAlloc = infoLen; - void *pBuf = taosMemoryRealloc(pIter->buf, infoLen); - if (!pBuf) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return TSDB_CODE_FAILED; - } - pIter->buf = pBuf; - nBytes = infoLen; - - if (tdSeekTFile(pTFile, pIter->offset, SEEK_SET)) { - ASSERT(0); - return TSDB_CODE_FAILED; - } - - if (tdReadTFile(pTFile, pIter->buf, nBytes) != nBytes) { - ASSERT(0); - return TSDB_CODE_FAILED; - } - } - - pIter->offset += nBytes; - pIter->nBytes = nBytes; - pIter->nBufPos = 0; - - return TSDB_CODE_SUCCESS; -} - -static int32_t tdRSmaQTaskInfoIterNext(SRSmaQTaskFIter *pIter, SRSmaQTaskInfoItem *pItem, bool *isEnd) { - while (1) { - // block iter - bool isFinish = false; - if (tdRSmaQTaskInfoIterNextBlock(pIter, &isFinish) < 0) { - ASSERT(0); - return TSDB_CODE_FAILED; - } - if (isFinish) { - *isEnd = true; - return TSDB_CODE_SUCCESS; - } - - // consume the block - int32_t qTaskInfoLenWithHead = 0; - pIter->buf = taosDecodeFixedI32(pIter->buf, &qTaskInfoLenWithHead); - if (qTaskInfoLenWithHead < 0) { - terrno = TSDB_CODE_TDB_FILE_CORRUPTED; - return TSDB_CODE_FAILED; - } - while (1) { - if ((pIter->nBufPos + qTaskInfoLenWithHead) <= pIter->nBytes) { - pIter->buf = taosDecodeFixedI8(pIter->buf, &pItem->type); - pIter->buf = taosDecodeFixedI64(pIter->buf, &pItem->suid); - pItem->qTaskInfo = pIter->buf; - pItem->len = tdRSmaQTaskInfoContLen(qTaskInfoLenWithHead); - // do the restore job - printf("%s:%d ###### restore the qtask info offset:%" PRIi64 "\n", __func__, __LINE__, pIter->offset); - - pIter->buf = POINTER_SHIFT(pIter->buf, pItem->len); - pIter->nBufPos += qTaskInfoLenWithHead; - - pIter->buf = taosDecodeFixedI32(pIter->buf, &qTaskInfoLenWithHead); - continue; - } - // prepare and load next block in the file - pIter->offset -= (pIter->nBytes - pIter->nBufPos); - break; - } - } - - return TSDB_CODE_SUCCESS; -} diff --git a/source/dnode/vnode/src/sma/smaUtil.c b/source/dnode/vnode/src/sma/smaUtil.c index 1f60da0b0a..5f78aadddf 100644 --- a/source/dnode/vnode/src/sma/smaUtil.c +++ b/source/dnode/vnode/src/sma/smaUtil.c @@ -22,7 +22,6 @@ #define TD_FILE_INIT_MAGIC 0xFFFFFFFF - static int32_t tdEncodeTFInfo(void **buf, STFInfo *pInfo); static void *tdDecodeTFInfo(void *buf, STFInfo *pInfo); @@ -46,7 +45,7 @@ static void *tdDecodeTFInfo(void *buf, STFInfo *pInfo) { } int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t nwrite = taosWriteFile(pTFile->pFile, buf, nbyte); if (nwrite < nbyte) { @@ -58,9 +57,9 @@ int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { } int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); - int64_t loffset = taosLSeekFile(TD_FILE_PFILE(pTFile), offset, whence); + int64_t loffset = taosLSeekFile(TD_TFILE_PFILE(pTFile), offset, whence); if (loffset < 0) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -70,12 +69,12 @@ int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { } int64_t tdGetTFileSize(STFile *pTFile, int64_t *size) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); return taosFStatFile(pTFile->pFile, size, NULL); } int64_t tdReadTFile(STFile *pTFile, void *buf, int64_t nbyte) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t nread = taosReadFile(pTFile->pFile, buf, nbyte); if (nread < 0) { @@ -108,7 +107,7 @@ int32_t tdLoadTFileHeader(STFile *pTFile, STFInfo *pInfo) { char buf[TD_FILE_HEAD_SIZE] = "\0"; uint32_t _version; - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); if (tdSeekTFile(pTFile, 0, SEEK_SET) < 0) { return -1; @@ -133,7 +132,7 @@ void tdUpdateTFileMagic(STFile *pTFile, void *pCksm) { } int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) { - ASSERT(TD_FILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t toffset; @@ -141,6 +140,11 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) return -1; } +#if 1 + smaDebug("append to file %s, offset:%" PRIi64 " + nbyte:%" PRIi64 " =%" PRIi64, TD_TFILE_FULL_NAME(pTFile), toffset, + nbyte, toffset + nbyte); +#endif + ASSERT(pTFile->info.fsize == toffset); if (offset) { @@ -157,9 +161,9 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) } int32_t tdOpenTFile(STFile *pTFile, int flags) { - ASSERT(!TD_FILE_OPENED(pTFile)); + ASSERT(!TD_TFILE_OPENED(pTFile)); - pTFile->pFile = taosOpenFile(TD_FILE_FULL_NAME(pTFile), flags); + pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), flags); if (pTFile->pFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -169,9 +173,9 @@ int32_t tdOpenTFile(STFile *pTFile, int flags) { } void tdCloseTFile(STFile *pTFile) { - if (TD_FILE_OPENED(pTFile)) { + if (TD_TFILE_OPENED(pTFile)) { taosCloseFile(&pTFile->pFile); - TD_FILE_SET_CLOSED(pTFile); + TD_TFILE_SET_CLOSED(pTFile); } } @@ -183,8 +187,8 @@ int32_t tdInitTFile(STFile *pTFile, STfs *pTfs, const char *fname) { char fullname[TSDB_FILENAME_LEN]; SDiskID did = {0}; - TD_FILE_SET_STATE(pTFile, TD_FILE_STATE_OK); - TD_FILE_SET_CLOSED(pTFile); + TD_TFILE_SET_STATE(pTFile, TD_FILE_STATE_OK); + TD_TFILE_SET_CLOSED(pTFile); memset(&(pTFile->info), 0, sizeof(pTFile->info)); pTFile->info.magic = TD_FILE_INIT_MAGIC; @@ -202,18 +206,18 @@ int32_t tdInitTFile(STFile *pTFile, STfs *pTfs, const char *fname) { int32_t tdCreateTFile(STFile *pTFile, STfs *pTfs, bool updateHeader, int8_t fType) { ASSERT(pTFile->info.fsize == 0 && pTFile->info.magic == TD_FILE_INIT_MAGIC); - pTFile->pFile = taosOpenFile(TD_FILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pTFile->pFile == NULL) { if (errno == ENOENT) { // Try to create directory recursively - char *s = strdup(TD_FILE_REL_NAME(pTFile)); - if (tfsMkdirRecurAt(pTfs, taosDirName(s), TD_FILE_DID(pTFile)) < 0) { + char *s = strdup(TD_TFILE_REL_NAME(pTFile)); + if (tfsMkdirRecurAt(pTfs, taosDirName(s), TD_TFILE_DID(pTFile)) < 0) { taosMemoryFreeClear(s); return -1; } taosMemoryFreeClear(s); - pTFile->pFile = taosOpenFile(TD_FILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pTFile->pFile == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; @@ -240,7 +244,7 @@ int32_t tdCreateTFile(STFile *pTFile, STfs *pTfs, bool updateHeader, int8_t fTyp return 0; } -int32_t tdRemoveTFile(STFile *pTFile) { return tfsRemoveFile(TD_FILE_F(pTFile)); } +int32_t tdRemoveTFile(STFile *pTFile) { return tfsRemoveFile(TD_TFILE_F(pTFile)); } // smaXXXUtil ================ // ... \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 4d73dbc406..57d7386667 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -152,14 +152,14 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) { return pVnode; _err: - if (pVnode->pSma) smaClose(pVnode->pSma); + if (pVnode->pSma) smaCloseEnv(pVnode->pSma); if (pVnode->pQuery) vnodeQueryClose(pVnode); if (pVnode->pTq) tqClose(pVnode->pTq); if (pVnode->pWal) walClose(pVnode->pWal); if (pVnode->pTsdb) tsdbClose(&pVnode->pTsdb); + if (pVnode->pSma) smaCloseEx(pVnode->pSma); if (pVnode->pMeta) metaClose(pVnode->pMeta); - tsem_destroy(&(pVnode->canCommit)); taosMemoryFree(pVnode); return NULL; From cbd581c431238ae432287ec1776109748b01f4eb Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 28 Jun 2022 14:11:44 +0800 Subject: [PATCH 22/47] feat: add taosudf.h to package files and install files --- cmake/cmake.install | 1 + packaging/check_package.sh | 2 +- packaging/deb/DEBIAN/prerm | 1 + packaging/deb/makedeb.sh | 1 + packaging/rpm/tdengine.spec | 2 ++ packaging/tools/install.sh | 3 ++- packaging/tools/install_arbi.sh | 3 ++- packaging/tools/install_client.sh | 3 ++- packaging/tools/make_install.sh | 9 +++++---- packaging/tools/makearbi.sh | 2 +- packaging/tools/makeclient.sh | 2 +- packaging/tools/makepkg.sh | 2 +- packaging/tools/post.sh | 3 ++- packaging/tools/preun.sh | 1 + packaging/tools/remove.sh | 1 + packaging/tools/remove_arbi.sh | 2 ++ packaging/tools/remove_client.sh | 1 + 17 files changed, 27 insertions(+), 12 deletions(-) diff --git a/cmake/cmake.install b/cmake/cmake.install index b2421fac25..27edd8e27a 100644 --- a/cmake/cmake.install +++ b/cmake/cmake.install @@ -13,6 +13,7 @@ ELSEIF (TD_WINDOWS) INSTALL(FILES ${TD_SOURCE_DIR}/packaging/cfg/taos.cfg DESTINATION cfg) INSTALL(FILES ${TD_SOURCE_DIR}/include/client/taos.h DESTINATION include) INSTALL(FILES ${TD_SOURCE_DIR}/include/util/taoserror.h DESTINATION include) + INSTALL(FILES ${TD_SOURCE_DIR}/include/libs/function/taosudf.h DESTINATION include) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos.lib DESTINATION driver) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos_static.lib DESTINATION driver) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos.dll DESTINATION driver) diff --git a/packaging/check_package.sh b/packaging/check_package.sh index 81abff57a5..e728c6455a 100644 --- a/packaging/check_package.sh +++ b/packaging/check_package.sh @@ -170,7 +170,7 @@ function check_lib_path() { function check_header_path() { # check all header - header_dir=("taos.h" "taosdef.h" "taoserror.h") + header_dir=("taos.h" "taosdef.h" "taoserror.h" "taosudf.h") for i in "${header_dir[@]}";do check_link ${inc_link_dir}/$i done diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm index c01db74701..501398f350 100644 --- a/packaging/deb/DEBIAN/prerm +++ b/packaging/deb/DEBIAN/prerm @@ -29,6 +29,7 @@ else ${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${cfg_link_dir}/* || : ${csudo}rm -f ${inc_link_dir}/taos.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${log_link_dir} || : diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index 5a14aea4ec..043c1456b8 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -70,6 +70,7 @@ cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_pat cp ${compile_dir}/../include/client/taos.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/common/taosdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/util/taoserror.h ${pkg_dir}${install_home_path}/include +cp ${compile_dir}/../include/libs/function/taosudf.h ${pkg_dir}${install_home_path}/include cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples #cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index d61d12932f..f440f72aa2 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -77,6 +77,7 @@ cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driv cp %{_compiledir}/../include/client/taos.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/common/taosdef.h %{buildroot}%{homepath}/include cp %{_compiledir}/../include/util/taoserror.h %{buildroot}%{homepath}/include +cp %{_compiledir}/../include/libs/function/taosudf.h %{buildroot}%{homepath}/include #cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector #cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector @@ -201,6 +202,7 @@ if [ $1 -eq 0 ];then ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${log_link_dir} || : diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index d730cc0d8a..7c7d5477cf 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -314,11 +314,12 @@ function install_jemalloc() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h } function add_newHostname_to_hosts() { diff --git a/packaging/tools/install_arbi.sh b/packaging/tools/install_arbi.sh index e3c63965d4..2863640153 100755 --- a/packaging/tools/install_arbi.sh +++ b/packaging/tools/install_arbi.sh @@ -115,11 +115,12 @@ function install_bin() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h } function install_jemalloc() { diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh index 5f449e5d91..0c86877c99 100755 --- a/packaging/tools/install_client.sh +++ b/packaging/tools/install_client.sh @@ -148,11 +148,12 @@ function install_lib() { } function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h } function install_jemalloc() { diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 6726b3fe2d..59be60f8fc 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -349,16 +349,17 @@ function install_lib() { function install_header() { if [ "$osType" != "Darwin" ]; then - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h \ + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h else - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h \ + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_dir}/include || - ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h \ + ${csudo}cp -f ${source_dir}/include/client/taos.h ${source_dir}/include/common/taosdef.h ${source_dir}/include/util/taoserror.h ${source_dir}/include/libs/function/taosudf.h \ ${install_main_2_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* || ${csudo}chmod 644 ${install_main_2_dir}/include/* diff --git a/packaging/tools/makearbi.sh b/packaging/tools/makearbi.sh index 65a6dae9a4..cfae2b4a46 100755 --- a/packaging/tools/makearbi.sh +++ b/packaging/tools/makearbi.sh @@ -36,7 +36,7 @@ fi bin_files="${build_dir}/bin/tarbitrator ${script_dir}/remove_arbi.sh" install_files="${script_dir}/install_arbi.sh" -#header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h" +#header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index 9e7f013006..0f1080521e 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -62,7 +62,7 @@ else lib_files="${build_dir}/lib/libtaos.${version}.dylib" fi -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" if [ "$dbName" != "taos" ]; then cfg_dir="${top_dir}/../enterprise/packaging/cfg" else diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index d0fbf0c4d7..0bc11b99b3 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -93,7 +93,7 @@ else fi lib_files="${build_dir}/lib/libtaos.so.${version}" -header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h" +header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" if [ "$dbName" != "taos" ]; then cfg_dir="${top_dir}/../enterprise/packaging/cfg" diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 93849dd4eb..2d744233ba 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -81,10 +81,11 @@ function kill_taosd() { } function install_include() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h|| : + ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : ${csudo}ln -s ${inc_dir}/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${inc_dir}/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${inc_dir}/taoserror.h ${inc_link_dir}/taoserror.h + ${csudo}ln -s ${inc_dir}/taosudf.h ${inc_link_dir}/taosudf.h } function install_lib() { diff --git a/packaging/tools/preun.sh b/packaging/tools/preun.sh index 2f35e41a48..8dee9da988 100755 --- a/packaging/tools/preun.sh +++ b/packaging/tools/preun.sh @@ -128,6 +128,7 @@ ${csudo}rm -f ${cfg_link_dir}/*.new || : ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : +${csudo}rm -f ${inc_link_dir}/taosudf.h || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 3b043f44a3..413de17ee6 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -84,6 +84,7 @@ function clean_header() { ${csudo} rm -f ${inc_link_dir}/taos.h || : ${csudo} rm -f ${inc_link_dir}/taosdef.h || : ${csudo} rm -f ${inc_link_dir}/taoserror.h || : + ${csudo} rm -f ${inc_link_dir}/taosudf.h || : } function clean_config() { diff --git a/packaging/tools/remove_arbi.sh b/packaging/tools/remove_arbi.sh index 0a1162cd7a..c95c579d30 100755 --- a/packaging/tools/remove_arbi.sh +++ b/packaging/tools/remove_arbi.sh @@ -59,6 +59,8 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : + } function clean_log() { diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh index f2cbccb45f..54f7a949f3 100755 --- a/packaging/tools/remove_client.sh +++ b/packaging/tools/remove_client.sh @@ -54,6 +54,7 @@ function clean_header() { ${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || : + ${csudo}rm -f ${inc_link_dir}/taosudf.h || : } function clean_config() { From 29e69878552bee430d113bdc6a02ccccef62fd10 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 28 Jun 2022 14:12:49 +0800 Subject: [PATCH 23/47] other: merge 3.0 --- source/dnode/vnode/src/inc/sma.h | 3 +-- source/dnode/vnode/src/sma/smaRollup.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h index 63ac6397bd..23ad70bad3 100644 --- a/source/dnode/vnode/src/inc/sma.h +++ b/source/dnode/vnode/src/inc/sma.h @@ -28,8 +28,7 @@ extern "C" { #define smaError(...) do { if (smaDebugFlag & DEBUG_ERROR) { taosPrintLog("SMA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0) #define smaWarn(...) do { if (smaDebugFlag & DEBUG_WARN) { taosPrintLog("SMA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) #define smaInfo(...) do { if (smaDebugFlag & DEBUG_INFO) { taosPrintLog("SMA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0) -// #define smaDebug(...) do { if (smaDebugFlag & DEBUG_DEBUG) { taosPrintLog("SMA ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) -#define smaDebug(...) do { if (smaDebugFlag & DEBUG_WARN) { taosPrintLog("SMA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0) +#define smaDebug(...) do { if (smaDebugFlag & DEBUG_DEBUG) { taosPrintLog("SMA ", DEBUG_DEBUG, tsdbDebugFlag, __VA_ARGS__); }} while(0) #define smaTrace(...) do { if (smaDebugFlag & DEBUG_TRACE) { taosPrintLog("SMA ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) // clang-format on diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 8423654eee..f68fc4f30c 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -15,7 +15,7 @@ #include "sma.h" -#define RSMA_QTASKINFO_PERSIST_MS 5000 // 7200000 +#define RSMA_QTASKINFO_PERSIST_MS 7200000 #define RSMA_QTASKINFO_BUFSIZE 32768 #define RSMA_QTASKINFO_HEAD_LEN (sizeof(int32_t) + sizeof(int8_t) + sizeof(int64_t)) // len + type + suid typedef enum { TD_QTASK_TMP_FILE = 0, TD_QTASK_CUR_FILE } TD_QTASK_FILE_T; From 33d1440e7bb4e130d3f5421bc9d051a1fa513245 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 28 Jun 2022 14:23:45 +0800 Subject: [PATCH 24/47] refactor(sync): adjust trace log --- source/dnode/mnode/impl/src/mndMain.c | 4 ++-- source/dnode/vnode/src/vnd/vnodeSync.c | 2 +- source/libs/sync/src/syncMain.c | 33 ++++++++++++++++++-------- source/libs/sync/src/syncSnapshot.c | 7 +++--- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index b66082dd98..cb2f2aef07 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "mndAcct.h" -#include "mndPrivilege.h" #include "mndBnode.h" #include "mndCluster.h" #include "mndConsumer.h" @@ -27,6 +26,7 @@ #include "mndMnode.h" #include "mndOffset.h" #include "mndPerfSchema.h" +#include "mndPrivilege.h" #include "mndProfile.h" #include "mndQnode.h" #include "mndQuery.h" @@ -416,7 +416,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { char *syncNodeStr = sync2SimpleStr(pMgmt->sync); static int64_t mndTick = 0; if (++mndTick % 10 == 1) { - mTrace("vgId:%d, sync heartbeat msg:%s, %s", syncGetVgId(pMgmt->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); + mTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pMgmt->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); } if (gRaftDetailLog) { char logBuf[512] = {0}; diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index b998f40195..d324a76438 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -243,7 +243,7 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { char *syncNodeStr = sync2SimpleStr(pVnode->sync); static int64_t vndTick = 0; if (++vndTick % 10 == 1) { - vGTrace("vgId:%d, sync heartbeat msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); + vGTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); } if (gRaftDetailLog) { char logBuf[512] = {0}; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 60f6ca7e7b..89f0fcee02 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -698,7 +698,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) { } else { ret = -1; terrno = TSDB_CODE_SYN_NOT_LEADER; - sError("syncPropose not leader, %s", syncUtilState2String(pSyncNode->state)); + sError("sync propose not leader, %s", syncUtilState2String(pSyncNode->state)); goto _END; } @@ -1414,46 +1414,59 @@ void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) { int32_t userStrLen = strlen(str); SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0}; - if (pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { + if (pSyncNode->pFsm != NULL && pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); } - SyncIndex logLastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - SyncIndex logBeginIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); + + SyncIndex logLastIndex = SYNC_INDEX_INVALID; + SyncIndex logBeginIndex = SYNC_INDEX_INVALID; + if (pSyncNode->pLogStore != NULL) { + logLastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); + logBeginIndex = pSyncNode->pLogStore->syncLogBeginIndex(pSyncNode->pLogStore); + } + + char* pCfgStr = syncCfg2SimpleStr(&(pSyncNode->pRaftCfg->cfg)); + char* printStr = ""; + if (pCfgStr != NULL) { + printStr = pCfgStr; + } if (userStrLen < 256) { - char logBuf[128 + 256]; + char logBuf[256 + 256]; if (pSyncNode != NULL && pSyncNode->pRaftCfg != NULL && pSyncNode->pRaftStore != NULL) { snprintf(logBuf, sizeof(logBuf), "vgId:%d, sync %s %s, term:%lu, commit:%ld, beginlog:%ld, lastlog:%ld, lastsnapshot:%ld, standby:%d, " "replica-num:%d, " - "lconfig:%ld, changing:%d", + "lconfig:%ld, changing:%d, restore:%d, %s", pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, - pSyncNode->changing); + pSyncNode->changing, pSyncNode->restoreFinish, printStr); } else { snprintf(logBuf, sizeof(logBuf), "%s", str); } sError("%s", logBuf); } else { - int len = 128 + userStrLen; + int len = 256 + userStrLen; char* s = (char*)taosMemoryMalloc(len); if (pSyncNode != NULL && pSyncNode->pRaftCfg != NULL && pSyncNode->pRaftStore != NULL) { snprintf(s, len, "vgId:%d, sync %s %s, term:%lu, commit:%ld, beginlog:%ld, lastlog:%ld, lastsnapshot:%ld, standby:%d, " "replica-num:%d, " - "lconfig:%ld, changing:%d", + "lconfig:%ld, changing:%d, restore:%d, %s", pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, - pSyncNode->changing); + pSyncNode->changing, pSyncNode->restoreFinish, printStr); } else { snprintf(s, len, "%s", str); } sError("%s", s); taosMemoryFree(s); } + + taosMemoryFree(pCfgStr); } char* syncNode2SimpleStr(const SSyncNode* pSyncNode) { diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 7b15be2d14..13343111f3 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -363,8 +363,9 @@ char *snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event) { uint16_t port; syncUtilU642Addr(destId.addr, host, sizeof(host), &port); - snprintf(s, len, "%s %p laindex:%ld laterm:%lu lcindex:%ld seq:%d ack:%d finish:%d pterm:%lu replica-index:%d %s:%d", - event, pSender, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm, + snprintf(s, len, + "%s {%p laindex:%ld laterm:%lu lcindex:%ld seq:%d ack:%d finish:%d pterm:%lu replica-index:%d %s:%d}", event, + pSender, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm, pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack, pSender->finish, pSender->privateTerm, pSender->replicaIndex, host, port); @@ -629,7 +630,7 @@ char *snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event) uint16_t port; syncUtilU642Addr(fromId.addr, host, sizeof(host), &port); - snprintf(s, len, "%s %p start:%d ack:%d term:%lu pterm:%lu from:%s:%d laindex:%ld laterm:%lu lcindex:%ld", event, + snprintf(s, len, "%s {%p start:%d ack:%d term:%lu pterm:%lu from:%s:%d laindex:%ld laterm:%lu lcindex:%ld}", event, pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term, pReceiver->privateTerm, host, port, pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex); From 38ae79e6e0a7f823908ef9f4cce5d8f0ee9e8d6d Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 28 Jun 2022 14:32:58 +0800 Subject: [PATCH 25/47] feat: refactor the plan implementation of unique function --- source/libs/planner/src/planOptimizer.c | 3 ++- source/libs/planner/test/planBasicTest.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 1927afec0f..42f7f744c5 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1623,7 +1623,7 @@ static bool mergeProjectsMayBeOptimized(SLogicNode* pNode) { } SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pNode->pChildren, 0); if (QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(pChild) || 1 < LIST_LENGTH(pChild->pChildren) || - NULL != pChild->pConditions || NULL != pNode->pLimit || NULL != pNode->pSlimit) { + NULL != pChild->pConditions || NULL != pChild->pLimit || NULL != pChild->pSlimit) { return false; } return true; @@ -1680,6 +1680,7 @@ static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* NODES_CLEAR_LIST(pChild->pChildren); } nodesDestroyNode((SNode*)pChild); + pCxt->optimized = true; return code; } diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index dbedb2d787..ff725c444e 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -77,6 +77,8 @@ TEST_F(PlanBasicTest, tailFunc) { run("SELECT TAIL(c2 + 10, 10, 80) FROM t1 WHERE c1 > 10 LIMIT 5"); run("SELECT TAIL(c2 + 10, 10, 80) FROM t1 WHERE c1 > 10 PARTITION BY c1 LIMIT 5"); + + run("SELECT TAIL(c1, 2, 1) FROM st1s1 UNION ALL SELECT c1 FROM st1s2"); } TEST_F(PlanBasicTest, interpFunc) { From 286ec4ec017796392eb8684101f4ce6564ee0913 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 11:11:07 +0800 Subject: [PATCH 26/47] test: case for balance vgroup --- tests/script/jenkins/basic.txt | 5 + .../{unique => tsim}/dnode/balance1.sim | 242 +++++------- tests/script/tsim/dnode/balance2.sim | 280 +++++++++++++ tests/script/tsim/dnode/balance3.sim | 340 ++++++++++++++++ .../remove1.sim => tsim/dnode/balancex.sim} | 215 +++++----- tests/script/tsim/dnode/offline_reason.sim | 161 ++++++++ tests/script/unique/dnode/alternativeRole.sim | 97 ----- tests/script/unique/dnode/balance2.sim | 306 --------------- tests/script/unique/dnode/balance3.sim | 337 ---------------- tests/script/unique/dnode/balancex.sim | 215 ---------- tests/script/unique/dnode/m2.sim | 367 ------------------ tests/script/unique/dnode/m3.sim | 359 ----------------- tests/script/unique/dnode/monitor_bug.sim | 77 ---- tests/script/unique/dnode/offline1.sim | 77 ---- tests/script/unique/dnode/offline2.sim | 126 ------ tests/script/unique/dnode/offline3.sim | 111 ------ tests/script/unique/dnode/reason.sim | 203 ---------- tests/script/unique/dnode/remove2.sim | 204 ---------- 18 files changed, 1003 insertions(+), 2719 deletions(-) rename tests/script/{unique => tsim}/dnode/balance1.sim (55%) create mode 100644 tests/script/tsim/dnode/balance2.sim create mode 100644 tests/script/tsim/dnode/balance3.sim rename tests/script/{unique/dnode/remove1.sim => tsim/dnode/balancex.sim} (51%) create mode 100644 tests/script/tsim/dnode/offline_reason.sim delete mode 100644 tests/script/unique/dnode/alternativeRole.sim delete mode 100644 tests/script/unique/dnode/balance2.sim delete mode 100644 tests/script/unique/dnode/balance3.sim delete mode 100644 tests/script/unique/dnode/balancex.sim delete mode 100644 tests/script/unique/dnode/m2.sim delete mode 100644 tests/script/unique/dnode/m3.sim delete mode 100644 tests/script/unique/dnode/monitor_bug.sim delete mode 100644 tests/script/unique/dnode/offline1.sim delete mode 100644 tests/script/unique/dnode/offline2.sim delete mode 100644 tests/script/unique/dnode/offline3.sim delete mode 100644 tests/script/unique/dnode/reason.sim delete mode 100644 tests/script/unique/dnode/remove2.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index df174aa950..36ed45739c 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -23,6 +23,10 @@ # ---- dnode ./test.sh -f tsim/dnode/balance_replica1.sim ./test.sh -f tsim/dnode/balance_replica3.sim +./test.sh -f tsim/dnode/balance1.sim +./test.sh -f tsim/dnode/balance2.sim +./test.sh -f tsim/dnode/balance3.sim +./test.sh -f tsim/dnode/balancex.sim ./test.sh -f tsim/dnode/create_dnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim @@ -30,6 +34,7 @@ ./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim ./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim ./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim +./test.sh -f tsim/dnode/offline_reason.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim diff --git a/tests/script/unique/dnode/balance1.sim b/tests/script/tsim/dnode/balance1.sim similarity index 55% rename from tests/script/unique/dnode/balance1.sim rename to tests/script/tsim/dnode/balance1.sim index 8743204a03..6471529a1e 100644 --- a/tests/script/unique/dnode/balance1.sim +++ b/tests/script/tsim/dnode/balance1.sim @@ -1,40 +1,18 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create database d1 +sql create database d1 vgroups 1 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -43,35 +21,49 @@ sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 1 then +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 1 then return -1 endi print ========== step2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -show2: +step2: $x = $x + 1 sleep 1000 - if $x == 20 then + if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $data2_2 != 1 then - goto show2 +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 1 then + return -1 endi print ========== step3 -sql create database d2 +sql create database d2 vgroups 1 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -80,69 +72,67 @@ sql insert into d2.t2 values(now+4s, 22) sql insert into d2.t2 values(now+5s, 21) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then return -1 endi -if $data2_2 != 2 then +if $data(2)[2] != 2 then return -1 endi print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - +sql drop dnode 2 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 2 then - goto show4 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 2 then + return -1 endi -if $data2_2 != null then - goto show4 -endi -if $rows != 1 then - goto show4 +if $data(2)[2] != null then + return -1 endi system sh/exec.sh -n dnode2 -s stop -x SIGINT print ========== step5 -sql create dnode $hostname3 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode3 -s start $x = 0 -show5: +step5: $x = $x + 1 sleep 1000 - if $x == 30 then + if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - goto show5 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $data2_2 != null then - goto show5 +if $data(1)[4] != ready then + goto step5 endi -if $data2_3 != 2 then - goto show5 +if $data(3)[4] != ready then + goto step5 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 1 then + return -1 endi print ========== step6 -sql create database d3 +sql create database d3 vgroups 1 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -151,52 +141,46 @@ sql insert into d3.t3 values(now+4s, 32) sql insert into d3.t3 values(now+5s, 31) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 - -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then return -1 endi -if $data2_2 != null then - return -1 -endi -if $data2_3 != 3 then +if $data(3)[2] != 2 then return -1 endi print ========== step7 -sql create dnode $hostname4 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode4 -s start $x = 0 -show7: +step7: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 endi -if $data2_2 != null then - goto show7 +if $data(1)[4] != ready then + goto step7 endi -if $data2_3 != 2 then - goto show7 +if $data(3)[4] != ready then + goto step7 endi -if $data2_4 != 1 then - goto show7 +if $data(4)[4] != ready then + goto step7 endi print ========== step8 -sql create database d4 +sql create database d4 vgroups 1 sql create table d4.t4 (t timestamp, i int) sql insert into d4.t4 values(now+1s, 45) sql insert into d4.t4 values(now+2s, 44) @@ -205,56 +189,32 @@ sql insert into d4.t4 values(now+4s, 42) sql insert into d4.t4 values(now+5s, 41) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 1 then return -1 endi -if $data2_2 != null then +if $data(3)[2] != 2 then return -1 endi -if $data2_3 != 2 then - return -1 -endi -if $data2_4 != 2 then +if $data(4)[2] != 1 then return -1 endi print ========== step9 -sql drop dnode $hostname3 - -$x = 0 -show9: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - +sql drop dnode 3 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - goto show9 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 2 then + return -1 endi -if $data2_2 != null then - goto show9 -endi -if $data2_3 != null then - goto show9 -endi -if $data2_4 != 4 then - goto show9 +if $data(4)[2] != 2 then + return -1 endi system sh/exec.sh -n dnode3 -s stop -x SIGINT - sql reset query cache sleep 100 diff --git a/tests/script/tsim/dnode/balance2.sim b/tests/script/tsim/dnode/balance2.sim new file mode 100644 index 0000000000..5da9a659f3 --- /dev/null +++ b/tests/script/tsim/dnode/balance2.sim @@ -0,0 +1,280 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi + +print ========== step2 +sql create database d1 replica 3 vgroups 1 +sql create table d1.t1 (t timestamp, i int) +sql insert into d1.t1 values(now+1s, 15) +sql insert into d1.t1 values(now+2s, 14) +sql insert into d1.t1 values(now+3s, 13) +sql insert into d1.t1 values(now+4s, 12) +sql insert into d1.t1 values(now+5s, 11) + +sql create database d2 replica 3 vgroups 1 +sql create table d2.t2 (t timestamp, i int) +sql insert into d2.t2 values(now+1s, 25) +sql insert into d2.t2 values(now+2s, 24) +sql insert into d2.t2 values(now+3s, 23) +sql insert into d2.t2 values(now+4s, 22) +sql insert into d2.t2 values(now+5s, 21) + +sql create database d3 replica 3 vgroups 1 +sql create table d3.t3 (t timestamp, i int) +sql insert into d3.t3 values(now+1s, 35) +sql insert into d3.t3 values(now+2s, 34) +sql insert into d3.t3 values(now+3s, 33) +sql insert into d3.t3 values(now+4s, 32) +sql insert into d3.t3 values(now+5s, 31) + +sql create database d4 replica 3 vgroups 1 +sql create table d4.t4 (t timestamp, i int) +sql insert into d4.t4 values(now+1s, 45) +sql insert into d4.t4 values(now+2s, 44) +sql insert into d4.t4 values(now+3s, 43) +sql insert into d4.t4 values(now+4s, 42) +sql insert into d4.t4 values(now+5s, 41) + +print ========== step2.1 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +if $data(1)[2] != 4 then + return -1 +endi +if $data(2)[2] != 4 then + return -1 +endi +if $data(3)[2] != 4 then + return -1 +endi + +print ========== step3 +sql create dnode $hostname port 7400 +sql create dnode $hostname port 7500 +system sh/exec.sh -n dnode4 -s start +system sh/exec.sh -n dnode5 -s start + +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +print ===> $data40 $data41 $data42 $data43 $data44 $data45 +if $rows != 5 then + return -1 +endi +if $data(1)[4] != ready then + goto step3 +endi +if $data(2)[4] != ready then + goto step3 +endi +if $data(3)[4] != ready then + goto step3 +endi +if $data(4)[4] != ready then + goto step3 +endi +if $data(5)[4] != ready then + goto step3 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != 3 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 2 then + return -1 +endi + +print ========== step4 +sql drop dnode 2 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 4 then + return -1 +endi +if $data(5)[2] != 3 then + return -1 +endi + +system sh/exec.sh -n dnode2 -s stop -x SIGINT + +print ========== step5 +sql drop dnode 3 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 4 then + return -1 +endi +if $data(3)[2] != null then + return -1 +endi +if $data(4)[2] != 4 then + return -1 +endi +if $data(5)[2] != 4 then + return -1 +endi + +sql reset query cache +sleep 100 +system sh/exec.sh -n dnode3 -s stop -x SIGINT + +print ========== step6 +sql select * from d1.t1 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 11 then + return -1 +endi +if $data11 != 12 then + return -1 +endi +if $data21 != 13 then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data41 != 15 then + return -1 +endi + +sql select * from d2.t2 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 21 then + return -1 +endi +if $data11 != 22 then + return -1 +endi +if $data21 != 23 then + return -1 +endi +if $data31 != 24 then + return -1 +endi +if $data41 != 25 then + return -1 +endi + +sql select * from d3.t3 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 31 then + return -1 +endi +if $data11 != 32 then + return -1 +endi +if $data21 != 33 then + return -1 +endi +if $data31 != 34 then + return -1 +endi +if $data41 != 35 then + return -1 +endi + +sql select * from d4.t4 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 41 then + return -1 +endi +if $data11 != 42 then + return -1 +endi +if $data21 != 43 then + return -1 +endi +if $data31 != 44 then + return -1 +endi +if $data41 != 45 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/dnode/balance3.sim b/tests/script/tsim/dnode/balance3.sim new file mode 100644 index 0000000000..0e21861b14 --- /dev/null +++ b/tests/script/tsim/dnode/balance3.sim @@ -0,0 +1,340 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi +if $data(4)[4] != ready then + goto step1 +endi + +sql create database d1 replica 3 vgroups 1 +sql create table d1.t1 (t timestamp, i int) +sql insert into d1.t1 values(now+1s, 15) +sql insert into d1.t1 values(now+2s, 14) +sql insert into d1.t1 values(now+3s, 13) +sql insert into d1.t1 values(now+4s, 12) +sql insert into d1.t1 values(now+5s, 11) + +sql create database d2 replica 3 vgroups 1 +sql create table d2.t2 (t timestamp, i int) +sql insert into d2.t2 values(now+1s, 25) +sql insert into d2.t2 values(now+2s, 24) +sql insert into d2.t2 values(now+3s, 23) +sql insert into d2.t2 values(now+4s, 22) +sql insert into d2.t2 values(now+5s, 21) + +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi + +print ========== step2 +sql drop dnode 2 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != null then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi + +system sh/exec.sh -n dnode2 -s stop -x SIGINT + +print ========== step3 +sql create dnode $hostname port 7500 +system sh/exec.sh -n dnode5 -s start + +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step3 +endi +if $data(3)[4] != ready then + goto step3 +endi +if $data(4)[4] != ready then + goto step3 +endi +if $data(5)[4] != ready then + goto step3 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 1 then + return -1 +endi + +print ========== step4 +sql create database d3 replica 3 vgroups 1 +sql create table d3.t3 (t timestamp, i int) +sql insert into d3.t3 values(now+1s, 35) +sql insert into d3.t3 values(now+2s, 34) +sql insert into d3.t3 values(now+3s, 33) +sql insert into d3.t3 values(now+4s, 32) +sql insert into d3.t3 values(now+5s, 31) + +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 3 then + return -1 +endi +if $data(4)[2] != 3 then + return -1 +endi +if $data(5)[2] != 2 then + return -1 +endi + +print ========== step5 +sql create dnode $hostname port 7600 +system sh/exec.sh -n dnode6 -s start + +$x = 0 +step5: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +print ===> $data40 $data41 $data42 $data43 $data44 $data45 +if $rows != 5 then + return -1 +endi +if $data(1)[4] != ready then + goto step5 +endi +if $data(3)[4] != ready then + goto step5 +endi +if $data(4)[4] != ready then + goto step5 +endi +if $data(5)[4] != ready then + goto step5 +endi +if $data(6)[4] != ready then + goto step5 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +print dnode5 openVnodes $data(6)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 2 then + return -1 +endi +if $data(6)[2] != 2 then + return -1 +endi + +print ========== step6 +sql drop dnode 3 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode3 openVnodes $data(3)[2] +print dnode4 openVnodes $data(4)[2] +print dnode5 openVnodes $data(5)[2] +print dnode5 openVnodes $data(6)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(3)[2] != null then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi +if $data(5)[2] != 3 then + return -1 +endi +if $data(6)[2] != 2 then + return -1 +endi + +system sh/exec.sh -n dnode3 -s stop -x SIGINT +sql reset query cache +sleep 100 + +print ========== step7 +sql select * from d1.t1 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 11 then + return -1 +endi +if $data11 != 12 then + return -1 +endi +if $data21 != 13 then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data41 != 15 then + return -1 +endi + +sql select * from d2.t2 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 21 then + return -1 +endi +if $data11 != 22 then + return -1 +endi +if $data21 != 23 then + return -1 +endi +if $data31 != 24 then + return -1 +endi +if $data41 != 25 then + return -1 +endi + +sql select * from d3.t3 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 31 then + return -1 +endi +if $data11 != 32 then + return -1 +endi +if $data21 != 33 then + return -1 +endi +if $data31 != 34 then + return -1 +endi +if $data41 != 35 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/remove1.sim b/tests/script/tsim/dnode/balancex.sim similarity index 51% rename from tests/script/unique/dnode/remove1.sim rename to tests/script/tsim/dnode/balancex.sim index 25e0846129..124ccbebba 100644 --- a/tests/script/unique/dnode/remove1.sim +++ b/tests/script/tsim/dnode/balancex.sim @@ -1,30 +1,18 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create database d1 +sql create database d1 vgroups 1 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -32,7 +20,7 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 +sql create database d2 vgroups 1 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -41,36 +29,59 @@ sql insert into d2.t2 values(now+4s, 22) sql insert into d2.t2 values(now+5s, 21) sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 2 then +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 2 then return -1 endi print ========== step2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + $x = 0 -step2: +step2: $x = $x + 1 sleep 1000 if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then goto step2 endi -if $data4_2 != ready then +if $data(2)[4] != ready then + goto step2 +endi +if $data(3)[4] != ready then goto step2 endi -sql create database d3 replica 2 +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 1 then + return -1 +endi +if $data(3)[2] != 1 then + return -1 +endi + +print ========== step3 +sql create database d3 replica 3 vgroups 1 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -78,89 +89,95 @@ sql insert into d3.t3 values(now+3s, 33) sql insert into d3.t3 values(now+4s, 32) sql insert into d3.t3 values(now+5s, 31) -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 1 then - goto show2 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then + return -1 endi -if $data2_2 != 3 then - goto show2 +if $data(2)[2] != 2 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 endi print ========== step3 - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 - -print ========== step4 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_2 != null then - goto show4 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ========== step5 -sql create dnode $hostname4 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode4 -s start $x = 0 -show5: +step3: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show5 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 endi -if $data2_2 != null then - goto show5 +if $data(1)[4] != ready then + goto step3 endi -if $data2_3 != 2 then - goto show5 +if $data(2)[4] != ready then + goto step3 endi -if $data2_4 != 2 then - goto show5 +if $data(3)[4] != ready then + goto step3 endi +if $data(4)[4] != ready then + goto step3 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 1 then + return -1 +endi + +print ========== step5 +sql drop dnode 2 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(2)[2] != null then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 2 then + return -1 +endi + +system sh/exec.sh -n dnode2 -s stop -x SIGINT +sql reset query cache +sleep 100 print ========== step6 sql select * from d1.t1 order by t desc @@ -224,4 +241,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT system sh/exec.sh -n dnode6 -s stop -x SIGINT system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/dnode/offline_reason.sim b/tests/script/tsim/dnode/offline_reason.sim new file mode 100644 index 0000000000..3c6fff8b59 --- /dev/null +++ b/tests/script/tsim/dnode/offline_reason.sim @@ -0,0 +1,161 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect +sql create dnode $hostname port 7200 + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(2)[6] + +if $data(2)[6] != @status not received@ then + return -1 +endi + +print ========== step2 +system sh/exec.sh -n dnode2 -s start + +$x = 0 +step2: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi + +print ========== step3 +system sh/exec.sh -n dnode2 -s stop + +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(2)[6] +if $data(2)[6] != @status msg timeout@ then + goto step3 +endi + +print ========== step4 +sql drop dnode 2 +sql show dnodes +if $rows != 1 then + return -1 +endi + +print ========== step5 +system sh/exec.sh -n dnode2 -s start +sql create dnode $hostname port 7200 + +$x = 0 +step5: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(3)[6] +if $data(3)[6] != @dnodeId not match@ then + goto step5 +endi + +print ========== step6 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode4 -c statusInterval -v 4 +system sh/exec.sh -n dnode4 -s start +sql create dnode $hostname port 7400 + +$x = 0 +step6: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode2 off: $data(3)[6] +print dnode3 off: $data(4)[6] +if $data(4)[6] != @interval not match@ then + goto step6 +endi + +print ========== step7 +system sh/deploy.sh -n dnode5 -i 5 +system sh/cfg.sh -n dnode5 -c locale -v zn_CH.UTF-8 +system sh/exec.sh -n dnode5 -s start +sql create dnode $hostname port 7500 + +$x = 0 +step7: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode3 off: $data(3)[6] +print dnode4 off: $data(4)[6] +print dnode5 off: $data(5)[6] +if $data(5)[6] != @locale not match@ then + goto step7 +endi + +print ========== step8 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode6 -c charset -v UTF-16 +system sh/exec.sh -n dnode6 -s start +sql create dnode $hostname port 7600 + +$x = 0 +step8: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 off: $data(1)[6] +print dnode3 off: $data(3)[6] +print dnode4 off: $data(4)[6] +print dnode5 off: $data(5)[6] +print dnode6 off: $data(6)[6] +if $data(6)[6] != @charset not match@ then + goto step8 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/alternativeRole.sim b/tests/script/unique/dnode/alternativeRole.sim deleted file mode 100644 index 14a6e92f06..0000000000 --- a/tests/script/unique/dnode/alternativeRole.sim +++ /dev/null @@ -1,97 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 0 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 - - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sleep 5000 - -sql show dnodes -print dnode1 $data5_1 -print dnode1 $data5_2 -print dnode1 $data5_3 - -if $data5_1 != mnode then - return -1 -endi -if $data5_2 != vnode then - return -1 -endi -if $data5_3 != any then - return -1 -endi - -sql show mnodes -print dnode1 ==> $data2_1 -print dnode2 ==> $data2_2 -print dnode3 ==> $data2_3 -if $data2_1 != master then - return -1 -endi -if $data2_2 != null then - return -1 -endi -if $data2_3 != slave then - return -1 -endi - -print ========== step2 -sql create database d1 -sql create table d1.t1 (ts timestamp, i int) -sql create table d1.t2 (ts timestamp, i int) -sql create table d1.t3 (ts timestamp, i int) -sql create table d1.t4 (ts timestamp, i int) -sql create table d1.t5 (ts timestamp, i int) -sql create table d1.t6 (ts timestamp, i int) -sql create table d1.t7 (ts timestamp, i int) -sql create table d1.t8 (ts timestamp, i int) - -sql show dnodes -print dnode1 $data2_1 -print dnode2 $data2_2 -print dnode3 $data2_3 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balance2.sim b/tests/script/unique/dnode/balance2.sim deleted file mode 100644 index 4c67e20c3e..0000000000 --- a/tests/script/unique/dnode/balance2.sim +++ /dev/null @@ -1,306 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 -system sh/cfg.sh -n dnode5 -c wallevel -v 1 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 2 then - return -1 -endi -if $data2_3 != 2 then - return -1 -endi - -print ========== step2 -sql drop dnode $hostname2 - -$x = 0 -show2: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 2 then - goto show2 -endi -if $data2_2 != null then - goto show2 -endi -if $data2_3 != 2 then - goto show2 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ========== step3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi -if $data2_4 != 2 then - goto show3 -endi - -print ========== step4 -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != null then - return -1 -endi -if $data2_3 != 3 then - return -1 -endi -if $data2_4 != 3 then - return -1 -endi - -print ========== step5 -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 -if $data2_1 != 0 then - goto show5 -endi -if $data2_2 != null then - goto show5 -endi -if $data2_3 != 2 then - goto show5 -endi -if $data2_4 != 2 then - goto show5 -endi -if $data2_5 != 2 then - goto show5 -endi - -print ========== step6 -sql drop dnode $hostname3 - -$x = 0 -show6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 -if $data2_1 != 0 then - goto show6 -endi -if $data2_2 != null then - goto show6 -endi -if $data2_3 != null then - goto show6 -endi -if $data2_4 != 3 then - goto show6 -endi -if $data2_5 != 3 then - goto show6 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql reset query cache -sleep 100 - -print ========== step7 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balance3.sim b/tests/script/unique/dnode/balance3.sim deleted file mode 100644 index f5558d504e..0000000000 --- a/tests/script/unique/dnode/balance3.sim +++ /dev/null @@ -1,337 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 -system sh/deploy.sh -n dnode6 -i 6 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 -system sh/cfg.sh -n dnode5 -c wallevel -v 1 -system sh/cfg.sh -n dnode6 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode6 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql create database d1 replica 3 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 3 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 2 then - return -1 -endi -if $data2_3 != 2 then - return -1 -endi -if $data2_4 != 2 then - return -1 -endi - -print ========== step2 -sql drop dnode $hostname2 - -$x = 0 -show2: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 2 then - goto show2 -endi -if $data2_2 != null then - goto show2 -endi -if $data2_3 != 2 then - goto show2 -endi -if $data2_4 != 2 then - goto show2 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -print ========== step -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 60 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi -if $data2_4 != 2 then - goto show3 -endi -if $data2_5 != 2 then - goto show3 -endi - -print ========== step4 -sql create database d3 replica 3 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show4 -endi -if $data2_2 != null then - goto show4 -endi -if $data2_3 != 3 then - goto show4 -endi -if $data2_4 != 3 then - goto show4 -endi -if $data2_5 != 3 then - goto show4 -endi - -print ========== step5 -sql create dnode $hostname6 -system sh/exec.sh -n dnode6 -s start - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode6 openVnodes $data2_6 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show5 -endi -if $data2_6 != 2 then - goto show5 -endi - -sleep 8000 - -print ========== step6 -sql drop dnode $hostname3 - -$x = 0 -show6: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode6 openVnodes $data2_6 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_1 != 0 then - goto show6 -endi -if $data2_6 != 3 then - goto show6 -endi -if $data2_3 != null then - goto show6 -endi -if $data2_4 != 3 then - goto show6 -endi -if $data2_5 != 3 then - goto show6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sql reset query cache -sleep 100 - -print ========== step7 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balancex.sim b/tests/script/unique/dnode/balancex.sim deleted file mode 100644 index d2c738ee97..0000000000 --- a/tests/script/unique/dnode/balancex.sim +++ /dev/null @@ -1,215 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sleep 2000 - -sql create database d1 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 2 then - return -1 -endi - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 -endi -if $data2_2 != 2 then - goto show2 -endi - -print ========== step3 -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 1 then - goto show3 -endi -if $data2_2 != 3 then - goto show3 -endi - -print ========== step3 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -show4: - $x = $x + 1 - sleep 2000 - if $x == 20 then - return -1 - endi -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - goto show4 -endi -if $data2_2 != 2 then - goto show4 -endi -if $data2_3 != 2 then - goto show4 -endi - -print ========== step5 -sql drop dnode $hostname2 - -$x = 0 -show5: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 1 then - goto show5 -endi -if $data2_2 != null then - goto show5 -endi -if $data2_3 != 3 then - goto show5 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 - -sql reset query cache -sleep 1000 - -print ========== step6 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/m2.sim b/tests/script/unique/dnode/m2.sim deleted file mode 100644 index 5fdf3b7400..0000000000 --- a/tests/script/unique/dnode/m2.sim +++ /dev/null @@ -1,367 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -print ========== step2 - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -sql create database d4 replica 2 -sql create table d4.t4 (t timestamp, i int) -sql insert into d4.t4 values(now+1s, 45) -sql insert into d4.t4 values(now+2s, 44) -sql insert into d4.t4 values(now+3s, 43) -sql insert into d4.t4 values(now+4s, 42) -sql insert into d4.t4 values(now+5s, 41) - -print ========== step2.1 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 4 then - return -1 -endi -if $data2_3 != 4 then - return -1 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -print ========== step3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != 2 then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi -if $data2_4 != 2 then - goto show3 -endi -if $data2_5 != 2 then - goto show3 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show3 -endi - -print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != null then - goto show4 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show4 -endi - -sql reset query cache -sleep 100 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ========== step5 -sql drop dnode $hostname3 - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != null then - goto show5 -endi -if $data2_3 != null then - goto show5 -endi -if $data2_4 != 4 then - goto show5 -endi -if $data2_5 != 4 then - goto show4 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data03 != 2 then - goto show5 -endi - -sql reset query cache -sleep 100 -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -print ========== step6 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -sql select * from d4.t4 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 41 then - return -1 -endi -if $data11 != 42 then - return -1 -endi -if $data21 != 43 then - return -1 -endi -if $data31 != 44 then - return -1 -endi -if $data41 != 45 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/m3.sim b/tests/script/unique/dnode/m3.sim deleted file mode 100644 index 5850147d04..0000000000 --- a/tests/script/unique/dnode/m3.sim +++ /dev/null @@ -1,359 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -print ========== step2 - -sql create database d1 replica 3 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql create database d2 replica 3 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(now+1s, 25) -sql insert into d2.t2 values(now+2s, 24) -sql insert into d2.t2 values(now+3s, 23) -sql insert into d2.t2 values(now+4s, 22) -sql insert into d2.t2 values(now+5s, 21) - -sql create database d3 replica 3 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(now+1s, 35) -sql insert into d3.t3 values(now+2s, 34) -sql insert into d3.t3 values(now+3s, 33) -sql insert into d3.t3 values(now+4s, 32) -sql insert into d3.t3 values(now+5s, 31) - -sql create database d4 replica 3 -sql create table d4.t4 (t timestamp, i int) -sql insert into d4.t4 values(now+1s, 45) -sql insert into d4.t4 values(now+2s, 44) -sql insert into d4.t4 values(now+3s, 43) -sql insert into d4.t4 values(now+4s, 42) -sql insert into d4.t4 values(now+5s, 41) - -print ========== step2.1 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 4 then - return -1 -endi -if $data2_3 != 4 then - return -1 -endi -if $data2_4 != 4 then - return -1 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 3 then - return -1 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 2 then - return -1 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi - -print ========== step3 -sql create dnode $hostname5 -system sh/exec.sh -n dnode5 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != 3 then - goto show3 -endi -if $data2_3 != 3 then - goto show3 -endi -if $data2_4 != 3 then - goto show3 -endi -if $data2_5 != 3 then - goto show3 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 5 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 5 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 2 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi -if $data03 != 3 then - goto show3 -endi - -print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != null then - goto show4 -endi -if $data2_3 != 4 then - goto show4 -endi -if $data2_4 != 4 then - goto show4 -endi -if $data2_5 != 4 then - goto show4 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 5 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql show d2.vgroups; -print d2.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 3 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql show d3.vgroups; -print d3.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql show d4.vgroups; -print d4.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data04 != 4 then - return -1 -endi -if $data03 != 3 then - goto show4 -endi - -sql reset query cache -sleep 100 - -print ========== step5 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 21 then - return -1 -endi -if $data11 != 22 then - return -1 -endi -if $data21 != 23 then - return -1 -endi -if $data31 != 24 then - return -1 -endi -if $data41 != 25 then - return -1 -endi - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -sql select * from d4.t4 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 41 then - return -1 -endi -if $data11 != 42 then - return -1 -endi -if $data21 != 43 then - return -1 -endi -if $data31 != 44 then - return -1 -endi -if $data41 != 45 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/monitor_bug.sim b/tests/script/unique/dnode/monitor_bug.sim deleted file mode 100644 index 60c6524d9c..0000000000 --- a/tests/script/unique/dnode/monitor_bug.sim +++ /dev/null @@ -1,77 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c monitor -v 1 -system sh/cfg.sh -n dnode2 -c monitor -v 0 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sleep 3000 - -sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 > 2 then - return -1 -endi - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 -endi -if $data2_2 > 2 then - goto show2 -endi - -print ========== step3 -sql show log.tables - -print $data00 -print $data10 -print $data20 -print $data30 -print $data40 -print $data50 - -if $rows > 5 then - return -1 -endi - -print ========== step4 -sql select * from log.dn1 -print $rows -$rows1 = $rows - -sleep 2000 -sql select * from log.dn1 -print $rows -$rows2 = $rows - -if $rows2 <= $rows1 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/offline1.sim b/tests/script/unique/dnode/offline1.sim deleted file mode 100644 index 9bbd14cf07..0000000000 --- a/tests/script/unique/dnode/offline1.sim +++ /dev/null @@ -1,77 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 5 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sleep 2000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != ready then - return -1 -endi - -print ========== step2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 8000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 == ready then - return -1 -endi - -print ========== step3 -sleep 10000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != null then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/offline2.sim b/tests/script/unique/dnode/offline2.sim deleted file mode 100644 index 711488cf3f..0000000000 --- a/tests/script/unique/dnode/offline2.sim +++ /dev/null @@ -1,126 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 5 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 5 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sleep 2000 - -sql create database d1 replica 2 -sql create table d1.t1(ts timestamp, i int) -sql insert into d1.t1 values(1588262400001, 1) - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != ready then - return -1 -endi - -print ========== step2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 8000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 == ready then - return -1 -endi - -print ========== step3 -sleep 10000 - -sql show dnodes -print dnode1 $data4_1 -print dnode1 $data4_2 - -if $data4_1 != ready then - return -1 -endi -if $data4_2 != dropping then - return -1 -endi - -print ========== step4 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode2 -s start -sql drop dnode $hostname2 - -sleep 3000 -$x = 0 -show4: - $x = $x + 1 - sleep 3000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -if $data4_1 != ready then - goto show4 -endi -if $data4_2 != null then - goto show4 -endi -if $data4_3 != ready then - goto show4 -endi - -print ======================== step5 -sql reset query cache -sleep 1000 - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/offline3.sim b/tests/script/unique/dnode/offline3.sim deleted file mode 100644 index 93c75e3b13..0000000000 --- a/tests/script/unique/dnode/offline3.sim +++ /dev/null @@ -1,111 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 3 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 3 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 3 -system sh/cfg.sh -n dnode4 -c offlineThreshold -v 3 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 300 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 300 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 300 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 300 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -if $data2_1 != master then - goto step1 -endi - -print ========== step2 -sql create database db replica 3 -sql use db -sql create table tb (ts timestamp, value int) -sql insert into tb values (now, 1) -sql insert into tb values (now, 2) - -sql show vgroups; -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -print ========== step2 -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -$x = 0 -step2: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show vgroups; -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step2 -endi -if $data4_2 != ready then - goto step2 -endi -if $data4_3 != ready then - goto step2 -endi -if $data4_4 != null then - goto step2 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/reason.sim b/tests/script/unique/dnode/reason.sim deleted file mode 100644 index c685b1129d..0000000000 --- a/tests/script/unique/dnode/reason.sim +++ /dev/null @@ -1,203 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 - -sql show dnodes -print dnode1 off: $data7_1 -print dnode2 off: $data7_2 -if $data7_2 != @status not received@ then - return -1 -endi - -print ========== step2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi - -print ========== step3 -system sh/exec.sh -n dnode2 -s stop - -$x = 0 -step3: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi -sql show dnodes -print dnode1 off: $data7_1 -print dnode2 off: $data7_2 -if $data7_2 != @status msg timeout@ then - goto step3 -endi - -print ========== step4 -sql drop dnode $hostname2 -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -if $rows != 1 then - goto step4 -endi - -print ========== step5 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname2 - -$x = 0 -step5: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode2 off: $data7_3 -if $data7_3 != @dnodeId not match@ then - goto step5 -endi - -print ========== step6 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 3 -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname4 - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode4 off: $data7_4 -if $data7_4 != @mnEqualVn not match@ then - goto step6 -endi - -print ========== step7 -system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode5 -c statusInterval -v 3 -system sh/exec.sh -n dnode5 -s start -sql create dnode $hostname5 - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode5 off: $data7_5 -if $data7_5 != @interval not match@ then - goto step7 -endi - -print ========== step8 -system sh/deploy.sh -n dnode6 -i 6 -system sh/cfg.sh -n dnode6 -c balance -v 0 -system sh/exec.sh -n dnode6 -s start -sql create dnode $hostname6 - -$x = 0 -step8: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode6 off: $data7_6 -if $data7_6 != @balance not match@ then - goto step8 -endi - -print ========== step9 -system sh/deploy.sh -n dnode7 -i 7 -system sh/cfg.sh -n dnode7 -c maxTablesPerVnode -v 3000 -system sh/exec.sh -n dnode7 -s start -sql create dnode $hostname7 - -$x = 0 -step9: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode7 off: $data7_7 -if $data7_7 != @maxTabPerVn not match@ then - goto step9 -endi - -print ========== step10 -system sh/deploy.sh -n dnode8 -i 8 -system sh/cfg.sh -n dnode8 -c maxVgroupsPerDb -v 3 -system sh/exec.sh -n dnode8 -s start -sql create dnode $hostname8 - -$x = 0 -step10: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 off: $data7_1 -print dnode8 off: $data7_8 -if $data7_8 != @maxVgPerDb not match@ then - goto step10 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/remove2.sim b/tests/script/unique/dnode/remove2.sim deleted file mode 100644 index 1d707bc4a3..0000000000 --- a/tests/script/unique/dnode/remove2.sim +++ /dev/null @@ -1,204 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create database d1 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(1588262400001, 15) -sql insert into d1.t1 values(1588262400002, 14) -sql insert into d1.t1 values(1588262400003, 13) -sql insert into d1.t1 values(1588262400004, 12) -sql insert into d1.t1 values(1588262400005, 11) - -sql create database d2 -sql create table d2.t2 (t timestamp, i int) -sql insert into d2.t2 values(1588262400001, 25) -sql insert into d2.t2 values(1588262400002, 24) -sql insert into d2.t2 values(1588262400003, 23) -sql insert into d2.t2 values(1588262400004, 22) -sql insert into d2.t2 values(1588262400005, 21) - -sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 2 then - return -1 -endi - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -$x = 0 -step2: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step2 -endi -if $data4_2 != ready then - goto step2 -endi - -sql create database d3 replica 2 -sql create table d3.t3 (t timestamp, i int) -sql insert into d3.t3 values(1588262400001, 35) -sql insert into d3.t3 values(1588262400002, 34) -sql insert into d3.t3 values(1588262400003, 33) -sql insert into d3.t3 values(1588262400004, 32) -sql insert into d3.t3 values(1588262400005, 31) - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 1 then - goto show2 -endi -if $data2_2 != 3 then - goto show2 -endi - -print ========== step3 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 - -print ========== step4 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -# wait dnode3 create first vgroup in dnode-status msg -if $data2_3 != 1 then - goto step4 -endi - -print ============ step 4.1 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step4.1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_2 != ready then - goto step4.1 -endi - -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -if $data2_1 != 1 then - goto show4 -endi -if $data2_2 != null then - goto show4 -endi -if $data2_3 != 3 then - goto show4 -endi - -print ========== step5 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 - -sql select * from d2.t2 order by t desc -print $data01 $data11 $data21 $data31 $data41 - -sql select * from d3.t3 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT From df417c7f505b14eb73303d40f402ec3b4fdf9040 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 28 Jun 2022 14:48:40 +0800 Subject: [PATCH 27/47] fix: not restore rsma if qtaskinfo file not exist --- source/dnode/vnode/src/sma/smaRollup.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index f68fc4f30c..34c3ef8fca 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -749,9 +749,17 @@ int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { if (tdInitTFile(&tFile, pVnode->pTfs, qTaskInfoFName) < 0) { goto _err; } + + if(!taosCheckExistFile(TD_TFILE_FULL_NAME(&tFile))) { + metaReaderClear(&mr); + taosArrayDestroy(suidList); + return TSDB_CODE_SUCCESS; + } + if (tdOpenTFile(&tFile, TD_FILE_READ) < 0) { goto _err; } + SRSmaQTaskInfoIter fIter = {0}; if (tdRSmaQTaskInfoIterInit(&fIter, &tFile) < 0) { goto _err; From 93d3879037108c1f7aa301bc44c594b50be717bc Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 15:24:35 +0800 Subject: [PATCH 28/47] test: case for drop dnode --- tests/script/jenkins/basic.txt | 1 + tests/script/sh/move_dnode.sh | 56 ---- .../{unique => tsim}/dnode/vnode_clean.sim | 242 +++++++++--------- tests/script/unique/dnode/data1.sim | 137 ---------- tests/script/unique/dnode/datatrans_1node.sim | 53 ---- tests/script/unique/dnode/datatrans_3node.sim | 91 ------- .../script/unique/dnode/datatrans_3node_2.sim | 91 ------- tests/script/unique/dnode/lossdata.sim | 165 ------------ tests/script/unique/dnode/simple.sim | 147 ----------- tests/script/unique/dnode/testSuite.sim | 9 - 10 files changed, 125 insertions(+), 867 deletions(-) delete mode 100755 tests/script/sh/move_dnode.sh rename tests/script/{unique => tsim}/dnode/vnode_clean.sim (55%) delete mode 100644 tests/script/unique/dnode/data1.sim delete mode 100644 tests/script/unique/dnode/datatrans_1node.sim delete mode 100644 tests/script/unique/dnode/datatrans_3node.sim delete mode 100644 tests/script/unique/dnode/datatrans_3node_2.sim delete mode 100644 tests/script/unique/dnode/lossdata.sim delete mode 100644 tests/script/unique/dnode/simple.sim delete mode 100644 tests/script/unique/dnode/testSuite.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 36ed45739c..0751cc767a 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -40,6 +40,7 @@ ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim ./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim +./test.sh -f tsim/dnode/vnode_clean.sim # ---- insert ./test.sh -f tsim/insert/basic0.sim diff --git a/tests/script/sh/move_dnode.sh b/tests/script/sh/move_dnode.sh deleted file mode 100755 index d3650c18ad..0000000000 --- a/tests/script/sh/move_dnode.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -echo "Executing move_dnode.sh" - -UNAME_BIN=`which uname` -OS_TYPE=`$UNAME_BIN` - -SCRIPT_DIR=`dirname $0` -cd $SCRIPT_DIR/../ -SCRIPT_DIR=`pwd` -echo "SCRIPT_DIR: $SCRIPT_DIR" - -IN_TDINTERNAL="community" -if [[ "$SCRIPT_DIR" == *"$IN_TDINTERNAL"* ]]; then - cd ../../.. -else - cd ../../ -fi - -TAOS_DIR=`pwd` -TAOSD_DIR=`find . -name "taosd"|grep bin|head -n1` - -if [[ "$OS_TYPE" != "Darwin" ]]; then - cut_opt="--field=" -else - cut_opt="-f " -fi - -if [[ "$TAOSD_DIR" == *"$IN_TDINTERNAL"* ]]; then - BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2,3` -else - BIN_DIR=`find . -name "taosd"|grep bin|head -n1|cut -d '/' ${cut_opt}2` -fi - -BUILD_DIR=$TAOS_DIR/$BIN_DIR/build - -SIM_DIR=$TAOS_DIR/sim - -NODE_DIR=$SIM_DIR/$NODE_NAME - -if [ -d "$SIM_DIR/$2" ];then - rm -rf $SIM_DIR/$2 -fi -mv $SIM_DIR/$1 $SIM_DIR/$2 - -if [[ $2 =~ "dnode2" ]];then - sed -i 's/serverPort 7100/serverPort 7200/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/dnode1/dnode2/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/7100/7200/g' $SIM_DIR/$2/data/dnode/dnodeEps.json -elif [[ $2 =~ "dnode4" ]];then - sed -i 's/serverPort 7100/serverPort 7400/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/dnode1/dnode4/g' $SIM_DIR/$2/cfg/taos.cfg - sed -i 's/7100/7400/g' $SIM_DIR/dnode2/data/dnode/dnodeEps.json - sed -i 's/7100/7400/g' $SIM_DIR/dnode3/data/dnode/dnodeEps.json - sed -i 's/7100/7400/g' $SIM_DIR/$2/data/dnode/dnodeEps.json -fi diff --git a/tests/script/unique/dnode/vnode_clean.sim b/tests/script/tsim/dnode/vnode_clean.sim similarity index 55% rename from tests/script/unique/dnode/vnode_clean.sim rename to tests/script/tsim/dnode/vnode_clean.sim index 76311a6cac..9fcf9451c1 100644 --- a/tests/script/unique/dnode/vnode_clean.sim +++ b/tests/script/tsim/dnode/vnode_clean.sim @@ -1,30 +1,14 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 1 -system sh/cfg.sh -n dnode2 -c wallevel -v 1 -system sh/cfg.sh -n dnode3 -c wallevel -v 1 -system sh/cfg.sh -n dnode4 -c wallevel -v 1 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 - print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create database d1 +sql create database d1 vgroups 1 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -33,34 +17,49 @@ sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) sql show dnodes -print dnode1 openVnodes $data2_1 -if $data2_1 != 1 then +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 1 then return -1 endi print ========== step2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -show2: +step2: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then - goto show2 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $data2_2 != 1 then - goto show2 +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(2)[2] != 1 then + return -1 endi print ========== step3 -sql create database d2 +sql create database d2 vgroups 1 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) @@ -69,65 +68,68 @@ sql insert into d2.t2 values(now+3s, 23) sql insert into d2.t2 values(now+4s, 22) sql insert into d2.t2 values(now+5s, 21) -$x = 0 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 0 then return -1 endi -if $data2_2 != 2 then +if $data(2)[2] != 2 then return -1 endi print ========== step4 -sql drop dnode $hostname2 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi +sql drop dnode 2 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -if $data2_1 != 2 then - goto show4 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 2 then + return -1 endi -if $data2_2 != null then - goto show4 -endi -if $rows != 1 then - goto show4 +if $data(2)[2] != null then + return -1 endi system sh/exec.sh -n dnode2 -s stop -x SIGINT print ========== step5 -sql create dnode $hostname3 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode3 -s start $x = 0 -show5: +step5: $x = $x + 1 sleep 1000 - if $x == 40 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -if $data2_1 != 0 then - goto show5 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $data2_3 != 2 then - goto show5 +if $data(1)[4] != ready then + goto step5 +endi +if $data(3)[4] != ready then + goto step5 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then + return -1 +endi +if $data(3)[2] != 1 then + return -1 endi print ========== step6 -sql create database d3 +sql create database d3 vgroups 1 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -136,43 +138,61 @@ sql insert into d3.t3 values(now+4s, 32) sql insert into d3.t3 values(now+5s, 31) sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_3 -if $data2_1 != 0 then +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +if $data(1)[2] != 1 then return -1 endi -if $data2_3 != 3 then +if $data(3)[2] != 2 then return -1 endi print ========== step7 -sql create dnode $hostname4 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode4 -s start $x = 0 -show7: +step7: $x = $x + 1 sleep 1000 - if $x == 40 then + if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 endi -if $data2_3 != 2 then - goto show7 +if $data(1)[4] != ready then + goto step7 endi -if $data2_4 != 1 then - goto show7 +if $data(3)[4] != ready then + goto step7 +endi +if $data(4)[4] != ready then + goto step7 +endi + +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 +endi +if $data(3)[2] != 2 then + return -1 +endi +if $data(4)[2] != 1 then + return -1 endi print ========== step8 -sql create database d4 +sql create database d4 vgroups 1 sql create table d4.t4 (t timestamp, i int) sql insert into d4.t4 values(now+1s, 45) sql insert into d4.t4 values(now+2s, 44) @@ -180,53 +200,39 @@ sql insert into d4.t4 values(now+3s, 43) sql insert into d4.t4 values(now+4s, 42) sql insert into d4.t4 values(now+5s, 41) -$x = 0 -show8: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show8 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 0 then + return -1 endi -if $data2_3 != 2 then - goto show8 +if $data(3)[2] != 2 then + return -1 endi -if $data2_4 != 2 then - goto show8 +if $data(4)[2] != 2 then + return -1 endi print ========== step9 -sql drop dnode $hostname3 - -$x = 0 -show9: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - +sql drop dnode 3 sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show9 +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(3)[2] +print dnode2 openVnodes $data(4)[2] +if $data(1)[2] != 1 then + return -1 endi -if $data2_3 != null then - goto show9 +if $data(3)[2] != null then + return -1 endi -if $data2_4 != 4 then - goto show9 +if $data(4)[2] != 3 then + return -1 endi -system sh/exec.sh -n dnode3 -s stop +system sh/exec.sh -n dnode3 -s stop -x SIGINT +sql reset query cache +sleep 100 print ========== step10 sql select * from d1.t1 order by t desc diff --git a/tests/script/unique/dnode/data1.sim b/tests/script/unique/dnode/data1.sim deleted file mode 100644 index 75a484abb6..0000000000 --- a/tests/script/unique/dnode/data1.sim +++ /dev/null @@ -1,137 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect -sleep 2000 - -print ========== step2 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show2: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show2 -endi -if $data2_2 != 0 then - goto show2 -endi -if $data2_3 != 0 then - goto show2 -endi -if $data2_4 != 0 then - goto show2 -endi - -print ========== step3 -sql create database d1 replica 3 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 35) -sql insert into d1.t1 values(now+2s, 34) -sql insert into d1.t1 values(now+3s, 33) -sql insert into d1.t1 values(now+4s, 32) -sql insert into d1.t1 values(now+5s, 31) - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != 1 then - goto show3 -endi -if $data2_3 != 1 then - goto show3 -endi -if $data2_4 != 1 then - goto show3 -endi - -print ========== step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -print ========== step5 -system_content rm -rf ../../../sim/dnode4/data/vnode/vnode2/tsdb/data - -print ========== step6 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sleep 10000 - -print ========== step7 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 31 then - return -1 -endi -if $data11 != 32 then - return -1 -endi -if $data21 != 33 then - return -1 -endi -if $data31 != 34 then - return -1 -endi -if $data41 != 35 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/datatrans_1node.sim b/tests/script/unique/dnode/datatrans_1node.sim deleted file mode 100644 index a156c32672..0000000000 --- a/tests/script/unique/dnode/datatrans_1node.sim +++ /dev/null @@ -1,53 +0,0 @@ - -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print =============== step1 -sql drop database -x step1 -step1: -sql create database db -sql use db -sql create table m1 (ts timestamp, speed int) - -print =============== step 2 -$x = 0 -while $x < 10 - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into m1 values ($ms , $x ) - $x = $x + 1 -endw - -sql select * from m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -print =============== step 3 -system sh/move_dnode.sh dnode1 dnode2 -system sh/exec.sh -n dnode2 -s start - - -print =============== step 4 -sleep 2000 -sql connect - -sql select * from db.m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/datatrans_3node.sim b/tests/script/unique/dnode/datatrans_3node.sim deleted file mode 100644 index 7948eb6d3a..0000000000 --- a/tests/script/unique/dnode/datatrans_3node.sim +++ /dev/null @@ -1,91 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 - - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 2 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 - - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 - - - - -print ============== step1: start dnode1 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 2000 - -# create table -sql drop database -x step1 -step1: -sql create database db -sql use db -sql create table m1 (ts timestamp, speed int) - -# insert data -$x = 0 -while $x < 10 - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into m1 values ($ms , $x ) - $x = $x + 1 -endw - -sql select * from m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -print ============== step3: stop cluster , then move_dnode1 ,start cluster -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -system sh/move_dnode.sh dnode1 dnode4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start - -print =============== step 4 -sleep 2000 -sql connect - -sql select * from db.m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/datatrans_3node_2.sim b/tests/script/unique/dnode/datatrans_3node_2.sim deleted file mode 100644 index 844afc5b02..0000000000 --- a/tests/script/unique/dnode/datatrans_3node_2.sim +++ /dev/null @@ -1,91 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 - - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 2 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 - - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 - - - - -print ============== step1: start dnode1 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 2000 - -# create table -sql drop database -x step1 -step1: -sql create database db replica 2 -sql use db -sql create table m1 (ts timestamp, speed int) - -# insert data -$x = 0 -while $x < 10 - $cc = $x * 60000 - $ms = 1601481600000 + $cc - - sql insert into m1 values ($ms , $x ) - $x = $x + 1 -endw - -sql select * from m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -print ============== step3: stop cluster , then move_dnode1 ,start cluster -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -system sh/move_dnode.sh dnode1 dnode4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start - -print =============== step 4 -sleep 2000 -sql connect - -sql select * from db.m1 - -print $rows points data are retrieved -if $rows != 10 then - return -1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/lossdata.sim b/tests/script/unique/dnode/lossdata.sim deleted file mode 100644 index 89ba716970..0000000000 --- a/tests/script/unique/dnode/lossdata.sim +++ /dev/null @@ -1,165 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -print ========== step2 - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) - -print ========== step2.1 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi - -print ========== step3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 - -if $data2_2 != 1 then - goto show3 -endi -if $data2_3 != 1 then - goto show3 -endi -if $data2_4 != 0 then - goto show3 -endi - -sql show d1.vgroups; -print d1.vgroups $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 - -print ========== step4 -sql drop dnode $hostname3 - -$i = 0 -$rowNum = 10000 - -while $i < $rowNum - $ts = 1500000000000 + $i - sql insert into d1.t1 values( $ts , $i ) - - $i = $i + 1 -endw - -print insert $rowNum finished - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -print dnode5 openVnodes $data2_5 - -if $data2_2 != 1 then - goto show4 -endi -if $data2_3 != null then - goto show4 -endi -if $data2_4 != 1 then - goto show4 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -print ========== step5 -sql select count(*) from d1.t1 -print select count(*) from d1.t1 ==> $data00 -if $data00 != $rowNum then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/simple.sim b/tests/script/unique/dnode/simple.sim deleted file mode 100644 index 38d8c08d75..0000000000 --- a/tests/script/unique/dnode/simple.sim +++ /dev/null @@ -1,147 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -print ========== step1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sleep 2000 - -sql create database d1 replica 2 -sql create table d1.t1 (t timestamp, i int) -sql insert into d1.t1 values(now+1s, 15) -sql insert into d1.t1 values(now+2s, 14) -sql insert into d1.t1 values(now+3s, 13) -sql insert into d1.t1 values(now+4s, 12) -sql insert into d1.t1 values(now+5s, 11) - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi -if $data2_4 != null then - return -1 -endi - -print ========== step2 -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start -sleep 2000 - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - return -1 -endi -if $data2_2 != 1 then - return -1 -endi -if $data2_3 != 1 then - return -1 -endi -if $data2_4 != 0 then - return -1 -endi - -print ========== step3 -sql drop dnode $hostname2 - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 0 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 1 then - goto show3 -endi -if $data2_4 != 1 then - goto show3 -endi - -print ========== step4 -sql drop dnode $hostname3 - -$x = 0 -show4: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 openVnodes $data2_1 -print dnode2 openVnodes $data2_2 -print dnode3 openVnodes $data2_3 -print dnode4 openVnodes $data2_4 -if $data2_1 != 1 then - goto show4 -endi -if $data2_2 != null then - goto show4 -endi -if $data2_3 != null then - goto show4 -endi -if $data2_4 != 1 then - goto show4 -endi - -print ========== step5 -sql select * from d1.t1 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 11 then - return -1 -endi -if $data11 != 12 then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data41 != 15 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT diff --git a/tests/script/unique/dnode/testSuite.sim b/tests/script/unique/dnode/testSuite.sim deleted file mode 100644 index ecd43cc224..0000000000 --- a/tests/script/unique/dnode/testSuite.sim +++ /dev/null @@ -1,9 +0,0 @@ -run unique/dnode/balance1.sim -run unique/dnode/balance2.sim -run unique/dnode/balance3.sim -run unique/dnode/balancex.sim -run unique/dnode/offline1.sim -run unique/dnode/offline2.sim -run unique/dnode/remove1.sim -run unique/dnode/remove2.sim -run unique/dnode/vnode_clean.sim From 55a1c02f73793c95698b3c92a6a84095f29d1ca0 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 28 Jun 2022 15:45:29 +0800 Subject: [PATCH 29/47] refactor: rsma code optimization --- source/dnode/vnode/src/sma/smaRollup.c | 73 +++++++++++++++++++++----- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 34c3ef8fca..7ce0cf6fad 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -40,6 +40,10 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter); static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *infoItem); +static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma); +static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma); +static int32_t tdRSmaRestoreTSDataReload(SSma *pSma); + struct SRSmaInfoItem { SRSmaInfo *pRsmaInfo; void *taskInfo; // qTaskInfo_t @@ -696,10 +700,9 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) { return TSDB_CODE_SUCCESS; } -int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { +static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma) { SVnode *pVnode = pSma->pVnode; - // step 1: iterate all stables to restore the rsma env SArray *suidList = taosArrayInit(1, sizeof(tb_uid_t)); if (tsdbGetStbIdList(SMA_META(pSma), 0, suidList) < 0) { taosArrayDestroy(suidList); @@ -741,7 +744,20 @@ int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { } } - // step 2: retrieve qtaskinfo items from the persistence file(rsma/qtaskinfo) and restore + metaReaderClear(&mr); + taosArrayDestroy(suidList); + + return TSDB_CODE_SUCCESS; +_err: + metaReaderClear(&mr); + taosArrayDestroy(suidList); + + return TSDB_CODE_FAILED; +} + +static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma) { + SVnode *pVnode = pSma->pVnode; + STFile tFile = {0}; char qTaskInfoFName[TSDB_FILENAME_LEN]; @@ -749,34 +765,63 @@ int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { if (tdInitTFile(&tFile, pVnode->pTfs, qTaskInfoFName) < 0) { goto _err; } - - if(!taosCheckExistFile(TD_TFILE_FULL_NAME(&tFile))) { - metaReaderClear(&mr); - taosArrayDestroy(suidList); + + if (!taosCheckExistFile(TD_TFILE_FULL_NAME(&tFile))) { return TSDB_CODE_SUCCESS; } if (tdOpenTFile(&tFile, TD_FILE_READ) < 0) { goto _err; } - + SRSmaQTaskInfoIter fIter = {0}; if (tdRSmaQTaskInfoIterInit(&fIter, &tFile) < 0) { goto _err; } - SRSmaQTaskInfoItem infoItem = {0}; + if (tdRSmaQTaskInfoRestore(pSma, &fIter) < 0) { - tdRSmaQTaskInfoIterDestroy(&fIter); goto _err; } +_err: tdRSmaQTaskInfoIterDestroy(&fIter); - metaReaderClear(&mr); - taosArrayDestroy(suidList); + smaError("failed to restore rsma task since %s", terrstr()); + return TSDB_CODE_FAILED; +} + +/** + * @brief reload ts data from checkpoint + * + * @param pSma + * @return int32_t + */ +static int32_t tdRSmaRestoreTSDataReload(SSma *pSma) { + // TODO + return TSDB_CODE_SUCCESS; +_err: + return TSDB_CODE_FAILED; +} + +int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { + SVnode *pVnode = pSma->pVnode; + + // step 1: iterate all stables to restore the rsma env + if (tdRSmaRestoreQTaskInfoInit(pSma) < 0) { + goto _err; + } + + // step 2: retrieve qtaskinfo items from the persistence file(rsma/qtaskinfo) and restore + if (tdRSmaRestoreQTaskInfoReload(pSma) < 0) { + goto _err; + } + + // step 3: reload ts data from checkpoint + if (tdRSmaRestoreTSDataReload(pSma) < 0) { + goto _err; + } + return TSDB_CODE_SUCCESS; _err: - metaReaderClear(&mr); - taosArrayDestroy(suidList); smaError("failed to restore rsma task since %s", terrstr()); return TSDB_CODE_FAILED; } From 4091113dae77d9daa91d99f6b16eed80b21c8cfc Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 28 Jun 2022 15:56:06 +0800 Subject: [PATCH 30/47] refactor: rsma code optimization --- source/dnode/vnode/src/sma/smaRollup.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 7ce0cf6fad..6f99970c5a 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -757,9 +757,8 @@ _err: static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma) { SVnode *pVnode = pSma->pVnode; - - STFile tFile = {0}; - char qTaskInfoFName[TSDB_FILENAME_LEN]; + STFile tFile = {0}; + char qTaskInfoFName[TSDB_FILENAME_LEN]; tdRSmaQTaskInfoGetFName(TD_VID(pVnode), TD_QTASK_CUR_FILE, qTaskInfoFName); if (tdInitTFile(&tFile, pVnode->pTfs, qTaskInfoFName) < 0) { @@ -776,15 +775,21 @@ static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma) { SRSmaQTaskInfoIter fIter = {0}; if (tdRSmaQTaskInfoIterInit(&fIter, &tFile) < 0) { + tdRSmaQTaskInfoIterDestroy(&fIter); + tdCloseTFile(&tFile); goto _err; } if (tdRSmaQTaskInfoRestore(pSma, &fIter) < 0) { + tdRSmaQTaskInfoIterDestroy(&fIter); + tdCloseTFile(&tFile); goto _err; } -_err: tdRSmaQTaskInfoIterDestroy(&fIter); + tdCloseTFile(&tFile); + return TSDB_CODE_SUCCESS; +_err: smaError("failed to restore rsma task since %s", terrstr()); return TSDB_CODE_FAILED; } From e5c633f89ef426b791f76a1cf41f4f979eae0a97 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 16:02:39 +0800 Subject: [PATCH 31/47] test: remove out date case --- tests/script/windows/alter/metrics.sim | 769 -------------- tests/script/windows/alter/table.sim | 672 ------------ tests/script/windows/compute/avg.sim | 158 --- tests/script/windows/compute/bottom.sim | 99 -- tests/script/windows/compute/count.sim | 174 --- tests/script/windows/compute/diff.sim | 91 -- tests/script/windows/compute/first.sim | 160 --- tests/script/windows/compute/interval.sim | 176 ---- tests/script/windows/compute/last.sim | 159 --- tests/script/windows/compute/leastsquare.sim | 102 -- tests/script/windows/compute/max.sim | 159 --- tests/script/windows/compute/min.sim | 159 --- tests/script/windows/compute/percentile.sim | 116 -- tests/script/windows/compute/stddev.sim | 98 -- tests/script/windows/compute/sum.sim | 159 --- tests/script/windows/compute/top.sim | 99 -- tests/script/windows/db/basic.sim | 193 ---- tests/script/windows/db/len.sim | 92 -- tests/script/windows/field/2.sim | 295 ------ tests/script/windows/field/3.sim | 521 --------- tests/script/windows/field/4.sim | 711 ------------- tests/script/windows/field/5.sim | 834 --------------- tests/script/windows/field/6.sim | 989 ------------------ tests/script/windows/field/bigint.sim | 160 --- tests/script/windows/field/binary.sim | 77 -- tests/script/windows/field/bool.sim | 161 --- tests/script/windows/field/double.sim | 160 --- tests/script/windows/field/float.sim | 160 --- tests/script/windows/field/int.sim | 160 --- tests/script/windows/field/single.sim | 218 ---- tests/script/windows/field/smallint.sim | 160 --- tests/script/windows/field/tinyint.sim | 160 --- tests/script/windows/import/basic.sim | 125 --- tests/script/windows/insert/basic.sim | 49 - .../windows/insert/query_block1_file.sim | 195 ---- .../windows/insert/query_block1_memory.sim | 177 ---- .../windows/insert/query_block2_file.sim | 210 ---- .../windows/insert/query_block2_memory.sim | 172 --- .../windows/insert/query_file_memory.sim | 209 ---- .../windows/insert/query_multi_file.sim | 55 - tests/script/windows/table/binary.sim | 63 -- tests/script/windows/table/bool.sim | 92 -- tests/script/windows/table/column_name.sim | 91 -- tests/script/windows/table/column_num.sim | 86 -- tests/script/windows/table/column_value.sim | 80 -- tests/script/windows/table/db.table.sim | 48 - tests/script/windows/table/double.sim | 98 -- tests/script/windows/table/float.sim | 98 -- tests/script/windows/table/table.sim | 225 ---- tests/script/windows/table/table_len.sim | 105 -- tests/script/windows/tag/3.sim | 521 --------- tests/script/windows/tag/4.sim | 711 ------------- tests/script/windows/tag/5.sim | 834 --------------- tests/script/windows/tag/6.sim | 989 ------------------ tests/script/windows/tag/add.sim | 854 --------------- tests/script/windows/tag/bigint.sim | 241 ----- tests/script/windows/tag/binary.sim | 241 ----- tests/script/windows/tag/binary_binary.sim | 308 ------ tests/script/windows/tag/bool.sim | 238 ----- tests/script/windows/tag/bool_binary.sim | 308 ------ tests/script/windows/tag/bool_int.sim | 324 ------ tests/script/windows/tag/change.sim | 513 --------- tests/script/windows/tag/column.sim | 93 -- tests/script/windows/tag/create.sim | 601 ----------- tests/script/windows/tag/delete.sim | 825 --------------- tests/script/windows/tag/double.sim | 241 ----- tests/script/windows/tag/filter.sim | 149 --- tests/script/windows/tag/float.sim | 241 ----- tests/script/windows/tag/int.sim | 241 ----- tests/script/windows/tag/int_binary.sim | 308 ------ tests/script/windows/tag/int_float.sim | 324 ------ tests/script/windows/tag/set.sim | 457 -------- tests/script/windows/tag/smallint.sim | 241 ----- tests/script/windows/tag/tinyint.sim | 241 ----- tests/script/windows/testSuite.sim | 93 -- tests/script/windows/vector/metrics_field.sim | 622 ----------- tests/script/windows/vector/metrics_mix.sim | 622 ----------- tests/script/windows/vector/metrics_query.sim | 618 ----------- tests/script/windows/vector/metrics_tag.sim | 618 ----------- tests/script/windows/vector/metrics_time.sim | 618 ----------- tests/script/windows/vector/multi.sim | 215 ---- tests/script/windows/vector/single.sim | 302 ------ tests/script/windows/vector/table_field.sim | 618 ----------- tests/script/windows/vector/table_mix.sim | 618 ----------- tests/script/windows/vector/table_query.sim | 618 ----------- tests/script/windows/vector/table_time.sim | 618 ----------- 86 files changed, 26803 deletions(-) delete mode 100644 tests/script/windows/alter/metrics.sim delete mode 100644 tests/script/windows/alter/table.sim delete mode 100644 tests/script/windows/compute/avg.sim delete mode 100644 tests/script/windows/compute/bottom.sim delete mode 100644 tests/script/windows/compute/count.sim delete mode 100644 tests/script/windows/compute/diff.sim delete mode 100644 tests/script/windows/compute/first.sim delete mode 100644 tests/script/windows/compute/interval.sim delete mode 100644 tests/script/windows/compute/last.sim delete mode 100644 tests/script/windows/compute/leastsquare.sim delete mode 100644 tests/script/windows/compute/max.sim delete mode 100644 tests/script/windows/compute/min.sim delete mode 100644 tests/script/windows/compute/percentile.sim delete mode 100644 tests/script/windows/compute/stddev.sim delete mode 100644 tests/script/windows/compute/sum.sim delete mode 100644 tests/script/windows/compute/top.sim delete mode 100644 tests/script/windows/db/basic.sim delete mode 100644 tests/script/windows/db/len.sim delete mode 100644 tests/script/windows/field/2.sim delete mode 100644 tests/script/windows/field/3.sim delete mode 100644 tests/script/windows/field/4.sim delete mode 100644 tests/script/windows/field/5.sim delete mode 100644 tests/script/windows/field/6.sim delete mode 100644 tests/script/windows/field/bigint.sim delete mode 100644 tests/script/windows/field/binary.sim delete mode 100644 tests/script/windows/field/bool.sim delete mode 100644 tests/script/windows/field/double.sim delete mode 100644 tests/script/windows/field/float.sim delete mode 100644 tests/script/windows/field/int.sim delete mode 100644 tests/script/windows/field/single.sim delete mode 100644 tests/script/windows/field/smallint.sim delete mode 100644 tests/script/windows/field/tinyint.sim delete mode 100644 tests/script/windows/import/basic.sim delete mode 100644 tests/script/windows/insert/basic.sim delete mode 100644 tests/script/windows/insert/query_block1_file.sim delete mode 100644 tests/script/windows/insert/query_block1_memory.sim delete mode 100644 tests/script/windows/insert/query_block2_file.sim delete mode 100644 tests/script/windows/insert/query_block2_memory.sim delete mode 100644 tests/script/windows/insert/query_file_memory.sim delete mode 100644 tests/script/windows/insert/query_multi_file.sim delete mode 100644 tests/script/windows/table/binary.sim delete mode 100644 tests/script/windows/table/bool.sim delete mode 100644 tests/script/windows/table/column_name.sim delete mode 100644 tests/script/windows/table/column_num.sim delete mode 100644 tests/script/windows/table/column_value.sim delete mode 100644 tests/script/windows/table/db.table.sim delete mode 100644 tests/script/windows/table/double.sim delete mode 100644 tests/script/windows/table/float.sim delete mode 100644 tests/script/windows/table/table.sim delete mode 100644 tests/script/windows/table/table_len.sim delete mode 100644 tests/script/windows/tag/3.sim delete mode 100644 tests/script/windows/tag/4.sim delete mode 100644 tests/script/windows/tag/5.sim delete mode 100644 tests/script/windows/tag/6.sim delete mode 100644 tests/script/windows/tag/add.sim delete mode 100644 tests/script/windows/tag/bigint.sim delete mode 100644 tests/script/windows/tag/binary.sim delete mode 100644 tests/script/windows/tag/binary_binary.sim delete mode 100644 tests/script/windows/tag/bool.sim delete mode 100644 tests/script/windows/tag/bool_binary.sim delete mode 100644 tests/script/windows/tag/bool_int.sim delete mode 100644 tests/script/windows/tag/change.sim delete mode 100644 tests/script/windows/tag/column.sim delete mode 100644 tests/script/windows/tag/create.sim delete mode 100644 tests/script/windows/tag/delete.sim delete mode 100644 tests/script/windows/tag/double.sim delete mode 100644 tests/script/windows/tag/filter.sim delete mode 100644 tests/script/windows/tag/float.sim delete mode 100644 tests/script/windows/tag/int.sim delete mode 100644 tests/script/windows/tag/int_binary.sim delete mode 100644 tests/script/windows/tag/int_float.sim delete mode 100644 tests/script/windows/tag/set.sim delete mode 100644 tests/script/windows/tag/smallint.sim delete mode 100644 tests/script/windows/tag/tinyint.sim delete mode 100644 tests/script/windows/testSuite.sim delete mode 100644 tests/script/windows/vector/metrics_field.sim delete mode 100644 tests/script/windows/vector/metrics_mix.sim delete mode 100644 tests/script/windows/vector/metrics_query.sim delete mode 100644 tests/script/windows/vector/metrics_tag.sim delete mode 100644 tests/script/windows/vector/metrics_time.sim delete mode 100644 tests/script/windows/vector/multi.sim delete mode 100644 tests/script/windows/vector/single.sim delete mode 100644 tests/script/windows/vector/table_field.sim delete mode 100644 tests/script/windows/vector/table_mix.sim delete mode 100644 tests/script/windows/vector/table_query.sim delete mode 100644 tests/script/windows/vector/table_time.sim diff --git a/tests/script/windows/alter/metrics.sim b/tests/script/windows/alter/metrics.sim deleted file mode 100644 index 7dfda05bd0..0000000000 --- a/tests/script/windows/alter/metrics.sim +++ /dev/null @@ -1,769 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print ======== step1 -sql create database d2 -sql use d2 -sql create table mt (ts timestamp, a int) TAGS (t int) -sql create table tb using mt tags (1) -sql insert into tb values(now-28d, -28) -sql insert into tb values(now-27d, -27) -sql insert into tb values(now-26d, -26) -sql select * from tb -if $rows != 3 then - return -1 -endi -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != t then - return -1 -endi -if $data21 != INT then - return -1 -endi - -print ======== step2 -sql alter table mt add column b smallint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != t then - return -1 -endi -if $data31 != INT then - return -1 -endi - -print ======== step3 -sql alter table mt add column c tinyint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != t then - return -1 -endi -if $data41 != INT then - return -1 -endi - -print ======== step4 -sql alter table mt add column d int -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != t then - return -1 -endi -if $data51 != INT then - return -1 -endi - -print ======== step5 -sql alter table mt add column e bigint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != t then - return -1 -endi -if $data61 != INT then - return -1 -endi - -print ======== step6 -sql alter table mt add column f float -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != t then - return -1 -endi -if $data71 != INT then - return -1 -endi - -print ======== step7 -sql alter table mt add column g double -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != t then - return -1 -endi -if $data81 != INT then - return -1 -endi - -print ======== step8 -sql alter table mt add column h binary(10) -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi -if $data90 != t then - return -1 -endi -if $data91 != INT then - return -1 -endi - -print ======== step9 -print ======== step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 -system sh/exec.sh -n dnode1 -s start -sleep 3000 - -sql use d2 -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi -if $data90 != t then - return -1 -endi -if $data91 != INT then - return -1 -endi - -print ======== step11 -#sql alter table mt drop column a -x step111 -# return -1 -#step111: - -#sql alter table mt drop column ts -x step112 -# return -1 -#step112: - -#sql alter table mt drop column cdfg -x step113 -# return -1 -#step113: - -#sql alter table mt add column a -x step114 -# return -1 -#step114: - -#sql alter table mt add column b -x step115 -# return -1 -#step115: - -print ======== step12 -sql alter table mt drop column b -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != c then - return -1 -endi -if $data21 != TINYINT then - return -1 -endi -if $data30 != d then - return -1 -endi -if $data31 != INT then - return -1 -endi -if $data40 != e then - return -1 -endi -if $data41 != BIGINT then - return -1 -endi -if $data50 != f then - return -1 -endi -if $data51 != FLOAT then - return -1 -endi -if $data60 != g then - return -1 -endi -if $data61 != DOUBLE then - return -1 -endi -if $data70 != h then - return -1 -endi -if $data71 != BINARY then - return -1 -endi -if $data72 != 10 then - return -1 -endi -if $data80 != t then - return -1 -endi -if $data81 != INT then - return -1 -endi - -print ======== step13 -sql alter table mt drop column c -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != d then - return -1 -endi -if $data21 != INT then - return -1 -endi -if $data30 != e then - return -1 -endi -if $data31 != BIGINT then - return -1 -endi -if $data40 != f then - return -1 -endi -if $data41 != FLOAT then - return -1 -endi -if $data50 != g then - return -1 -endi -if $data51 != DOUBLE then - return -1 -endi -if $data60 != h then - return -1 -endi -if $data61 != BINARY then - return -1 -endi -if $data62 != 10 then - return -1 -endi -if $data70 != t then - return -1 -endi -if $data71 != INT then - return -1 -endi - -print ======== step14 -sql alter table mt drop column d -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != e then - return -1 -endi -if $data21 != BIGINT then - return -1 -endi -if $data30 != f then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data40 != g then - return -1 -endi -if $data41 != DOUBLE then - return -1 -endi -if $data50 != h then - return -1 -endi -if $data51 != BINARY then - return -1 -endi -if $data52 != 10 then - return -1 -endi -if $data60 != t then - return -1 -endi -if $data61 != INT then - return -1 -endi - -print ======== step15 -sql alter table mt drop column e -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != f then - return -1 -endi -if $data21 != FLOAT then - return -1 -endi -if $data30 != g then - return -1 -endi -if $data31 != DOUBLE then - return -1 -endi -if $data40 != h then - return -1 -endi -if $data41 != BINARY then - return -1 -endi -if $data42 != 10 then - return -1 -endi -if $data50 != t then - return -1 -endi -if $data51 != INT then - return -1 -endi - -print ======== step16 -sql alter table mt drop column f -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != g then - return -1 -endi -if $data21 != DOUBLE then - return -1 -endi -if $data30 != h then - return -1 -endi -if $data31 != BINARY then - return -1 -endi -if $data32 != 10 then - return -1 -endi -if $data40 != t then - return -1 -endi -if $data41 != INT then - return -1 -endi - -print ======== step17 -sql alter table mt drop column g -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != h then - return -1 -endi -if $data21 != BINARY then - return -1 -endi -if $data22 != 10 then - return -1 -endi -if $data30 != t then - return -1 -endi -if $data31 != INT then - return -1 -endi - -print ============= step18 -sql alter table mt drop column h -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != t then - return -1 -endi -if $data21 != INT then - return -1 -endi -if $data30 != null then - return -1 -endi - -print ======= over -sql drop database d2 -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/alter/table.sim b/tests/script/windows/alter/table.sim deleted file mode 100644 index 52757da20e..0000000000 --- a/tests/script/windows/alter/table.sim +++ /dev/null @@ -1,672 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print ======== step1 -sql create database d1 -sql use d1 -sql create table tb (ts timestamp, a int) -sql insert into tb values(now-28d, -28) -sql insert into tb values(now-27d, -27) -sql insert into tb values(now-26d, -26) -sql select * from tb -if $rows != 3 then - return -1 -endi -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi - -print ======== step2 -sql alter table tb add column b smallint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi - -print ======== step3 -sql alter table tb add column c tinyint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi - -print ======== step4 -sql alter table tb add column d int -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi - -print ======== step5 -sql alter table tb add column e bigint -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi - -print ======== step6 -sql alter table tb add column f float -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi - -print ======== step7 -sql alter table tb add column g double -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi - -print ======== step8 -sql alter table tb add column h binary(10) -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi - -print ======== step9 -print ======== step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 -system sh/exec.sh -n dnode1 -s start -sleep 3000 - -sql use d1 -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != b then - return -1 -endi -if $data21 != SMALLINT then - return -1 -endi -if $data30 != c then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data40 != d then - return -1 -endi -if $data41 != INT then - return -1 -endi -if $data50 != e then - return -1 -endi -if $data51 != BIGINT then - return -1 -endi -if $data60 != f then - return -1 -endi -if $data61 != FLOAT then - return -1 -endi -if $data70 != g then - return -1 -endi -if $data71 != DOUBLE then - return -1 -endi -if $data80 != h then - return -1 -endi -if $data81 != BINARY then - return -1 -endi -if $data82 != 10 then - return -1 -endi - -print ======== step11 -sql alter table drop column a -x step111 - return -1 -step111: - -sql alter table drop column ts -x step112 - return -1 -step112: - -sql alter table drop column cdfg -x step113 - return -1 -step113: - -sql alter table add column a -x step114 - return -1 -step114: - -sql alter table add column b -x step115 - return -1 -step115: - -print ======== step12 -sql alter table tb drop column b -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != c then - return -1 -endi -if $data21 != TINYINT then - return -1 -endi -if $data30 != d then - return -1 -endi -if $data31 != INT then - return -1 -endi -if $data40 != e then - return -1 -endi -if $data41 != BIGINT then - return -1 -endi -if $data50 != f then - return -1 -endi -if $data51 != FLOAT then - return -1 -endi -if $data60 != g then - return -1 -endi -if $data61 != DOUBLE then - return -1 -endi -if $data70 != h then - return -1 -endi -if $data71 != BINARY then - return -1 -endi -if $data72 != 10 then - return -1 -endi - -print ======== step13 -sql alter table tb drop column c -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != d then - return -1 -endi -if $data21 != INT then - return -1 -endi -if $data30 != e then - return -1 -endi -if $data31 != BIGINT then - return -1 -endi -if $data40 != f then - return -1 -endi -if $data41 != FLOAT then - return -1 -endi -if $data50 != g then - return -1 -endi -if $data51 != DOUBLE then - return -1 -endi -if $data60 != h then - return -1 -endi -if $data61 != BINARY then - return -1 -endi -if $data62 != 10 then - return -1 -endi - -print ======== step14 -sql alter table tb drop column d -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != e then - return -1 -endi -if $data21 != BIGINT then - return -1 -endi -if $data30 != f then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data40 != g then - return -1 -endi -if $data41 != DOUBLE then - return -1 -endi -if $data50 != h then - return -1 -endi -if $data51 != BINARY then - return -1 -endi -if $data52 != 10 then - return -1 -endi - -print ======== step15 -sql alter table tb drop column e -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != f then - return -1 -endi -if $data21 != FLOAT then - return -1 -endi -if $data30 != g then - return -1 -endi -if $data31 != DOUBLE then - return -1 -endi -if $data40 != h then - return -1 -endi -if $data41 != BINARY then - return -1 -endi -if $data42 != 10 then - return -1 -endi - -print ======== step16 -sql alter table tb drop column f -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != g then - return -1 -endi -if $data21 != DOUBLE then - return -1 -endi -if $data30 != h then - return -1 -endi -if $data31 != BINARY then - return -1 -endi -if $data32 != 10 then - return -1 -endi - -print ======== step17 -sql alter table tb drop column g -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != h then - return -1 -endi -if $data21 != BINARY then - return -1 -endi -if $data22 != 10 then - return -1 -endi - -print ============= step18 -sql alter table tb drop column h -sql describe tb -if $data00 != ts then - return -1 -endi -if $data01 != TIMESTAMP then - return -1 -endi -if $data10 != a then - return -1 -endi -if $data11 != INT then - return -1 -endi -if $data20 != null then - return -1 -endi - -print ======= over -sql drop database d1 -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/compute/avg.sim b/tests/script/windows/compute/avg.sim deleted file mode 100644 index 7445808db5..0000000000 --- a/tests/script/windows/compute/avg.sim +++ /dev/null @@ -1,158 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_av_db -$tbPrefix = m_av_tb -$mtPrefix = m_av_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select avg(tbcol) from $tb -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -print =============== step3 -sql select avg(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -sql select avg(tbcol) as b from $tb -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -print =============== step5 -sql select avg(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data11 != 1.000000000 then - return -1 -endi - -sql select avg(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 9.500000000 then - return -1 -endi - -print =============== step6 -sql select avg(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data41 != 4.000000000 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select avg(tbcol) from $mt -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -print =============== step8 -sql select avg(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select avg(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -sql select avg(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step9 -sql select avg(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1.000000000 then - return -1 -endi - -sql select avg(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 9.500000000 then - return -1 -endi - -print =============== step10 -sql select avg(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 9.500000000 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select avg(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1.000000000 then - return -1 -endi -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/bottom.sim b/tests/script/windows/compute/bottom.sim deleted file mode 100644 index 18f6c0bd09..0000000000 --- a/tests/script/windows/compute/bottom.sim +++ /dev/null @@ -1,99 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_bo_db -$tbPrefix = m_bo_tb -$mtPrefix = m_bo_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select bottom(tbcol, 1) from $tb -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step3 -sql select bottom(tbcol, 1) from $tb where ts > now + 4m -print ===> $data01 -if $data01 != 5 then - return -1 -endi - -print =============== step4 -sql select bottom(tbcol, 1) as b from $tb -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step5 -sql select bottom(tbcol, 2) as b from $tb -print ===> $data01 $data11 -if $data01 != 0 then - return -1 -endi -if $data11 != 1 then - return -1 -endi - -print =============== step6 -sql select bottom(tbcol, 2) as b from $tb where ts > now + 4m -print ===> $data01 $data11 -if $data01 != 5 then - return -1 -endi -if $data11 != 6 then - return -1 -endi - -sql select bottom(tbcol, 122) as b from $tb -x step6 - return -1 -step6: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/count.sim b/tests/script/windows/compute/count.sim deleted file mode 100644 index 227b49a8bd..0000000000 --- a/tests/script/windows/compute/count.sim +++ /dev/null @@ -1,174 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_co_db -$tbPrefix = m_co_tb -$mtPrefix = m_co_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - - -sql select count(*) from $tb -print ===> select count(*) from $tb => $data00 -if $data00 != $rowNum then - return -1 -endi - -sql select count(tbcol) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step3 -sql select count(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol) as b from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi - -sql select count(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != $rowNum then - return -1 -endi - -print =============== step6 -sql select count(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(*) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -sql select count(tbcol) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -print =============== step8 -sql select count(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 25 then - return -1 -endi - -print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) -print ===> $data01 -if $data01 != 10 then - return -1 -endi -if $data11 != 10 then - return -1 -endi - -sql select count(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 200 then - return -1 -endi - -print =============== step10 -sql select count(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/diff.sim b/tests/script/windows/compute/diff.sim deleted file mode 100644 index bdc5a0e3d8..0000000000 --- a/tests/script/windows/compute/diff.sim +++ /dev/null @@ -1,91 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_di_db -$tbPrefix = m_di_tb -$mtPrefix = m_di_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select diff(tbcol) from $tb -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -print =============== step3 -sql select diff(tbcol) from $tb where ts > now + 4m -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select diff(tbcol) from $tb where ts < now + 4m -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -print =============== step4 -sql select diff(tbcol) as b from $tb -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -print =============== step5 -sql select diff(tbcol) as b from $tb interval(1m) -x step5 - return -1 -step5: - -print =============== step6 -sql select diff(tbcol) as b from $tb where ts < now + 4m interval(1m) -x step6 - return -1 -step6: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/first.sim b/tests/script/windows/compute/first.sim deleted file mode 100644 index a83939c2a6..0000000000 --- a/tests/script/windows/compute/first.sim +++ /dev/null @@ -1,160 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_fi_db -$tbPrefix = m_fi_tb -$mtPrefix = m_fi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select first(tbcol) from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step3 -sql select first(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step4 -sql select first(tbcol) as b from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step5 -sql select first(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -sql select first(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step6 -sql select first(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data41 != 4 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select first(tbcol) from $mt -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step8 -sql select first(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select first(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select first(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step9 -sql select first(tbcol) as b from $mt interval(1m) -print select first(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select first(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step10 -sql select first(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select first(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/interval.sim b/tests/script/windows/compute/interval.sim deleted file mode 100644 index feacce1606..0000000000 --- a/tests/script/windows/compute/interval.sim +++ /dev/null @@ -1,176 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_in_db -$tbPrefix = m_in_tb -$mtPrefix = m_in_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m) -print ===> $rows -if $rows < $rowNum then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi - -print =============== step3 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now + 4m interval(1m) -print ===> $rows -if $rows > 10 then - return -1 -endi -if $rows < 3 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now-1m interval(1m) -print ===> $rows -if $rows < 18 then - return -1 -endi -if $rows > 22 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data05 != 1 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now+1m interval(1m) fill(value,0) -print ===> $rows -if $rows < 30 then - return -1 -endi -if $rows > 50 then - return -1 -endi -if $data21 != 1 then - return -1 -endi -if $data25 != 1 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m) -print ===> $rows -if $rows < 18 then - return -1 -endi -if $rows > 22 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now + 4m interval(1m) -print ===> $rows -if $rows < 3 then - return -1 -endi -if $rows > 7 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now-1m interval(1m) -print ===> $rows -if $rows < 18 then - return -1 -endi -if $rows > 22 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now+1m interval(1m) fill(value, 0) -if $rows < 30 then - return -1 -endi -if $rows > 50 then - return -1 -endi -if $data11 > 15 then - return -1 -endi -if $data11 < 5 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/last.sim b/tests/script/windows/compute/last.sim deleted file mode 100644 index 379a5ae64a..0000000000 --- a/tests/script/windows/compute/last.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_la_db -$tbPrefix = m_la_tb -$mtPrefix = m_la_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select last(tbcol) from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step3 -sql select last(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step4 -sql select last(tbcol) as b from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step5 -sql select last(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select last(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step6 -sql select last(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select last(tbcol) from $mt -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step8 -sql select last(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -sql select last(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -sql select last(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step9 -sql select last(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select last(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step10 -sql select last(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select last(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/leastsquare.sim b/tests/script/windows/compute/leastsquare.sim deleted file mode 100644 index 20353a409e..0000000000 --- a/tests/script/windows/compute/leastsquare.sim +++ /dev/null @@ -1,102 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_le_db -$tbPrefix = m_le_tb -$mtPrefix = m_le_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db keep 36500 -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 2 - $ms = 1000 - while $x < $rowNum - $ms = $ms + 1000 - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select leastsquares(tbcol, 1, 1) from $tb -print ===> $data00 -if $data00 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step3 -sql select leastsquares(tbcol, 1, 1) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step4 -sql select leastsquares(tbcol, 1, 1) as b from $tb -print ===> $data00 -if $data00 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step5 -print select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) -sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1m) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) -sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi - -print =============== step6 -sql select leastsquares(tbcol, 1, 1) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then - return -1 -endi -print ===> $rows -if $rows != 1 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/compute/max.sim b/tests/script/windows/compute/max.sim deleted file mode 100644 index 641b31fe36..0000000000 --- a/tests/script/windows/compute/max.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_ma_db -$tbPrefix = m_ma_tb -$mtPrefix = m_ma_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select max(tbcol) from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step3 -sql select max(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step4 -sql select max(tbcol) as b from $tb -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step5 -sql select max(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select max(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step6 -sql select max(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select max(tbcol) from $mt -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -print =============== step8 -sql select max(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -sql select max(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -sql select max(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 4 then - return -1 -endi - -print =============== step9 -sql select max(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select max(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step10 -sql select max(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 19 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select max(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/min.sim b/tests/script/windows/compute/min.sim deleted file mode 100644 index 3528f573ce..0000000000 --- a/tests/script/windows/compute/min.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mi_db -$tbPrefix = m_mi_tb -$mtPrefix = m_mi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select min(tbcol) from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step3 -sql select min(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step4 -sql select min(tbcol) as b from $tb -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step5 -sql select min(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select min(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step6 -sql select min(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select min(tbcol) from $mt -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step8 -sql select min(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select min(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -sql select min(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -print =============== step9 -sql select min(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select min(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 0 then - return -1 -endi - -print =============== step10 -sql select min(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 0 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select min(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then - return -1 -endi -print ===> $rows -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/percentile.sim b/tests/script/windows/compute/percentile.sim deleted file mode 100644 index fa6212f013..0000000000 --- a/tests/script/windows/compute/percentile.sim +++ /dev/null @@ -1,116 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_pe_db -$tbPrefix = m_pe_tb -$mtPrefix = m_pe_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select percentile(tbcol, 10) from $tb -print ===> $data00 -if $data00 != 1.900000000 then - return -1 -endi - -sql select percentile(tbcol, 20) from $tb -print ===> $data00 -if $data00 != 3.800000000 then - return -1 -endi - -sql select percentile(tbcol, 100) from $tb -print ===> $data00 -if $data00 != 19.000000000 then - return -1 -endi - -sql select percentile(tbcol, 110) from $tb -x step2 - return -1 -step2: - -print =============== step3 -sql select percentile(tbcol, 1) from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.140000000 then - return -1 -endi - -sql select percentile(tbcol, 5) from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.700000000 then - return -1 -endi - -sql select percentile(tbcol, 0) from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -print =============== step4 -sql select percentile(tbcol, 1) as c from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.140000000 then - return -1 -endi - -sql select percentile(tbcol, 5) as c from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.700000000 then - return -1 -endi - -sql select percentile(tbcol, 0) as c from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/stddev.sim b/tests/script/windows/compute/stddev.sim deleted file mode 100644 index eea6c8aa05..0000000000 --- a/tests/script/windows/compute/stddev.sim +++ /dev/null @@ -1,98 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_st_db -$tbPrefix = m_st_tb -$mtPrefix = m_st_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select stddev(tbcol) from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step3 -sql select stddev(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 1.414213562 then - return -1 -endi - -print =============== step4 -sql select stddev(tbcol) as b from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step5 -sql select stddev(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - return -1 -endi - -sql select stddev(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 5.766281297 then - return -1 -endi - -print =============== step6 -sql select stddev(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/sum.sim b/tests/script/windows/compute/sum.sim deleted file mode 100644 index a429ce99e0..0000000000 --- a/tests/script/windows/compute/sum.sim +++ /dev/null @@ -1,159 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_su_db -$tbPrefix = m_su_tb -$mtPrefix = m_su_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select sum(tbcol) from $tb -print ===> $data00 -if $data00 != 190 then - return -1 -endi - -print =============== step3 -sql select sum(tbcol) from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 10 then - return -1 -endi - -print =============== step4 -sql select sum(tbcol) as b from $tb -print ===> $data00 -if $data00 != 190 then - return -1 -endi - -print =============== step5 -sql select sum(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi - -sql select sum(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 190 then - return -1 -endi - -print =============== step6 -sql select sum(tbcol) as b from $tb where ts < now + 4m interval(1m) -print ===> $data11 -if $data11 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select sum(tbcol) from $mt -print ===> $data00 -if $data00 != 1900 then - return -1 -endi - -print =============== step8 -sql select sum(tbcol) as c from $mt where ts < now + 4m -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select sum(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 950 then - return -1 -endi - -sql select sum(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select sum(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 < 5 then - return -1 -endi - -sql select sum(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 1900 then - return -1 -endi - -print =============== step10 -sql select sum(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != 190 then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol -print select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol -print ===> $data01 -if $data01 != 10 then - return -1 -endi -if $rows != 10 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/compute/top.sim b/tests/script/windows/compute/top.sim deleted file mode 100644 index 65e448b0fa..0000000000 --- a/tests/script/windows/compute/top.sim +++ /dev/null @@ -1,99 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_to_db -$tbPrefix = m_to_tb -$mtPrefix = m_to_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select top(tbcol, 1) from $tb -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step3 -sql select top(tbcol, 1) from $tb where ts < now + 4m -print ===> $data01 -if $data01 != 4 then - return -1 -endi - -print =============== step4 -sql select top(tbcol, 1) as b from $tb -print ===> $data01 -if $data01 != 19 then - return -1 -endi - -print =============== step5 -sql select top(tbcol, 2) as b from $tb -print ===> $data01 $data11 -if $data01 != 18 then - return -1 -endi -if $data11 != 19 then - return -1 -endi - -print =============== step6 -sql select top(tbcol, 2) as b from $tb where ts < now + 4m -print ===> $data01 $data11 -if $data01 != 3 then - return -1 -endi -if $data11 != 4 then - return -1 -endi - -sql select top(tbcol, 122) as b from $tb -x step6 - return -1 -step6: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/db/basic.sim b/tests/script/windows/db/basic.sim deleted file mode 100644 index 1f0fc31a6b..0000000000 --- a/tests/script/windows/db/basic.sim +++ /dev/null @@ -1,193 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print ============================ dnode1 start - -$i = 0 -$dbPrefix = ob_db_db -$tbPrefix = ob_db_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db replica 1 duration 20 keep 2000 cache 16 -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 -if $data00 != $db then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0 then - return -1 -endi -if $data04 != 1 then - return -1 -endi -if $data06 != 20 then - return -1 -endi -if $data08 != 16 then - return -1 -endi - -print =============== step2 -sql create database $db -sql show databases -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql_error drop database $db - -print =============== step5 -sql create database $db replica 1 duration 15 keep 1500 -sql show databases -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 -if $data00 != $db then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 0 then - return -1 -endi -if $data04 != 1 then - return -1 -endi -if $data06 != 15 then - return -1 -endi - -print =============== step6 -sql use $db -sql create table $tb (ts timestamp, speed int) -$i = 1 -while $i < 4 - $db = $dbPrefix . $i - $tb = $tbPrefix . $i - sql create database $db - sql use $db - sql create table $tb (ts timestamp, speed int) - $i = $i + 1 -endw - -sql show databases -if $rows != 4 then - return -1 -endi - -$i = 4 -$db = $dbPrefix . $i -$tb = $tbPrefix . $i -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -print =============== step7 -$i = 0 -while $i < 5 - $db = $dbPrefix . $i - sql drop database $db - $i = $i + 1 -endw - -print =============== step8 -$i = 0 -$db = $dbPrefix . $i -$tb = $tbPrefix . $i -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -print =============== step9 -sql drop database $db - -print =============== step10 -sql create database $db -sql use $db -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step11 -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -print =============== step12 -sql drop database $db - -print =============== step13 -sql create database $db -sql use $db -sql show tables -if $rows != 0 then - return -1 -endi -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi -sql insert into $tb values (now+1a, 0) -sql insert into $tb values (now+2a, 1) -sql insert into $tb values (now+3a, 2) -sql insert into $tb values (now+4a, 3) -sql insert into $tb values (now+5a, 4) -sql select * from $tb -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql drop database $db - -print =============== step15 -sql create database $db -sql use $db -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step16 -sql create table $tb (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi -sql select * from $tb -if $rows != 0 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/db/len.sim b/tests/script/windows/db/len.sim deleted file mode 100644 index 3356165117..0000000000 --- a/tests/script/windows/db/len.sim +++ /dev/null @@ -1,92 +0,0 @@ -sleep 2000 -sql connect - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -print =============== step1 -sql_error drop database dd - -sql create database -x step1 - return -1 -step1: - -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create database a -sql show databases -if $rows != 1 then - return -1 -endi - -sql drop database a -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create database a12345678 -sql show databases -if $rows != 1 then - return -1 -endi - -sql drop database a12345678 -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create database a012345678901201234567890120123456789012a012345678901201234567890120123456789012 -x step4 - return -1 -step4: -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step5 -sql create database a;1 -sql drop database a -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step6 -sql create database a'1 -x step6 - return -1 -step6: - -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step7 -sql create database (a) -x step7 - return -1 -step7: -sql show databases -if $rows != 0 then - return -1 -endi - -print =============== step8 -sql create database a.1 -x step8 - return -1 -step8: -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/2.sim b/tests/script/windows/field/2.sim deleted file mode 100644 index e258fbe80e..0000000000 --- a/tests/script/windows/field/2.sim +++ /dev/null @@ -1,295 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_bt_db -$tbPrefix = fi_bt_tb -$mtPrefix = fi_bt_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol2 bool, tbcol int) TAGS(tgcol bool, tgcol2 int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 and tbcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 interval(1d) group by tgcol order by tgcol desc -print $db -print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/3.sim b/tests/script/windows/field/3.sim deleted file mode 100644 index e3fe0b0b11..0000000000 --- a/tests/script/windows/field/3.sim +++ /dev/null @@ -1,521 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_3_db -$tbPrefix = fi_3_tb -$mtPrefix = fi_3_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 smallint, tbcol2 int, tbcol3 float) TAGS(tgcol1 smallint, tgcol2 int, tgcol3 float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step14 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step15 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step16 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step17 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step18 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step19 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/4.sim b/tests/script/windows/field/4.sim deleted file mode 100644 index aabfe2be2c..0000000000 --- a/tests/script/windows/field/4.sim +++ /dev/null @@ -1,711 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_4_db -$tbPrefix = fi_4_tb -$mtPrefix = fi_4_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 smallint, tbcol2 bigint, tbcol3 float, tbcol4 double) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 float, tgcol4 double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tbcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step19 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step20 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step21 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step22 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/5.sim b/tests/script/windows/field/5.sim deleted file mode 100644 index 874730ff1c..0000000000 --- a/tests/script/windows/field/5.sim +++ /dev/null @@ -1,834 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_5_db -$tbPrefix = fi_5_tb -$mtPrefix = fi_5_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 tinyint, tbcol2 int, tbcol3 bigint, tbcol4 double, tbcol5 smallint) TAGS(tgcol1 tinyint, tgcol2 int, tgcol3 bigint, tgcol4 double, tgcol5 smallint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tbcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tbcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step22 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step25 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step26 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step27 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 interval(1d) group by tgcol5 order by tgcol5 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/6.sim b/tests/script/windows/field/6.sim deleted file mode 100644 index 77277df35b..0000000000 --- a/tests/script/windows/field/6.sim +++ /dev/null @@ -1,989 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_6_db -$tbPrefix = fi_6_tb -$mtPrefix = fi_6_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol1 smallint, tbcol2 bigint, tbcol3 smallint, tbcol4 bigint, tbcol5 float, tbcol6 bool) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 smallint, tgcol4 bigint, tgcol5 float, tgcol6 bool) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0, 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1, 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tbcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tbcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tbcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tbcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where tbcol6 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol6 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol6 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol6 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tbcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol6 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step22 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step23 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step24 -sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 and tbcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 and tbcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step25 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step26 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step27 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step28 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt group by tgcol6 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step29 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step30 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step31 -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol1 order by tgcol1 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol2 order by tgcol2 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 interval(1d) group by tgcol3 order by tgcol3 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 interval(1d) group by tgcol4 order by tgcol4 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 interval(1d) group by tgcol5 order by tgcol5 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 interval(1d) group by tgcol6 order by tgcol6 desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/bigint.sim b/tests/script/windows/field/bigint.sim deleted file mode 100644 index f912ee968b..0000000000 --- a/tests/script/windows/field/bigint.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_bi_db -$tbPrefix = fi_bi_tb -$mtPrefix = fi_bi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol bigint) TAGS(tgcol bigint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/binary.sim b/tests/script/windows/field/binary.sim deleted file mode 100644 index aa641878e4..0000000000 --- a/tests/script/windows/field/binary.sim +++ /dev/null @@ -1,77 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_by_db -$tbPrefix = fi_by_tb -$mtPrefix = fi_by_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol binary(10)) TAGS(tgcol binary(10)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , '0' ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , '1' ) - $x = $x + 1 - endw - $i = $i + 1 -endw - - -print =============== step2 - -sql select * from $mt where tbcol = '0' -if $rows != 100 then - return -1 -endi - -sql select * from $mt where ts > now + 4m and tbcol = '1' -if $rows != 75 then - return -1 -endi - -print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' -sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol -sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol -sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol - -#can't filter binary fields - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/bool.sim b/tests/script/windows/field/bool.sim deleted file mode 100644 index 3ef56a1d95..0000000000 --- a/tests/script/windows/field/bool.sim +++ /dev/null @@ -1,161 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_bo_db -$tbPrefix = fi_bo_tb -$mtPrefix = fi_bo_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol bool) TAGS(tgcol bool) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true interval(1d) group by tgcol order by tgcol desc -print select count(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = true interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/double.sim b/tests/script/windows/field/double.sim deleted file mode 100644 index ef404d28dc..0000000000 --- a/tests/script/windows/field/double.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_do_db -$tbPrefix = fi_do_tb -$mtPrefix = fi_do_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol double) TAGS(tgcol double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/float.sim b/tests/script/windows/field/float.sim deleted file mode 100644 index 8435f31c1f..0000000000 --- a/tests/script/windows/field/float.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_fl_db -$tbPrefix = fi_fl_tb -$mtPrefix = fi_fl_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol float) TAGS(tgcol float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/int.sim b/tests/script/windows/field/int.sim deleted file mode 100644 index 781b939484..0000000000 --- a/tests/script/windows/field/int.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_in_db -$tbPrefix = fi_in_tb -$mtPrefix = fi_in_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/single.sim b/tests/script/windows/field/single.sim deleted file mode 100644 index b6b4402091..0000000000 --- a/tests/script/windows/field/single.sim +++ /dev/null @@ -1,218 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_si_db -$tbPrefix = fi_si_tb -$mtPrefix = fi_si_mt -$rowNum = 20 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql create database $db -sql use $db -sql create table $tb (ts timestamp, tbcol int) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - -print =============== step2 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi - -sql select * from $tb where tbcol = 10 -if $rows != 1 then - return -1 -endi -if $data01 != 10 then - return -1 -endi - -sql select * from $tb where tbcol = 8 -if $rows != 1 then - return -1 -endi -if $data01 != 8 then - return -1 -endi - -sql select * from $tb where tbcol < 10 -if $rows != 10 then - return -1 -endi -if $data91 != 9 then - return -1 -endi - -sql select * from $tb where tbcol <= 10 -if $rows != 11 then - return -1 -endi -if $data81 != 8 then - return -1 -endi - -sql select * from $tb where tbcol > 10 -if $rows != 9 then - return -1 -endi -if $data81 != 19 then - return -1 -endi - -sql select * from $tb where tbcol > 10 order by ts asc -if $rows != 9 then - return -1 -endi -if $data01 != 11 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and tbcol > 5 order by ts desc -if $rows != 4 then - return -1 -endi -if $data01 != 9 then - return -1 -endi -if $data31 != 6 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and tbcol > 5 order by ts asc -if $rows != 4 then - return -1 -endi -if $data01 != 6 then - return -1 -endi -if $data31 != 9 then - return -1 -endi - -sql select * from $tb where tbcol > 10 and tbcol < 5 order by ts asc -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi - -sql select * from $tb where tbcol = 10 and ts < now + 4m -print select * from $tb where tbcol = 10 and ts < now + 4m -if $rows != 0 then - return -1 -endi - -sql select * from $tb where tbcol = 4 and ts < now + 4m order by ts desc -if $rows != 1 then - return -1 -endi -if $data01 != 4 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and ts < now + 4m order by ts desc -if $rows != 5 then - return -1 -endi -if $data01 != 4 then - return -1 -endi - -sql select * from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m order by ts desc -print $rows $data00 $data01 -if $rows != 1 then - return -1 -endi -if $data01 != 5 then - return -1 -endi - -print =============== step4 -sql select count(*) from $tb -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from $tb where tbcol = 10 -if $data00 != 1 then - return -1 -endi - -#sql select count(*) from $tb where tbcol = 8 or tbcol = 9 -#if $data00 != 2 then -# return -1 -#endi - -sql select count(*) from $tb where tbcol < 10 -if $data00 != 10 then - return -1 -endi - -sql select count(*) from $tb where tbcol <= 10 -if $data00 != 11 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and tbcol > 5 -if $data00 != 4 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and tbcol > 5 order by ts asc -x step4 -# return -1 -step4: - -print =============== step5 -sql select count(*) from $tb where ts < now + 4m -if $data00 != 5 then - return -1 -endi - -#sql select count(*) from $tb where tbcol = 10 and ts < now + 4m -#if $data00 != 0 then -# return -1 -#endi - -sql select count(*) from $tb where tbcol = 4 and ts < now + 4m -if $data00 != 1 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and ts < now + 4m -if $data00 != 5 then - return -1 -endi - -sql select count(*) from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m -if $data00 != 1 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/smallint.sim b/tests/script/windows/field/smallint.sim deleted file mode 100644 index 5f1839226b..0000000000 --- a/tests/script/windows/field/smallint.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_sm_db -$tbPrefix = fi_sm_tb -$mtPrefix = fi_sm_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol smallint) TAGS(tgcol smallint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/field/tinyint.sim b/tests/script/windows/field/tinyint.sim deleted file mode 100644 index c90ff3f932..0000000000 --- a/tests/script/windows/field/tinyint.sim +++ /dev/null @@ -1,160 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = fi_ti_db -$tbPrefix = fi_ti_tb -$mtPrefix = fi_ti_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol tinyint) TAGS(tgcol tinyint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 0 ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , 1 ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tbcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step3 -sql select * from $mt where ts > now + 4m and tbcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tbcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 interval(1d) group by tgcol order by tgcol desc -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/import/basic.sim b/tests/script/windows/import/basic.sim deleted file mode 100644 index ee19893ae2..0000000000 --- a/tests/script/windows/import/basic.sim +++ /dev/null @@ -1,125 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -sql create database ibadb -sql use ibadb -sql create table tb(ts timestamp, i int) - -print ================= step1 - -sql import into tb values(1564641710000, 10000) -sql select * from tb; -if $rows != 1 then - return -1 -endi - -print ================= step2 -sql insert into tb values(1564641708000, 8000) -sql select * from tb; -if $rows != 2 then - return -1 -endi - -print ================= step3 -sql insert into tb values(1564641720000, 20000) -sql select * from tb; -if $rows != 3 then - return -1 -endi - -print ================= step4 -sql import into tb values(1564641708000, 8000) -sql import into tb values(1564641715000, 15000) -sql import into tb values(1564641730000, 30000) -sql select * from tb; -if $rows != 5 then - return -1 -endi - -print ================= step5 -sql insert into tb values(1564641708000, 8000) -sql insert into tb values(1564641714000, 14000) -sql insert into tb values(1564641725000, 25000) -sql insert into tb values(1564641740000, 40000) -sql select * from tb; -if $rows != 8 then - return -1 -endi - -print ================= step6 -sql import into tb values(1564641707000, 7000) -sql import into tb values(1564641712000, 12000) -sql import into tb values(1564641723000, 23000) -sql import into tb values(1564641734000, 34000) -sql import into tb values(1564641750000, 50000) -sql select * from tb; -if $rows != 13 then - return -1 -endi - -print ================= step7 -sql import into tb values(1564641707001, 7001) -sql import into tb values(1564641712001, 12001) -sql import into tb values(1564641723001, 23001) -sql import into tb values(1564641734001, 34001) -sql import into tb values(1564641750001, 50001) -sql select * from tb; -if $rows != 18 then - return -1 -endi - -print ================= step8 -sql insert into tb values(1564641708002, 8002) -sql insert into tb values(1564641714002, 14002) -sql insert into tb values(1564641725002, 25002) -sql insert into tb values(1564641900000, 200000) -sql select * from tb; -if $rows != 22 then - return -1 -endi - -print ================= step9 only insert last one -sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 700000) -sql select * from tb; -if $rows != 25 then - return -1 -endi - -print ================= step10 -sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 70000) -sql select * from tb; -if $rows != 25 then - return -1 -endi - -print ================= step11 -sql import into tb values(1564642400000, 700000) -sql select * from tb; -if $rows != 25 then - return -1 -endi - -print ================= step12 -sql import into tb values(1564641709527, 9527)(1564641709527, 9528) -sql select * from tb; -print rows=> $rows -if $rows != 26 then - return -1 -endi - -print ================= step13 -sql import into tb values(1564641709898, 9898)(1564641709897, 9897) -sql select * from tb; -print rows=> $rows -if $rows != 28 then - return -1 -endi - -sql drop database ibadb \ No newline at end of file diff --git a/tests/script/windows/insert/basic.sim b/tests/script/windows/insert/basic.sim deleted file mode 100644 index a516f80e10..0000000000 --- a/tests/script/windows/insert/basic.sim +++ /dev/null @@ -1,49 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_in_db -$tbPrefix = tb_in_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -$x = 0 -while $x < 10 - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -print =============== step 2 -sql insert into $tb values (now - 5m , 10) -sql insert into $tb values (now - 6m , 10) -sql insert into $tb values (now - 7m , 10) -sql insert into $tb values (now - 8m , 10) - -sql select * from $tb - -print $rows points data are retrieved -if $rows != 14 then - return -1 -endi - -sql drop database $db -sleep 1000 -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/insert/query_block1_file.sim b/tests/script/windows/insert/query_block1_file.sim deleted file mode 100644 index 62b74ac19c..0000000000 --- a/tests/script/windows/insert/query_block1_file.sim +++ /dev/null @@ -1,195 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_1f_db -$tbPrefix = tb_1f_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -#commit to file will trigger if insert 82 rows - -$N = 82 - -print =============== step 1 -$x = $N -$y = $N / 2 -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $x ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $y then - return -1 -endi - -$x = $N / 2 -$y = $N -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $N then - return -1 -endi - -print =============== step 2 - -$R = 4 -$x = $N * 2 -$y = $N * $R -$expect = $y + $N -$y = $y + $x -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -print =============== step 3 - -$N1 = $N + 1 -$result1 = $N / 2 -$result2 = $N -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/insert/query_block1_memory.sim b/tests/script/windows/insert/query_block1_memory.sim deleted file mode 100644 index 6c3e58d70e..0000000000 --- a/tests/script/windows/insert/query_block1_memory.sim +++ /dev/null @@ -1,177 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_1m_db -$tbPrefix = tb_1m_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -sql create table $tb (ts timestamp, speed int) - -#commit to file will trigger if insert 82 rows - -$N = 82 - -print =============== step 1 -$x = $N -$y = $N / 2 -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , -$x ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $y then - return -1 -endi - -$x = $N / 2 -$y = $N -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $N then - return -1 -endi - -print =============== step 2 - -$N1 = $N + 1 -$result1 = $N / 2 -$result2 = $N -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/insert/query_block2_file.sim b/tests/script/windows/insert/query_block2_file.sim deleted file mode 100644 index 164c8a1124..0000000000 --- a/tests/script/windows/insert/query_block2_file.sim +++ /dev/null @@ -1,210 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_2f_db -$tbPrefix = tb_2f_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $tb (ts timestamp, speed int) -x create1 - -#commit to file will trigger if insert 82 rows -$N = 82 - -print =============== step 1 -$x = $N * 2 -$y = $N -$expect = $N -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $xt ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -$x = $N -$y = $N * 2 -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -print =============== step 2 - -$R = 4 -$y = $N * $R - -$expect = $y + $N -$expect = $expect + $N - -$x = $N * 3 -$y = $y + $x - -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - - -print =============== step 2 - -$N2 = $N -$result1 = $N -$result2 = 2 * $N -$N1 = $result2 + 1 -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/insert/query_block2_memory.sim b/tests/script/windows/insert/query_block2_memory.sim deleted file mode 100644 index f3ceb503ac..0000000000 --- a/tests/script/windows/insert/query_block2_memory.sim +++ /dev/null @@ -1,172 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_2m_db -$tbPrefix = tb_2m_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed int) - -$N = 82 - -$x = $N * 2 -$y = $N -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $xt ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $y then - return -1 -endi - -$x = $N -$y = $N * 2 -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -print =============== step 2 - -$result1 = $N -$result2 = $N * 2 - -$N1 = $result2 + 1 -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/insert/query_file_memory.sim b/tests/script/windows/insert/query_file_memory.sim deleted file mode 100644 index d9752c40c9..0000000000 --- a/tests/script/windows/insert/query_file_memory.sim +++ /dev/null @@ -1,209 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_fm_db -$tbPrefix = tb_fm_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $tb (ts timestamp, speed int) -x create1 - -#commit to file will trigger if insert 82 rows - -$N = 82 - -$x = $N * 2 -$y = $N -$expect = $y -while $x > $y - $ms = $x . m - $xt = - . $x - sql insert into $tb values (now - $ms , $xt ) - $x = $x - 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -$x = $N -$y = $N * 2 -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - -$R = 4 -$R = $R - 1 - -$y = $N * $R -$expect = $y + $N -$expect = $expect + $N - -$x = $N * 3 -$y = $y + $x -while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $tb -print sql select * from $tb -> $rows points -if $rows != $expect then - return -1 -endi - - -print =============== step 2 - -$result1 = $N -$result2 = $N * 2 -$N1 = $result2 + 1 -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step - - -sql select * from $tb where ts < $start1 and ts > $end1 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 -print select * from $tb where ts < $start2 and ts > $end1 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 -print sql select * from $tb where ts < $start3 and ts > $end1 -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 -print sql select * from $tb where ts < $start3 and ts > $end2 -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 -if $rows != 0 then - return -1 -endi - -print ================= order by ts desc - -sql select * from $tb where ts < $start1 and ts > $end1 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start1 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end1 order by ts desc -print select * from $tb where ts < $start2 and ts > $end1 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end2 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start2 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end1 order by ts desc -> $rows points -if $rows != $result2 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -print sql select * from $tb where ts < $start3 and ts > $end2 order by ts desc -> $rows points -if $rows != $result1 then - return -1 -endi - -sql select * from $tb where ts < $start3 and ts > $end3 order by ts desc -if $rows != 0 then - return -1 -endi - -clear: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - diff --git a/tests/script/windows/insert/query_multi_file.sim b/tests/script/windows/insert/query_multi_file.sim deleted file mode 100644 index ba617ce63c..0000000000 --- a/tests/script/windows/insert/query_multi_file.sim +++ /dev/null @@ -1,55 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = tb_mf_db -$tbPrefix = tb_mf_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database -x step1 -step1: -sql create database $db -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $tb (ts timestamp, speed int) -x create1 - -$N = 20000 - -$x = 0 - -while $x < $N - $ms = $x . s - #print insert into $tb values (now + $ms , $x ) - sql insert into $tb values (now + $ms , $x ) -x error_insert - $x = $x + 1 -endw -error_insert: - -sql select * from $tb -print $rows points data are retrieved -> exepct $N rows -if $rows < $N then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - diff --git a/tests/script/windows/table/binary.sim b/tests/script/windows/table/binary.sim deleted file mode 100644 index 5efa0bc666..0000000000 --- a/tests/script/windows/table/binary.sim +++ /dev/null @@ -1,63 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_bn_db -$tbPrefix = lm_bn_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed binary(5)) - -sql insert into $tb values (now, ) -x step1 - return -1 -step1: - -print =============== step2 -sql insert into $tb values (now+1a, '1234') -sql select speed from $tb order by ts desc -if $rows != 1 then - return -1 -endi -if $data00 != 1234 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2a, '23456') -sql select speed from $tb order by ts desc -if $rows != 2 then - return -1 -endi -print ==> $data00 -if $data00 != 23456 then - return -1 -endi - -print =============== step4 -sql_error insert into $tb values (now+3a, '345678') -sql insert into $tb values (now+3a, '34567') -sql select speed from $tb order by ts desc -if $rows != 3 then - return -1 -endi -print ==> $data00 -if $data00 != 34567 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/bool.sim b/tests/script/windows/table/bool.sim deleted file mode 100644 index 0d185d31e8..0000000000 --- a/tests/script/windows/table/bool.sim +++ /dev/null @@ -1,92 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_bo_db -$tbPrefix = lm_bo_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -$x = 0 -sql create table $tb (ts timestamp, speed bool) - -sql insert into $tb values (now, true) -sql select * from $tb -if $rows != 1 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step2 -sql insert into $tb values (now+1m, 1) -sql select * from $tb order by ts desc -if $rows != 2 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2m, 2) -sql select * from $tb order by ts desc -if $rows != 3 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step4 -sql insert into $tb values (now+3m, 0) -sql select * from $tb order by ts desc -if $rows != 4 then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -print =============== step5 -sql insert into $tb values (now+4m, -1) -sql select * from $tb order by ts desc -if $rows != 5 then - return -1 -endi - -if $data01 != 1 then - return -1 -endi - -print =============== step6 -sql insert into $tb values (now+5m, false) -sql select * from $tb order by ts desc -if $rows != 6 then - return -1 -endi - -if $data01 != 0 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/column_name.sim b/tests/script/windows/table/column_name.sim deleted file mode 100644 index 6f9f954461..0000000000 --- a/tests/script/windows/table/column_name.sim +++ /dev/null @@ -1,91 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_cm_db -$tbPrefix = lm_cm_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql drop table dd -x step0 - return -1 -step0: - -sql create table $tb(ts timestamp, int) -x step1 - return -1 -step1: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table $tb (ts timestamp, s int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create table $tb (ts timestamp, a0123456789 int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table $tb (ts timestamp, a0123456789012345678901234567890123456789 int) -sql drop table $tb - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step5 -sql create table $tb (ts timestamp, a0123456789 int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql insert into $tb values (now , 1) -sql select * from $tb -if $rows != 1 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - - - diff --git a/tests/script/windows/table/column_num.sim b/tests/script/windows/table/column_num.sim deleted file mode 100644 index 395ee02cde..0000000000 --- a/tests/script/windows/table/column_num.sim +++ /dev/null @@ -1,86 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_cn_db -$tbPrefix = lm_cn_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql create table $tb() -x step1 - return -1 -step1: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table $tb (ts timestamp) -x step2 - return -1 -step2: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create table $tb (ts int) -x step3 - return -1 -step3: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table $tb (ts timestamp, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, a10 int, a11 int, a12 int, a13 int, a14 int, a15 int, a16 int, a17 int, a18 int, a19 int, a20 int, a21 int, a22 int, a23 int, a24 int, a25 int, a26 int, a27 int, a28 int,a29 int,a30 int,a31 int,a32 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int, b7 int, b8 int, b9 int, b10 int, b11 int, b12 int, b13 int, b14 int, b15 int, b16 int, b17 int, b18 int, b19 int, b20 int, b21 int, b22 int, b23 int, b24 int, b25 int, b26 int, b27 int, b28 int,b29 int,b30 int,b31 int,b32 int) - -sql show tables -if $rows != 1 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql create table $tb (ts timestamp, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, a10 int, a11 int, a12 int, a13 int, a14 int, a15 int, a16 int, a17 int, a18 int, a19 int, a20 int, a21 int, a22 int, a23 int, a24 int, a25 int, a26 int, a27 int, a28 int,a29 int,a30 int,a31 int,a32 int, b1 int, b2 int, b3 int, b4 int, b5 int) - -sql show tables -if $rows != 2 then - return -1 -endi - -sql insert into $tb values (now, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 ,26 , 27 ,28 ,29,30,31, 32, 33, 34, 35, 36, 37) -sql select * from $tb -if $rows != 1 then - return -1 -endi - -sql drop table $tb -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/column_value.sim b/tests/script/windows/table/column_value.sim deleted file mode 100644 index 8db85f16ad..0000000000 --- a/tests/script/windows/table/column_value.sim +++ /dev/null @@ -1,80 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_cv_db -$tbPrefix = lm_cv_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql create table $tb (ts timestamp, speed int, v1 binary(100), v2 binary(100), v3 binary(100), v4 binary(100), v5 binary(100)) -sql show tables -if $rows != 1 then - return -1 -endi -sql insert into $tb values(now, 1, '1', '2', '3', '4', '5') -sql insert into $tb values(now+1a, 1, '1', '2', '3', '4', '5') -sql select * from $tb -if $rows != 2 then - return -1 -endi -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table $tb (ts timestamp, speed bigint, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) -sql show tables -if $rows != 1 then - return -1 -endi -sql drop table $tb - -print =============== step3 -sql create table $tb (ts timestamp, speed float, v1 binary(100), v2 binary(100), v3 binary(100), v4 binary(100), v5 binary(100)) -sql show tables -if $rows != 1 then - return -1 -endi -sql insert into $tb values(now+2a, 1, '1', '2', '3', '4', '5') -sql insert into $tb values(now+3a, 1, '1', '2', '3', '4', '5') -sql select * from $tb -if $rows != 2 then - return -1 -endi -sql drop table $tb -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table $tb (ts timestamp, speed double, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - - - diff --git a/tests/script/windows/table/db.table.sim b/tests/script/windows/table/db.table.sim deleted file mode 100644 index 0e207c9982..0000000000 --- a/tests/script/windows/table/db.table.sim +++ /dev/null @@ -1,48 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - - -$i = 0 -$dbPrefix = lm_dt_db -$tbPrefix = lm_dt_tb -$db = $dbPrefix -$tb = $tbPrefix - -print =============== step1 -sql create database $db -$table = lm_dt_db.lm_dt_tb - -print =============== step2 -sql create table $table (ts timestamp, speed int) - -print =============== step3 -sql insert into $table values (now, 1) - -print =============== step4 -sql select * from $table -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -print =============== step5 -sql describe $table - -print =============== step6 -sql drop table $table - - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/table/double.sim b/tests/script/windows/table/double.sim deleted file mode 100644 index b88ac4a199..0000000000 --- a/tests/script/windows/table/double.sim +++ /dev/null @@ -1,98 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_do_db -$tbPrefix = lm_do_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed double) -#sql insert into $tb values (now, -1.79E+308) -x step1 -# return -1 -#step1: - -print =============== step2 -#sql insert into $tb values (now+1a, 1.79E+308) -x step2 -# return -1 -#step2: - -sql select * from $tb order by ts desc -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2a, 2.85) -sql select * from $tb order by ts desc -if $rows != 1 then - return -1 -endi -if $data01 != 2.850000000 then - return -1 -endi - -print =============== step4 -sql insert into $tb values (now+3a, 3.4) -sql select * from $tb order by ts desc -if $rows != 2 then - return -1 -endi -if $data01 != 3.400000000 then - return -1 -endi - -print =============== step5 -sql insert into $tb values (now+4a, a2) -x step51 - return -1 -step51: -sql insert into $tb values (now+4a, 0) -sql select * from $tb order by ts desc -if $rows != 3 then - return -1 -endi -if $data01 != 0.000000000 then - return -1 -endi - -print =============== step6 -sql insert into $tb values (now+5a, 2a) -x step6 - return -1 -step6: -sql insert into $tb values(now+5a, 2) -sql select * from $tb order by ts desc -if $rows != 4 then - return -1 -endi -if $data01 != 2.000000000 then - return -1 -endi - -print =============== step7 -sql insert into $tb values (now+6a, 2a'1) -x step7 - return -1 -step7: -sql insert into $tb values(now+6a, 2) -sql select * from $tb order by ts desc -if $rows != 5 then - return -1 -endi -if $data01 != 2.000000000 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/float.sim b/tests/script/windows/table/float.sim deleted file mode 100644 index 741525830d..0000000000 --- a/tests/script/windows/table/float.sim +++ /dev/null @@ -1,98 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_fl_db -$tbPrefix = lm_fl_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db -sql create table $tb (ts timestamp, speed float) -#sql insert into $tb values (now, -3.40E+38) -x step1 -# return -1 -#step1: - -print =============== step2 -#sql insert into $tb values (now+1a, 3.40E+308) -x step2 -# return -1 -#step2: - -sql select * from $tb order by ts desc -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql insert into $tb values (now+2a, 2.85) -sql select * from $tb order by ts desc -if $rows != 1 then - return -1 -endi -if $data01 != 2.85000 then - return -1 -endi - -print =============== step4 -sql insert into $tb values (now+3a, 3.4) -sql select * from $tb order by ts desc -if $rows != 2 then - return -1 -endi -if $data01 != 3.40000 then - return -1 -endi - -print =============== step5 -sql insert into $tb values (now+4a, a2) -x step5 - return -1 -step5: -sql insert into $tb values (now+4a, 0) -sql select * from $tb order by ts desc -if $rows != 3 then - return -1 -endi -if $data01 != 0.00000 then - return -1 -endi - -print =============== step6 -sql insert into $tb values (now+5a, 2a) -x step6 - return -1 -step6: -sql insert into $tb values (now+5a, 2) -sql select * from $tb order by ts desc -if $rows != 4 then - return -1 -endi -if $data01 != 2.00000 then - return -1 -endi - -print =============== step7 -sql insert into $tb values (now+6a, 2a'1) -x step7 - return -1 -step7: -sql insert into $tb values (now+6a, 2) -sql select * from $tb order by ts desc -if $rows != 5 then - return -1 -endi -if $data01 != 2.00000 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/table/table.sim b/tests/script/windows/table/table.sim deleted file mode 100644 index 13d1576277..0000000000 --- a/tests/script/windows/table/table.sim +++ /dev/null @@ -1,225 +0,0 @@ -sql connect -sleep 2000 -print ============================ dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = ob_tb_db -$tbPrefix = ob_tb_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql drop database $db -x step1 -step1: -sql create database $db - -print =============== step2-3-4 -sql use $db - -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val tinyint, val2 tinyint) -sql insert into $tb values(now, 1, 1) -sql select * from $tb -if $data01 != 1 then - return -1 -endi - -$i = 2 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val smallint, val2 smallint) -sql insert into $tb values(now, 2, 2) -sql select * from $tb -if $data01 != 2 then - return -1 -endi - -$i = 3 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val int, val2 int) -sql insert into $tb values(now, 3, 3) -sql select * from $tb -if $data01 != 3 then - return -1 -endi - -$i = 4 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val bigint, val2 bigint) -sql insert into $tb values(now, 4, 4) -sql select * from $tb -if $data01 != 4 then - return -1 -endi - -$i = 5 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val float, val2 float) -sql insert into $tb values(now, 5, 5) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 5.00000 then - return -1 -endi - -$i = 6 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val double, val2 double) -sql insert into $tb values(now, 6, 6) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 6.000000000 then - return -1 -endi - -$i = 7 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val binary(20), val2 binary(20)) -sql insert into $tb values(now, '7', '7') -sql select * from $tb -if $data01 != 7 then - return -1 -endi - -print =============== step5 -sql show tables -if $rows != 7 then - return -1 -endi - -$i = 1 -while $i < 8 - $tb = $tbPrefix . $i - sql drop table $tb - $i = $i + 1 -endw - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step6-9 -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val tinyint, val2 tinyint) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 1, 1) -sql select * from $tb -if $data01 != 1 then - return -1 -endi - -$i = 2 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val smallint, val2 smallint) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 2, 2) -sql select * from $tb -if $data01 != 2 then - return -1 -endi - -$i = 3 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val int, val2 int) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 3, 3) -sql select * from $tb -if $data01 != 3 then - return -1 -endi - -$i = 4 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val bigint, val2 bigint) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 4, 4) -sql select * from $tb -if $data01 != 4 then - return -1 -endi - -$i = 5 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val float, val2 float) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 5, 5) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 5.00000 then - return -1 -endi - -$i = 6 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val double, val2 double) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, 6, 6) -sql select * from $tb -print ==> $data01 $data02 -if $data01 != 6.000000000 then - return -1 -endi - -$i = 7 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val binary(20), val2 binary(20)) -sql select * from $tb -if $rows != 0 then - return -1 -endi -sql insert into $tb values(now, '7', '7') -sql select * from $tb -if $data01 != 7 then - return -1 -endi - -print =============== step10 -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val tinyint, val2 tinyint) -sql show tables -if $rows != 7 then - return -1 -endi - -print =============== step11 -sql create table $tb (ts timestamp, val float, val2 double) -sql show tables -if $rows != 7 then - return -1 -endi - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - - diff --git a/tests/script/windows/table/table_len.sim b/tests/script/windows/table/table_len.sim deleted file mode 100644 index 72ed549466..0000000000 --- a/tests/script/windows/table/table_len.sim +++ /dev/null @@ -1,105 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$i = 0 -$dbPrefix = lm_tb_db -$tbPrefix = lm_tb_tb -$db = $dbPrefix . $i -$tb = $tbPrefix . $i - -print =============== step1 -sql create database $db -sql use $db - -sql drop table dd -x step0 - return -1 -step0: - -sql create table (ts timestamp, speed int) -x step1 - return -1 -step1: - -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step2 -sql create table a (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table a -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step3 -sql create table a0123456789 (ts timestamp, speed int) -sql show tables -if $rows != 1 then - return -1 -endi - -sql drop table a0123456789 -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step4 -sql create table ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789 (ts timestamp, speed int) -x step4 - return -1 -step4: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step5 -sql create table a;1 (ts timestamp, speed int) -x step5 - return -1 -step5: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step6 -sql create table a'1 (ts timestamp, speed int) -x step6 - return -1 -step6: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step7 -sql create table (a) (ts timestamp, speed int) -x step7 - return -1 -step7: -sql show tables -if $rows != 0 then - return -1 -endi - -print =============== step8 -sql create table a.1 (ts timestamp, speed int) -x step8 - return -1 -step8: - -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/3.sim b/tests/script/windows/tag/3.sim deleted file mode 100644 index 5479be158b..0000000000 --- a/tests/script/windows/tag/3.sim +++ /dev/null @@ -1,521 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_3_db -$tbPrefix = ta_3_tb -$mtPrefix = ta_3_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> false -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol1 = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol1 = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol1 = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> false -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step15 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step16 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step17 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step18 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step19 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = true and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/4.sim b/tests/script/windows/tag/4.sim deleted file mode 100644 index 17552010b0..0000000000 --- a/tests/script/windows/tag/4.sim +++ /dev/null @@ -1,711 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_4_db -$tbPrefix = ta_4_tb -$mtPrefix = ta_4_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 bigint, tgcol3 float, tgcol4 double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tgcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step19 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step20 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step21 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step22 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/5.sim b/tests/script/windows/tag/5.sim deleted file mode 100644 index f06d78e7b5..0000000000 --- a/tests/script/windows/tag/5.sim +++ /dev/null @@ -1,834 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_5_db -$tbPrefix = ta_5_tb -$mtPrefix = ta_5_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 tinyint, tgcol2 int, tgcol3 bigint, tgcol4 double, tgcol5 binary(20)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0, 0, 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1, 1, 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tgcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tgcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step22 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step23 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step24 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step25 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step26 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step27 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/6.sim b/tests/script/windows/tag/6.sim deleted file mode 100644 index 64cb9df6f0..0000000000 --- a/tests/script/windows/tag/6.sim +++ /dev/null @@ -1,989 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_6_db -$tbPrefix = ta_6_tb -$mtPrefix = ta_6_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 bigint, tgcol3 smallint, tgcol4 bigint, tgcol5 binary(30), tgcol6 binary(20)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0', 0, 0, 0, '0', '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1', 1, 1, 1, '1', '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol1 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where tgcol3 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol3 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step6 -sql select * from $mt where tgcol4 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol4 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step7 -sql select * from $mt where tgcol5 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol5 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step8 -sql select * from $mt where tgcol6 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol6 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol6 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol6 <> 1 -if $rows != 100 then - return -1 -endi - -print =============== step9 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step10 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step11 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step12 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step13 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step14 -sql select * from $mt where ts > now + 4m and tgcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol6 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step15 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step16 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step17 -sql select * from $mt where ts > now + 4m and tgcol3 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol3 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step18 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 and tgcol4 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and tgcol4 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and tgcol4 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol4 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step19 -sql select * from $mt where ts > now + 4m and tgcol5 = 1 and tgcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and tgcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and ts < now + 5m and ts < now + 5m and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step20 -sql select * from $mt where ts > now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step21 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step22 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step23 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step24 -sql select * from $mt where ts > now + 4m and tgcol4 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol1 = 1 and tgcol5 = 1 and tgcol6 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and tgcol6 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step25 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step26 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step27 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step28 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol6 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step29 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step30 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step31 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol2 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 interval(1d) group by tgcol3 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 interval(1d) group by tgcol4 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 interval(1d) group by tgcol5 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and tgcol2 = 1 and tgcol3 = 1 and tgcol4 = 1 and tgcol5 = 1 and tgcol6 = 1 interval(1d) group by tgcol6 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/add.sim b/tests/script/windows/tag/add.sim deleted file mode 100644 index 02d027ccf4..0000000000 --- a/tests/script/windows/tag/add.sim +++ /dev/null @@ -1,854 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_ad_db -$tbPrefix = ta_ad_tb -$mtPrefix = ta_ad_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 int -sql reset query cache -sql alter table $tb set tag tgcol4 =4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step2 - return -1 -step2: - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 tinyint -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step3 - return -1 -step3: - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql describe $tb -print sql describe $tb -if $data21 != BIGINT then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data23 != TAG then - return -1 -endi -if $data33 != TAG then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 float -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step4 - return -1 -step4: - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt add tag tgcol4 smallint -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql reset query cache - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol3 = '1' -x step5 - return -1 -step5: - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint) -sql create table $tb using $mt tags( 1, 2, 3 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 binary(10) -sql alter table $mt add tag tgcol6 binary(10) - -sql reset query cache -sql alter table $tb set tag tgcol4=false -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 -sql reset query cache - -sql select * from $mt where tgcol5 = '5' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 6 then - return -1 -endi - -sql select * from $mt where tgcol6 = '6' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 6 then - return -1 -endi - -sql select * from $mt where tgcol4 = 1 -if $rows != 0 then - return -1 -endi -sql select * from $mt where tgcol3 = 1 -x step52 - return -1 -step52: - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 bigint -sql alter table $mt add tag tgcol6 tinyint - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 -sql reset query cache - -sql select * from $mt where tgcol6 = 6 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 4 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 6 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step71 - return -1 -step71: -sql select * from $mt where tgcol3 = 1 -x step72 - return -1 -step72: - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 binary(17) -sql alter table $mt add tag tgcol6 bool -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=1 -sql reset query cache - -sql select * from $mt where tgcol5 = '5' -print select * from $mt where tgcol5 = 5 -print $data01 $data02 $data03 $data04 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 4 then - return -1 -endi -if $data03 != 5 then - return -1 -endi -if $data04 != 1 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step81 - return -1 -step81: -sql select * from $mt where tgcol3 = 1 -x step82 - return -1 -step82: - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt add tag tgcol5 bool -sql alter table $mt add tag tgcol6 float - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=1 -sql alter table $tb set tag tgcol6=6 -sql reset query cache - -sql select * from $mt where tgcol5 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 4.000000000 then - return -1 -endi -if $data03 != 1 then - return -1 -endi -if $data04 != 6.00000 then - return -1 -endi - -sql select * from $mt where tgcol3 = 1 -x step91 - return -1 -step91: -sql select * from $mt where tgcol2 = 1 -x step92 - return -1 -step92: - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10)) -sql create table $tb using $mt tags( '1', '2', '3', '4' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol4 = '4' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -x step103 - return -1 -step103: - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql reset query cache -sql alter table $mt add tag tgcol4 binary(10) -sql alter table $mt add tag tgcol5 bool - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=false -sql reset query cache - -sql select * from $mt where tgcol4 = '4' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi -if $data04 != 0 then - return -1 -endi -if $data05 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step101 - return -1 -step101: -sql select * from $mt where tgcol3 = 1 -x step102 - return -1 -step102: - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4.00000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol4 -x step114 - return -1 -step114: - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol5 -sql reset query cache -sql alter table $mt add tag tgcol4 binary(10) -sql alter table $mt add tag tgcol5 int -sql alter table $mt add tag tgcol6 binary(10) -sql alter table $mt add tag tgcol7 bigint -sql alter table $mt add tag tgcol8 smallint - -sql reset query cache -sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 -sql alter table $tb set tag tgcol7=7 -sql alter table $tb set tag tgcol8=8 -sql reset query cache - -sql select * from $mt where tgcol5 =5 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4 then - return -1 -endi -if $data04 != 5 then - return -1 -endi -if $data05 != 6 then - return -1 -endi -if $data06 != 7 then - return -1 -endi -if $data07 != 8 then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step111 - return -1 -step111: -sql select * from $mt where tgcol3 = 1 -x step112 - return -1 -step112: -sql select * from $mt where tgcol9 = 1 -x step113 - return -1 -step113: - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3.00000 then - return -1 -endi -if $data05 != 4.000000000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol5 -sql reset query cache -sql alter table $mt add tag tgcol2 binary(10) -sql alter table $mt add tag tgcol3 int -sql alter table $mt add tag tgcol4 binary(10) -sql alter table $mt add tag tgcol5 bigint - -sql reset query cache -sql alter table $tb set tag tgcol1=false -sql alter table $tb set tag tgcol2=5 -sql alter table $tb set tag tgcol3=4 -sql alter table $tb set tag tgcol4=3 -sql alter table $tb set tag tgcol5=2 -sql alter table $tb set tag tgcol6=1 -sql reset query cache - -sql select * from $mt where tgcol4 = '3' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 1 then - return -1 -endi -if $data04 != 5 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 3 then - return -1 -endi -if $data07 != 2 then - return -1 -endi - -sql select * from $mt where tgcol2 = '5' -if $rows != 1 then - return -1 -endi - -sql select * from $mt where tgcol3 = 4 -if $rows != 1 then - return -1 -endi - -sql select * from $mt where tgcol5 = 2 -if $rows != 1 then - return -1 -endi - -sql select * from $mt where tgcol6 = '1' -if $rows != 1 then - return -1 -endi - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol6 -sql reset query cache -sql alter table $mt add tag tgcol2 binary(10) -sql alter table $mt add tag tgcol4 int -sql alter table $mt add tag tgcol6 bigint - -sql reset query cache -sql alter table $tb set tag tgcol1=7 -sql alter table $tb set tag tgcol2=8 -sql alter table $tb set tag tgcol3=9 -sql alter table $tb set tag tgcol4=10 -sql alter table $tb set tag tgcol5=11 -sql alter table $tb set tag tgcol6=12 -sql reset query cache - -sql select * from $mt where tgcol2 = '8' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 9 then - return -1 -endi -if $data04 != 11.000000000 then - return -1 -endi -if $data05 != 8 then - return -1 -endi -if $data06 != 10 then - return -1 -endi -if $data07 != 12 then - return -1 -endi - -print =============== step14 -$i = 14 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 1 ) -sql insert into $tb values(now, 1) - -sql alter table $mt add tag tgcol3 binary(10) -sql alter table $mt add tag tgcol4 int -sql alter table $mt add tag tgcol5 bigint -sql alter table $mt add tag tgcol6 bigint - -return -sql alter table $mt add tag tgcol7 bigint -x step141 - return -1 -step141: -sql reset query cache -sql alter table $mt drop tag tgcol6 -sql alter table $mt add tag tgcol7 bigint -sql alter table $mt add tag tgcol8 bigint -x step142 - return -1 -step142: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bigint.sim b/tests/script/windows/tag/bigint.sim deleted file mode 100644 index ebb67d452c..0000000000 --- a/tests/script/windows/tag/bigint.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bi_db -$tbPrefix = ta_bi_tb -$mtPrefix = ta_bi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bigint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/binary.sim b/tests/script/windows/tag/binary.sim deleted file mode 100644 index c59039b6a6..0000000000 --- a/tests/script/windows/tag/binary.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_by_db -$tbPrefix = ta_by_tb -$mtPrefix = ta_by_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/binary_binary.sim b/tests/script/windows/tag/binary_binary.sim deleted file mode 100644 index 361a6edb8b..0000000000 --- a/tests/script/windows/tag/binary_binary.sim +++ /dev/null @@ -1,308 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bib_db -$tbPrefix = ta_bib_tb -$mtPrefix = ta_bib_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(5), tgcol2 binary(5)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0', '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1', '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> '0' -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '1' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' and tgcol = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and tgcol <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and tgcol = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' and tgcol <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' and tgcol <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m and ts < now + 5m and tgcol <> '0' -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bool.sim b/tests/script/windows/tag/bool.sim deleted file mode 100644 index adf12338d0..0000000000 --- a/tests/script/windows/tag/bool.sim +++ /dev/null @@ -1,238 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bo_db -$tbPrefix = ta_bo_tb -$mtPrefix = ta_bo_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bool_binary.sim b/tests/script/windows/tag/bool_binary.sim deleted file mode 100644 index 064677ee40..0000000000 --- a/tests/script/windows/tag/bool_binary.sim +++ /dev/null @@ -1,308 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_bob_db -$tbPrefix = ta_bob_tb -$mtPrefix = ta_bob_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(5)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '1' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/bool_int.sim b/tests/script/windows/tag/bool_int.sim deleted file mode 100644 index ef5cd27553..0000000000 --- a/tests/script/windows/tag/bool_int.sim +++ /dev/null @@ -1,324 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_boi_db -$tbPrefix = ta_boi_tb -$mtPrefix = ta_boi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> false -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> true -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = false -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> false -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> false and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol = true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol <> true -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol = false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol <> false -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> false -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> false -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/change.sim b/tests/script/windows/tag/change.sim deleted file mode 100644 index 4126ea1181..0000000000 --- a/tests/script/windows/tag/change.sim +++ /dev/null @@ -1,513 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_ch_db -$tbPrefix = ta_ch_tb -$mtPrefix = ta_ch_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt change tag tagcx tgcol3 -x step21 - return -1 -step21: -sql alter table $mt change tag tgcol1 tgcol2 -x step22 - return -1 -step22: -#sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 -# return -1 -#step20: - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 -sql alter table $mt change tag tgcol4 tgcol3 -x step23 - return -1 -step23: - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql reset query cache -sql alter table $mt change tag tgcol4 tgcol3 -sql alter table $mt change tag tgcol1 tgcol7 -sql alter table $mt change tag tgcol2 tgcol8 -sql reset query cache -sql alter table $mt change tag tgcol3 tgcol9 -sql alter table $mt change tag tgcol5 tgcol10 -sql alter table $mt change tag tgcol6 tgcol11 - -sleep 3000 -sql reset query cache - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step24 - return -1 -step24: -sql select * from $mt where tgcol2 = 1 -x step25 - return -1 -step25: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql select * from $mt where tgcol4 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step31 - return -1 -step31: -sql select * from $mt where tgcol2 = 1 -x step32 - return -1 -step32: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql select * from $mt where tgcol4 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step41 - return -1 -step41: -sql select * from $mt where tgcol2 = 1 -x step42 - return -1 -step42: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql select * from $mt where tgcol4 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step51 - return -1 -step51: -sql select * from $mt where tgcol2 = 1 -x step52 - return -1 -step52: - -sql select * from $mt where tgcol3 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql select * from $mt where tgcol4 = '2' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -x step61 - return -1 -step61: -sql select * from $mt where tgcol2 = 1 -x step62 - return -1 -step62: -sql select * from $mt where tgcol3 = 1 -x step63 - return -1 -step63: -sql select * from $mt where tgcol4 = 1 -x step64 - return -1 -step64: -sql select * from $mt where tgcol5 = 1 -x step65 - return -1 -step65: -sql select * from $mt where tgcol6 = 1 -x step66 - return -1 -step66: - -sql select * from $mt where tgcol7 = '1' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol8 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol9 = '4' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol10 = 5 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol11 = '6' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 4 then - return -1 -endi -if $data05 != 5.000000000 then - return -1 -endi -if $data06 != 6 then - return -1 -endi -if $data07 != null then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi diff --git a/tests/script/windows/tag/column.sim b/tests/script/windows/tag/column.sim deleted file mode 100644 index 40159bcae3..0000000000 --- a/tests/script/windows/tag/column.sim +++ /dev/null @@ -1,93 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_co_db -$tbPrefix = ta_co_tb -$mtPrefix = ta_co_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db - -$i = 0 -sql create table $mt (ts timestamp, tbcol int, tbcol2 binary(10)) TAGS(tgcol int, tgcol2 binary(10)) - -print =============== step2 - -$i = 0 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( 0, '0' ) - -$i = 1 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( 1, 1 ) - -$i = 2 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( '2', '2' ) - -$i = 3 -$tb = $tbPrefix . $i -sql create table $tb using $mt tags( '3', 3 ) - -sql show tables -if $rows != 4 then - return -1 -endi - -print =============== step3 - -$i = 0 -$tb = $tbPrefix . $i -sql insert into $tb values(now, 0, '0') - -$i = 1 -$tb = $tbPrefix . $i -sql insert into $tb values(now, 1, 1 ) - -$i = 2 -$tb = $tbPrefix . $i -sql insert into $tb values(now, '2', '2') - -$i = 3 -$tb = $tbPrefix . $i -sql insert into $tb values(now, '3', 3) - -print =============== step4 -sql select * from $mt where tgcol2 = '1' -if $rows != 1 then - return -1 -endi - -print =============== step5 -sql select * from $mt -if $rows != 4 then - return -1 -endi - -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/create.sim b/tests/script/windows/tag/create.sim deleted file mode 100644 index 62dc8a7a21..0000000000 --- a/tests/script/windows/tag/create.sim +++ /dev/null @@ -1,601 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_cr_db -$tbPrefix = ta_cr_tb -$mtPrefix = ta_cr_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol smallint) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol tinyint) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bigint) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol float) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - print expect 0, actual: $rows - return -1 -endi - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol double) -sql create table $tb using $mt tags( 1 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 0 then - return -1 -endi - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10)) -sql create table $tb using $mt tags( '1') -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol = '0' -if $rows != 0 then - return -1 -endi - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - print expect 1, actual: $rows - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 smallint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step14 -$i = 14 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi -print =============== step15 -$i = 15 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step16 -$i = 16 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 double) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step17 -$i = 17 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = true -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step18 -$i = 18 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step19 -$i = 19 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol tinyint, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step20 -$i = 20 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step21 -$i = 21 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step22 -$i = 22 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol float, tgcol2 double) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step23 -$i = 23 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 0 then - return -1 -endi - -print =============== step24 -$i = 24 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol3 = 3 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol4 = 4 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol5 = 5 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol6 = '6' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol6 = '0' -if $rows != 0 then - return -1 -endi - -print =============== step25 -$i = 25 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 int, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol6 = '6' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol6 = '0' -if $rows != 0 then - return -1 -endi - -print =============== step26 -$i = 26 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10), tgcol5 binary(10), tgcol6 binary(10)) -sql create table $tb using $mt tags( '1', '2', '3', '4', '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from $mt where tgcol3 = '0' -if $rows != 0 then - return -1 -endi - -print =============== step27 -$i = 27 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool, tgcol3 int, tgcol4 float, tgcol5 double, tgcol6 binary(10), tgcol7) -x step27 - return -1 -step27: - -print =============== step28 -$i = 28 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250)) -sql create table $tb using $mt tags('1', '1') -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -print =============== step29 -$i = 29 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(25), tgcol2 binary(250)) -sql create table $tb using $mt tags('1', '1') -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi - -print =============== step30 -$i = 30 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250), tgcol3 binary(30)) -x step30 -# return -1 -step30: - -print =============== step31 -$i = 31 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(5)) -sql_error create table $tb using $mt tags('1234567') -sql create table $tb using $mt tags('12345') -sql insert into $tb values(now, 1) -sql select * from $mt -print sql select * from $mt -if $rows != 1 then - return -1 -endi - -print $data00 $data01 $data02 -if $data02 != 12345 then - return -1 -endi diff --git a/tests/script/windows/tag/delete.sim b/tests/script/windows/tag/delete.sim deleted file mode 100644 index 2b503fdf47..0000000000 --- a/tests/script/windows/tag/delete.sim +++ /dev/null @@ -1,825 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_de_db -$tbPrefix = ta_de_tb -$mtPrefix = ta_de_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 < 3 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql describe $tb -if $data21 != BIGINT then - return -1 -endi -if $data31 != FLOAT then - return -1 -endi -if $data23 != TAG then - return -1 -endi - -sql alter table $mt drop tag tgcol1 -x step40 - return -1 -step40: -sql alter table $mt drop tag tgcol2 - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $mt drop tag tgcol1 -x step50 - return -1 -step50: -sql alter table $mt drop tag tgcol2 - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint) -sql create table $tb using $mt tags( 1, 2, 3 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql describe $tb -if $data21 != SMALLINT then - return -1 -endi -if $data31 != TINYINT then - return -1 -endi -if $data41 != BINARY then - return -1 -endi -if $data22 != 2 then - return -1 -endi -if $data32 != 1 then - return -1 -endi -if $data42 != 10 then - return -1 -endi -if $data23 != TAG then - return -1 -endi -if $data33 != TAG then - return -1 -endi -if $data43 != TAG then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol3 = '3' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, '2', '3' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = 2 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol2 - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10)) -sql create table $tb using $mt tags( '1', '2', '3', '4' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol4 = '4' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol4 - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4.00000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol5 - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20)) -sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3.00000 then - return -1 -endi -if $data05 != 4.000000000 then - return -1 -endi -if $data06 != 5 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol5 -sql alter table $mt drop tag tgcol6 - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $mt drop tag tgcol4 -sql alter table $mt drop tag tgcol6 - -sleep 3000 - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step2 - return -1 -step2: - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step3 - return -1 -step3: - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step4 - return -1 -step4: - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = '1' -x step5 - return -1 -step5: - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step51 - return -1 -step51: -sql select * from $mt where tgcol3 = 1 -x step52 - return -1 -step52: - -print =============== step7 -$i = 7 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step71 - return -1 -step71: -sql select * from $mt where tgcol3 = 1 -x step72 - return -1 -step72: - -print =============== step8 -$i = 8 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step81 - return -1 -step81: -sql select * from $mt where tgcol3 = 1 -x step82 - return -1 -step82: - -print =============== step9 -$i = 9 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = 1 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi - -sql select * from $mt where tgcol3 = 1 -x step91 - return -1 -step91: -sql select * from $mt where tgcol2 = 1 -x step92 - return -1 -step92: - -print =============== step10 -$i = 10 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol1 = '1' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != null then - return -1 -endi -if $data04 != null then - return -1 -endi -if $data05 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step101 - return -1 -step101: -sql select * from $mt where tgcol3 = 1 -x step102 - return -1 -step102: -sql select * from $mt where tgcol4 = 1 -x step103 - return -1 -step103: - -print =============== step11 -$i = 11 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol4=4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi -if $data04 != null then - return -1 -endi -if $data05 != null then - return -1 -endi -if $data06 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step111 - return -1 -step111: -sql select * from $mt where tgcol3 = 1 -x step112 - return -1 -step112: -sql select * from $mt where tgcol5 = 1 -x step113 - return -1 -step113: - -print =============== step12 -$i = 12 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql select * from $mt where tgcol4 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 4.000000000 then - return -1 -endi -if $data04 != null then - return -1 -endi -if $data05 != null then - return -1 -endi -if $data06 != null then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 1 -x step120 - return -1 -step120: -sql select * from $mt where tgcol3 = 1 -x step121 - return -1 -step121: -sql select * from $mt where tgcol5 = 1 -x step122 - return -1 -step122: -sql select * from $mt where tgcol6 = 1 -x step123 - return -1 -step123: - -print =============== step13 -$i = 13 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i - -sql reset query cache -sql select * from $mt where tgcol2 = 2 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 5.000000000 then - return -1 -endi -if $data05 != null then - return -1 -endi -if $data06 != null then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol3 = 1 -x step130 - return -1 -step130: -sql select * from $mt where tgcol4 = 1 -x step131 - return -1 -step131: -sql select * from $mt where tgcol6 = 1 -x step133 - return -1 -step133: - -print =============== step14 -$i = 14 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint) -sql create table $tb using $mt tags( 1, 1 ) -sql insert into $tb values(now, 1) - -sql alter table xxmt drop tag tag1 -x step141 - return -1 -step141: -sql alter table $tb drop tag tag1 -x step142 - return -1 -step142: -sql alter table $mt drop tag tag1 -x step143 - return -1 -step143: - -sql alter table $mt drop tag tagcol1 -x step144 - return -1 -step144: - -sql alter table $mt drop tag tgcol2 -sql alter table $mt drop tag tgcol1 -x step145 - return -1 -step145: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/double.sim b/tests/script/windows/tag/double.sim deleted file mode 100644 index 4381aa20f9..0000000000 --- a/tests/script/windows/tag/double.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_do_db -$tbPrefix = ta_do_tb -$mtPrefix = ta_do_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol double) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/filter.sim b/tests/script/windows/tag/filter.sim deleted file mode 100644 index 802e9a312f..0000000000 --- a/tests/script/windows/tag/filter.sim +++ /dev/null @@ -1,149 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_fi_db -$tbPrefix = ta_fi_tb -$mtPrefix = ta_fi_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(10)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x step2 - return -1 -step2: - -print =============== step3 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where noexist = '1' -x step3 - return -1 -step3: - -print =============== step4 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' -if $rows != 1 then - return -1 -endi -if $data00 != 10 then - return -1 -endi - -print =============== step5 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(cc), sum(xx), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -x step6 - return -1 -step6: - -print =============== step7 -sql select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(tgcol), last(tgcol) from $mt -x step7 - return -1 -step7: - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tbcol - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by noexist -x step9 - return -1 -step9: - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as c from $mt group by tbcol - -print =============== step12 -sql select count(tbcol) as c from $mt group by noexist -x step12 - return -1 -step12: - -print =============== step13 -sql select count(tbcol) as c from $mt group by tgcol -print $data00 -if $data00 != 100 then - return -1 -endi - -print =============== step14 -sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - print expect 100, actual $data00 - return -1 -endi - -print =============== step15 -sql select count(tbcol) as c from $mt where noexist < 1 group by tgcol -x step15 - return -1 -step15: - -print =============== step16 -sql select count(tbcol) as c from $mt where tgcol = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/float.sim b/tests/script/windows/tag/float.sim deleted file mode 100644 index 8df44c24a5..0000000000 --- a/tests/script/windows/tag/float.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_fl_db -$tbPrefix = ta_fl_tb -$mtPrefix = ta_fl_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/int.sim b/tests/script/windows/tag/int.sim deleted file mode 100644 index dbff8c15b6..0000000000 --- a/tests/script/windows/tag/int.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_in_db -$tbPrefix = ta_in_tb -$mtPrefix = ta_in_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/int_binary.sim b/tests/script/windows/tag/int_binary.sim deleted file mode 100644 index 94aa9eb7f4..0000000000 --- a/tests/script/windows/tag/int_binary.sim +++ /dev/null @@ -1,308 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_inb_db -$tbPrefix = ta_inb_tb -$mtPrefix = ta_inb_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 binary(5)) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, '0' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, '1' ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 = '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '0' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = '1' -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> '1' -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = '1' and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = '0' and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> '0' and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and ts < now + 5m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = '1' -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = '1' group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/int_float.sim b/tests/script/windows/tag/int_float.sim deleted file mode 100644 index 9789c9ea06..0000000000 --- a/tests/script/windows/tag/int_float.sim +++ /dev/null @@ -1,324 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_inf_db -$tbPrefix = ta_inf_tb -$mtPrefix = ta_inf_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int, tgcol2 float) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0, 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1, 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step3 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol2 > 0.5 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 < 0.5 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 > 0.5 and tgcol2 < 1.5 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol2 <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select * from $mt where ts > now + 4m and tgcol2 = 1 and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 = 0 and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol2 <> 0 and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and ts < now + 5m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and tgcol2 = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - - -print =============== step13 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - -print =============== step14 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/set.sim b/tests/script/windows/tag/set.sim deleted file mode 100644 index 54b87c7d0c..0000000000 --- a/tests/script/windows/tag/set.sim +++ /dev/null @@ -1,457 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_se_db -$tbPrefix = ta_se_tb -$mtPrefix = ta_se_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i - -sql create database $db -sql use $db - -print =============== step2 -$i = 2 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $tb set tag tagcx 1 -x step21 - return -1 -step21: -sql alter table $tb set tag tgcol1=false -sql alter table $tb set tag tgcol2=4 - -sql reset query cache - -sql select * from $mt where tgcol1 = false -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql describe $tb -print $data21 $data23 $data32 $data33 -if $data21 != BOOL then - return -1 -endi -if $data31 != INT then - return -1 -endi -if $data23 != TAG then - return -1 -endi -if $data33 != TAG then - return -1 -endi - -print =============== step3 -$i = 3 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $tb set tag tgcol1=3 -sql alter table $tb set tag tgcol2=4 - -sql reset query cache - -sql select * from $mt where tgcol1 = 3 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = 2 -if $rows != 0 then - return -1 -endi - - -print =============== step4 -$i = 4 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float) -sql create table $tb using $mt tags( 1, 2 ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = 1 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2.00000 then - return -1 -endi - -sql alter table $tb set tag tgcol1=3 -sql alter table $tb set tag tgcol2=4 - -sql reset query cache - -sql select * from $mt where tgcol1 = 3 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi - -sql select * from $mt where tgcol2 = 4 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi - - -print =============== step5 -$i = 5 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10)) -sql create table $tb using $mt tags( 1, '2' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol2 = '2' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1.000000000 then - return -1 -endi -if $data03 != 2 then - return -1 -endi - -sql alter table $tb set tag tgcol1=3 -sql alter table $tb set tag tgcol2='4' - -sql reset query cache - -sql select * from $mt where tgcol1 = 3 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3.000000000 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -sql select * from $mt where tgcol2 = '4' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 3.000000000 then - return -1 -endi -if $data03 != 4 then - return -1 -endi - -print =============== step6 -$i = 6 -$mt = $mtPrefix . $i -$tb = $tbPrefix . $i -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20)) -sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' ) -sql insert into $tb values(now, 1) -sql select * from $mt where tgcol1 = '1' -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data03 != 2 then - return -1 -endi -if $data04 != 3 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 5.000000000 then - return -1 -endi -if $data07 != 6 then - return -1 -endi - -sql alter table $mt drop tag tgcol3 -sql alter table $tb set tag tgcol1='7' -sql alter table $tb set tag tgcol2=8 -sql alter table $tb set tag tgcol4='9' -sql alter table $tb set tag tgcol5=10 -sql alter table $tb set tag tgcol6='11' - -sql reset query cache - -sql select * from $mt where tgcol1 = '7' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol2 = 8 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol4 = '9' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol5 = 10 -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -sql select * from $mt where tgcol6 = '11' -print $data01 $data02 $data03 -if $rows != 1 then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 7 then - return -1 -endi -if $data03 != 8 then - return -1 -endi -if $data04 != 9 then - return -1 -endi -if $data05 != 10.000000000 then - return -1 -endi -if $data06 != 11 then - return -1 -endi -if $data07 != null then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/smallint.sim b/tests/script/windows/tag/smallint.sim deleted file mode 100644 index bc668b164d..0000000000 --- a/tests/script/windows/tag/smallint.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_sm_db -$tbPrefix = ta_sm_tb -$mtPrefix = ta_sm_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol smallint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/tag/tinyint.sim b/tests/script/windows/tag/tinyint.sim deleted file mode 100644 index 44fc9ba4dc..0000000000 --- a/tests/script/windows/tag/tinyint.sim +++ /dev/null @@ -1,241 +0,0 @@ -sql connect -sleep 2000 -print ======================== dnode1 start - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = ta_ti_db -$tbPrefix = ta_ti_tb -$mtPrefix = ta_ti_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol tinyint) - -$i = 0 -while $i < 5 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 0 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw -while $i < 10 - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( 1 ) - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - $i = $i + 1 -endw - -print =============== step2 -sleep 100 -sql select * from $tb -if $rows != $rowNum then - return -1 -endi -sql select * from $tb where ts < now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts <= now + 4m -if $rows != 5 then - return -1 -endi -sql select * from $tb where ts > now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts >= now + 4m -if $rows != 15 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 5m -if $rows != 1 then - return -1 -endi -sql select * from $tb where ts < now + 4m and ts > now + 5m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > 100000 and ts < 100000 -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts < now + 3m -if $rows != 0 then - return -1 -endi -sql select * from $tb where ts > now + 4m and ts > now + 5m and ts < now + 6m -if $rows != 1 then - return -1 -endi - -print =============== step3 -sql select * from $mt -if $rows != $totalNum then - return -1 -endi - -sql select * from $mt where ts < now + 4m -if $rows != 50 then - return -1 -endi -sql select * from $mt where ts > now + 4m -if $rows != 150 then - return -1 -endi -sql select * from $mt where ts = now + 4m -if $rows != 0 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m -if $rows != 10 then - return -1 -endi - -print =============== step4 -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 1 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol = 0 -if $rows != 100 then - return -1 -endi -sql select * from $mt where tgcol <> 0 -if $rows != 100 then - return -1 -endi - -print =============== step5 -sql select * from $mt where ts > now + 4m and tgcol = 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 1 -if $rows != 75 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts < now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol = 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts <= now + 4m and tgcol <> 0 -if $rows != 25 then - return -1 -endi -sql select * from $mt where ts > now + 4m and ts < now + 5m and tgcol <> 0 -if $rows != 5 then - return -1 -endi -sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts < now + 5m -if $rows != 5 then - return -1 -endi - -print =============== step6 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 200 then - return -1 -endi - -print =============== step7 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step8 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 50 then - return -1 -endi - -print =============== step9 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step10 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 100 then - return -1 -endi - -print =============== step11 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data00 != 25 then - return -1 -endi - - -print =============== step12 -sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt interval(1d) group by tgcol -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/testSuite.sim b/tests/script/windows/testSuite.sim deleted file mode 100644 index e372217b62..0000000000 --- a/tests/script/windows/testSuite.sim +++ /dev/null @@ -1,93 +0,0 @@ -run windows/alter/table.sim -run windows/alter/metrics.sim - -run windows/compute/avg.sim -run windows/compute/bottom.sim -run windows/compute/count.sim -run windows/compute/diff.sim -run windows/compute/first.sim -run windows/compute/interval.sim -run windows/compute/last.sim -run windows/compute/leastsquare.sim -run windows/compute/max.sim -run windows/compute/min.sim -run windows/compute/percentile.sim -run windows/compute/stddev.sim -run windows/compute/sum.sim -run windows/compute/top.sim - -run windows/db/basic.sim -run windows/db/len.sim - -run windows/field/2.sim -run windows/field/3.sim -run windows/field/4.sim -run windows/field/5.sim -run windows/field/6.sim -run windows/field/bigint.sim -run windows/field/binary.sim -run windows/field/bool.sim -run windows/field/double.sim -run windows/field/float.sim -run windows/field/int.sim -run windows/field/single.sim -run windows/field/smallint.sim -run windows/field/tinyint.sim - -run windows/import/basic.sim - -run windows/insert/basic.sim -run windows/insert/query_block1_file.sim -run windows/insert/query_block1_memory.sim -run windows/insert/query_block2_file.sim -run windows/insert/query_block2_memory.sim -run windows/insert/query_file_memory.sim -run windows/insert/query_multi_file.sim - -run windows/table/binary.sim -run windows/table/bool.sim -run windows/table/column_num.sim -run windows/table/column_name.sim -run windows/table/column_value.sim -run windows/table/db.table.sim -run windows/table/double.sim -run windows/table/float.sim -run windows/table/table_len.sim -run windows/table/table.sim - -run windows/tag/3.sim -run windows/tag/4.sim -run windows/tag/5.sim -run windows/tag/6.sim -run windows/tag/add.sim -run windows/tag/bigint.sim -run windows/tag/binary_binary.sim -run windows/tag/binary.sim -run windows/tag/bool_binary.sim -run windows/tag/bool_int.sim -run windows/tag/bool.sim -run windows/tag/change.sim -run windows/tag/column.sim -run windows/tag/create.sim -run windows/tag/delete.sim -run windows/tag/double.sim -run windows/tag/filter.sim -run windows/tag/float.sim -run windows/tag/int_binary.sim -run windows/tag/int_float.sim -run windows/tag/int.sim -run windows/tag/set.sim -run windows/tag/smallint.sim -run windows/tag/tinyint.sim - -run windows/vector/metrics_field.sim -run windows/vector/metrics_mix.sim -run windows/vector/metrics_query.sim -run windows/vector/metrics_tag.sim -run windows/vector/metrics_time.sim -run windows/vector/multi.sim -run windows/vector/single.sim -run windows/vector/table_field.sim -run windows/vector/table_mix.sim -run windows/vector/table_query.sim -run windows/vector/table_time.sim diff --git a/tests/script/windows/vector/metrics_field.sim b/tests/script/windows/vector/metrics_field.sim deleted file mode 100644 index dfaa7e1d99..0000000000 --- a/tests/script/windows/vector/metrics_field.sim +++ /dev/null @@ -1,622 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mf_db -$tbPrefix = m_mf_tb -$mtPrefix = m_mf_mt - -$dbPrefix = db -$tbPrefix = tb -$mtPrefix = mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $mt where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $mt where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where a = 5 -x step21 - return -1 -step21: - -sql select h - f from $mt where a = 5 -x step22 - return -1 -step22: - -sql select ts - f from $mt where a = 5 -x step23 - return -1 -step23: - -sql select a - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $mt where a = 5 -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $mt where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $mt where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $mt where a = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $mt where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $mt where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $mt where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $mt where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where a = 5 -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where a = 5 -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where a = 5 -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where a = 5 -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where a = 5 -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where a = 5 -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where a = 5 -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where a = 5 -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where a = 5 -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where a = 5 -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_mix.sim b/tests/script/windows/vector/metrics_mix.sim deleted file mode 100644 index 111fdebb05..0000000000 --- a/tests/script/windows/vector/metrics_mix.sim +++ /dev/null @@ -1,622 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mx_db -$tbPrefix = m_mx_tb -$mtPrefix = m_mx_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - ffrom $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step020 - return -1 -step020: - -sql select a -f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where a = 5 and tgcol = 5 and ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_query.sim b/tests/script/windows/vector/metrics_query.sim deleted file mode 100644 index 45e734f468..0000000000 --- a/tests/script/windows/vector/metrics_query.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mq_db -$tbPrefix = m_mq_tb -$mtPrefix = m_mq_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - a from $mt -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select b - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - b from $mt -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select c - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select d - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select e - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - f from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt -x step21 - return -1 -step21: - -sql select h - f from $mt -x step22 - return -1 -step22: - -sql select ts - f from $mt -x step23 - return -1 -step23: - -sql select a - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + a from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select b + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + b from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select c + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select d + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select e + f from $mt -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + f from $mt -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select d + e from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + d from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + d from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + c from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + b from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + a from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * a from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * b from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select e * f from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * f from $mt -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d * e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * b from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * a from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / a from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / b from $mt -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select d / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select e / f from $mt -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / f from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_tag.sim b/tests/script/windows/vector/metrics_tag.sim deleted file mode 100644 index 80c204fa10..0000000000 --- a/tests/script/windows/vector/metrics_tag.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mtg_db -$tbPrefix = m_mtg_tb -$mtPrefix = m_mtg_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select b - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select c - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select d - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select e - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where tgcol = 5 -x step21 - return -1 -step21: - -sql select h - f from $mt where tgcol = 5 -x step22 - return -1 -step22: - -sql select ts - f from $mt where tgcol = 5 -x step23 - return -1 -step23: - -sql select a - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select b + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select c + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select d + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select e + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select d + e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select e * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d * e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select d / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select e / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where tgcol = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where tgcol = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where tgcol = 5 -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where tgcol = 5 -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where tgcol = 5 -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/metrics_time.sim b/tests/script/windows/vector/metrics_time.sim deleted file mode 100644 index c127fe78fc..0000000000 --- a/tests/script/windows/vector/metrics_time.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mt_db -$tbPrefix = m_mt_tb -$mtPrefix = m_mt_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where tgcol = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $mt where tgcol = 5 and ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/multi.sim b/tests/script/windows/vector/multi.sim deleted file mode 100644 index ff63cda9a5..0000000000 --- a/tests/script/windows/vector/multi.sim +++ /dev/null @@ -1,215 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_mu_db -$tbPrefix = m_mu_tb -$mtPrefix = m_mu_mt - -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f binary(10), g bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + b from $tb -print ===> $data00 $data10 $data20 $data30 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + e from $tb where ts < now + 4m order by ts desc - -sql select a + a from $tb where ts > now + 4m order by ts desc - -sql select a + c from $tb where ts < now + 4m order by ts asc - -sql select a + f from $tb where ts > now + 4m order by ts asc -x step24 - return -1 -step24: - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - e from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select a - b from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - e from $tb where ts > now + 4m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * b + e from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select a * b + c from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a * b -d from $tb where ts > now + 4m -print ===> $data20 -if $data20 != 42.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / 2 + e from $tb -print ===> $data00 -if $data00 != 10.500000000 then - return -1 -endi - -sql select a / 2 from $tb where ts < now + 4m -print ===> $data10 -if $data10 != 1.000000000 then - return -1 -endi - -sql select a / 2 * e from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a / e from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i -sql select a + ts from $tb -x step61 - return -1 -step61: - -sql select a + f from $tb -x step62 - return -1 -step62: - -sql select a + g from $tb -x step63 - return -1 -step63: - -print =============== step7 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + b from $tb where a = 2 -print ===> $data00 -if $data00 != 4.000000000 then - return -1 -endi - -sql select * from $tb where b < 2 -print ===> $rows -if $rows != 1 then - return -1 -endi - -sql select * from $tb where b > 2 -print ===> $rows -if $rows != 17 then - return -1 -endi - -sql select a + c from $tb where b = 2 and ts < now + 4m -print ===> $data00 -if $data00 != 4.000000000 then - return -1 -endi - -sql select a + d from $tb where c = 10 and ts > now + 4m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where d = 2 and ts < now + 4m order by ts desc - -sql select a + a from $tb where e = 2 and ts > now + 4m order by ts desc - -sql select a + c from $tb where f = 2 and ts < now + 4m order by ts asc - -sql select a + f from $tb where g = 2 and ts > now + 4m order by ts asc -x step74 - return -1 -step74: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/single.sim b/tests/script/windows/vector/single.sim deleted file mode 100644 index fb3a52760b..0000000000 --- a/tests/script/windows/vector/single.sim +++ /dev/null @@ -1,302 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_si_db -$tbPrefix = m_si_tb -$mtPrefix = m_si_mt - -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol + 1 from $tb -print ===> $data00 $data10 $data20 $data30 -if $data00 != 1.000000000 then - return -1 -endi - -sql select tbcol + 1 from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select tbcol + 1 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 6.000000000 then - return -1 -endi - -sql select tbcol + 1 from $tb where ts < now + 4m order by ts desc - -sql select tbcol + 1 from $tb where ts > now + 4m order by ts desc - -sql select tbcol + 1 from $tb where ts < now + 4m order by ts asc - -sql select tbcol + 1 from $tb where ts > now + 4m order by ts asc - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol - 1 from $tb -print ===> $data00 -if $data00 != -1.000000000 then - return -1 -endi - -sql select tbcol - 1 from $tb where ts < now + 4m -print ===> $data00 -if $data00 != -1.000000000 then - return -1 -endi - -sql select tbcol - 1 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 4.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select tbcol * 2 from $tb where ts < now + 4m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select tbcol * 2 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select tbcol / 2 from $tb where ts < now + 4m -print ===> $data10 -if $data10 != 0.500000000 then - return -1 -endi - -sql select tbcol / 2 from $tb where ts > now + 4m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select tbcol / 0 from $tb where ts > now + 4m -print ===> $data00 -#if $data00 != 0.000000000 then -# return -1 -#endi - -print =============== step6 -$i = 11 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol bool) -sql insert into $tb values(now, 0) -sql select tbcol + 2 from $tb -x step6 - return -1 -step6: - -print =============== step7 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol tinyint) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step8 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol smallint) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step9 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol bigint) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step10 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol float) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step11 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol double) -sql insert into $tb values(now, 0); -sql select tbcol + 2 from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi -sql select tbcol - 2 from $tb -print ===> $data00 -if $data00 != -2.000000000 then - return -1 -endi -sql select tbcol * 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi -sql select tbcol / 2 from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step12 -$i = $i + 1 -$tb = $tbPrefix . $i -sql create table $tb (ts timestamp, tbcol binary(100)) -sql insert into $tb values(now, '0'); -sql select tbcol + 2 from $tb -x step12 - return -1 -step12: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_field.sim b/tests/script/windows/vector/table_field.sim deleted file mode 100644 index 10c5148243..0000000000 --- a/tests/script/windows/vector/table_field.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tf_db -$tbPrefix = m_tf_tb -$mtPrefix = m_tf_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $tb where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $tb where a = 5 -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb where a = 5 -x step21 - return -1 -step21: - -sql select h - f from $tb where a = 5 -x step22 - return -1 -step22: - -sql select ts - f from $tb where a = 5 -x step23 - return -1 -step23: - -sql select a - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb where a = 5 -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select a + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $tb where a = 5 -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $tb where a = 5 -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select a * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $tb where a = 5 -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $tb where a = 5 -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $tb where a = 5 -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select a / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $tb where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $tb where a = 5 -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $tb where a = 5 -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb where a = 5 -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where a = 5 = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb where a = 5 -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb where a = 5 -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb where a = 5 -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb where a = 5 -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb where a = 5 -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb where a = 5 -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb where a = 5 -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb where a = 5 -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb where a = 5 -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb where a = 5 -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb where a = 5 -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb where a = 5 -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_mix.sim b/tests/script/windows/vector/table_mix.sim deleted file mode 100644 index 7418cb453d..0000000000 --- a/tests/script/windows/vector/table_mix.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tm_db -$tbPrefix = m_tm_tb -$mtPrefix = m_tm_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb where a = 5 -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where a = 5 and ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb where a = 5 and ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_query.sim b/tests/script/windows/vector/table_query.sim deleted file mode 100644 index 7654688b26..0000000000 --- a/tests/script/windows/vector/table_query.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tq_db -$tbPrefix = m_tq_tb -$mtPrefix = m_tq_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - a from $tb -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select b - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - b from $tb -print ===> $data00 -if $data00 != 9.000000000 then - return -1 -endi - -sql select c - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select d - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select e - f from $tb -print ===> $data00 -if $data00 != -9.000000000 then - return -1 -endi - -sql select f - f from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb -x step21 - return -1 -step21: - -sql select h - f from $tb -x step22 - return -1 -step22: - -sql select ts - f from $tb -x step23 - return -1 -step23: - -sql select a - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb = $tbPrefix . $i - -sql select a + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + a from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select b + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + b from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select c + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select d + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select e + f from $tb -print ===> $data00 -if $data00 != 11.000000000 then - return -1 -endi - -sql select f + f from $tb -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select d + e from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + d from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + d from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c + d from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + c from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + c from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select a + b from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b + a from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb = $tbPrefix . $i - -sql select a * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * a from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * b from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select e * f from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select f * f from $tb -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d * e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c * d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a * b from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b * a from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb = $tbPrefix . $i - -sql select a / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / a from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / b from $tb -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select d / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select e / f from $tb -print ===> $data00 -if $data00 != 0.100000000 then - return -1 -endi - -sql select f / f from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/windows/vector/table_time.sim b/tests/script/windows/vector/table_time.sim deleted file mode 100644 index bea9d41d1b..0000000000 --- a/tests/script/windows/vector/table_time.sim +++ /dev/null @@ -1,618 +0,0 @@ -sql connect -sleep 2000 - -sql show databases -sql drop database $data00 -x e1 -e1: -sql show databases -sql drop database $data00 -x e2 -e2: - -$dbPrefix = m_tt_db -$tbPrefix = m_tt_tb -$mtPrefix = m_tt_mt - -$tbNum = 10 -$rowNum = 21 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, a int, b float, c smallint, d double, e tinyint, f bigint, g binary(10), h bool) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 1 - while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $x , 10 , '11' , true ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select a - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select b - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 5.000000000 then - return -1 -endi - -sql select c - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select d - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select e - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select f - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select g - f from $tb where ts > now + 4m and ts < now + 6m -x step21 - return -1 -step21: - -sql select h - f from $tb where ts > now + 4m and ts < now + 6m -x step22 - return -1 -step22: - -sql select ts - f from $tb where ts > now + 4m and ts < now + 6m -x step23 - return -1 -step23: - -sql select a - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select d - e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select c - d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select a - b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -sql select b - a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.000000000 then - return -1 -endi - -print =============== step3 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select b + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select c + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select d + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select e + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 20.000000000 then - return -1 -endi - -sql select a + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select d + e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select c + d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select a + b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -sql select b + a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 10.000000000 then - return -1 -endi - -print =============== step4 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select b * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select c * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select d * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select e * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 50.000000000 then - return -1 -endi - -sql select f * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 100.000000000 then - return -1 -endi - -sql select a * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select d * e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select c * d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select a * b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -sql select b * a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 25.000000000 then - return -1 -endi - -print =============== step5 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select a / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select b / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.000000000 then - return -1 -endi - -sql select c / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select d / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select e / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.500000000 then - return -1 -endi - -sql select f / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select d / e from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select c / d from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / c from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select a / b from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -sql select b / a from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 1.000000000 then - return -1 -endi - -print =============== step6 -$i = 1 -$tb where ts > now + 4m and ts < now + 6m = $tbPrefix . $i - -sql select (a+b+c+d+e) / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 2.500000000 then - return -1 -endi - -sql select f / (a+b+c+d+e) from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 0.400000000 then - return -1 -endi - -sql select (a+b+c+d+e) * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select f * (a+b+c+d+e) from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 250.000000000 then - return -1 -endi - -sql select (a+b+c+d+e) - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != 15.000000000 then - return -1 -endi - -sql select f - (a+b+c+d+e) from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -15.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) / f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1.500000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) * f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -150.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) + f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -5.000000000 then - return -1 -endi - -sql select (f - (a+b+c+d+e)) - f from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -25.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e) * f as zz from $tb where ts > now + 4m and ts < now + 6m -print ===> $data00 -if $data00 != -1300.000000000 then - return -1 -endi - -sql select (f - (a*b+c)*a + d + e))) * f as zz from $tb where ts > now + 4m and ts < now + 6m -x step61 - return -1 -step61: - -sql select (f - (a*b+c)*a + d + e))) * 2f as zz from $tb where ts > now + 4m and ts < now + 6m -x step62 - return -1 -step62: - -sql select (f - (a*b+c)*a + d + e))) ** f as zz from $tb where ts > now + 4m and ts < now + 6m -x step63 - return -1 -step63: - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi \ No newline at end of file From aded474d5b3980b1c9e0c98f3b3ba4cf817f19f5 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 28 Jun 2022 16:19:15 +0800 Subject: [PATCH 32/47] refactor(sync): adjust trace log --- source/libs/sync/src/syncMain.c | 12 ------------ source/libs/sync/src/syncSnapshot.c | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 89f0fcee02..f6768bf494 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1488,18 +1488,6 @@ char* syncNode2SimpleStr(const SSyncNode* pSyncNode) { pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, pSyncNode->changing, pSyncNode->restoreFinish); - /* - snprintf(s, len, - "syncNode: vgId:%d, term:%lu, commit:%ld, state:%d %s, standby:%d, " - "lc:%lu, " - "lc-user:%lu, " - "ems:%d, replica-num:%d, restore:%d, changing:%d", - pSyncNode->vgId, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, pSyncNode->state, - syncUtilState2String(pSyncNode->state), pSyncNode->pRaftCfg->isStandBy, pSyncNode->electTimerLogicClock, - pSyncNode->electTimerLogicClockUser, pSyncNode->electTimerMS, pSyncNode->replicaNum, - pSyncNode->restoreFinish, pSyncNode->changing); - */ - return s; } diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 13343111f3..0e77876b97 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -683,7 +683,16 @@ int32_t syncNodeOnSnapshotSendCb(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { needRsp = true; } else { - ASSERT(0); + // error log + do { + char logBuf[96]; + snprintf(logBuf, sizeof(logBuf), "snapshot receiver recv error seq:%d, my ack:%d", pMsg->seq, pReceiver->ack); + char *eventLog = snapshotReceiver2SimpleStr(pReceiver, logBuf); + syncNodeErrorLog(pSyncNode, eventLog); + taosMemoryFree(eventLog); + } while (0); + + return -1; } // send ack @@ -764,8 +773,8 @@ int32_t syncNodeOnSnapshotRspCb(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { } else { do { - char logBuf[64]; - snprintf(logBuf, sizeof(logBuf), "error ack, recv ack:%d, my seq:%d", pMsg->ack, pSender->seq); + char logBuf[96]; + snprintf(logBuf, sizeof(logBuf), "snapshot sender recv error ack:%d, my seq:%d", pMsg->ack, pSender->seq); char *eventLog = snapshotSender2SimpleStr(pSender, logBuf); syncNodeErrorLog(pSyncNode, eventLog); taosMemoryFree(eventLog); From fc55d6fb85c7ad7ec6c1ed18221c638f5849bb3d Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 28 Jun 2022 16:24:48 +0800 Subject: [PATCH 33/47] refactor: rsma code optimization --- include/util/taoserror.h | 1 + source/dnode/vnode/src/sma/smaRollup.c | 6 +++--- source/util/src/terror.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 8565eea63b..967b5796ec 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -615,6 +615,7 @@ int32_t* taosGetErrno(); //rsma #define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150) #define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151) +#define TSDB_CODE_RSMA_QTASKINFO_CREATE TAOS_DEF_ERROR_CODE(0, 0x3152) //index #define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200) diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 6f99970c5a..4402f37c34 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -250,6 +250,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaInfo pItem->pRsmaInfo = pRSmaInfo; pItem->taskInfo = qCreateStreamExecTaskInfo(param->qmsg[idx], pReadHandle); if (!pItem->taskInfo) { + terrno = TSDB_CODE_RSMA_QTASKINFO_CREATE; goto _err; } pItem->triggerStat = TASK_TRIGGER_STAT_INACTIVE; @@ -790,7 +791,7 @@ static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma) { tdCloseTFile(&tFile); return TSDB_CODE_SUCCESS; _err: - smaError("failed to restore rsma task since %s", terrstr()); + smaError("rsma restore, qtaskinfo reload failed since %s", terrstr()); return TSDB_CODE_FAILED; } @@ -804,12 +805,11 @@ static int32_t tdRSmaRestoreTSDataReload(SSma *pSma) { // TODO return TSDB_CODE_SUCCESS; _err: + smaError("rsma restore, ts data reload failed since %s", terrstr()); return TSDB_CODE_FAILED; } int32_t tdProcessRSmaRestoreImpl(SSma *pSma) { - SVnode *pVnode = pSma->pVnode; - // step 1: iterate all stables to restore the rsma env if (tdRSmaRestoreQTaskInfoInit(pSma) < 0) { goto _err; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index fa10fc26dd..651fd90bcf 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -581,10 +581,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_PTR, "Invalid tsma pointe TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_INVALID_PARA, "Invalid tsma parameters") TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_NO_INDEX_IN_CACHE, "No tsma index in cache") - //rsma TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_ENV, "Invalid rsma env") TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_STAT, "Invalid rsma state") +TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_QTASKINFO_CREATE, "Rsma qtaskinfo creation error") //tq TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "No committed offset") From f98d4f33bea26e0e650d2eba8b35678c8fefbaaa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 16:59:33 +0800 Subject: [PATCH 34/47] test: case for replica3 --- tests/script/jenkins/basic.txt | 6 + .../{unique => tsim}/vnode/back_insert.sim | 0 .../vnode/back_insert_many.sim | 0 tests/script/tsim/vnode/replica3_basic.sim | 368 ++++++++++++++++++ tests/script/tsim/vnode/replica3_many.sim | 262 +++++++++++++ .../vnode/replica3_repeat.sim | 91 +++-- tests/script/tsim/vnode/replica3_vgroup.sim | 129 ++++++ tests/script/unique/vnode/backup/replica4.sim | 220 ----------- tests/script/unique/vnode/backup/replica5.sim | 263 ------------- tests/script/unique/vnode/many.sim | 147 ------- .../script/unique/vnode/replica2_a_large.sim | 103 ----- tests/script/unique/vnode/replica2_basic2.sim | 223 ----------- tests/script/unique/vnode/replica2_repeat.sim | 110 ------ tests/script/unique/vnode/replica3_basic.sim | 233 ----------- tests/script/unique/vnode/replica3_vgroup.sim | 71 ---- tests/script/unique/vnode/testSuite.sim | 6 - 16 files changed, 814 insertions(+), 1418 deletions(-) rename tests/script/{unique => tsim}/vnode/back_insert.sim (100%) rename tests/script/{unique => tsim}/vnode/back_insert_many.sim (100%) create mode 100644 tests/script/tsim/vnode/replica3_basic.sim create mode 100644 tests/script/tsim/vnode/replica3_many.sim rename tests/script/{unique => tsim}/vnode/replica3_repeat.sim (60%) create mode 100644 tests/script/tsim/vnode/replica3_vgroup.sim delete mode 100644 tests/script/unique/vnode/backup/replica4.sim delete mode 100644 tests/script/unique/vnode/backup/replica5.sim delete mode 100644 tests/script/unique/vnode/many.sim delete mode 100644 tests/script/unique/vnode/replica2_a_large.sim delete mode 100644 tests/script/unique/vnode/replica2_basic2.sim delete mode 100644 tests/script/unique/vnode/replica2_repeat.sim delete mode 100644 tests/script/unique/vnode/replica3_basic.sim delete mode 100644 tests/script/unique/vnode/replica3_vgroup.sim delete mode 100644 tests/script/unique/vnode/testSuite.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index b7cedf04a6..d36837f3a6 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -162,6 +162,12 @@ # --- valgrind ./test.sh -f tsim/valgrind/checkError.sim -v +# --- vnode +#./test.sh -f tsim/vnode/replica3_basic.sim +#./test.sh -f tsim/vnode/replica3_repeat.sim +#./test.sh -f tsim/vnode/replica3_vgroup.sim +./test.sh -f tsim/vnode/replica3_many.sim + # --- sync ./test.sh -f tsim/sync/3Replica1VgElect.sim ./test.sh -f tsim/sync/3Replica5VgElect.sim diff --git a/tests/script/unique/vnode/back_insert.sim b/tests/script/tsim/vnode/back_insert.sim similarity index 100% rename from tests/script/unique/vnode/back_insert.sim rename to tests/script/tsim/vnode/back_insert.sim diff --git a/tests/script/unique/vnode/back_insert_many.sim b/tests/script/tsim/vnode/back_insert_many.sim similarity index 100% rename from tests/script/unique/vnode/back_insert_many.sim rename to tests/script/tsim/vnode/back_insert_many.sim diff --git a/tests/script/tsim/vnode/replica3_basic.sim b/tests/script/tsim/vnode/replica3_basic.sim new file mode 100644 index 0000000000..f7dd5dd136 --- /dev/null +++ b/tests/script/tsim/vnode/replica3_basic.sim @@ -0,0 +1,368 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 + +print ========== step0 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step01: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step01 +endi +if $data(2)[4] != ready then + goto step01 +endi +if $data(3)[4] != ready then + goto step01 +endi + +sql create mnode on dnode 2 +sql create mnode on dnode 3 + +$x = 0 +step02: + $x = $x + 1 + sleep 1000 + if $x == 20 then + return -1 + endi +sql show mnodes +print $data(1)[0] $data(1)[1] $data(1)[2] +print $data(2)[0] $data(2)[1] $data(2)[2] +print $data(3)[0] $data(3)[1] $data(3)[2] + +if $rows != 3 then + return -1 +endi +if $data(1)[0] != 1 then + return -1 +endi +if $data(1)[2] != leader then + return -1 +endi +if $data(2)[0] != 2 then + return -1 +endi +if $data(2)[2] != follower then + goto step02 +endi +if $data(3)[0] != 3 then + return -1 +endi +if $data(3)[2] != follower then + goto step02 +endi + +$N = 10 +$table = table_r3 +$db = db1 + +print =================== step 1 +sql create database $db replica 3 vgroups 1 +sql use $db + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step1 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step1 +endi + +sql use $db +sql create table $table (ts timestamp, speed int) + +print =================== step2 +$x = 1 +$y = $x + $N +$expect = $N +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +if $rows != $expect then + return -1 +endi + +print =================== step3 +system sh/exec.sh -n dnode2 -s stop +$x = 0 +step3: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step3 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step3 +endi + +$y = $x + $N +$expect = $N * 2 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step4 +system sh/exec.sh -n dnode2 -s start +$x = 0 +step4: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step4 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step4 +endi + +$y = $x + $N +$expect = $N * 3 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step5 +system sh/exec.sh -n dnode3 -s stop +$x = 0 +step5: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step5 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step5 +endi + +$y = $x + $N +$expect = $N * 4 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , 10) + $x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step6 +system sh/exec.sh -n dnode3 -s start +$x = 0 +step6: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step6 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step6 +endi + +$y = $x + $N +$expect = $N * 5 +while $x < $y +$ms = $x . m +sql insert into $table values (now + $ms , $x ) +$x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step7 +system sh/exec.sh -n dnode1 -s stop +$x = 0 +step7: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step7 +endi + +$y = $x + $N +$expect = $N * 6 +while $x < $y +$ms = $x . m +sql insert into $table values (now + $ms , 10) +$x = $x + 1 +endw + +sql select * from $table +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +print =================== step 8 +system sh/exec.sh -n dnode1 -s start +$x = 0 +step8: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step8 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step8 +endi + +$y = $x + $N +$expect = $N * 7 +while $x < $y + $ms = $x . m + sql insert into $table values (now + $ms , 10) + $x = $x + 1 +endw + +print sql select * from $table -> $rows points +#if $rows != $expect then +# return -1 +#endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/vnode/replica3_many.sim b/tests/script/tsim/vnode/replica3_many.sim new file mode 100644 index 0000000000..6b1a582f23 --- /dev/null +++ b/tests/script/tsim/vnode/replica3_many.sim @@ -0,0 +1,262 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 + +print ========== step0 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +step0: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step0 +endi +if $data(2)[4] != ready then + goto step0 +endi +if $data(3)[4] != ready then + goto step0 +endi +if $data(4)[4] != ready then + goto step0 +endi + +print ========= step1 +sql create database db1 replica 3 vgroups 1 +sql create database db2 replica 3 vgroups 1 +sql create database db3 replica 3 vgroups 1 +sql create database db4 replica 3 vgroups 1 + +print =============== step12 wait vgroup2 +$x = 0 +step12: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 +if $rows != 4 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step12 +endi + +print =============== step13 wait vgroup3 +$x = 0 +step13: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 +if $rows != 4 then + return -1 +endi +if $data(3)[4] == leader then + $leaderExist = 1 +endi +if $data(3)[6] == leader then + $leaderExist = 1 +endi +if $data(3)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step13 +endi + +print =============== step14 wait vgroup4 +$x = 0 +step14: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 +if $rows != 4 then + return -1 +endi +if $data(4)[4] == leader then + $leaderExist = 1 +endi +if $data(4)[6] == leader then + $leaderExist = 1 +endi +if $data(4)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step14 +endi + +print =============== step15 wait vgroup5 +$x = 0 +step15: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 +if $rows != 4 then + return -1 +endi +if $data(4)[4] == leader then + $leaderExist = 1 +endi +if $data(4)[6] == leader then + $leaderExist = 1 +endi +if $data(4)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step15 +endi + +print =============== step16: create table +sql create table db1.tb1 (ts timestamp, i int) +sql create table db2.tb2 (ts timestamp, i int) +sql create table db3.tb3 (ts timestamp, i int) +sql create table db4.tb4 (ts timestamp, i int) +sql insert into db1.tb1 values(now, 1) +sql insert into db2.tb2 values(now, 1) +sql insert into db3.tb3 values(now, 1) +sql insert into db4.tb4 values(now, 1) + +sql select count(*) from db1.tb1 +$lastRows1 = $rows +sql select count(*) from db2.tb2 +$lastRows2 = $rows +sql select count(*) from db3.tb3 +$lastRows3 = $rows +sql select count(*) from db4.tb4 +$lastRows4 = $rows + +print ======== step2 +run_back tsim/vnode/back_insert_many.sim +sleep 3000 + +$x = 0 +loop: + +print ======== step3 +system sh/exec.sh -n dnode2 -s stop +sleep 3000 +system sh/exec.sh -n dnode2 -s start +sleep 3000 + +print ======== step4 +system sh/exec.sh -n dnode3 -s stop +sleep 3000 +system sh/exec.sh -n dnode3 -s start +sleep 3000 + +print ======== step5 +system sh/exec.sh -n dnode2 -s stop +sleep 3000 +system sh/exec.sh -n dnode2 -s start +sleep 3000 + +print ======== step6 +sql select count(*) from db1.tb1 +print select count(*) from db1.tb1 ==> $data00 $lastRows1 +if $data00 <= $lastRows1 then + return -1 +endi +$lastRows1 = $data00 + +sql select count(*) from db2.tb2 +print select count(*) from db2.tb2 ==> $data00 $lastRows2 +if $data00 <= $lastRows2 then + return -1 +endi +$lastRows2 = $data00 + +sql select count(*) from db3.tb3 +print select count(*) from db3.tb3 ==> $data00 $lastRows3 +if $data00 <= $lastRows3 then + return -1 +endi +$lastRows3 = $data00 + +sql select count(*) from db4.tb4 +print select count(*) from db4.tb4 ==> $data00 $lastRows4 +if $data00 <= $lastRows4 then + return -1 +endi +$lastRows4 = $data00 + +print ======== step7 + +print ======== loop Times $x + +if $x < 2 then + $x = $x + 1 + goto loop +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_repeat.sim b/tests/script/tsim/vnode/replica3_repeat.sim similarity index 60% rename from tests/script/unique/vnode/replica3_repeat.sim rename to tests/script/tsim/vnode/replica3_repeat.sim index 636bc64f89..7419139277 100644 --- a/tests/script/unique/vnode/replica3_repeat.sim +++ b/tests/script/tsim/vnode/replica3_repeat.sim @@ -1,77 +1,84 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 +print ========== step0 system sh/exec.sh -n dnode1 -s start - sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start - $x = 0 -step1: +step0: $x = $x + 1 sleep 1000 if $x == 10 then + print ====> dnode not ready! return -1 endi - sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 endi -if $data4_2 != ready then - goto step1 +if $data(1)[4] != ready then + goto step0 endi -if $data4_3 != ready then - goto step1 +if $data(2)[4] != ready then + goto step0 endi -if $data4_4 != ready then - goto step1 +if $data(3)[4] != ready then + goto step0 endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 +if $data(4)[4] != ready then + goto step0 endi print ========= step1 -sql create database db replica 3 +sql create database db replica 3 vgroups 1 +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show db.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +if $rows != 4 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step1 +endi + sql create table db.tb (ts timestamp, i int) sql insert into db.tb values(now, 1) sql select count(*) from db.tb $lastRows = $rows print ======== step2 -run_back unique/vnode/back_insert.sim +run_back tsim/vnode/back_insert.sim sleep 2000 print ======== step3 diff --git a/tests/script/tsim/vnode/replica3_vgroup.sim b/tests/script/tsim/vnode/replica3_vgroup.sim new file mode 100644 index 0000000000..746a9d67ae --- /dev/null +++ b/tests/script/tsim/vnode/replica3_vgroup.sim @@ -0,0 +1,129 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 + +print ========== step0 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +step0: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step0 +endi +if $data(2)[4] != ready then + goto step0 +endi +if $data(3)[4] != ready then + goto step0 +endi +if $data(4)[4] != ready then + goto step0 +endi + +$N = 10 +$table = table_r3 +$db = db1 + +print =================== step 1 +sql create database $db replica 3 vgroups 2 +sql use $db + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +if $rows != 2 then + return -1 +endi +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step1 +endi +$leaderExist = 0 +if $data(3)[4] == leader then + $leaderExist = 1 +endi +if $data(3)[6] == leader then + $leaderExist = 1 +endi +if $data(3)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step1 +endi + +sql create table st (ts timestamp, speed int) tags (t1 int) + +$tbPre = m +$N = 300 +$x = 0 +$y = $x + $N +while $x < $y + $table = $tbPre . $x + sql create table $table using st tags ( $x ) + $ms = $x . m + sql insert into $table values (now + $ms , $x ) + $x = $x + 1 +endw + +#print =================== step2 +$x = -500 +$y = $x + $N +while $x < $y + $ms = $x . m + sql insert into $table values (now $ms , $x ) + $x = $x + 1 +endw + +$expect = $N + 1 +sql select * from $table +print sql select * from $table -> $rows points expect $expect +if $rows != $expect then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/backup/replica4.sim b/tests/script/unique/vnode/backup/replica4.sim deleted file mode 100644 index c0ff267c73..0000000000 --- a/tests/script/unique/vnode/backup/replica4.sim +++ /dev/null @@ -1,220 +0,0 @@ -system sh/stop_dnodes.sh - - - - - - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 - -system sh/exec.sh -n dnode1 -s start -$x = 0 -connectTbase: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql connect -x connectTbase - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 - -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sleep 3001 - -$N = 10 -$table = table_r4 -$db = db1 - -print =================== step 1 - -$x = 0 -created: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create database $db replica 4 -x created -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $table (ts timestamp, speed int) -x create1 -sleep 3001 - -print =================== step 2 -$x = 1 -$y = $x + $N -$expect = $N -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 3 -system sh/exec.sh -n dnode2 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 4 -system sh/exec.sh -n dnode2 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 3 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 5 -system sh/exec.sh -n dnode3 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 4 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 6 -system sh/exec.sh -n dnode3 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 5 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - - -print =================== step 7 -system sh/exec.sh -n dnode4 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 6 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 8 -system sh/exec.sh -n dnode4 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 7 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 9 -system sh/exec.sh -n dnode1 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 8 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , 10) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 10 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 9 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -system sh/exec.sh -n dnode2 -s stop -system sh/exec.sh -n dnode3 -s stop -system sh/exec.sh -n dnode4 -s stop - diff --git a/tests/script/unique/vnode/backup/replica5.sim b/tests/script/unique/vnode/backup/replica5.sim deleted file mode 100644 index 1223cf6b58..0000000000 --- a/tests/script/unique/vnode/backup/replica5.sim +++ /dev/null @@ -1,263 +0,0 @@ -system sh/stop_dnodes.sh - - - - - - - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 -system sh/cfg.sh -n dnode5 -c walLevel -v 1 - -system sh/exec.sh -n dnode1 -s start - -$x = 0 -connectTbase: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql connect -x connectTbase - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sql create dnode $hostname5 - -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -system sh/exec.sh -n dnode5 -s start -sleep 3001 - -$N = 10 -$table = table_r5 -$db = db1 - -print =================== step 1 - -$x = 0 -created: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create database $db replica 5 -x created -sql use $db - -$x = 0 -create1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $table (ts timestamp, speed int) -x create1 - -sleep 3001 - -print =================== step 2 -$x = 1 -$y = $x + $N -$expect = $N -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 3 -system sh/exec.sh -n dnode2 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 4 -system sh/exec.sh -n dnode2 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 3 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 5 -system sh/exec.sh -n dnode3 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 4 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 6 -system sh/exec.sh -n dnode3 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 5 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - - -print =================== step 7 -system sh/exec.sh -n dnode4 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 6 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 8 -system sh/exec.sh -n dnode4 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 7 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - - -print =================== step 9 -system sh/exec.sh -n dnode5 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 8 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 10 -system sh/exec.sh -n dnode5 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 9 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 11 -system sh/exec.sh -n dnode1 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 10 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , 10) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 12 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -$y = $x + $N -$expect = $N * 11 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -system sh/exec.sh -n dnode2 -s stop -system sh/exec.sh -n dnode3 -s stop -system sh/exec.sh -n dnode4 -s stop -system sh/exec.sh -n dnode5 -s stop - diff --git a/tests/script/unique/vnode/many.sim b/tests/script/unique/vnode/many.sim deleted file mode 100644 index a9298b1cf2..0000000000 --- a/tests/script/unique/vnode/many.sim +++ /dev/null @@ -1,147 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ========= step1 -sql create database db1 replica 2 -sql create database db2 replica 2 -sql create database db3 replica 2 -sql create database db4 replica 2 -sql create table db1.tb1 (ts timestamp, i int) -sql create table db2.tb2 (ts timestamp, i int) -sql create table db3.tb3 (ts timestamp, i int) -sql create table db4.tb4 (ts timestamp, i int) -sql insert into db1.tb1 values(now, 1) -sql insert into db2.tb2 values(now, 1) -sql insert into db3.tb3 values(now, 1) -sql insert into db4.tb4 values(now, 1) - -sql select count(*) from db1.tb1 -$lastRows1 = $rows -sql select count(*) from db2.tb2 -$lastRows2 = $rows -sql select count(*) from db3.tb3 -$lastRows3 = $rows -sql select count(*) from db4.tb4 -$lastRows4 = $rows - -print ======== step2 -run_back unique/vnode/back_insert_many.sim -sleep 3000 - -print ======== step3 - -$x = 0 -loop: - -print ======== step4 -system sh/exec.sh -n dnode3 -s stop -sleep 3000 -system sh/exec.sh -n dnode3 -s start -sleep 3000 - -print ======== step5 -system sh/exec.sh -n dnode2 -s stop -sleep 3000 -system sh/exec.sh -n dnode2 -s start -sleep 3000 - -print ======== step6 -sql select count(*) from db1.tb1 -print select count(*) from db1.tb1 ==> $data00 $lastRows1 -if $data00 <= $lastRows1 then - return -1 -endi -$lastRows1 = $data00 - -sql select count(*) from db2.tb2 -print select count(*) from db2.tb2 ==> $data00 $lastRows2 -if $data00 <= $lastRows2 then - return -1 -endi -$lastRows2 = $data00 - -sql select count(*) from db3.tb3 -print select count(*) from db3.tb3 ==> $data00 $lastRows3 -if $data00 <= $lastRows3 then - return -1 -endi -$lastRows3 = $data00 - -sql select count(*) from db4.tb4 -print select count(*) from db4.tb4 ==> $data00 $lastRows4 -if $data00 <= $lastRows4 then - return -1 -endi -$lastRows4 = $data00 - -print ======== step7 - -print ======== loop Times $x - -if $x < 2 then - $x = $x + 1 - goto loop -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_a_large.sim b/tests/script/unique/vnode/replica2_a_large.sim deleted file mode 100644 index 6f31803845..0000000000 --- a/tests/script/unique/vnode/replica2_a_large.sim +++ /dev/null @@ -1,103 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c debugFlag -v 131 -system sh/cfg.sh -n dnode2 -c debugFlag -v 131 -system sh/cfg.sh -n dnode3 -c debugFlag -v 131 -system sh/cfg.sh -n dnode4 -c debugFlag -v 131 -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -t -system sh/exec.sh -n dnode3 -s start -t -sleep 2000 - -print ========= step1 -sql create database db replica 2 -#sql create table db.tb1 (ts timestamp, i int) -#sql create table db.tb2 (ts timestamp, i int) -#sql create table db.tb3 (ts timestamp, i int) -#sql create table db.tb4 (ts timestamp, i int) -#sql insert into db.tb1 values(now, 1) -#sql select count(*) from db.tb1 - -sql create database db replica 2 -sql create table db.tb (ts timestamp, i int) -sql insert into db.tb values(now, 1) -sql select count(*) from db.tb -$lastRows = $rows - -print ======== step2 -#run_back unique/vnode/back_insert_many.sim -run_back unique/vnode/back_insert.sim -sleep 2000 - -print ======== step3 - -$x = 0 -loop: - -print ======== step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 10000 -system sh/exec.sh -n dnode2 -s start -t -sleep 10000 - -print ======== step5 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 10000 -system sh/exec.sh -n dnode3 -s start -t -sleep 10000 - -print ======== step6 -#sql select count(*) from db.tb1 -#print select count(*) from db.tb1 ==> $data00 $lastRows -sql select count(*) from db.tb -print select count(*) from db.tb ==> $data00 $lastRows -if $data00 <= $lastRows then - return -1 -endi - -print ======== step7 -$lastRows = $data00 -print ======== loop Times $x - -if $x < 10 then - $x = $x + 1 - goto loop -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_basic2.sim b/tests/script/unique/vnode/replica2_basic2.sim deleted file mode 100644 index c081f878dd..0000000000 --- a/tests/script/unique/vnode/replica2_basic2.sim +++ /dev/null @@ -1,223 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep 2000 - -sql reset query cache - -print ========= step1 -sql create database d1 replica 2 -sql create database d2 replica 2 -sql create database d3 replica 2 -sql create database d4 replica 2 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(now, 1) -sql insert into d2.t2 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -if $data4_1 != ready then - print dnode1 status should ready but is $data4_1 - return -1 -endi - -if $data4_2 != ready then - return -1 -endi - -if $data4_3 != ready then - return -1 -endi - -print ========= step2 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step3 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 - -#sql insert into d1.t1 values(now, 3) -#sql insert into d2.t2 values(now, 3) -#sql insert into d3.t3 values(now, 3) -#sql insert into d4.t4 values(now, 3) - -#sql select * from d1.t1 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d2.t2 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d3.t3 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d4.t4 -#if $rows != 2 then -# return -1 -#endi - -print ========= step4 -system sh/exec.sh -n dnode2 -s start -sleep 3000 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 3000 - -#sql insert into d1.t1 values(now, 4) -#sql insert into d2.t2 values(now, 4) -#sql insert into d3.t3 values(now, 4) -#sql insert into d4.t4 values(now, 4) - -#sql select * from d1.t1 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d2.t2 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d3.t3 -#if $rows != 2 then -# return -1 -#endi - -#sql select * from d4.t4 -#if $rows != 2 then -# return -1 -#endi - -print ========= step5 -system sh/exec.sh -n dnode3 -s start -sleep 3000 - -sql insert into d1.t1 values(now, 5) -sql insert into d2.t2 values(now, 5) -sql insert into d3.t3 values(now, 5) -sql insert into d4.t4 values(now, 5) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_repeat.sim b/tests/script/unique/vnode/replica2_repeat.sim deleted file mode 100644 index ac68d59164..0000000000 --- a/tests/script/unique/vnode/replica2_repeat.sim +++ /dev/null @@ -1,110 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ========= step1 -sql create database db replica 2 -sql create table db.tb (ts timestamp, i int) -sql insert into db.tb values(now, 1) -sql select count(*) from db.tb -$lastRows = $rows - -print ======== step2 -run_back unique/vnode/back_insert.sim -sleep 2000 - -print ======== step3 - -$x = 0 -loop: - -print ======== step4 -system sh/exec.sh -n dnode2 -s stop -sleep 3000 -system sh/exec.sh -n dnode2 -s start -sleep 3000 - -print ======== step5 -system sh/exec.sh -n dnode3 -s stop -sleep 3000 -system sh/exec.sh -n dnode3 -s start -sleep 3000 - -print ======== step6 -sql select count(*) from db.tb -print select count(*) from db.tb ==> $data00 $lastRows -if $data00 <= $lastRows then - return -1 -endi - -print ======== step7 -$lastRows = $data00 -print ======== loop Times $x - -if $x < 2 then - $x = $x + 1 - goto loop -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_basic.sim b/tests/script/unique/vnode/replica3_basic.sim deleted file mode 100644 index 0ff42b523b..0000000000 --- a/tests/script/unique/vnode/replica3_basic.sim +++ /dev/null @@ -1,233 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != slave then - goto step1 -endi -if $data2_3 != slave then - goto step1 -endi - -$N = 10 -$table = table_r3 -$db = db1 - -print =================== step 1 - -sql create database $db replica 3 -sql use $db -sql create table $table (ts timestamp, speed int) -sleep 3001 - -print =================== step 2 -$x = 1 -$y = $x + $N -$expect = $N -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 3 -system sh/exec.sh -n dnode2 -s stop -sleep 2000 -$y = $x + $N -$expect = $N * 2 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 4 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show db1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step4 -endi - -$y = $x + $N -$expect = $N * 3 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 5 -system sh/exec.sh -n dnode3 -s stop -$y = $x + $N -$expect = $N * 4 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -print =================== step 6 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show db1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -$y = $x + $N -$expect = $N * 5 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , $x ) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 7 -system sh/exec.sh -n dnode1 -s stop -$y = $x + $N -$expect = $N * 6 -while $x < $y -$ms = $x . m -sql insert into $table values (now + $ms , 10) -$x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then -return -1 -endi - -print =================== step 8 -system sh/exec.sh -n dnode1 -s start - -$x = 0 -step8: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show db1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -$y = $x + $N -$expect = $N * 7 -while $x < $y - $ms = $x . m - sql insert into $table values (now + $ms , 10) - $x = $x + 1 -endw - -sql select * from $table -print sql select * from $table -> $rows points -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_vgroup.sim b/tests/script/unique/vnode/replica3_vgroup.sim deleted file mode 100644 index de4c48eca5..0000000000 --- a/tests/script/unique/vnode/replica3_vgroup.sim +++ /dev/null @@ -1,71 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep 2000 - -$N = 10 -$table = table_r3 -$db = db1 - -sleep 2000 - -print =================== step 1 - -sql create database $db replica 3 -sql use $db -sql create table st (ts timestamp, speed int) tags (t1 int) -sleep 3001 - - -$tbPre = m -$N = 300 -$x = 0 -$y = $x + $N -while $x < $y - $table = $tbPre . $x - sql create table $table using st tags ( $x ) - $ms = $x . m - sql insert into $table values (now + $ms , $x ) - $x = $x + 1 -endw - - -#print =================== step 2 -$x = -500 -$y = $x + $N -while $x < $y - $ms = $x . m - sql insert into $table values (now $ms , $x ) - $x = $x + 1 -endw - -$expect = $N + 1 -sql select * from $table -print sql select * from $table -> $rows points expect $expect -if $rows != $expect then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/testSuite.sim b/tests/script/unique/vnode/testSuite.sim deleted file mode 100644 index 3a9db66beb..0000000000 --- a/tests/script/unique/vnode/testSuite.sim +++ /dev/null @@ -1,6 +0,0 @@ -run unique/vnode/many.sim -run unique/vnode/replica2_basic2.sim -run unique/vnode/replica2_repeat.sim -run unique/vnode/replica3_basic.sim -run unique/vnode/replica3_repeat.sim -run unique/vnode/replica3_vgroup.sim From 98e81746996e92712db17de2cf833518f8ecef88 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 17:21:15 +0800 Subject: [PATCH 35/47] test: case for replica3 db --- tests/script/jenkins/basic.txt | 5 +- tests/script/tsim/dnode/balance3.sim | 66 +++- tests/script/tsim/vnode/replica3_import.sim | 338 ++++++++++++++++++++ tests/script/unique/import/replica2.sim | 300 ----------------- tests/script/unique/import/replica3.sim | 291 ----------------- tests/script/unique/import/testSuite.sim | 2 - 6 files changed, 401 insertions(+), 601 deletions(-) create mode 100644 tests/script/tsim/vnode/replica3_import.sim delete mode 100644 tests/script/unique/import/replica2.sim delete mode 100644 tests/script/unique/import/replica3.sim delete mode 100644 tests/script/unique/import/testSuite.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index d36837f3a6..90bc4ab7c0 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -165,8 +165,9 @@ # --- vnode #./test.sh -f tsim/vnode/replica3_basic.sim #./test.sh -f tsim/vnode/replica3_repeat.sim -#./test.sh -f tsim/vnode/replica3_vgroup.sim -./test.sh -f tsim/vnode/replica3_many.sim +./test.sh -f tsim/vnode/replica3_vgroup.sim +#./test.sh -f tsim/vnode/replica3_many.sim +#./test.sh -f tsim/vnode/replica3_import.sim # --- sync ./test.sh -f tsim/sync/3Replica1VgElect.sim diff --git a/tests/script/tsim/dnode/balance3.sim b/tests/script/tsim/dnode/balance3.sim index 0e21861b14..f26c0eaa21 100644 --- a/tests/script/tsim/dnode/balance3.sim +++ b/tests/script/tsim/dnode/balance3.sim @@ -24,7 +24,7 @@ system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start $x = 0 -step1: +step10: $x = $x + 1 sleep 1000 if $x == 10 then @@ -40,19 +40,74 @@ if $rows != 4 then return -1 endi if $data(1)[4] != ready then - goto step1 + goto step10 endi if $data(2)[4] != ready then - goto step1 + goto step10 endi if $data(3)[4] != ready then - goto step1 + goto step10 endi if $data(4)[4] != ready then - goto step1 + goto step10 endi sql create database d1 replica 3 vgroups 1 +$x = 0 +step11: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step11 +endi + +sql create database d2 replica 3 vgroups 1 +$x = 0 +step12: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> d2 not ready! + return -1 + endi +sql show d2.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(3)[4] == leader then + $leaderExist = 1 +endi +if $data(3)[6] == leader then + $leaderExist = 1 +endi +if $data(3)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step12 +endi + sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -60,7 +115,6 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 replica 3 vgroups 1 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) diff --git a/tests/script/tsim/vnode/replica3_import.sim b/tests/script/tsim/vnode/replica3_import.sim new file mode 100644 index 0000000000..d1e73b9f27 --- /dev/null +++ b/tests/script/tsim/vnode/replica3_import.sim @@ -0,0 +1,338 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start + +$x = 0 +stepa: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto stepa +endi +if $data(2)[4] != ready then + goto stepa +endi +if $data(3)[4] != ready then + goto stepa +endi +if $data(4)[4] != ready then + goto stepa +endi + +sql create database ir3db replica 3 duration 7 vgroups 1 +sql use ir3db +$x = 0 +stepb: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $rows != 1 then + return -1 +endi +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto stepb +endi + +sql create table tb(ts timestamp, i bigint) + +print ================= step1 +sql insert into tb values(1520000010000, 1520000010000) +sql select * from tb; +print $rows +if $rows != 1 then + return -1 +endi + +print ================= step2 +sql insert into tb values(1520000008000, 1520000008000) +print $rows +sql select * from tb; +if $rows != 2 then + return -1 +endi + +print ================= step3 +sql insert into tb values(1520000020000, 1520000020000) +sql select * from tb; +print $rows +if $rows != 3 then + return -1 +endi + +print ================= step4 +sql insert into tb values(1520000009000, 1520000009000) +sql insert into tb values(1520000015000, 1520000015000) +sql insert into tb values(1520000030000, 1520000030000) +sql select * from tb; +print $rows +if $rows != 6 then + return -1 +endi + +print ================= step5 +sql insert into tb values(1520000008000, 1520000008000) +sql insert into tb values(1520000014000, 1520000014000) +sql insert into tb values(1520000025000, 1520000025000) +sql insert into tb values(1520000040000, 1520000040000) +sql select * from tb; +print $rows +if $rows != 9 then + return -1 +endi + +print ================= step6 +sql insert into tb values(1520000007000, 1520000007000) +sql insert into tb values(1520000012000, 1520000012000) +sql insert into tb values(1520000023000, 1520000023000) +sql insert into tb values(1520000034000, 1520000034000) +sql insert into tb values(1520000050000, 1520000050000) +sql select * from tb; +print $rows +if $rows != 14 then + return -1 +endi + +print ================== step7 +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s start +$x = 0 +step7: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step7 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step7 +endi + +print ================= step7 +sql insert into tb values(1520000007001, 1520000007001) +sql insert into tb values(1520000012001, 1520000012001) +sql insert into tb values(1520000023001, 1520000023001) +sql insert into tb values(1520000034001, 1520000034001) +sql insert into tb values(1520000050001, 1520000050001) +sql select * from tb; +print $rows +if $rows != 19 then + print expect 19, actual: $rows + return -1 +endi + +print ================= step8 +sql insert into tb values(1520000008002, 1520000008002) +sql insert into tb values(1520000014002, 1520000014002) +sql insert into tb values(1520000025002, 1520000025002) +sql insert into tb values(1520000060000, 1520000060000) +sql select * from tb; +print $rows +if $rows != 23 then + return -1 +endi + +print ================= step9 +sql insert into tb values(1517408000000, 1517408000000) +sql insert into tb values(1518272000000, 1518272000000) +sql insert into tb values(1519136000000, 1519136000000) +sql insert into tb values(1519568000000, 1519568000000) +sql insert into tb values(1519654400000, 1519654400000) +sql insert into tb values(1519827200000, 1519827200000) +sql insert into tb values(1520345600000, 1520345600000) +sql insert into tb values(1520691200000, 1520691200000) +sql insert into tb values(1520864000000, 1520864000000) +sql insert into tb values(1521900800000, 1521900800000) +sql insert into tb values(1523110400000, 1523110400000) +sql insert into tb values(1521382400000, 1521382400000) +sql select * from tb; +print $rows +if $rows != 35 then + return -1 +endi + +print ================= step10 +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s start +$x = 0 +step10: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step10 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step10 +endi + +sql select * from tb; +print $rows +if $rows != 35 then + return -1 +endi + +print ================= step11 +sql insert into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) +sql select * from tb; +if $rows != 40 then + return -1 +endi + +print ================= step12 +sql insert into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) +sql select * from tb; +print $rows +if $rows != 49 then + return -1 +endi + +print ================= step13 +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s start +$x = 0 +step13: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step13 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step13 +endi + +print ================= step14 +sql insert into tb values(1515852800001, -48) +sql insert into tb values(1516716800000, -38) +sql insert into tb values(1517580800000, -28) + +sql select * from tb; +print $rows +if $rows != 52 then + return -1 +endi + +print ================= step15 +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s start +$x = 0 +step15: + $x = $x + 1 + sleep 1000 + if $x == 60 then + print ====> db not ready! + return -1 + endi +sql show vgroups -x step15 +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +$leaderExist = 0 +if $data(2)[4] == leader then + $leaderExist = 1 +endi +if $data(2)[6] == leader then + $leaderExist = 1 +endi +if $data(2)[8] == leader then + $leaderExist = 1 +endi +if $leaderExist != 1 then + goto step15 +endi + +sql select * from tb; +if $rows != 52 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT +system sh/exec.sh -n dnode5 -s stop -x SIGINT +system sh/exec.sh -n dnode6 -s stop -x SIGINT +system sh/exec.sh -n dnode7 -s stop -x SIGINT +system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/import/replica2.sim b/tests/script/unique/import/replica2.sim deleted file mode 100644 index 387567fc82..0000000000 --- a/tests/script/unique/import/replica2.sim +++ /dev/null @@ -1,300 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi - -sql create database ir2db replica 2 duration 7 -sql use ir2db -sql create table tb(ts timestamp, i bigint) - -print ================= step1 -sql import into tb values(1520000010000, 1520000010000) -sql select * from tb; -print $rows -if $rows != 1 then - return -1 -endi - -print ================= step2 -sql insert into tb values(1520000008000, 1520000008000) -print $rows -sql select * from tb; -if $rows != 2 then - return -1 -endi - -print ================= step3 -sql insert into tb values(1520000020000, 1520000020000) -sql select * from tb; -print $rows -if $rows != 3 then - return -1 -endi - -print ================= step4 -sql import into tb values(1520000009000, 1520000009000) -sql import into tb values(1520000015000, 1520000015000) -sql import into tb values(1520000030000, 1520000030000) -sql select * from tb; -print $rows -if $rows != 6 then - return -1 -endi - -print ================= step5 -sql insert into tb values(1520000008000, 1520000008000) -sql insert into tb values(1520000014000, 1520000014000) -sql insert into tb values(1520000025000, 1520000025000) -sql insert into tb values(1520000040000, 1520000040000) -sql select * from tb; -print $rows -if $rows != 9 then - return -1 -endi - -print ================= step6 -sql import into tb values(1520000007000, 1520000007000) -sql import into tb values(1520000012000, 1520000012000) -sql import into tb values(1520000023000, 1520000023000) -sql import into tb values(1520000034000, 1520000034000) -sql import into tb values(1520000050000, 1520000050000) -sql select * from tb; -print $rows -if $rows != 14 then - return -1 -endi - -print ================== dnode restart -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql select * from tb; -if $rows != 14 then - return -1 -endi - -print ================= step7 -sql import into tb values(1520000007001, 1520000007001) -sql import into tb values(1520000012001, 1520000012001) -sql import into tb values(1520000023001, 1520000023001) -sql import into tb values(1520000034001, 1520000034001) -sql import into tb values(1520000050001, 1520000050001) -sql select * from tb; -print $rows -if $rows != 19 then - print expect 19, actual: $rows - return -1 -endi - -print ================= step8 -sql insert into tb values(1520000008002, 1520000008002) -sql insert into tb values(1520000014002, 1520000014002) -sql insert into tb values(1520000025002, 1520000025002) -sql insert into tb values(1520000060000, 1520000060000) -sql select * from tb; -print $rows -if $rows != 23 then - return -1 -endi - -print ================= step9 -#1520000000000 -#sql import into tb values(now-30d, 7003) -#sql import into tb values(now-20d, 34003) -#sql import into tb values(now-10d, 34003) -#sql import into tb values(now-5d, 34003) -#sql import into tb values(now+1d, 50001) -#sql import into tb values(now+2d, 50001) -#sql import into tb values(now+6d, 50001) -#sql import into tb values(now+8d, 50002) -#sql import into tb values(now+10d, 50003) -#sql import into tb values(now+12d, 50004) -#sql import into tb values(now+14d, 50001) -#sql import into tb values(now+16d, 500051) - -sql import into tb values(1517408000000, 1517408000000) -sql import into tb values(1518272000000, 1518272000000) -sql import into tb values(1519136000000, 1519136000000) -sql import into tb values(1519568000000, 1519568000000) -sql import into tb values(1519654400000, 1519654400000) -sql import into tb values(1519827200000, 1519827200000) -sql import into tb values(1520345600000, 1520345600000) -sql import into tb values(1520691200000, 1520691200000) -sql import into tb values(1520864000000, 1520864000000) -sql import into tb values(1521900800000, 1521900800000) -sql import into tb values(1523110400000, 1523110400000) -sql import into tb values(1521382400000, 1521382400000) -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start - -$x = 0 -a2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step11 - -#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) -sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) -sql select * from tb; -if $rows != 40 then - return -1 -endi - -print ================= step12 -#1520000000000 -#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11) -sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) -sql select * from tb; -print $rows -if $rows != 49 then - return -1 -endi - -print ================= step13 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s start -$x = 0 -a3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a3 -endi - -print ================= step14 -#1520000000000 -#sql import into tb values(now-48d, -48) -#sql import into tb values(now-38d, -38) -#sql import into tb values(now-28d, -28) - -sql import into tb values(1515852800001, -48) -sql import into tb values(1516716800000, -38) -sql import into tb values(1517580800000, -28) - -sql select * from tb; -if $rows != 52 then - return -1 -endi - -print ================= step15 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start -$x = 0 -a4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a4 -endi - -sql select * from tb; -if $rows != 52 then - goto a4 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/import/replica3.sim b/tests/script/unique/import/replica3.sim deleted file mode 100644 index 5c1b8b8932..0000000000 --- a/tests/script/unique/import/replica3.sim +++ /dev/null @@ -1,291 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -print ========= start dnode1 -system sh/exec.sh -n dnode1 -s start -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql create database ir3db replica 3 duration 7 -sql use ir3db -sql create table tb(ts timestamp, i bigint) - -print ================= step1 -sql import into tb values(1520000010000, 1520000010000) -sql select * from tb; -print $rows -if $rows != 1 then - return -1 -endi - -print ================= step2 -sql insert into tb values(1520000008000, 1520000008000) -print $rows -sql select * from tb; -if $rows != 2 then - return -1 -endi - -print ================= step3 -sql insert into tb values(1520000020000, 1520000020000) -sql select * from tb; -print $rows -if $rows != 3 then - return -1 -endi - -print ================= step4 -sql import into tb values(1520000009000, 1520000009000) -sql import into tb values(1520000015000, 1520000015000) -sql import into tb values(1520000030000, 1520000030000) -sql select * from tb; -print $rows -if $rows != 6 then - return -1 -endi - -print ================= step5 -sql insert into tb values(1520000008000, 1520000008000) -sql insert into tb values(1520000014000, 1520000014000) -sql insert into tb values(1520000025000, 1520000025000) -sql insert into tb values(1520000040000, 1520000040000) -sql select * from tb; -print $rows -if $rows != 9 then - return -1 -endi - -print ================= step6 -sql import into tb values(1520000007000, 1520000007000) -sql import into tb values(1520000012000, 1520000012000) -sql import into tb values(1520000023000, 1520000023000) -sql import into tb values(1520000034000, 1520000034000) -sql import into tb values(1520000050000, 1520000050000) -sql select * from tb; -print $rows -if $rows != 14 then - return -1 -endi - -print ================== dnode restart -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start -$x = 0 -a4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a4 -endi - -sql select * from tb; -if $rows != 14 then - return -1 -endi - -print ================= step7 -sql import into tb values(1520000007001, 1520000007001) -sql import into tb values(1520000012001, 1520000012001) -sql import into tb values(1520000023001, 1520000023001) -sql import into tb values(1520000034001, 1520000034001) -sql import into tb values(1520000050001, 1520000050001) -sql select * from tb; -print $rows -if $rows != 19 then - print expect 19, actual: $rows - return -1 -endi - -print ================= step8 -sql insert into tb values(1520000008002, 1520000008002) -sql insert into tb values(1520000014002, 1520000014002) -sql insert into tb values(1520000025002, 1520000025002) -sql insert into tb values(1520000060000, 1520000060000) -sql select * from tb; -print $rows -if $rows != 23 then - return -1 -endi - -print ================= step9 -#1520000000000 -#sql import into tb values(now-30d, 7003) -#sql import into tb values(now-20d, 34003) -#sql import into tb values(now-10d, 34003) -#sql import into tb values(now-5d, 34003) -#sql import into tb values(now+1d, 50001) -#sql import into tb values(now+2d, 50001) -#sql import into tb values(now+6d, 50001) -#sql import into tb values(now+8d, 50002) -#sql import into tb values(now+10d, 50003) -#sql import into tb values(now+12d, 50004) -#sql import into tb values(now+14d, 50001) -#sql import into tb values(now+16d, 500051) - -sql import into tb values(1517408000000, 1517408000000) -sql import into tb values(1518272000000, 1518272000000) -sql import into tb values(1519136000000, 1519136000000) -sql import into tb values(1519568000000, 1519568000000) -sql import into tb values(1519654400000, 1519654400000) -sql import into tb values(1519827200000, 1519827200000) -sql import into tb values(1520345600000, 1520345600000) -sql import into tb values(1520691200000, 1520691200000) -sql import into tb values(1520864000000, 1520864000000) -sql import into tb values(1521900800000, 1521900800000) -sql import into tb values(1523110400000, 1523110400000) -sql import into tb values(1521382400000, 1521382400000) -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step10 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start - -$x = 0 -step10: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step10 -endi - -sql select * from tb; -print $rows -if $rows != 35 then - return -1 -endi - -print ================= step11 - -#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) -sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) -sql select * from tb; -if $rows != 40 then - return -1 -endi - -print ================= step12 -#1520000000000 -#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11) -sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) -sql select * from tb; -print $rows -if $rows != 49 then - return -1 -endi - -print ================= step13 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 -system sh/exec.sh -n dnode2 -s start -sleep 3000 - -print ================= step14 -#1520000000000 -#sql import into tb values(now-48d, -48) -#sql import into tb values(now-38d, -38) -#sql import into tb values(now-28d, -28) - -sql import into tb values(1515852800001, -48) -sql import into tb values(1516716800000, -38) -sql import into tb values(1517580800000, -28) - -sql select * from tb; -if $rows != 52 then - return -1 -endi - -print ================= step15 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s start -$x = 0 -step15: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi -sql show vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step15 -endi - -sql select * from tb; -if $rows != 52 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/import/testSuite.sim b/tests/script/unique/import/testSuite.sim deleted file mode 100644 index 8be358ce17..0000000000 --- a/tests/script/unique/import/testSuite.sim +++ /dev/null @@ -1,2 +0,0 @@ -run unique/import/replica2.sim -run unique/import/replica3.sim \ No newline at end of file From 232e96abab2045470d3d734f84a7f6ea3142559e Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Tue, 28 Jun 2022 17:51:49 +0800 Subject: [PATCH 36/47] test: lengthen taos shell wait time --- tests/system-test/0-others/taosShell.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system-test/0-others/taosShell.py b/tests/system-test/0-others/taosShell.py index e03b34adca..f55813ac83 100644 --- a/tests/system-test/0-others/taosShell.py +++ b/tests/system-test/0-others/taosShell.py @@ -44,13 +44,13 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key tdLog.info ("taos cmd: %s" % taosCmd) - child = taosExpect.spawn(taosCmd, timeout=10) + child = taosExpect.spawn(taosCmd, timeout=20) #output = child.readline() #print (output.decode()) if len(expectString) != 0: - i = child.expect([expectString, taosExpect.TIMEOUT, taosExpect.EOF], timeout=10) + i = child.expect([expectString, taosExpect.TIMEOUT, taosExpect.EOF], timeout=20) else: - i = child.expect([taosExpect.TIMEOUT, taosExpect.EOF], timeout=10) + i = child.expect([taosExpect.TIMEOUT, taosExpect.EOF], timeout=20) if platform.system().lower() == 'windows': retResult = child.before @@ -62,7 +62,7 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key print ('taos login success! Here can run sql, taos> ') if len(sqlString) != 0: child.sendline (sqlString) - w = child.expect(["Query OK", taosExpect.TIMEOUT, taosExpect.EOF], timeout=1) + w = child.expect(["Query OK", taosExpect.TIMEOUT, taosExpect.EOF], timeout=10) if w == 0: return "TAOS_OK" else: From d949962769dd79e458ececb80469c4087807bd41 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 17:56:27 +0800 Subject: [PATCH 37/47] test: case for alter db replica --- tests/script/jenkins/basic.txt | 8 +- .../{unique => tsim}/db/back_insert.sim | 0 tests/script/{unique => tsim}/db/commit.sim | 0 tests/script/{unique => tsim}/db/delete.sim | 0 .../{unique => tsim}/db/delete_part.sim | 0 .../{unique => tsim}/db/replica_add13.sim | 0 .../{unique => tsim}/db/replica_part.sim | 0 .../{unique => tsim}/db/replica_reduce31.sim | 0 tests/script/unique/db/replica_add12.sim | 349 --------------- tests/script/unique/db/replica_add23.sim | 416 ------------------ tests/script/unique/db/replica_reduce21.sim | 187 -------- tests/script/unique/db/replica_reduce32.sim | 294 ------------- tests/script/unique/db/testSuite.sim | 10 - 13 files changed, 7 insertions(+), 1257 deletions(-) rename tests/script/{unique => tsim}/db/back_insert.sim (100%) rename tests/script/{unique => tsim}/db/commit.sim (100%) rename tests/script/{unique => tsim}/db/delete.sim (100%) rename tests/script/{unique => tsim}/db/delete_part.sim (100%) rename tests/script/{unique => tsim}/db/replica_add13.sim (100%) rename tests/script/{unique => tsim}/db/replica_part.sim (100%) rename tests/script/{unique => tsim}/db/replica_reduce31.sim (100%) delete mode 100644 tests/script/unique/db/replica_add12.sim delete mode 100644 tests/script/unique/db/replica_add23.sim delete mode 100644 tests/script/unique/db/replica_reduce21.sim delete mode 100644 tests/script/unique/db/replica_reduce32.sim delete mode 100644 tests/script/unique/db/testSuite.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 90bc4ab7c0..3c43dca999 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -8,7 +8,6 @@ ./test.sh -f tsim/user/privilege_sysinfo.sim ## ---- db -./test.sh -f tsim/db/create_all_options.sim ./test.sh -f tsim/db/alter_option.sim ./test.sh -f tsim/db/alter_replica_13.sim ./test.sh -f tsim/db/alter_replica_31.sim @@ -17,7 +16,14 @@ ./test.sh -f tsim/db/basic3.sim ./test.sh -f tsim/db/basic6.sim ./test.sh -f tsim/db/basic7.sim +#./test.sh -f tsim/db/commit.sim +./test.sh -f tsim/db/create_all_options.sim +#./test.sh -f tsim/db/delete_part.sim +#./test.sh -f tsim/db/delete.sim ./test.sh -f tsim/db/error1.sim +#./test.sh -f tsim/db/replica_add13.sim +#./test.sh -f tsim/db/replica_part.sim +#./test.sh -f tsim/db/replica_reduce31.sim ./test.sh -f tsim/db/taosdlog.sim # ---- dnode diff --git a/tests/script/unique/db/back_insert.sim b/tests/script/tsim/db/back_insert.sim similarity index 100% rename from tests/script/unique/db/back_insert.sim rename to tests/script/tsim/db/back_insert.sim diff --git a/tests/script/unique/db/commit.sim b/tests/script/tsim/db/commit.sim similarity index 100% rename from tests/script/unique/db/commit.sim rename to tests/script/tsim/db/commit.sim diff --git a/tests/script/unique/db/delete.sim b/tests/script/tsim/db/delete.sim similarity index 100% rename from tests/script/unique/db/delete.sim rename to tests/script/tsim/db/delete.sim diff --git a/tests/script/unique/db/delete_part.sim b/tests/script/tsim/db/delete_part.sim similarity index 100% rename from tests/script/unique/db/delete_part.sim rename to tests/script/tsim/db/delete_part.sim diff --git a/tests/script/unique/db/replica_add13.sim b/tests/script/tsim/db/replica_add13.sim similarity index 100% rename from tests/script/unique/db/replica_add13.sim rename to tests/script/tsim/db/replica_add13.sim diff --git a/tests/script/unique/db/replica_part.sim b/tests/script/tsim/db/replica_part.sim similarity index 100% rename from tests/script/unique/db/replica_part.sim rename to tests/script/tsim/db/replica_part.sim diff --git a/tests/script/unique/db/replica_reduce31.sim b/tests/script/tsim/db/replica_reduce31.sim similarity index 100% rename from tests/script/unique/db/replica_reduce31.sim rename to tests/script/tsim/db/replica_reduce31.sim diff --git a/tests/script/unique/db/replica_add12.sim b/tests/script/unique/db/replica_add12.sim deleted file mode 100644 index d46187e445..0000000000 --- a/tests/script/unique/db/replica_add12.sim +++ /dev/null @@ -1,349 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != null then - goto step1 -endi -if $data2_3 != null then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 1 -sql create database d2 replica 1 -sql create database d3 replica 1 -sql create database d4 replica 1 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(now, 1) -sql insert into d2.t2 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 2 then - return -1 -endi - -if $data2_3 != 2 then - return -1 -endi - -print ======== step2 -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -print ======== step3 -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -print ======== step4 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -sql reset query cache -sleep 200 - -print ========= step5 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql select * from d1.t1 -x s51 -s51: -#sql insert into d1.t1 values(now, 3) -x s52 -s52: - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql insert into d1.t1 values(now, 3) -x step6 -sql insert into d2.t2 values(now, 3) -x step6 -sql insert into d3.t3 values(now, 3) -x step6 -sql insert into d4.t4 values(now, 3) -x step6 - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step61 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -#sql insert into d1.t1 values(now, 3) -x s61 -s61: - -sql select * from d2.t2 -x s62 -s62: - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql insert into d1.t1 values(now, 5) -x step7 -sql insert into d2.t2 values(now, 5) -x step7 -sql insert into d3.t3 values(now, 5) -x step7 -sql insert into d4.t4 values(now, 5) -x step7 - -sql select * from d1.t1 -if $rows != 4 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 4 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 4 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 4 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_add23.sim b/tests/script/unique/db/replica_add23.sim deleted file mode 100644 index ac0bd6d9d7..0000000000 --- a/tests/script/unique/db/replica_add23.sim +++ /dev/null @@ -1,416 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 2 -sql create database d2 replica 2 -sql create database d3 replica 2 -sql create database d4 replica 2 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(1588262400001, 1) -sql insert into d2.t2 values(1588262400001, 1) -sql insert into d3.t3 values(1588262400001, 1) -sql insert into d4.t4 values(1588262400001, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ======== step2 -sql alter database d1 replica 3 -sql alter database d2 replica 3 -sql alter database d3 replica 3 -sql alter database d4 replica 3 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -print ======== step3 -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 -print dnode4 ==> openVnodes: $data2_4 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -print ======== step4 -sql insert into d1.t1 values(1588262400002, 2) -sql insert into d2.t2 values(1588262400002, 2) -sql insert into d3.t3 values(1588262400002, 2) -sql insert into d4.t4 values(1588262400002, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -sql reset query cache -sleep 100 - -print ========= step5 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql insert into d1.t1 values(1588262400003, 3) -sql insert into d2.t2 values(1588262400003, 3) -sql insert into d3.t3 values(1588262400003, 3) -sql insert into d4.t4 values(1588262400003, 3) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -sql insert into d1.t1 values(1588262400004, 4) -sql insert into d2.t2 values(1588262400004, 4) -sql insert into d3.t3 values(1588262400004, 4) -sql insert into d4.t4 values(1588262400004, 4) - -sql select * from d1.t1 -if $rows != 4 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 4 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 4 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 4 then - return -1 -endi - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -sql insert into d1.t1 values(1588262400005, 5) -sql insert into d2.t2 values(1588262400005, 5) -sql insert into d3.t3 values(1588262400005, 5) -sql insert into d4.t4 values(1588262400005, 5) - -sql select * from d1.t1 -if $rows != 5 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 5 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 5 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 5 then - return -1 -endi - -print ========= step8 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step8: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d1.t1 values(1588262400006, 6) -sql insert into d2.t2 values(1588262400006, 6) -sql insert into d3.t3 values(1588262400006, 6) -sql insert into d4.t4 values(1588262400006, 6) - -sql select * from d1.t1 -if $rows != 6 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 6 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 6 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 6 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce21.sim b/tests/script/unique/db/replica_reduce21.sim deleted file mode 100644 index d3a76485f8..0000000000 --- a/tests/script/unique/db/replica_reduce21.sim +++ /dev/null @@ -1,187 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 2 -sql create database d2 replica 2 -sql create database d3 replica 2 -sql create database d4 replica 2 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d2.t2 values(now, 1) -sql insert into d1.t1 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) -sleep 1000 - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ======== step2 create d5 -sql create database d5 replica 1 - -print ========= step3 alter d1 -sql alter database d1 replica 1 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - - -print ========= step4 query d1 -sql insert into d1.t1 values(now, 2) -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -print ========= step5 query d5 -sql create table d5.t5 (ts timestamp, i int) -sql insert into d5.t5 values(now, 1); -sql select * from d5.t5 -if $rows != 1 then - return -1 -endi -return -print ========= step7 drop d1 -sql drop database d1 -sql reset query cache -sleep 100 - -print ========= step8 -sql insert into d5.t5 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d5.t5 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ======== step9 stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d5.t5 values(now, 3) -sql insert into d2.t2 values(now, 3) -sql insert into d3.t3 values(now, 3) -sql insert into d4.t4 values(now, 3) - -sql select * from d5.t5 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce32.sim b/tests/script/unique/db/replica_reduce32.sim deleted file mode 100644 index ead265d5d5..0000000000 --- a/tests/script/unique/db/replica_reduce32.sim +++ /dev/null @@ -1,294 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi -if $data2_2 != null then - goto step1 -endi -if $data2_3 != null then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 3 -sql create database d2 replica 3 -sql create database d3 replica 3 -sql create database d4 replica 3 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d2.t2 values(now, 1) -sql insert into d1.t1 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ========= step2 alter db -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -print ========= step3 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -sql reset query cache -sleep 200 - -print ========= step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 - -sql insert into d1.t1 values(now, 3) -x s41 -s41: -sql insert into d2.t2 values(now, 3) -x s42 -s42: -sql insert into d3.t3 values(now, 3) -x s43 -s43: -sql insert into d4.t4 values(now, 3) -x s44 -s44: - -sql select * from d1.t1 -x s45 -s45: -sql select * from d2.t2 -x s46 -s46: -sql select * from d3.t3 -x s47 -s47: -sql select * from d4.t4 -x s48 -s48: - -print ========= step5 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step5: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step5 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sql reset query cache -sleep 100 - -sql_error insert into d1.t1 values(now, 3) -x s51 -s51: -sql_error insert into d2.t2 values(now, 3) -x s52 -s52: -sql_error insert into d3.t3 values(now, 3) -x s53 -s53: -sql_error insert into d4.t4 values(now, 3) -x s54 -s54: - -print ========= step6 -system sh/exec.sh -n dnode3 -s start -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql insert into d1.t1 values(now, 5) -sql insert into d2.t2 values(now, 5) -sql insert into d3.t3 values(now, 5) -sql insert into d4.t4 values(now, 5) -sleep 1000 - -sql select * from d1.t1 -print d1.t1 $rows - -sql select * from d2.t2 -print d2.t2 $rows - -sql select * from d3.t3 -print d3.t3 $rows - -sql select * from d4.t4 -print d4.t4 $rows - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/testSuite.sim b/tests/script/unique/db/testSuite.sim deleted file mode 100644 index adc1883a71..0000000000 --- a/tests/script/unique/db/testSuite.sim +++ /dev/null @@ -1,10 +0,0 @@ -run unique/db/commit.sim -run unique/db/delete.sim -run unique/db/replica_add12.sim -run unique/db/replica_add13.sim -run unique/db/replica_add23.sim -run unique/db/replica_reduce21.sim -run unique/db/replica_reduce32.sim -run unique/db/replica_reduce31.sim -run unique/db/replica_part.sim -run unique/db/delete_part.sim From 2b5b2fee6ee44774d58476e3b21118a52727299b Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 28 Jun 2022 18:11:50 +0800 Subject: [PATCH 38/47] test:modify testcase of muti-mnodes; --- tests/pytest/util/cluster.py | 10 +- tests/pytest/util/common.py | 5 + .../1-insert/insertWithMoreVgroup.py | 6 +- tests/system-test/2-query/queryQnode.py | 342 ++++++++++++++++++ .../5dnode3mnodeSep1VnodeStopDnodeCreateDb.py | 200 ++++++++++ ...dnode3mnodeSep1VnodeStopDnodeCreateStb.py} | 95 +++-- .../5dnode3mnodeSep1VnodeStopMnodeCreateDb.py | 116 +++--- ...5dnode3mnodeSep1VnodeStopMnodeCreateStb.py | 204 +++++++++++ .../5dnode3mnodeSep1VnodeStopVnodeCreateDb.py | 95 +++-- ...5dnode3mnodeSep1VnodeStopVnodeCreateStb.py | 204 +++++++++++ .../6-cluster/5dnode3mnodeStopConnect.py | 132 +++++++ .../6-cluster/clusterCommonCheck.py | 17 +- .../6-cluster/clusterCommonCreate.py | 15 + tests/system-test/fulltest.sh | 15 +- 14 files changed, 1300 insertions(+), 156 deletions(-) create mode 100644 tests/system-test/2-query/queryQnode.py create mode 100644 tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py rename tests/system-test/6-cluster/{5dnode3mnodeSep1VnodeStopCreateDb.py => 5dnode3mnodeSep1VnodeStopDnodeCreateStb.py} (68%) create mode 100644 tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py create mode 100644 tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py create mode 100644 tests/system-test/6-cluster/5dnode3mnodeStopConnect.py diff --git a/tests/pytest/util/cluster.py b/tests/pytest/util/cluster.py index 21cad4c5bb..efa83323a4 100644 --- a/tests/pytest/util/cluster.py +++ b/tests/pytest/util/cluster.py @@ -26,7 +26,7 @@ class ClusterDnodes(TDDnodes): class ConfigureyCluster: """This will create defined number of dnodes and create a cluster. at the same time, it will return TDDnodes list: dnodes, """ - hostname= socket.gethostname() + hostname = socket.gethostname() def __init__(self): self.dnodes = [] @@ -86,7 +86,13 @@ class ConfigureyCluster: time.sleep(1) else: tdLog.exit("create cluster with %d dnode but check dnode not ready within 5s ! "%self.dnodeNums) - + def checkConnectStatus(self,dnodeNo,hostname=hostname): + dnodeNo = int(dnodeNo) + tdLog.info("check dnode-%d connection"%(dnodeNo+1)) + hostname = socket.gethostname() + port = 6030 + dnodeNo*100 + connectToDnode = tdCom.newcon(host=hostname,port=port) + return connectToDnode cluster = ConfigureyCluster() \ No newline at end of file diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index b43f87be29..ca0c66a9d4 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -379,6 +379,11 @@ class TDCom: tdLog.info("cfgPath: %s" % cfgPath) return cfgPath + def newcon(self,host='localhost',port=6030,user='root',password='taosdata'): + con=taos.connect(host=host, user=user, password=password, port=port) + print(con) + return con + def newcur(self,host='localhost',port=6030,user='root',password='taosdata'): cfgPath = self.getClientCfgPath() con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port) diff --git a/tests/system-test/1-insert/insertWithMoreVgroup.py b/tests/system-test/1-insert/insertWithMoreVgroup.py index 29c293c608..1ebbc1fc57 100644 --- a/tests/system-test/1-insert/insertWithMoreVgroup.py +++ b/tests/system-test/1-insert/insertWithMoreVgroup.py @@ -81,7 +81,7 @@ class TDTestCase: user = "root" password = "taosdata" port =6030 - con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) + con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port,config="/home/chr/TDengine/sim/psim/cfg/") cur=con.cursor() print(cur) return cur @@ -401,10 +401,6 @@ class TDTestCase: tdLog.debug(" LIMIT test_case3 ............ [OK]") - # test qnode - self.test_case4() - tdLog.debug(" LIMIT test_case3 ............ [OK]") - return # diff --git a/tests/system-test/2-query/queryQnode.py b/tests/system-test/2-query/queryQnode.py new file mode 100644 index 0000000000..15b643f5d7 --- /dev/null +++ b/tests/system-test/2-query/queryQnode.py @@ -0,0 +1,342 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +import threading as thd +import multiprocessing as mp +from numpy.lib.function_base import insert +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np +import datetime as dt +import time +# constant define +WAITS = 5 # wait seconds + +class TDTestCase: + # + # --------------- main frame ------------------- + # + clientCfgDict = {'queryproxy': '1','debugFlag': 135} + clientCfgDict["queryproxy"] = '2' + clientCfgDict["debugFlag"] = 143 + + updatecfgDict = {'clientCfg': {}} + updatecfgDict = {'debugFlag': 143} + updatecfgDict["clientCfg"] = clientCfgDict + def caseDescription(self): + ''' + limit and offset keyword function test cases; + case1: limit offset base function test + case2: offset return valid + ''' + return + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files or "taosd.exe" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + # init + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + # tdSql.prepare() + # self.create_tables(); + self.ts = 1500000000000 + + # stop + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + + # --------------- case ------------------- + + def newcur(self,host,cfg): + user = "root" + password = "taosdata" + port =6030 + con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) + cur=con.cursor() + print(cur) + return cur + + # create tables + def create_tables(self,host,dbname,stbname,count): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tsql.execute("use %s" %dbname) + + pre_create = "create table" + sql = pre_create + count=int(count) + + tdLog.debug("doing create one stable %s and %d child table in %s ..." %(stbname, count ,dbname)) + # print(time.time()) + exeStartTime=time.time() + # print(type(tcountStop),type(tcountStart)) + for i in range(0,count): + sql += " %s_%d using %s tags(%d)"%(stbname,i,stbname,i+1) + if i >0 and i%20000 == 0: + # print(sql) + tsql.execute(sql) + sql = pre_create + # print(time.time()) + # end sql + if sql != pre_create: + # print(sql) + tsql.execute(sql) + exeEndTime=time.time() + spendTime=exeEndTime-exeStartTime + speedCreate=count/spendTime + # tdLog.debug("spent %.2fs to create 1 stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,count,speedCreate)) + return + + def mutiThread_create_tables(self,host,dbname,stbname,vgroups,threadNumbers,childcount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tdLog.debug("create database %s"%dbname) + tsql.execute("drop database if exists %s"%dbname) + tsql.execute("create database %s vgroups %d"%(dbname,vgroups)) + tsql.execute("use %s" %dbname) + count=int(childcount) + threads = [] + for i in range(threadNumbers): + tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) + threads.append(thd.Thread(target=self.create_tables, args=(host, dbname, stbname+"%d"%i, count,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + spendTime=end_time-start_time + speedCreate=threadNumbers*count/spendTime + tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,threadNumbers,threadNumbers*count,speedCreate)) + + return + + # def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop): + + + # insert data + def insert_data(self, host, dbname, stbname, chilCount, ts_start, rowCount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + tsql=self.newcur(host,config) + tdLog.debug("ready to inser data") + tsql.execute("use %s" %dbname) + pre_insert = "insert into " + sql = pre_insert + chilCount=int(chilCount) + allRows=chilCount*rowCount + tdLog.debug("doing insert data into stable-index:%s rows:%d ..."%(stbname, allRows)) + exeStartTime=time.time() + for i in range(0,chilCount): + sql += " %s_%d values "%(stbname,i) + for j in range(rowCount): + sql += "(%d, %d, 'taos_%d') "%(ts_start + j*1000, j, j) + if j >0 and j%4000 == 0: + # print(sql) + tsql.execute(sql) + sql = "insert into %s_%d values " %(stbname,i) + # end sql + if sql != pre_insert: + # print(sql) + print(len(sql)) + tsql.execute(sql) + exeEndTime=time.time() + spendTime=exeEndTime-exeStartTime + speedInsert=allRows/spendTime + tdLog.debug("spent %.2fs to INSERT %d rows into %s , insert rate is %.2f rows/s... [OK]"% (spendTime,allRows,stbname,speedInsert)) + # tdLog.debug("INSERT TABLE DATA ............ [OK]") + return + + def mutiThread_insert_data(self, host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tdLog.debug("ready to inser data") + + tsql.execute("use %s" %dbname) + chilCount=int(chilCount) + threads = [] + for i in range(threadNumbers): + # tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) + threads.append(thd.Thread(target=self.insert_data, args=(host, dbname, stbname+"%d"%i, chilCount, ts_start, childrowcount,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + spendTime=end_time-start_time + tableCounts=threadNumbers*chilCount + stableRows=chilCount*childrowcount + allRows=stableRows*threadNumbers + speedInsert=allRows/spendTime + + for i in range(threadNumbers): + tdSql.execute("use %s" %dbname) + tdSql.query("select count(*) from %s%d"%(stbname,i)) + tdSql.checkData(0,0,stableRows) + tdLog.debug("spent %.2fs to insert %d rows into %d stable and %d table, speed is %.2f table/s... [OK]"% (spendTime,allRows,threadNumbers,tableCounts,speedInsert)) + tdLog.debug("INSERT TABLE DATA ............ [OK]") + + return + + + def taosBench(self,jsonFile): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + taosBenchbin = buildPath+ "/build/bin/taosBenchmark" + os.system("%s -f %s -y " %(taosBenchbin,jsonFile)) + + return + def taosBenchCreate(self,host,dropdb,dbname,stbname,vgroups,processNumbers,count): + + # count=50000 + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + tsql=self.newcur(host,config) + + # insert: create one or mutiple tables per sql and insert multiple rows per sql + tsql.execute("drop database if exists %s"%dbname) + + tsql.execute("create database %s vgroups %d"%(dbname,vgroups)) + print("db has been created") + # tsql.getResult("show databases") + # print(tdSql.queryResult) + tsql.execute("use %s" %dbname) + + threads = [] + for i in range(processNumbers): + jsonfile="1-insert/Vgroups%d%d.json"%(vgroups,i) + os.system("cp -f 1-insert/manyVgroups.json %s"%(jsonfile)) + os.system("sed -i 's/\"name\": \"db\",/\"name\": \"%s\",/g' %s"%(dbname,jsonfile)) + os.system("sed -i 's/\"drop\": \"no\",/\"drop\": \"%s\",/g' %s"%(dropdb,jsonfile)) + os.system("sed -i 's/\"host\": \"127.0.0.1\",/\"host\": \"%s\",/g' %s"%(host,jsonfile)) + os.system("sed -i 's/\"childtable_count\": 10000,/\"childtable_count\": %d,/g' %s "%(count,jsonfile)) + os.system("sed -i 's/\"name\": \"stb1\",/\"name\": \"%s%d\",/g' %s "%(stbname,i,jsonfile)) + os.system("sed -i 's/\"childtable_prefix\": \"stb1_\",/\"childtable_prefix\": \"%s%d_\",/g' %s "%(stbname,i,jsonfile)) + threads.append(mp.Process(target=self.taosBench, args=("%s"%jsonfile,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + + spendTime=end_time-start_time + speedCreate=count/spendTime + tdLog.debug("spent %.2fs to create 1 stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,count,speedCreate)) + return + + def checkData(self,dbname,stbname,stableCount,CtableCount,rowsPerSTable,): + tdSql.execute("use %s"%dbname) + tdSql.query("show stables") + tdSql.checkRows(stableCount) + tdSql.query("show tables") + tdSql.checkRows(CtableCount) + for i in range(stableCount): + tdSql.query("select count(*) from %s%d"%(stbname,i)) + tdSql.checkData(0,0,rowsPerSTable) + return + + # test case1 base + def test_case1(self): + #stableCount=threadNumbersCtb + parameterDict = {'vgroups': 1, \ + 'threadNumbersCtb': 5, \ + 'threadNumbersIda': 5, \ + 'stableCount': 5, \ + 'tablesPerStb': 50, \ + 'rowsPerTable': 10, \ + 'dbname': 'db', \ + 'stbname': 'stb', \ + 'host': 'localhost', \ + 'startTs': 1640966400000} # 2022-01-01 00:00:00.000 + + tdLog.debug("-----create database and muti-thread create tables test------- ") + + def test_case4(self): + self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10) + tdSql.execute("use db1;") + tdSql.query("show dnodes;") + dnodeId=tdSql.getData(0,0) + print(dnodeId) + tdSql.execute("create qnode on dnode %s"%dnodeId) + tdSql.query("select max(c1) from stb10;") + maxQnode=tdSql.getData(0,0) + tdSql.query("select min(c1) from stb11;") + minQnode=tdSql.getData(0,0) + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + unionQnode=tdSql.queryResult + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + unionallQnode=tdSql.queryResult + + # tdSql.query("show qnodes;") + # qnodeId=tdSql.getData(0,0) + tdSql.execute("drop qnode on dnode %s"%dnodeId) + tdSql.execute("reset query cache") + tdSql.query("select max(c1) from stb10;") + tdSql.checkData(0, 0, "%s"%maxQnode) + tdSql.query("select min(c1) from stb11;") + tdSql.checkData(0, 0, "%s"%minQnode) + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + unionVnode=tdSql.queryResult + assert unionQnode == unionVnode + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + unionallVnode=tdSql.queryResult + assert unionallQnode == unionallVnode + + + # tdSql.execute("create qnode on dnode %s"%dnodeId) + + # run case + def run(self): + + # test qnode + self.test_case4() + tdLog.debug(" LIMIT test_case3 ............ [OK]") + + + return +# +# add case with filename +# +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py new file mode 100644 index 0000000000..96fad487d1 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py @@ -0,0 +1,200 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """if it returns a number greater than one, you're in trouble, + # and you should call it again with exc=NULL to revert the effect""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db', + 'dbNumbers': 20, + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + # while stopcount < restartNumbers: + # tdLog.info(" restart loop: %d"%stopcount ) + # if stopRole == "mnode": + # for i in range(mnodeNums): + # tdDnodes[i].stoptaosd() + # # sleep(10) + # tdDnodes[i].starttaosd() + # # sleep(10) + # elif stopRole == "vnode": + # for i in range(vnodeNumbers): + # tdDnodes[i+mnodeNums].stoptaosd() + # # sleep(10) + # tdDnodes[i+mnodeNums].starttaosd() + # # sleep(10) + # elif stopRole == "dnode": + # for i in range(dnodeNumbers): + # tdDnodes[i].stoptaosd() + # # sleep(10) + # tdDnodes[i].starttaosd() + # # sleep(10) + + # # dnodeNumbers don't include database of schema + # if clusterComCheck.checkDnodes(dnodeNumbers): + # tdLog.info("check dnodes status is ready") + # else: + # tdLog.info("check dnodes status is not ready") + # self.stopThread(threads) + # tdLog.exit("one or more of dnodes failed to start ") + # # self.check3mnode() + # stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py similarity index 68% rename from tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py rename to tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py index 59fe1c0b16..4ab9aa64e1 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py @@ -90,35 +90,34 @@ class TDTestCase: tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") - paraDict = {'dbName': 'db', + paraDict = {'dbName': 'db0_0', 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - dbNumbers = int(dnodenumbers * restartNumber) - + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -133,45 +132,67 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping all dnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable - tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - for i in range(dnodenumbers): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[i].stoptaosd() - # sleep(10) - tdDnodes[i].starttaosd() - # sleep(10) + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + tdLog.info("Take turns stopping Mnodes ") - if clusterComCheck.checkDnodes(dnodenumbers): - # threads.join() - tdLog.info("first restart loop") + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") else: print("456") - threads.join() + self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(dnodenumbers,'db%d'%i) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py index cf608f6480..17c344e341 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py @@ -65,59 +65,35 @@ class TDTestCase: self._async_raise(thread.ident, SystemExit) - def insertData(self,countstart,countstop): - # fisrt add data : db\stable\childtable\general table - - for couti in range(countstart,countstop): - tdLog.debug("drop database if exists db%d" %couti) - tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("use db%d" %couti) - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - - - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db', + 'dbNumbers': 20, 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - dbNumbers = int(mnodeNums * restartNumber) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -132,46 +108,62 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping Mnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - tdLog.info("first restart loop") - for i in range(mnodeNums): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[i].stoptaosd() - # sleep(10) - tdDnodes[i].starttaosd() - # sleep(10) + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) - if clusterComCheck.checkDnodes(dnodenumbers): - # threads.join() - tdLog.info("123") + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("check dnodes status is ready") else: - print("456") - threads.join() + tdLog.info("check dnodes status is not ready") self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(mnodeNums,'db%d'%i) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py new file mode 100644 index 0000000000..29fb3008c3 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py @@ -0,0 +1,204 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """if it returns a number greater than one, you're in trouble, + # and you should call it again with exc=NULL to revert the effect""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db0_0', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") + else: + print("456") + + self.stopThread(threads) + tdLog.exit("one or more of dnodes failed to start ") + # self.check3mnode() + stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(dbNumbers) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py index 2d2322fada..e7353b0f13 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py @@ -90,35 +90,35 @@ class TDTestCase: tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db', + 'dbNumbers': 20, 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - vnodeNumbers = int(dnodenumbers-mnodeNums) - dbNumbers = int(vnodeNumbers * restartNumber) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -133,45 +133,64 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping Vnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable - tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - for i in range(vnodeNumbers): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[mnodeNums+i].stoptaosd() - # sleep(10) - tdDnodes[mnodeNums+i].starttaosd() - # sleep(10) - if clusterComCheck.checkDnodes(vnodeNumbers): - # threads.join() - tdLog.info("first restart loop") + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("check dnodes status is ready") else: - print("456") - threads.join() + tdLog.info("check dnodes status is not ready") self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(vnodeNumbers,'db%d'%i) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='vnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py new file mode 100644 index 0000000000..2f1c1368d1 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py @@ -0,0 +1,204 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """if it returns a number greater than one, you're in trouble, + # and you should call it again with exc=NULL to revert the effect""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db0_0', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + tdLog.info("Take turns stopping Mnodes ") + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") + else: + print("456") + + self.stopThread(threads) + tdLog.exit("one or more of dnodes failed to start ") + # self.check3mnode() + stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(dbNumbers) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='vnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py new file mode 100644 index 0000000000..247bd29ed9 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py @@ -0,0 +1,132 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.common import * +from util.cluster import * +from test import tdDnodes +sys.path.append("./6-cluster") + +from clusterCommonCreate import * +from clusterCommonCheck import * +import time +import socket +import subprocess +from multiprocessing import Process + + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + dnodenumbers=int(dnodenumbers) + mnodeNums=int(mnodeNums) + dbNumbers = int(dnodenumbers * restartNumber) + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodenumbers) + + # check status of connection + + + + # restart all taosd + tdDnodes=cluster.dnodes + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + for j in range(dnodenumbers): + if j != i: + cluster.checkConnectStatus(j) + clusterComCheck.check3mnodeoff(i+1,3) + clusterComCheck.init(cluster.checkConnectStatus(i+1)) + tdDnodes[i].starttaosd() + clusterComCheck.checkMnodeStatus(mnodeNums) + + tdLog.info("Take turns stopping all dnodes ") + # seperate vnode and mnode in different dnodes. + # create database and stable + stopcount =0 + while stopcount <= 2: + tdLog.info("first restart loop") + for i in range(dnodenumbers): + tdDnodes[i].stoptaosd() + tdDnodes[i].starttaosd() + stopcount+=1 + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(3) + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(5,3,1) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/clusterCommonCheck.py b/tests/system-test/6-cluster/clusterCommonCheck.py index d030008963..2d378e623d 100644 --- a/tests/system-test/6-cluster/clusterCommonCheck.py +++ b/tests/system-test/6-cluster/clusterCommonCheck.py @@ -33,7 +33,7 @@ from util.common import * # INSERT_DATA = 3 class ClusterComCheck: - def init(self, conn, logSql): + def init(self, conn, logSql=False): tdSql.init(conn.cursor()) # tdSql.init(conn.cursor(), logSql) # output sql.txt file @@ -71,25 +71,28 @@ class ClusterComCheck: tdLog.debug(tdSql.queryResult) tdLog.exit("we find %d databases but expect %d in clusters! " %(tdSql.queryRows,dbNumbers)) - def checkDb(self,dbNumbers,dbindex): + def checkDb(self,dbNumbers,restartNumber,dbNameIndex): count=0 + alldbNumbers=(dbNumbers*restartNumber)+2 while count < 5: query_status=0 - for i in range(dbNumbers): - for j in range(dbNumbers): + for j in range(dbNumbers): + for i in range(alldbNumbers): tdSql.query("show databases;") - if "%s%d"%(dbindex,j) == tdSql.queryResult[i+2][0] : - if tdSql.queryResult[i+2][19] == "ready": + if "%s_%d"%(dbNameIndex,j) == tdSql.queryResult[i][0] : + if tdSql.queryResult[i][19] == "ready": query_status+=1 + tdLog.debug("check %s_%d that status is ready "%(dbNameIndex,j)) else: continue - # print(query_status) + print(query_status) count+=1 if query_status == dbNumbers: tdLog.success("we find cluster with %d dnode and check all databases are ready within 5s! " %dbNumbers) return True else: tdLog.debug(tdSql.queryResult) + tdLog.debug("query status is %d"%query_status) tdLog.exit("database is not ready within 5s") def checkData(self,dbname,stbname,stableCount,CtableCount,rowsPerSTable,): diff --git a/tests/system-test/6-cluster/clusterCommonCreate.py b/tests/system-test/6-cluster/clusterCommonCreate.py index b3107d8537..78aac309a0 100644 --- a/tests/system-test/6-cluster/clusterCommonCreate.py +++ b/tests/system-test/6-cluster/clusterCommonCreate.py @@ -123,11 +123,26 @@ class ClusterComCreate: tdLog.debug("complete to create database %s"%(dbName)) return + def create_databases(self,tsql,dbNameIndex,dbNumbers,dropFlag=1,vgroups=4,replica=1): + for i in range(dbNumbers): + print(dbNumbers) + if dropFlag == 1: + tsql.execute("drop database if exists %s_%d"%(dbNameIndex,i)) + tsql.execute("create database if not exists %s_%d vgroups %d replica %d"%(dbNameIndex,i, vgroups, replica)) + tdLog.debug("complete to create database %s_%d"%(dbNameIndex,i)) + return + def create_stable(self,tsql, dbName,stbName): tsql.execute("create table if not exists %s.%s (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"%(dbName, stbName)) tdLog.debug("complete to create %s.%s" %(dbName, stbName)) return + def create_stables(self,tsql,dbNameIndex,stbNameIndex,stbNumbers): + for i in range(stbNumbers): + tsql.execute("create table if not exists %s.%s_%d (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"%(dbNameIndex, stbNameIndex,i)) + tdLog.debug("complete to create %s.%s_%d" %(dbNameIndex, stbNameIndex,i)) + return + def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1): tsql.execute("use %s" %dbName) pre_create = "create table" diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 571bb166e1..28b227761a 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -113,16 +113,21 @@ python3 ./test.py -f 2-query/twa.py python3 ./test.py -f 2-query/irate.py python3 ./test.py -f 2-query/function_null.py +python3 ./test.py -f 2-query/queryQnode.py python3 ./test.py -f 6-cluster/5dnode1mnode.py python3 ./test.py -f 6-cluster/5dnode2mnode.py python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 - -# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 +# python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py +# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 +python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 + python3 ./test.py -f 7-tmq/basic5.py python3 ./test.py -f 7-tmq/subscribeDb.py From eaf3f3ee3f20cf2161489faf314ea171c9729299 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 18:16:35 +0800 Subject: [PATCH 39/47] test: case for replica3 db --- tests/script/jenkins/basic.txt | 3 - tests/script/tsim/db/replica_add13.sim | 419 ---------------------- tests/script/tsim/db/replica_part.sim | 306 ---------------- tests/script/tsim/db/replica_reduce31.sim | 327 ----------------- tests/script/tsim/vnode/replica3_many.sim | 26 +- tests/script/unique/column/replica3.sim | 43 --- tests/script/unique/column/testSuite.sim | 1 - tests/script/unique/stable/testSuite.sim | 8 - 8 files changed, 6 insertions(+), 1127 deletions(-) delete mode 100644 tests/script/tsim/db/replica_add13.sim delete mode 100644 tests/script/tsim/db/replica_part.sim delete mode 100644 tests/script/tsim/db/replica_reduce31.sim delete mode 100644 tests/script/unique/column/replica3.sim delete mode 100644 tests/script/unique/column/testSuite.sim delete mode 100644 tests/script/unique/stable/testSuite.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 3c43dca999..34667b946c 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -21,9 +21,6 @@ #./test.sh -f tsim/db/delete_part.sim #./test.sh -f tsim/db/delete.sim ./test.sh -f tsim/db/error1.sim -#./test.sh -f tsim/db/replica_add13.sim -#./test.sh -f tsim/db/replica_part.sim -#./test.sh -f tsim/db/replica_reduce31.sim ./test.sh -f tsim/db/taosdlog.sim # ---- dnode diff --git a/tests/script/tsim/db/replica_add13.sim b/tests/script/tsim/db/replica_add13.sim deleted file mode 100644 index 13a5c97832..0000000000 --- a/tests/script/tsim/db/replica_add13.sim +++ /dev/null @@ -1,419 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode4 -c wallevel -v 2 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi -if $data4_4 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 1 -sql create database d2 replica 1 -sql create database d3 replica 1 -sql create database d4 replica 1 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(1589529000011, 1) -sql insert into d2.t2 values(1589529000021, 1) -sql insert into d3.t3 values(1589529000031, 1) -sql insert into d4.t4 values(1589529000041, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ======== step2 -sql alter database d1 replica 3 -sql alter database d2 replica 3 -sql alter database d3 replica 3 -sql alter database d4 replica 3 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a1 -endi - -print ======== step3 -sql show dnodes -print dnode1 ==> openVnodes: $data2_1 -print dnode2 ==> openVnodes: $data2_2 -print dnode3 ==> openVnodes: $data2_3 -print dnode4 ==> openVnodes: $data2_4 - -if $data2_1 != 0 then - return -1 -endi - -if $data2_2 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -if $data2_3 != 4 then - return -1 -endi - -print ======== step4 -sql insert into d1.t1 values(1589529000012, 2) -sql insert into d2.t2 values(1589529000022, 2) -sql insert into d3.t3 values(1589529000032, 2) -sql insert into d4.t4 values(1589529000042, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step5 -sql reset query cache -sleep 100 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000013, 3) -sql insert into d2.t2 values(1589529000023, 3) -sql insert into d3.t3 values(1589529000033, 3) -sql insert into d4.t4 values(1589529000043, 3) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000014, 4) -sql insert into d2.t2 values(1589529000024, 4) -sql insert into d3.t3 values(1589529000034, 4) -sql insert into d4.t4 values(1589529000044, 4) - -sql select * from d1.t1 -print select * from d1.t1 $rows -if $rows != 4 then - return -1 -endi - -sql select * from d2.t2 -print select * from d2.t2 $rows -if $rows != 4 then - return -1 -endi - -sql select * from d3.t3 -print select * from d3.t3 $rows -if $rows != 4 then - return -1 -endi - -sql select * from d4.t4 -print select * from d4.t4 $rows -if $rows != 4 then - return -1 -endi - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step7 -endi - -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000015, 5) -sql insert into d2.t2 values(1589529000025, 5) -sql insert into d3.t3 values(1589529000035, 5) -sql insert into d4.t4 values(1589529000045, 5) - -sql select * from d1.t1 -if $rows != 5 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 5 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 5 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 5 then - return -1 -endi - -print ========= step8 -system sh/exec.sh -n dnode4 -s start - -$x = 0 -step8: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 3 then - goto step8 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql insert into d1.t1 values(1589529000016, 6) -sql insert into d2.t2 values(1589529000026, 6) -sql insert into d3.t3 values(1589529000036, 6) -sql insert into d4.t4 values(1589529000046, 6) - -sql select * from d1.t1 -if $rows != 6 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 6 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 6 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 6 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/db/replica_part.sim b/tests/script/tsim/db/replica_part.sim deleted file mode 100644 index 9880ec666c..0000000000 --- a/tests/script/tsim/db/replica_part.sim +++ /dev/null @@ -1,306 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 3 -sql create database d2 replica 3 -sql create database d3 replica 3 -sql create database d4 replica 3 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d2.t2 values(now, 1) -sql insert into d1.t1 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ========= step2 alter db -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ========= step3 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step3: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step3 -endi - -print ========= step4 -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step5 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql reset query cache -sleep 100 - -sql insert into d1.t1 values(now, 3) -x s1 -s1: -#sql insert into d2.t2 values(now, 3) -x s2 -#s2: -#sql insert into d3.t3 values(now, 3) -x s3 -#s3: -#sql insert into d4.t4 values(now, 3) -x s4 -#s4: - -print ========= step6 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step6 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -#sql insert into d1.t1 values(now, 4) -x s5 -#s5: -sql insert into d2.t2 values(now, 4) -x s6 -s6: -#sql insert into d3.t3 values(now, 4) -x s7 -#s7: -#sql insert into d4.t4 values(now, 4) -x s8 -#s8: - -print ========= step7 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step7: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step7 -endi - -sql insert into d1.t1 values(now, 5) -sql insert into d2.t2 values(now, 5) -sql insert into d3.t3 values(now, 5) -sql insert into d4.t4 values(now, 5) - -sql select * from d1.t1 -sql select * from d2.t2 -sql select * from d3.t3 -sql select * from d4.t4 - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/db/replica_reduce31.sim b/tests/script/tsim/db/replica_reduce31.sim deleted file mode 100644 index 5350bcc78c..0000000000 --- a/tests/script/tsim/db/replica_reduce31.sim +++ /dev/null @@ -1,327 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 - -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 1 - -print ========= start dnodes -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi -if $data4_3 != ready then - goto step1 -endi - -sql show mnodes -print mnode1 $data2_1 -print mnode1 $data2_2 -print mnode1 $data2_3 -if $data2_1 != master then - goto step1 -endi - -print ======== step1 -sql create database d1 replica 3 -sql create database d2 replica 3 -sql create database d3 replica 3 -sql create database d4 replica 3 - -sql create table d1.t1 (ts timestamp, i int) -sql create table d2.t2 (ts timestamp, i int) -sql create table d3.t3 (ts timestamp, i int) -sql create table d4.t4 (ts timestamp, i int) - -sql insert into d1.t1 values(now, 1) -sql insert into d2.t2 values(now, 1) -sql insert into d3.t3 values(now, 1) -sql insert into d4.t4 values(now, 1) - -sql select * from d1.t1 -if $rows != 1 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 1 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 1 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 1 then - return -1 -endi - -print ========= step2 alter db -sql_error alter database d1 replica 1 -sql_error alter database d2 replica 1 -sql_error alter database d3 replica 1 -sql_error alter database d4 replica 1 -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -a2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a2 -endi - -sql alter database d1 replica 1 -sql alter database d2 replica 1 -sql alter database d3 replica 1 -sql alter database d4 replica 1 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a1 -endi - -sql show dnodes -print $data00 $data01 $data02 $data03 -print $data10 $data11 $data12 $data13 -print $data20 $data21 $data22 $data23 - -if $data02 != 0 then - goto a1 -endi -if $data12 != 2 then - goto a1 -endi -if $data22 != 2 then - goto a1 -endi - -print ========= step3 -sql reset query cache -sleep 100 - -sql insert into d1.t1 values(now, 2) -sql insert into d2.t2 values(now, 2) -sql insert into d3.t3 values(now, 2) -sql insert into d4.t4 values(now, 2) - -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi - -print ========= step4 alter db -sql alter database d1 replica 2 -sql alter database d2 replica 2 -sql alter database d3 replica 2 -sql alter database d4 replica 2 - -$x = 0 -step4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show d1.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql show d2.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql show d3.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql show d4.vgroups -print online vnodes $data03 -if $data03 != 2 then - goto step4 -endi - -sql insert into d1.t1 values(now, 3) -sql insert into d2.t2 values(now, 3) -sql insert into d3.t3 values(now, 3) -sql insert into d4.t4 values(now, 3) - -sql select * from d1.t1 -if $rows != 3 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 3 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 3 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 3 then - return -1 -endi - -print ========= step4 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sql reset query cache -sleep 100 - -#sql insert into d1.t1 values(now, 4) -x step1 -#step1: -#sql insert into d2.t2 values(now, 4) -x step2 -#step2: -#sql insert into d3.t3 values(now, 4) -x step3 -#step3: -#sql insert into d4.t4 values(now, 4) -x step4 -#step4: - -print ========= step5 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -#sql insert into d1.t1 values(now, 5) -x step5 -#step5: -#sql insert into d2.t2 values(now, 5) -x step6 -#step6: -#sql insert into d3.t3 values(now, 5) -x step7 -#step7: -#sql insert into d4.t4 values(now, 5) -x step8 -#step8: - -print ========= step6 -system sh/exec.sh -n dnode3 -s start - -sql insert into d1.t1 values(now, 6) -sql insert into d2.t2 values(now, 6) -sql insert into d3.t3 values(now, 6) -sql insert into d4.t4 values(now, 6) - -sql select * from d1.t1 -sql select * from d2.t2 -sql select * from d3.t3 -sql select * from d4.t4 - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/vnode/replica3_many.sim b/tests/script/tsim/vnode/replica3_many.sim index 6b1a582f23..4fd3e39fdf 100644 --- a/tests/script/tsim/vnode/replica3_many.sim +++ b/tests/script/tsim/vnode/replica3_many.sim @@ -61,10 +61,8 @@ step12: endi sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 -print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 -if $rows != 4 then +$leaderExist = 0 +if $rows != 1 then return -1 endi if $data(2)[4] == leader then @@ -91,10 +89,8 @@ step13: endi sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 -print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 -if $rows != 4 then +$leaderExist = 0 +if $rows != 1 then return -1 endi if $data(3)[4] == leader then @@ -121,12 +117,7 @@ step14: endi sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 -print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 -if $rows != 4 then - return -1 -endi +$leaderExist = 0 if $data(4)[4] == leader then $leaderExist = 1 endi @@ -151,12 +142,7 @@ step15: endi sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 -print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 -print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39 -if $rows != 4 then - return -1 -endi +$leaderExist = 0 if $data(4)[4] == leader then $leaderExist = 1 endi diff --git a/tests/script/unique/column/replica3.sim b/tests/script/unique/column/replica3.sim deleted file mode 100644 index 2d6c194ef8..0000000000 --- a/tests/script/unique/column/replica3.sim +++ /dev/null @@ -1,43 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode2 -c wallevel -v 2 -system sh/cfg.sh -n dnode3 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 - -system sh/exec.sh -n dnode1 -s start -sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -sql create database db replica 3 -sql use db -sql create table db.mt (ts timestamp, f1 float, f2 float, f3 float, f4 float, f5 float, f6 float, f7 float, f8 float, f9 float, f10 float) tags (t1 int, t2 int) -sql create table db.tb1 using db.mt tags(1, 2) -sleep 3001 - -$x = 1000 -while $x < 1010 - sql insert into tb1 values (now+1s , $x , $x , $x , $x , $x , $x , $x , $x , $x , $x ) - $x = $x + 1 -endw - -sql_error create database d1 replica 2 wallevel 0 -sql_error create database d2 replica 1 wallevel 0 -sql_error alter database d2 replica 2 - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/column/testSuite.sim b/tests/script/unique/column/testSuite.sim deleted file mode 100644 index 8663e9f305..0000000000 --- a/tests/script/unique/column/testSuite.sim +++ /dev/null @@ -1 +0,0 @@ -run unique/column/replica3.sim diff --git a/tests/script/unique/stable/testSuite.sim b/tests/script/unique/stable/testSuite.sim deleted file mode 100644 index 2e3ab31a44..0000000000 --- a/tests/script/unique/stable/testSuite.sim +++ /dev/null @@ -1,8 +0,0 @@ -run unique/metrics/balance_replica1.sim -run unique/metrics/dnode2_stop.sim -run unique/metrics/dnode2.sim -run unique/metrics/dnode3.sim -run unique/metrics/replica2_dnode4.sim -run unique/metrics/replica2_vnode3.sim -run unique/metrics/replica3_dnode6.sim -run unique/metrics/replica3_vnode3.sim \ No newline at end of file From 3a934d09e302e83b343f53af1d163595d1842dc3 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 28 Jun 2022 19:00:20 +0800 Subject: [PATCH 40/47] fix: fix windows quit issue --- source/libs/catalog/src/catalog.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index b459beb658..2b376bbce8 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -1284,7 +1284,9 @@ void catalogDestroy(void) { atomic_store_8((int8_t*)&gCtgMgmt.exit, true); - ctgClearCacheEnqueue(NULL, true, true, true); + if (!taosCheckCurrentInDll()) { + ctgClearCacheEnqueue(NULL, true, true, true); + } taosHashCleanup(gCtgMgmt.pCluster); gCtgMgmt.pCluster = NULL; From 8bff4b87f429357ca870221273dd03f2b66c792a Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Tue, 28 Jun 2022 19:08:48 +0800 Subject: [PATCH 41/47] test: fix test exit --- tests/system-test/test-all.bat | 10 +++++----- tests/system-test/test.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/system-test/test-all.bat b/tests/system-test/test-all.bat index d4032cbc0d..2af23596a3 100644 --- a/tests/system-test/test-all.bat +++ b/tests/system-test/test-all.bat @@ -20,12 +20,12 @@ if "%1" == "full" ( call :GetTimeSeconds !time! set time1=!_timeTemp! echo Start at !time! - call %%i ARG1 > result_!a!.txt 2>error_!a!.txt + call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8 if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && set /a exitNum=8 && echo %%i >>failed.txt ) else ( call :colorEcho 0a "Success" &echo. ) ) ) ) - exit !exitNum! + exit /b !exitNum! ) echo Windows Taosd Test for /F "usebackq tokens=*" %%i in (simpletest.bat) do ( @@ -36,8 +36,8 @@ for /F "usebackq tokens=*" %%i in (simpletest.bat) do ( call :GetTimeSeconds !timeNow! set time1=!_timeTemp! echo Start at !timeNow! - call %%i ARG1 > result_!a!.txt 2>error_!a!.txt - if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit 8 ) else ( call :colorEcho 0a "Success" &echo. ) + call %%i ARG1 > result_!a!.txt 2>error_!a!.txt || set errorlevel=8 + if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit /b 8 ) else ( call :colorEcho 0a "Success" &echo. ) ) ) @REM echo Linux Taosd Test @@ -52,7 +52,7 @@ for /F "usebackq tokens=*" %%i in (simpletest.bat) do ( @REM if errorlevel 1 ( call :colorEcho 0c "failed" &echo. && echo result: && cat result_!a!.txt && echo error: && cat error_!a!.txt && exit 8 ) else ( call :colorEcho 0a "Success" &echo. ) @REM ) @REM ) -exit +exit /b :colorEcho set timeNow=%time% diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 76b83da348..2d7f78661a 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -186,7 +186,7 @@ if __name__ == "__main__": tdLog.info("Procedures for tdengine deployed in %s" % (host)) if platform.system().lower() == 'windows': fileName = fileName.replace("/", os.sep) - if (masterIp == "" and not fileName[0:12] == "0-others\\udf"): + if (masterIp == "" and not fileName == "0-others\\udf_create.py"): threading.Thread(target=checkRunTimeError,daemon=True).start() tdLog.info("Procedures for testing self-deployment") tdDnodes.init(deployPath, masterIp) From 2d5217ecdbda13bacd6f01ab3bb43a49b517c92d Mon Sep 17 00:00:00 2001 From: haoranchen Date: Tue, 28 Jun 2022 19:17:01 +0800 Subject: [PATCH 42/47] Update insertWithMoreVgroup.py --- tests/system-test/1-insert/insertWithMoreVgroup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system-test/1-insert/insertWithMoreVgroup.py b/tests/system-test/1-insert/insertWithMoreVgroup.py index 1ebbc1fc57..e3a20cebf8 100644 --- a/tests/system-test/1-insert/insertWithMoreVgroup.py +++ b/tests/system-test/1-insert/insertWithMoreVgroup.py @@ -81,7 +81,7 @@ class TDTestCase: user = "root" password = "taosdata" port =6030 - con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port,config="/home/chr/TDengine/sim/psim/cfg/") + con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) cur=con.cursor() print(cur) return cur @@ -407,4 +407,4 @@ class TDTestCase: # add case with filename # tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) From ad51f506606ae3ba739da2b5abb2d43dd575c4fa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 19:43:59 +0800 Subject: [PATCH 43/47] test: case for stable --- tests/script/jenkins/basic.txt | 6 + .../vnode/stable_balance_replica1.sim} | 0 .../vnode/stable_dnode2.sim} | 67 +++--- .../vnode/stable_dnode2_stop.sim} | 86 ++++--- .../vnode/stable_dnode3.sim} | 0 .../vnode/stable_replica3_dnode6.sim} | 0 .../vnode/stable_replica3_vnode3.sim} | 0 .../script/unique/stable/replica2_dnode4.sim | 218 ------------------ .../script/unique/stable/replica2_vnode3.sim | 199 ---------------- 9 files changed, 91 insertions(+), 485 deletions(-) rename tests/script/{unique/stable/balance_replica1.sim => tsim/vnode/stable_balance_replica1.sim} (100%) rename tests/script/{unique/stable/dnode2.sim => tsim/vnode/stable_dnode2.sim} (73%) rename tests/script/{unique/stable/dnode2_stop.sim => tsim/vnode/stable_dnode2_stop.sim} (64%) rename tests/script/{unique/stable/dnode3.sim => tsim/vnode/stable_dnode3.sim} (100%) rename tests/script/{unique/stable/replica3_dnode6.sim => tsim/vnode/stable_replica3_dnode6.sim} (100%) rename tests/script/{unique/stable/replica3_vnode3.sim => tsim/vnode/stable_replica3_vnode3.sim} (100%) delete mode 100644 tests/script/unique/stable/replica2_dnode4.sim delete mode 100644 tests/script/unique/stable/replica2_vnode3.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 34667b946c..0a321aa57d 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -171,6 +171,12 @@ ./test.sh -f tsim/vnode/replica3_vgroup.sim #./test.sh -f tsim/vnode/replica3_many.sim #./test.sh -f tsim/vnode/replica3_import.sim +#./test.sh -f tsim/vnode/stable_balance_replica1.sim +./test.sh -f tsim/vnode/stable_dnode2_stop.sim +./test.sh -f tsim/vnode/stable_dnode2.sim +#./test.sh -f tsim/vnode/stable_dnode3.sim +#./test.sh -f tsim/vnode/stable_replica3_dnode6.sim +#./test.sh -f tsim/vnode/stable_replica3_vnode3.sim # --- sync ./test.sh -f tsim/sync/3Replica1VgElect.sim diff --git a/tests/script/unique/stable/balance_replica1.sim b/tests/script/tsim/vnode/stable_balance_replica1.sim similarity index 100% rename from tests/script/unique/stable/balance_replica1.sim rename to tests/script/tsim/vnode/stable_balance_replica1.sim diff --git a/tests/script/unique/stable/dnode2.sim b/tests/script/tsim/vnode/stable_dnode2.sim similarity index 73% rename from tests/script/unique/stable/dnode2.sim rename to tests/script/tsim/vnode/stable_dnode2.sim index 3ca8c4ee20..c29d960706 100644 --- a/tests/script/unique/stable/dnode2.sim +++ b/tests/script/tsim/vnode/stable_dnode2.sim @@ -1,28 +1,40 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +print ========== step1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -createDnode: +step1: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi print ======================== dnode1 start @@ -38,7 +50,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db +sql create database $db vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -97,20 +109,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -152,13 +164,13 @@ if $data00 != 25 then endi print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -175,20 +187,10 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi @@ -196,7 +198,4 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode5 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/dnode2_stop.sim b/tests/script/tsim/vnode/stable_dnode2_stop.sim similarity index 64% rename from tests/script/unique/stable/dnode2_stop.sim rename to tests/script/tsim/vnode/stable_dnode2_stop.sim index c10f04338d..113cf27e17 100644 --- a/tests/script/unique/stable/dnode2_stop.sim +++ b/tests/script/tsim/vnode/stable_dnode2_stop.sim @@ -1,27 +1,40 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +print ========== step1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create dnode $hostname2 + +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start $x = 0 -createDnode: +step1: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi print ======================== dnode1 start @@ -43,7 +56,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db +sql create database $db vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -72,7 +85,6 @@ endi sleep 100 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 print =============== step2 sql select count(*) from $mt -x step2 @@ -84,7 +96,27 @@ sql select count(tbcol) from $mt -x step21 step21: system sh/exec.sh -n dnode2 -s start -sleep 3000 + +$x = 0 +dnode2: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data(1)[4] != ready then + goto dnode2 +endi +if $data(2)[4] != ready then + goto dnode2 +endi print =============== step3 sql select count(tbcol) as c from $mt where ts <= 1519833840000 @@ -106,13 +138,13 @@ if $data00 != 25 then endi print =============== step4 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -129,28 +161,14 @@ if $rows != $tbNum then return -1 endi -print =============== step6 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode4 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/dnode3.sim b/tests/script/tsim/vnode/stable_dnode3.sim similarity index 100% rename from tests/script/unique/stable/dnode3.sim rename to tests/script/tsim/vnode/stable_dnode3.sim diff --git a/tests/script/unique/stable/replica3_dnode6.sim b/tests/script/tsim/vnode/stable_replica3_dnode6.sim similarity index 100% rename from tests/script/unique/stable/replica3_dnode6.sim rename to tests/script/tsim/vnode/stable_replica3_dnode6.sim diff --git a/tests/script/unique/stable/replica3_vnode3.sim b/tests/script/tsim/vnode/stable_replica3_vnode3.sim similarity index 100% rename from tests/script/unique/stable/replica3_vnode3.sim rename to tests/script/tsim/vnode/stable_replica3_vnode3.sim diff --git a/tests/script/unique/stable/replica2_dnode4.sim b/tests/script/unique/stable/replica2_dnode4.sim deleted file mode 100644 index 4f8211d5d4..0000000000 --- a/tests/script/unique/stable/replica2_dnode4.sim +++ /dev/null @@ -1,218 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect - -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start - -$x = 0 -createDnode: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi -if $data4_4 == offline then - goto createDnode -endi - -print ======================== dnode1 start - -$dbPrefix = r2d4_db -$tbPrefix = r2d4_tb -$mtPrefix = r2d4_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db replica 2 -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $val = $x * 60000 - $ms = 1519833600000 + $val - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sql show vgroups -print vgroups ==> $rows -if $rows != 3 then - return -1 -endi - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select count(*) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -sql select count(tbcol) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step3 -sql select count(tbcol) from $tb where ts <= 1519833840000 -print ===> $data00 -if $data00 != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol) as b from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi - -sql select count(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != $rowNum then - return -1 -endi - -print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(*) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -sql select count(tbcol) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -print =============== step8 -sql select count(tbcol) as c from $mt where ts <= 1519833840000 -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000 -print ===> $data00 -if $data00 != 25 then - return -1 -endi - -print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) -print ===> $data01 -if $data01 != 10 then - return -1 -endi - -sql select count(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 200 then - return -1 -endi - -print =============== step10 -sql select count(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi -return -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stable/replica2_vnode3.sim b/tests/script/unique/stable/replica2_vnode3.sim deleted file mode 100644 index 47d45c3d3d..0000000000 --- a/tests/script/unique/stable/replica2_vnode3.sim +++ /dev/null @@ -1,199 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start - -sql connect -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -createDnode: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi - -print ======================== dnode1 start - -$dbPrefix = r2v3_db -$tbPrefix = r2v3_tb -$mtPrefix = r2v3_mt -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql create database $db replica 2 -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $x = 0 - while $x < $rowNum - $val = $x * 60000 - $ms = 1519833600000 + $val - sql insert into $tb values ($ms , $x ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sql show vgroups -print vgroups ==> $rows -if $rows != 3 then - return -1 -endi - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select count(*) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -sql select count(tbcol) from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step3 -sql select count(tbcol) from $tb where ts <= 1519833840000 -print ===> $data00 -if $data00 != 5 then - return -1 -endi - -print =============== step4 -sql select count(tbcol) as b from $tb -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi - -sql select count(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != $rowNum then - return -1 -endi - -print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 5 then - return -1 -endi - -print =============== step7 -sql select count(*) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -sql select count(tbcol) from $mt -print ===> $data00 -if $data00 != $totalNum then - return -1 -endi - -print =============== step8 -sql select count(tbcol) as c from $mt where ts <= 1519833840000 -print ===> $data00 -if $data00 != 50 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 -print ===> $data00 -if $data00 != 100 then - return -1 -endi - -sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000 -print ===> $data00 -if $data00 != 25 then - return -1 -endi - -print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) -print ===> $data01 -if $data01 != 10 then - return -1 -endi - -sql select count(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 200 then - return -1 -endi - -print =============== step10 -sql select count(tbcol) as b from $mt group by tgcol -print ===> $data00 -if $data00 != $rowNum then - return -1 -endi - -if $rows != $tbNum then - return -1 -endi - -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi -return -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file From 507292720cb7ce10a60f6922392a783d1c6b301d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 20:13:09 +0800 Subject: [PATCH 44/47] test: case for stable --- tests/script/jenkins/basic.txt | 8 +- .../drop_dnode_has_multi_vnode_replica1.sim | 2 + .../tsim/vnode/stable_balance_replica1.sim | 84 ++++++------- tests/script/tsim/vnode/stable_dnode3.sim | 97 ++++++--------- .../tsim/vnode/stable_replica3_dnode6.sim | 110 ++++++++---------- .../tsim/vnode/stable_replica3_vnode3.sim | 94 +++++++-------- 6 files changed, 171 insertions(+), 224 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 0a321aa57d..fa520442e4 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -171,12 +171,12 @@ ./test.sh -f tsim/vnode/replica3_vgroup.sim #./test.sh -f tsim/vnode/replica3_many.sim #./test.sh -f tsim/vnode/replica3_import.sim -#./test.sh -f tsim/vnode/stable_balance_replica1.sim +./test.sh -f tsim/vnode/stable_balance_replica1.sim ./test.sh -f tsim/vnode/stable_dnode2_stop.sim ./test.sh -f tsim/vnode/stable_dnode2.sim -#./test.sh -f tsim/vnode/stable_dnode3.sim -#./test.sh -f tsim/vnode/stable_replica3_dnode6.sim -#./test.sh -f tsim/vnode/stable_replica3_vnode3.sim +./test.sh -f tsim/vnode/stable_dnode3.sim +./test.sh -f tsim/vnode/stable_replica3_dnode6.sim +./test.sh -f tsim/vnode/stable_replica3_vnode3.sim # --- sync ./test.sh -f tsim/sync/3Replica1VgElect.sim diff --git a/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim b/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim index 15ad13b6fa..78bca45f31 100644 --- a/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim +++ b/tests/script/tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim @@ -124,6 +124,8 @@ if $data(5)[3] != 3 then return -1 endi +#sql reset query cache + print =============== step4: select data sql show d1.tables if $rows != 1 then diff --git a/tests/script/tsim/vnode/stable_balance_replica1.sim b/tests/script/tsim/vnode/stable_balance_replica1.sim index 3ea158eb39..dfc8de5160 100644 --- a/tests/script/tsim/vnode/stable_balance_replica1.sim +++ b/tests/script/tsim/vnode/stable_balance_replica1.sim @@ -1,16 +1,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c statusInterval -v 1 -system sh/cfg.sh -n dnode2 -c statusInterval -v 1 -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 $dbPrefix = br1_db $tbPrefix = br1_tb @@ -29,7 +25,7 @@ $db = $dbPrefix $mt = $mtPrefix $st = $stPrefix . $i -sql create database $db +sql create database $db vgroups 4 sql use $db sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) @@ -54,51 +50,47 @@ endw sleep 100 print =============== step2 - -$x = 0 -show1: - $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 - endi -sql show dnodes -x show1 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes - -if $dnode1Vnodes != 4 then - goto show1 -endi -if $dnode2Vnodes != null then - goto show1 +sql show dnodes +print dnode1 openVnodes $data(1)[2] +if $data(1)[2] != 4 then + return -1 endi + print =============== step3 start dnode2 -sql create dnode $hostname2 +sql create dnode $hostname port 7200 system sh/exec.sh -n dnode2 -s start -sleep 8000 $x = 0 -show2: +step3: $x = $x + 1 - sleep 2000 - if $x == 10 then - return -1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes -x show2 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes - -if $dnode1Vnodes != 2 then - goto show2 +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 endi -if $dnode2Vnodes != 2 then - goto show2 +if $data(1)[4] != ready then + goto step3 +endi +if $data(2)[4] != ready then + goto step3 endi +sql balance vgroup +sql show dnodes +print dnode1 openVnodes $data(1)[2] +print dnode2 openVnodes $data(2)[2] +if $data(1)[2] != 2 then + return -1 +endi +if $data(2)[2] != 2 then + return -1 +endi print =============== step4 $i = 1 diff --git a/tests/script/tsim/vnode/stable_dnode3.sim b/tests/script/tsim/vnode/stable_dnode3.sim index d0708c8154..ae777b9942 100644 --- a/tests/script/tsim/vnode/stable_dnode3.sim +++ b/tests/script/tsim/vnode/stable_dnode3.sim @@ -2,39 +2,46 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +print ========== step1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start $x = 0 -createDnode: +step1: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi - print ======================== dnode1 start - $dbPrefix = d3_db $tbPrefix = d3_tb $mtPrefix = d3_mt @@ -47,7 +54,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db +sql create database $db vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -73,26 +80,6 @@ if $rows != 3 then return -1 endi -sql show dnodes -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes - -if $dnode1Vnodes != 1 then - return -1 -endi -if $dnode2Vnodes != 1 then - return -1 -endi -if $dnode3Vnodes != 1 then - return -1 -endi - -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i @@ -124,20 +111,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -179,13 +166,13 @@ if $data00 != 25 then endi print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -202,20 +189,10 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi @@ -223,7 +200,3 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/vnode/stable_replica3_dnode6.sim b/tests/script/tsim/vnode/stable_replica3_dnode6.sim index eeffb86cdb..aea5b88fed 100644 --- a/tests/script/tsim/vnode/stable_replica3_dnode6.sim +++ b/tests/script/tsim/vnode/stable_replica3_dnode6.sim @@ -5,29 +5,22 @@ system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 system sh/deploy.sh -n dnode5 -i 5 system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 -system sh/cfg.sh -n dnode5 -c walLevel -v 2 -system sh/cfg.sh -n dnode6 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode6 -c maxtablesPerVnode -v 4 - +print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sql create dnode $hostname5 -sql create dnode $hostname6 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 +sql create dnode $hostname port 7500 +sql create dnode $hostname port 7600 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start @@ -35,31 +28,41 @@ system sh/exec.sh -n dnode5 -s start system sh/exec.sh -n dnode6 -s start $x = 0 -createDnode: +step10: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi -if $data4_4 == offline then - goto createDnode -endi -if $data4_5 == offline then - goto createDnode -endi -if $data4_6 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 6 then + return -1 +endi +if $data(1)[4] != ready then + goto step10 +endi +if $data(2)[4] != ready then + goto step10 +endi +if $data(3)[4] != ready then + goto step10 +endi +if $data(4)[4] != ready then + goto step10 +endi +if $data(5)[4] != ready then + goto step10 +endi +if $data(6)[4] != ready then + goto step10 +endi print ======================== dnode1 start - $dbPrefix = r3d6_db $tbPrefix = r3d6_tb $mtPrefix = r3d6_mt @@ -78,7 +81,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 3 +sql create database $db replica 3 vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -137,20 +140,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -192,13 +195,13 @@ if $data00 != 25 then endi print =============== step9 -#sql select count(tbcol) as b from $mt interval(1m) +#sql select _wstartts, count(tbcol) as b from $mt interval(1m) #print ===> $data01 #if $data01 != 10 then # return -1 #endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -215,23 +218,6 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi -return -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT diff --git a/tests/script/tsim/vnode/stable_replica3_vnode3.sim b/tests/script/tsim/vnode/stable_replica3_vnode3.sim index bc700b7dda..8137b087f5 100644 --- a/tests/script/tsim/vnode/stable_replica3_vnode3.sim +++ b/tests/script/tsim/vnode/stable_replica3_vnode3.sim @@ -1,47 +1,58 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/exec.sh -n dnode1 -s start +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode4 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode5 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode6 -c supportVnodes -v 4 +print ========== step1 +system sh/exec.sh -n dnode1 -s start sql connect -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start + $x = 0 -createDnode: +step10: $x = $x + 1 sleep 1000 - if $x == 20 then - return -1 + if $x == 10 then + print ====> dnode not ready! + return -1 endi -sql show dnodes; -if $data4_2 == offline then - goto createDnode -endi -if $data4_3 == offline then - goto createDnode -endi -if $data4_4 == offline then - goto createDnode -endi +sql show dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data(1)[4] != ready then + goto step10 +endi +if $data(2)[4] != ready then + goto step10 +endi +if $data(3)[4] != ready then + goto step10 +endi +if $data(4)[4] != ready then + goto step10 +endi print ======================== dnode1 start - $dbPrefix = r3v3_db $tbPrefix = r3v3_tb $mtPrefix = r3v3_mt @@ -54,7 +65,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 3 +sql create database $db replica 3 vgroups 3 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -113,20 +124,20 @@ if $data00 != $rowNum then endi print =============== step5 -sql select count(tbcol) as b from $tb interval(1m) +sql select _wstartts, count(tbcol) as b from $tb interval(1m) print ===> $data01 if $data01 != 1 then return -1 endi -sql select count(tbcol) as b from $tb interval(1d) +sql select _wstartts, count(tbcol) as b from $tb interval(1d) print ===> $data01 if $data01 != $rowNum then return -1 endi print =============== step6 -sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) +sql select _wstartts, count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -169,13 +180,13 @@ if $data00 != 25 then endi print =============== step9 -sql select count(tbcol) as b from $mt interval(1m) +sql select _wstartts, count(tbcol) as b from $mt interval(1m) print ===> $data01 if $data01 != 10 then return -1 endi -sql select count(tbcol) as b from $mt interval(1d) +sql select _wstartts, count(tbcol) as b from $mt interval(1d) print ===> $data01 if $data01 != 200 then return -1 @@ -192,23 +203,6 @@ if $rows != $tbNum then return -1 endi -print =============== step11 -sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol -print ===> $data01 -if $data01 != 1 then - return -1 -endi -if $rows != 50 then - return -1 -endi - -print =============== clear -sql drop database $db -sql show databases -if $rows != 0 then - return -1 -endi - system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT From f73333f07becebcb25058b42575ad23bacd166b9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 28 Jun 2022 20:33:36 +0800 Subject: [PATCH 45/47] test: remove old cases --- tests/script/jenkins/basic.txt | 10 +- .../arbitrator/check_cluster_cfg_para.sim | 0 .../arbitrator/dn2_mn1_cache_file_sync.sim | 0 .../dn2_mn1_cache_file_sync_second.sim | 0 .../dn3_mn1_full_createTableFail.sim | 0 .../arbitrator/dn3_mn1_full_dropDnodeFail.sim | 0 .../dn3_mn1_multiCreateDropTable.sim | 0 ...3_mn1_nw_disable_timeout_autoDropDnode.sim | 0 .../arbitrator/dn3_mn1_r2_vnode_delDir.sim | 0 .../arbitrator/dn3_mn1_r3_vnode_delDir.sim | 0 .../dn3_mn1_replica2_wal1_AddDelDnode.sim | 0 .../arbitrator/dn3_mn1_replica_change.sim | 0 .../dn3_mn1_replica_change_dropDnod.sim | 0 .../arbitrator/dn3_mn1_stopDnode_timeout.sim | 0 .../arbitrator/dn3_mn1_vnode_change.sim | 0 .../dn3_mn1_vnode_corruptFile_offline.sim | 0 .../dn3_mn1_vnode_corruptFile_online.sim | 0 .../dn3_mn1_vnode_createErrData_online.sim | 0 .../arbitrator/dn3_mn1_vnode_delDir.sim | 0 .../dn3_mn1_vnode_noCorruptFile_offline.sim | 0 .../arbitrator/dn3_mn1_vnode_nomaster.sim | 0 .../backup}/arbitrator/dn3_mn2_killDnode.sim | 0 .../arbitrator/insert_duplicationTs.sim | 0 .../offline_replica2_alterTable_online.sim | 0 .../offline_replica2_alterTag_online.sim | 0 .../offline_replica2_createTable_online.sim | 0 .../offline_replica2_dropDb_online.sim | 0 .../offline_replica2_dropTable_online.sim | 0 .../offline_replica3_alterTable_online.sim | 0 .../offline_replica3_alterTag_online.sim | 0 .../offline_replica3_createTable_online.sim | 0 .../offline_replica3_dropDb_online.sim | 0 .../offline_replica3_dropTable_online.sim | 0 .../replica_changeWithArbitrator.sim | 0 .../sync_replica2_alterTable_add.sim | 0 .../sync_replica2_alterTable_drop.sim | 0 .../arbitrator/sync_replica2_dropDb.sim | 0 .../arbitrator/sync_replica2_dropTable.sim | 0 .../sync_replica3_alterTable_add.sim | 0 .../sync_replica3_alterTable_drop.sim | 0 .../arbitrator/sync_replica3_createTable.sim | 0 ...ca3_dnodeChang_DropAddAlterTableDropDb.sim | 0 .../arbitrator/sync_replica3_dropDb.sim | 0 .../arbitrator/sync_replica3_dropTable.sim | 0 ...sync_replica_alterTable_background_add.sim | 0 ...ync_replica_alterTable_background_drop.sim | 0 ...ync_replica_createTable_background_add.sim | 0 .../sync_replica_dropDb_background.sim | 0 .../sync_replica_dropTable_background.sim | 0 .../backup}/cluster/client1_0.sim | 0 .../backup}/cluster/client1_1.sim | 0 .../backup}/cluster/client1_2.sim | 0 .../backup}/cluster/client1_3.sim | 0 .../backup}/cluster/client2_0.sim | 0 .../backup}/cluster/client2_1.sim | 0 .../backup}/cluster/client2_2.sim | 0 .../backup}/cluster/client2_3.sim | 0 .../backup}/cluster/client3.sim | 0 .../backup}/cluster/client4.sim | 0 .../backup}/cluster/client5.sim | 0 .../backup}/cluster/cluster_main.sim | 0 .../backup}/cluster/cluster_main0.sim | 0 .../backup}/cluster/cluster_main1.sim | 0 .../backup}/cluster/cluster_main2.sim | 0 .../backup}/cluster/main1_client1_0.sim | 0 .../backup}/cluster/main1_client1_1.sim | 0 .../backup}/cluster/main1_client1_2.sim | 0 .../backup}/cluster/main1_client1_3.sim | 0 .../backup}/cluster/main1_client4.sim | 0 .../backup}/cluster/main2_client1_0.sim | 0 .../backup}/cluster/main2_client1_1.sim | 0 .../backup}/cluster/main2_client1_2.sim | 0 .../backup}/cluster/main2_client1_3.sim | 0 .../backup}/cluster/main2_client2_0.sim | 0 .../backup}/cluster/main2_client2_1.sim | 0 .../backup}/cluster/main2_client2_2.sim | 0 .../backup}/cluster/main2_client2_3.sim | 0 .../backup}/clusterSimCase/client-01.sim | 0 .../backup}/clusterSimCase/client-02.sim | 0 .../backup}/clusterSimCase/client-03.sim | 0 .../backup}/clusterSimCase/client-04.sim | 0 .../backup}/clusterSimCase/client-05.sim | 0 .../backup}/clusterSimCase/client-06.sim | 0 .../backup}/clusterSimCase/client-07.sim | 0 .../backup}/clusterSimCase/client-08.sim | 0 .../backup}/clusterSimCase/cluster_main.sim | 0 .../dnode/cluster_alter.sim} | 0 .../dnode/cluster_balance1.sim} | 0 .../dnode/cluster_balance2.sim} | 0 .../dnode/cluster_balance3.sim} | 0 .../dnode/cluster_cache.sim} | 0 .../dnode/cluster_flowctrl.sim} | 0 .../dnode/cluster_vgroup100.sim} | 0 tests/script/unique/arbitrator/testSuite.sim | 41 -- tests/script/unique/big/balance.sim | 399 ------------------ tests/script/unique/big/maxvnodes.sim | 89 ---- tests/script/unique/big/restartSpeed.sim | 41 -- tests/script/unique/big/tcp.sim | 113 ----- tests/script/unique/big/testSuite.sim | 3 - tests/script/unique/cluster/testSuite.sim | 4 - .../migrate/mn2_vn2_repl2_rmMnodeDir.sim | 275 ------------ .../migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim | 271 ------------ ..._repl2_rmMnodeVnodeDir_stopAll_starAll.sim | 205 --------- .../migrate/mn2_vn2_repl2_rmVnodeDir.sim | 269 ------------ 104 files changed, 8 insertions(+), 1712 deletions(-) rename tests/script/{unique => tsim/backup}/arbitrator/check_cluster_cfg_para.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn2_mn1_cache_file_sync.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn2_mn1_cache_file_sync_second.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_full_createTableFail.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_full_dropDnodeFail.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_multiCreateDropTable.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_r2_vnode_delDir.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_r3_vnode_delDir.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_replica_change.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_replica_change_dropDnod.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_stopDnode_timeout.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_vnode_change.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_vnode_corruptFile_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_vnode_createErrData_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_vnode_delDir.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn1_vnode_nomaster.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/dn3_mn2_killDnode.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/insert_duplicationTs.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica2_alterTable_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica2_alterTag_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica2_createTable_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica2_dropDb_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica2_dropTable_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica3_alterTable_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica3_alterTag_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica3_createTable_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica3_dropDb_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/offline_replica3_dropTable_online.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/replica_changeWithArbitrator.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica2_alterTable_add.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica2_alterTable_drop.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica2_dropDb.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica2_dropTable.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica3_alterTable_add.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica3_alterTable_drop.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica3_createTable.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica3_dropDb.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica3_dropTable.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica_alterTable_background_add.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica_alterTable_background_drop.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica_createTable_background_add.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica_dropDb_background.sim (100%) rename tests/script/{unique => tsim/backup}/arbitrator/sync_replica_dropTable_background.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client1_0.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client1_1.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client1_2.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client1_3.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client2_0.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client2_1.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client2_2.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client2_3.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client3.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client4.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/client5.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/cluster_main.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/cluster_main0.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/cluster_main1.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/cluster_main2.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main1_client1_0.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main1_client1_1.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main1_client1_2.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main1_client1_3.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main1_client4.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client1_0.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client1_1.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client1_2.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client1_3.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client2_0.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client2_1.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client2_2.sim (100%) rename tests/script/{unique => tsim/backup}/cluster/main2_client2_3.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-01.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-02.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-03.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-04.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-05.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-06.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-07.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/client-08.sim (100%) rename tests/script/{unique => tsim/backup}/clusterSimCase/cluster_main.sim (100%) rename tests/script/{unique/cluster/alter.sim => tsim/dnode/cluster_alter.sim} (100%) rename tests/script/{unique/cluster/balance1.sim => tsim/dnode/cluster_balance1.sim} (100%) rename tests/script/{unique/cluster/balance2.sim => tsim/dnode/cluster_balance2.sim} (100%) rename tests/script/{unique/cluster/balance3.sim => tsim/dnode/cluster_balance3.sim} (100%) rename tests/script/{unique/cluster/cache.sim => tsim/dnode/cluster_cache.sim} (100%) rename tests/script/{unique/cluster/flowctrl.sim => tsim/dnode/cluster_flowctrl.sim} (100%) rename tests/script/{unique/cluster/vgroup100.sim => tsim/dnode/cluster_vgroup100.sim} (100%) delete mode 100644 tests/script/unique/arbitrator/testSuite.sim delete mode 100644 tests/script/unique/big/balance.sim delete mode 100644 tests/script/unique/big/maxvnodes.sim delete mode 100644 tests/script/unique/big/restartSpeed.sim delete mode 100644 tests/script/unique/big/tcp.sim delete mode 100644 tests/script/unique/big/testSuite.sim delete mode 100644 tests/script/unique/cluster/testSuite.sim delete mode 100644 tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim delete mode 100644 tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim delete mode 100644 tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim delete mode 100644 tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index fa520442e4..cc114ac55f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -30,6 +30,13 @@ ./test.sh -f tsim/dnode/balance2.sim ./test.sh -f tsim/dnode/balance3.sim ./test.sh -f tsim/dnode/balancex.sim +#./test.sh -f tsim/dnode/cluster_alter.sim +#./test.sh -f tsim/dnode/cluster_balance1.sim +#./test.sh -f tsim/dnode/cluster_balance2.sim +#./test.sh -f tsim/dnode/cluster_balance3.sim +#./test.sh -f tsim/dnode/cluster_cache.sim +#./test.sh -f tsim/dnode/cluster_flowctrl.sim +#./test.sh -f tsim/dnode/cluster_vgroup100.sim ./test.sh -f tsim/dnode/create_dnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim @@ -81,7 +88,7 @@ ./test.sh -f tsim/mnode/basic2.sim ./test.sh -f tsim/mnode/basic3.sim ./test.sh -f tsim/mnode/basic4.sim -#./test.sh -f tsim/mnode/basic5.sim +./test.sh -f tsim/mnode/basic5.sim # ---- show ./test.sh -f tsim/show/basic.sim @@ -106,7 +113,6 @@ ./test.sh -f tsim/stream/schedSnode.sim ./test.sh -f tsim/stream/windowClose.sim - # ---- transaction ./test.sh -f tsim/trans/lossdata1.sim ./test.sh -f tsim/trans/create_db.sim diff --git a/tests/script/unique/arbitrator/check_cluster_cfg_para.sim b/tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim similarity index 100% rename from tests/script/unique/arbitrator/check_cluster_cfg_para.sim rename to tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim diff --git a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim b/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim similarity index 100% rename from tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim rename to tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim diff --git a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim b/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim similarity index 100% rename from tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim rename to tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_replica_change.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim diff --git a/tests/script/unique/arbitrator/dn3_mn2_killDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim similarity index 100% rename from tests/script/unique/arbitrator/dn3_mn2_killDnode.sim rename to tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim diff --git a/tests/script/unique/arbitrator/insert_duplicationTs.sim b/tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim similarity index 100% rename from tests/script/unique/arbitrator/insert_duplicationTs.sim rename to tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_createTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_createTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim diff --git a/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim similarity index 100% rename from tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim rename to tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim diff --git a/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim b/tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim similarity index 100% rename from tests/script/unique/arbitrator/replica_changeWithArbitrator.sim rename to tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_dropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_dropDb.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim diff --git a/tests/script/unique/arbitrator/sync_replica2_dropTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica2_dropTable.sim rename to tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_createTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_createTable.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_dropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_dropDb.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim diff --git a/tests/script/unique/arbitrator/sync_replica3_dropTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica3_dropTable.sim rename to tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim diff --git a/tests/script/unique/arbitrator/sync_replica_alterTable_background_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_alterTable_background_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica_alterTable_background_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_alterTable_background_drop.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim diff --git a/tests/script/unique/arbitrator/sync_replica_createTable_background_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_createTable_background_add.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim diff --git a/tests/script/unique/arbitrator/sync_replica_dropDb_background.sim b/tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_dropDb_background.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim diff --git a/tests/script/unique/arbitrator/sync_replica_dropTable_background.sim b/tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim similarity index 100% rename from tests/script/unique/arbitrator/sync_replica_dropTable_background.sim rename to tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim diff --git a/tests/script/unique/cluster/client1_0.sim b/tests/script/tsim/backup/cluster/client1_0.sim similarity index 100% rename from tests/script/unique/cluster/client1_0.sim rename to tests/script/tsim/backup/cluster/client1_0.sim diff --git a/tests/script/unique/cluster/client1_1.sim b/tests/script/tsim/backup/cluster/client1_1.sim similarity index 100% rename from tests/script/unique/cluster/client1_1.sim rename to tests/script/tsim/backup/cluster/client1_1.sim diff --git a/tests/script/unique/cluster/client1_2.sim b/tests/script/tsim/backup/cluster/client1_2.sim similarity index 100% rename from tests/script/unique/cluster/client1_2.sim rename to tests/script/tsim/backup/cluster/client1_2.sim diff --git a/tests/script/unique/cluster/client1_3.sim b/tests/script/tsim/backup/cluster/client1_3.sim similarity index 100% rename from tests/script/unique/cluster/client1_3.sim rename to tests/script/tsim/backup/cluster/client1_3.sim diff --git a/tests/script/unique/cluster/client2_0.sim b/tests/script/tsim/backup/cluster/client2_0.sim similarity index 100% rename from tests/script/unique/cluster/client2_0.sim rename to tests/script/tsim/backup/cluster/client2_0.sim diff --git a/tests/script/unique/cluster/client2_1.sim b/tests/script/tsim/backup/cluster/client2_1.sim similarity index 100% rename from tests/script/unique/cluster/client2_1.sim rename to tests/script/tsim/backup/cluster/client2_1.sim diff --git a/tests/script/unique/cluster/client2_2.sim b/tests/script/tsim/backup/cluster/client2_2.sim similarity index 100% rename from tests/script/unique/cluster/client2_2.sim rename to tests/script/tsim/backup/cluster/client2_2.sim diff --git a/tests/script/unique/cluster/client2_3.sim b/tests/script/tsim/backup/cluster/client2_3.sim similarity index 100% rename from tests/script/unique/cluster/client2_3.sim rename to tests/script/tsim/backup/cluster/client2_3.sim diff --git a/tests/script/unique/cluster/client3.sim b/tests/script/tsim/backup/cluster/client3.sim similarity index 100% rename from tests/script/unique/cluster/client3.sim rename to tests/script/tsim/backup/cluster/client3.sim diff --git a/tests/script/unique/cluster/client4.sim b/tests/script/tsim/backup/cluster/client4.sim similarity index 100% rename from tests/script/unique/cluster/client4.sim rename to tests/script/tsim/backup/cluster/client4.sim diff --git a/tests/script/unique/cluster/client5.sim b/tests/script/tsim/backup/cluster/client5.sim similarity index 100% rename from tests/script/unique/cluster/client5.sim rename to tests/script/tsim/backup/cluster/client5.sim diff --git a/tests/script/unique/cluster/cluster_main.sim b/tests/script/tsim/backup/cluster/cluster_main.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main.sim rename to tests/script/tsim/backup/cluster/cluster_main.sim diff --git a/tests/script/unique/cluster/cluster_main0.sim b/tests/script/tsim/backup/cluster/cluster_main0.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main0.sim rename to tests/script/tsim/backup/cluster/cluster_main0.sim diff --git a/tests/script/unique/cluster/cluster_main1.sim b/tests/script/tsim/backup/cluster/cluster_main1.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main1.sim rename to tests/script/tsim/backup/cluster/cluster_main1.sim diff --git a/tests/script/unique/cluster/cluster_main2.sim b/tests/script/tsim/backup/cluster/cluster_main2.sim similarity index 100% rename from tests/script/unique/cluster/cluster_main2.sim rename to tests/script/tsim/backup/cluster/cluster_main2.sim diff --git a/tests/script/unique/cluster/main1_client1_0.sim b/tests/script/tsim/backup/cluster/main1_client1_0.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_0.sim rename to tests/script/tsim/backup/cluster/main1_client1_0.sim diff --git a/tests/script/unique/cluster/main1_client1_1.sim b/tests/script/tsim/backup/cluster/main1_client1_1.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_1.sim rename to tests/script/tsim/backup/cluster/main1_client1_1.sim diff --git a/tests/script/unique/cluster/main1_client1_2.sim b/tests/script/tsim/backup/cluster/main1_client1_2.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_2.sim rename to tests/script/tsim/backup/cluster/main1_client1_2.sim diff --git a/tests/script/unique/cluster/main1_client1_3.sim b/tests/script/tsim/backup/cluster/main1_client1_3.sim similarity index 100% rename from tests/script/unique/cluster/main1_client1_3.sim rename to tests/script/tsim/backup/cluster/main1_client1_3.sim diff --git a/tests/script/unique/cluster/main1_client4.sim b/tests/script/tsim/backup/cluster/main1_client4.sim similarity index 100% rename from tests/script/unique/cluster/main1_client4.sim rename to tests/script/tsim/backup/cluster/main1_client4.sim diff --git a/tests/script/unique/cluster/main2_client1_0.sim b/tests/script/tsim/backup/cluster/main2_client1_0.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_0.sim rename to tests/script/tsim/backup/cluster/main2_client1_0.sim diff --git a/tests/script/unique/cluster/main2_client1_1.sim b/tests/script/tsim/backup/cluster/main2_client1_1.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_1.sim rename to tests/script/tsim/backup/cluster/main2_client1_1.sim diff --git a/tests/script/unique/cluster/main2_client1_2.sim b/tests/script/tsim/backup/cluster/main2_client1_2.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_2.sim rename to tests/script/tsim/backup/cluster/main2_client1_2.sim diff --git a/tests/script/unique/cluster/main2_client1_3.sim b/tests/script/tsim/backup/cluster/main2_client1_3.sim similarity index 100% rename from tests/script/unique/cluster/main2_client1_3.sim rename to tests/script/tsim/backup/cluster/main2_client1_3.sim diff --git a/tests/script/unique/cluster/main2_client2_0.sim b/tests/script/tsim/backup/cluster/main2_client2_0.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_0.sim rename to tests/script/tsim/backup/cluster/main2_client2_0.sim diff --git a/tests/script/unique/cluster/main2_client2_1.sim b/tests/script/tsim/backup/cluster/main2_client2_1.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_1.sim rename to tests/script/tsim/backup/cluster/main2_client2_1.sim diff --git a/tests/script/unique/cluster/main2_client2_2.sim b/tests/script/tsim/backup/cluster/main2_client2_2.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_2.sim rename to tests/script/tsim/backup/cluster/main2_client2_2.sim diff --git a/tests/script/unique/cluster/main2_client2_3.sim b/tests/script/tsim/backup/cluster/main2_client2_3.sim similarity index 100% rename from tests/script/unique/cluster/main2_client2_3.sim rename to tests/script/tsim/backup/cluster/main2_client2_3.sim diff --git a/tests/script/unique/clusterSimCase/client-01.sim b/tests/script/tsim/backup/clusterSimCase/client-01.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-01.sim rename to tests/script/tsim/backup/clusterSimCase/client-01.sim diff --git a/tests/script/unique/clusterSimCase/client-02.sim b/tests/script/tsim/backup/clusterSimCase/client-02.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-02.sim rename to tests/script/tsim/backup/clusterSimCase/client-02.sim diff --git a/tests/script/unique/clusterSimCase/client-03.sim b/tests/script/tsim/backup/clusterSimCase/client-03.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-03.sim rename to tests/script/tsim/backup/clusterSimCase/client-03.sim diff --git a/tests/script/unique/clusterSimCase/client-04.sim b/tests/script/tsim/backup/clusterSimCase/client-04.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-04.sim rename to tests/script/tsim/backup/clusterSimCase/client-04.sim diff --git a/tests/script/unique/clusterSimCase/client-05.sim b/tests/script/tsim/backup/clusterSimCase/client-05.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-05.sim rename to tests/script/tsim/backup/clusterSimCase/client-05.sim diff --git a/tests/script/unique/clusterSimCase/client-06.sim b/tests/script/tsim/backup/clusterSimCase/client-06.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-06.sim rename to tests/script/tsim/backup/clusterSimCase/client-06.sim diff --git a/tests/script/unique/clusterSimCase/client-07.sim b/tests/script/tsim/backup/clusterSimCase/client-07.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-07.sim rename to tests/script/tsim/backup/clusterSimCase/client-07.sim diff --git a/tests/script/unique/clusterSimCase/client-08.sim b/tests/script/tsim/backup/clusterSimCase/client-08.sim similarity index 100% rename from tests/script/unique/clusterSimCase/client-08.sim rename to tests/script/tsim/backup/clusterSimCase/client-08.sim diff --git a/tests/script/unique/clusterSimCase/cluster_main.sim b/tests/script/tsim/backup/clusterSimCase/cluster_main.sim similarity index 100% rename from tests/script/unique/clusterSimCase/cluster_main.sim rename to tests/script/tsim/backup/clusterSimCase/cluster_main.sim diff --git a/tests/script/unique/cluster/alter.sim b/tests/script/tsim/dnode/cluster_alter.sim similarity index 100% rename from tests/script/unique/cluster/alter.sim rename to tests/script/tsim/dnode/cluster_alter.sim diff --git a/tests/script/unique/cluster/balance1.sim b/tests/script/tsim/dnode/cluster_balance1.sim similarity index 100% rename from tests/script/unique/cluster/balance1.sim rename to tests/script/tsim/dnode/cluster_balance1.sim diff --git a/tests/script/unique/cluster/balance2.sim b/tests/script/tsim/dnode/cluster_balance2.sim similarity index 100% rename from tests/script/unique/cluster/balance2.sim rename to tests/script/tsim/dnode/cluster_balance2.sim diff --git a/tests/script/unique/cluster/balance3.sim b/tests/script/tsim/dnode/cluster_balance3.sim similarity index 100% rename from tests/script/unique/cluster/balance3.sim rename to tests/script/tsim/dnode/cluster_balance3.sim diff --git a/tests/script/unique/cluster/cache.sim b/tests/script/tsim/dnode/cluster_cache.sim similarity index 100% rename from tests/script/unique/cluster/cache.sim rename to tests/script/tsim/dnode/cluster_cache.sim diff --git a/tests/script/unique/cluster/flowctrl.sim b/tests/script/tsim/dnode/cluster_flowctrl.sim similarity index 100% rename from tests/script/unique/cluster/flowctrl.sim rename to tests/script/tsim/dnode/cluster_flowctrl.sim diff --git a/tests/script/unique/cluster/vgroup100.sim b/tests/script/tsim/dnode/cluster_vgroup100.sim similarity index 100% rename from tests/script/unique/cluster/vgroup100.sim rename to tests/script/tsim/dnode/cluster_vgroup100.sim diff --git a/tests/script/unique/arbitrator/testSuite.sim b/tests/script/unique/arbitrator/testSuite.sim deleted file mode 100644 index 127a320e53..0000000000 --- a/tests/script/unique/arbitrator/testSuite.sim +++ /dev/null @@ -1,41 +0,0 @@ -run unique/arbitrator/check_cluster_cfg_para.sim -run unique/arbitrator/dn2_mn1_cache_file_sync.sim -run unique/arbitrator/dn3_mn1_full_createTableFail.sim -run unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim -run unique/arbitrator/dn3_mn1_multiCreateDropTable.sim -run unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim -run unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim -run unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim -run unique/arbitrator/dn3_mn1_replica_change.sim -run unique/arbitrator/dn3_mn1_stopDnode_timeout.sim -run unique/arbitrator/dn3_mn1_vnode_change.sim -run unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim -run unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim -run unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim -run unique/arbitrator/dn3_mn1_vnode_delDir.sim -run unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim -run unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim -run unique/arbitrator/dn3_mn1_vnode_nomaster.sim -run unique/arbitrator/dn3_mn2_killDnode.sim -run unique/arbitrator/insert_duplicationTs.sim -run unique/arbitrator/offline_replica2_alterTable_online.sim -run unique/arbitrator/offline_replica2_alterTag_online.sim -run unique/arbitrator/offline_replica2_createTable_online.sim -run unique/arbitrator/offline_replica2_dropDb_online.sim -run unique/arbitrator/offline_replica2_dropTable_online.sim -run unique/arbitrator/offline_replica3_alterTable_online.sim -run unique/arbitrator/offline_replica3_alterTag_online.sim -run unique/arbitrator/offline_replica3_createTable_online.sim -run unique/arbitrator/offline_replica3_dropDb_online.sim -run unique/arbitrator/offline_replica3_dropTable_online.sim -run unique/arbitrator/replica_changeWithArbitrator.sim -run unique/arbitrator/sync_replica2_alterTable_add.sim -run unique/arbitrator/sync_replica2_alterTable_drop.sim -run unique/arbitrator/sync_replica3_createTable.sim -run unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim -run unique/arbitrator/sync_replica2_dropDb.sim -run unique/arbitrator/sync_replica2_dropTable.sim -run unique/arbitrator/sync_replica3_alterTable_add.sim -run unique/arbitrator/sync_replica3_alterTable_drop.sim -run unique/arbitrator/sync_replica3_dropDb.sim -run unique/arbitrator/sync_replica3_dropTable.sim diff --git a/tests/script/unique/big/balance.sim b/tests/script/unique/big/balance.sim deleted file mode 100644 index f20939d458..0000000000 --- a/tests/script/unique/big/balance.sim +++ /dev/null @@ -1,399 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 1000 - -system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode5 -c maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 1000 - -print =============== prepare data -system sh/exec.sh -n dnode1 -s start -sql connect - -$i = 0 -$tbNum = 4000 -$rowNum = 1 -$totalNum = 4000 * $rowNum - -sql create database db -sql use db -sql create table mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) - -$i = 0 -$tbPrefix = t -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using mt tags( $i ) - $i = $i + 1 -endw - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql insert into $tb values (now, $i , $i ) - - $i = $i + 1 -endw - -print ========== step0 -sql show db.tables -if $rows != 4000 then - return -1 -endi - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - return -1 -endi - -print ========== step1 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show1: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 openvnodes $data2_1 -print dnode2 openvnodes $data2_2 -if $data2_1 != 2 then - goto show1 -endi -if $data2_2 != 2 then - goto show1 -endi - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - goto show1 -endi - -print ========== step2 -sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start - -print ========== step3 -sql drop dnode $hostname2 - -$x = 0 -show3: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode2 freeVnodes $data2_2 -print dnode3 freeVnodes $data2_3 -if $data2_1 != 2 then - goto show3 -endi -if $data2_2 != null then - goto show3 -endi -if $data2_3 != 2 then - goto show3 -endi - -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - return -1 -endi - -print ========== step4 -sql drop dnode $hostname3 - -$x = 0 -show4: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode3 freeVnodes $data2_3 -if $data2_1 != 4 then - goto show4 -endi -if $data2_3 != null then - goto show4 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - return -1 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - return -1 -endi - -print ========== step5 -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname4 - -$x = 0 -step5: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql show dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_4 != ready then - goto step5 -endi - -sql alter database db replica 2 - -$x = 0 -show5: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode4 freeVnodes $data2_4 -if $data2_1 != 4 then - goto show5 -endi -if $data2_4 != 4 then - goto show5 -endi - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - goto show5 -endi - -print ========== step6 -sql alter database db replica 1 - -$x = 0 -show6: - $x = $x + 1 - sleep 1000 - if $x == 30 then - return -1 - endi - -sql show dnodes -print dnode1 freeVnodes $data2_1 -print dnode4 freeVnodes $data2_4 -if $data2_1 != 2 then - goto show6 -endi -if $data2_4 != 2 then - goto show6 -endi - -sql reset query cache -sleep 100 - -sql select count(*) from t10 -print select count(*) from t10 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t1010 -print select count(*) from t1010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t2010 -print select count(*) from t2010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from t3010 -print select count(*) from t3010 $data00 expect $rowNum -if $data00 != $rowNum then - goto show5 -endi - -sql select count(*) from mt -print select count(*) from mt $data00 expect $rowNum -if $data00 != $totalNum then - goto show5 -endi - - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim deleted file mode 100644 index 10dbc8bbff..0000000000 --- a/tests/script/unique/big/maxvnodes.sim +++ /dev/null @@ -1,89 +0,0 @@ -system sh/stop_dnodes.sh - -$totalVnodes = 20 -$minVnodes = 10 -$maxVnodes = 10 -$maxTables = 4 -$totalRows = $totalVnodes * $maxTables - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v $totalVnodes -system sh/cfg.sh -n dnode1 -c balanceInterval -v 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v $totalVnodes -system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 - -print ========== prepare data -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect -sql create database db blocks 3 cache 1 -sql use db - -print ========== step1 -sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$x = 0 -while $x < $totalRows - $tb = t . $x - sql create table $tb using mt tags( $x ) - sql insert into $tb values (now, $x ) - $x = $x + 1 -endw - -print ========== step2 -sql select * from mt -if $rows != $totalRows then - return -1 -endi - -sql select count(*) from mt -if $data00 != $totalRows then - return -1 -endi - -print ========== step3 -sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start - -$x = 0 -show3: - $x = $x + 1 - sleep 2000 - if $x == 1000 then - return -1 - endi - -sql show dnodes -print dnode1 openvnodes $data2_1 -print dnode2 openvnodes $data2_2 -if $data2_1 != $minVnodes then - goto show3 -endi -if $data2_2 != $maxVnodes then - goto show3 -endi - -print ========== step4 -sql select * from mt -if $rows != $totalRows then - return -1 -endi - -sql select count(*) from mt -if $data00 != $totalRows then - return -1 -endi - -return - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/restartSpeed.sim b/tests/script/unique/big/restartSpeed.sim deleted file mode 100644 index bdc4a8678b..0000000000 --- a/tests/script/unique/big/restartSpeed.sim +++ /dev/null @@ -1,41 +0,0 @@ -system sh/stop_dnodes.sh - -$totalVnodes = 20 -$minVnodes = 10 -$maxVnodes = 10 -$maxTables = 4 -$totalRows = $totalVnodes * $maxTables - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 - - -print ========== prepare data -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect -sql create database db blocks 3 cache 1 -sql use db - -print ========== step1 -sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$x = 0 -while $x < $totalRows - $tb = t . $x - sql create table $tb using mt tags( $x ) - sql insert into $tb values (now, $x ) - $x = $x + 1 -endw - - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/tcp.sim b/tests/script/unique/big/tcp.sim deleted file mode 100644 index b282e2e222..0000000000 --- a/tests/script/unique/big/tcp.sim +++ /dev/null @@ -1,113 +0,0 @@ -system sh/stop_dnodes.sh - -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 30000 - -system sh/cfg.sh -n dnode1 -c dDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c mDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c sdbDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c rpcDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c cDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c gcDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c adminDebugFlag -v 131 -system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 -system sh/cfg.sh -n dnode1 -c debugFlag -v 131 - -system sh/exec.sh -n dnode1 -s start -sql connect -print ======================== dnode1 start - -$dbPrefix = db -$tbPrefix = tb -$mtPrefix = mt -$tbNum = 22000 -$rowNum = 10 - -print =============== step1 -$i = 0 -$db = $dbPrefix -$mt = $mtPrefix - -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) - -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql create table $tb using $mt tags( $i ) - - $i = $i + 1 -endw - -print =============== step2 -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql insert into $tb values (now, $i , $i ) - - $i = $i + 1000 -endw - -$i = 0 -while $i < 5 - print =============== step3 $i - sql select count(*) from $mt - print ===> $data00 $data01 - if $rows != 1 then - return -1 - endi - if $data00 != 22 then - return -1 - endi - - print =============== step4 $i - sql select * from $mt - print ===> $data00 $data01 - if $rows != 22 then - return -1 - endi - - $i = $i + 1 -endw - -print =============== step3 -$i = 0 -while $i < $tbNum - $tb = $tbPrefix . $i - sql insert into $tb values (now, $i , $i ) - - $i = $i + 1000 -endw - -$i = 0 -while $i < 5 - print =============== step5 $i - sql select count(*) from $mt where tgcol < 20200 - print ===> $data00 $data01 - if $rows != 1 then - return -1 - endi - if $data00 != 42 then - return -1 - endi - - print =============== step6 $i - sql select * from $mt where tgcol < 20200 - print ===> $data00 $data01 - if $rows != 42 then - return -1 - endi - - $i = $i + 1 -endw - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/big/testSuite.sim b/tests/script/unique/big/testSuite.sim deleted file mode 100644 index 2cead5626a..0000000000 --- a/tests/script/unique/big/testSuite.sim +++ /dev/null @@ -1,3 +0,0 @@ -run unique/big/balance.sim -run unique/big/maxvnodes.sim -run unique/big/tcp.sim diff --git a/tests/script/unique/cluster/testSuite.sim b/tests/script/unique/cluster/testSuite.sim deleted file mode 100644 index 9657558c12..0000000000 --- a/tests/script/unique/cluster/testSuite.sim +++ /dev/null @@ -1,4 +0,0 @@ -run unique/cluster/balance1.sim -run unique/cluster/balance2.sim -run unique/cluster/balance3.sim -run unique/cluster/cache.sim diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim deleted file mode 100644 index e5f2928748..0000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim +++ /dev/null @@ -1,275 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its mnode dir, and copy mnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode1_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode1_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != offline then - sleep 2000 - goto wait_dnode1_offline -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_offline -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -#sql show vgroups -#print show vgroups: -#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/mnode -system_content cp -rf ../../../sim/dnode2/data/mnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1, waiting sync end -system sh/exec.sh -n dnode1 -s start -sleep 1000 - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 - -if $data5_4 != master then - print $data5_4 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_3 != slave then -print $data5_2 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_2 != master then -print $data5_3 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $data7_4 != slave then - print $data7_4 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_3 != master then - print $data7_3 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_2 != slave then - print $data7_2 - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -print ============== step7: stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim deleted file mode 100644 index 8d063020e7..0000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim +++ /dev/null @@ -1,271 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its mnode and vnode dir, and copy mnode and vnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode1_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode1_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != offline then - sleep 2000 - goto wait_dnode1_offline -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_offline -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -#sql show vgroups -#print show vgroups: -#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/vnode -system_content rm -rf ../../../sim/dnode1/data/mnode -system_content cp -rf ../../../sim/dnode2/data/vnode ../../../sim/dnode1/data/ -system_content cp -rf ../../../sim/dnode2/data/mnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1, waiting sync end -system sh/exec.sh -n dnode1 -s start -sleep 1000 - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 - -if $data5_4 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_3 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_2 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $data7_4 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_3 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_2 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -print ============== step7: stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim deleted file mode 100644 index 69e83a2c00..0000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim +++ /dev/null @@ -1,205 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its mnode and vnode dir, and copy mnode and vnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/vnode -system_content rm -rf ../../../sim/dnode1/data/mnode -system_content cp -rf ../../../sim/dnode2/data/vnode ../../../sim/dnode1/data/ -system_content cp -rf ../../../sim/dnode2/data/mnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1/dnode2 -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sql use $db - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 -$d2v2status = $data5_4 -$d2v3status = $data5_2 -$d2v4status = $data5_3 - -$d1v2status = $data7_4 -$d1v3status = $data7_2 -$d1v4status = $data7_3 - -if $d2v2status != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d2v3status != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d2v4status != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $d1v2status != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d1v3status != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $d1v4status != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi \ No newline at end of file diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim deleted file mode 100644 index 8f837b7e47..0000000000 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim +++ /dev/null @@ -1,269 +0,0 @@ -# Test case describe: dnode1/dnode2 include mnode and vnode roles -# step 1: start dnode1/dnode2, and added into cluster -# step 2: create db(repl = 2), table, insert data, -# step 4: stop dnode1, remove its vnode dir, and copy vnode dir of dnode2 to dnode1 -# step 5: restart dnode1, waiting sync end -# step 6: stop dnode2, reset query cache, and query - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -#system sh/deploy.sh -n dnode3 -i 3 -#system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -#system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -#system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -#system sh/cfg.sh -n dnode3 -c walLevel -v 2 -#system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -#system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -#system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1/dnode2 and add into cluster -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 1000 -sql connect -sleep 1000 -sql create dnode $hostname2 -sleep 1000 - -print ============== step2: create database with replica 2, and create table, insert data -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 1200 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 totalRows:$totalRows -if $rows != 1 then - return -1 -endi - -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode1 -system sh/exec.sh -n dnode1 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode1_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode1_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != offline then - sleep 2000 - goto wait_dnode1_offline -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_offline -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -#sql show vgroups -#print show vgroups: -#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - -print ============== step5: remove the mnode dir of dnode1, then copy the monde dir of dnode2 -system_content rm -rf ../../../sim/dnode1/data/vnode -system_content cp -rf ../../../sim/dnode2/data/vnode ../../../sim/dnode1/data/ - -print ============== step6: restart dnode1, waiting sync end -system sh/exec.sh -n dnode1 -s start -sleep 1000 - -$loopCnt = 0 -wait_dnode1_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi - -sql show dnodes -x wait_dnode1_ready -if $rows != 3 then - sleep 2000 - goto wait_dnode1_ready -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode1_ready -endi - -$loopCnt = 0 -wait_dnode1_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 $data5_4 $data6_4 $data7_4 $data8_4 $data9_4 - -if $data5_4 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_3 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data5_2 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -if $data7_4 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_3 != master then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi -if $data7_2 != slave then - sleep 2000 - goto wait_dnode1_vgroup_slave -endi - -print ============== step7: stop dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline -endi -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi - -sql reset query cache - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file From 3a99da6fd77d52bb09c90e76b16442d4fb038f99 Mon Sep 17 00:00:00 2001 From: Zhengmao Zhu <70138133+fenghuazzm@users.noreply.github.com> Date: Tue, 28 Jun 2022 19:24:45 +0800 Subject: [PATCH 46/47] docs: Update LineProtocolExample.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 看代码的时候发现注释有个小问题,毫秒的英文全称弄错了。 --- .../src/main/java/com/taos/example/LineProtocolExample.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java b/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java index 990922b7a5..4f3da59fd1 100644 --- a/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java +++ b/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java @@ -26,7 +26,7 @@ public class LineProtocolExample { private static void createDatabase(Connection conn) throws SQLException { try (Statement stmt = conn.createStatement()) { - // the default precision is ms (microsecond), but we use us(microsecond) here. + // the default precision is ms (milliseconds), but we use us(microsecond) here. stmt.execute("CREATE DATABASE IF NOT EXISTS test PRECISION 'us'"); stmt.execute("USE test"); } From b8ac5f0c11b05eec0bbe765d430b052ab69ce5e7 Mon Sep 17 00:00:00 2001 From: Bo Ding Date: Wed, 29 Jun 2022 08:24:18 +0800 Subject: [PATCH 47/47] docs: typo in LineProtocolExample.java --- .../src/main/java/com/taos/example/LineProtocolExample.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java b/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java index 4f3da59fd1..09c3078e22 100644 --- a/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java +++ b/docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java @@ -26,7 +26,7 @@ public class LineProtocolExample { private static void createDatabase(Connection conn) throws SQLException { try (Statement stmt = conn.createStatement()) { - // the default precision is ms (milliseconds), but we use us(microsecond) here. + // the default precision is ms (millisecond), but we use us(microsecond) here. stmt.execute("CREATE DATABASE IF NOT EXISTS test PRECISION 'us'"); stmt.execute("USE test"); }