diff --git a/cmake/cmake.options b/cmake/cmake.options index e013ff7592..5d99b2214a 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -79,7 +79,7 @@ ENDIF () option( BUILD_SANITIZER - "If build addr2line" + "If build sanitizer" OFF ) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index f672d47c92..5a7b32d20b 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -161,7 +161,6 @@ typedef struct SQueryTableDataCond { int64_t endVersion; } SQueryTableDataCond; -void* blockDataDestroy(SSDataBlock* pBlock); int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock); void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock); @@ -169,19 +168,6 @@ int32_t tEncodeDataBlocks(void** buf, const SArray* blocks); void* tDecodeDataBlocks(const void* buf, SArray** blocks); void colDataDestroy(SColumnInfoData* pColData); -static FORCE_INLINE void blockDestroyInner(SSDataBlock* pBlock) { - int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock); - for (int32_t i = 0; i < numOfOutput; ++i) { - SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i); - colDataDestroy(pColInfoData); - } - - taosArrayDestroy(pBlock->pDataBlock); - taosMemoryFreeClear(pBlock->pBlockAgg); -} - -static FORCE_INLINE void tDeleteSSDataBlock(SSDataBlock* pBlock) { blockDestroyInner(pBlock); } - //====================================================================================================================== // the following structure shared by parser and executor typedef struct SColumn { diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index af333f72aa..a4f5904018 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -226,8 +226,12 @@ int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n); int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src); int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src); -SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData); + SSDataBlock* createDataBlock(); +void* blockDataDestroy(SSDataBlock* pBlock); +void blockDataFreeRes(SSDataBlock* pBlock); +SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData); + int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData); SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId); diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 6a865b4e2a..b807aeca22 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -275,7 +275,12 @@ typedef struct SScanPhysiNode { typedef SScanPhysiNode STagScanPhysiNode; typedef SScanPhysiNode SBlockDistScanPhysiNode; -typedef SScanPhysiNode SLastRowScanPhysiNode; + +typedef struct SLastRowScanPhysiNode { + SScanPhysiNode scan; + SNodeList* pGroupTags; + bool groupSort; +} SLastRowScanPhysiNode; typedef struct SSystemTableScanPhysiNode { SScanPhysiNode scan; diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index a08db7b8f8..071c539ff3 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -340,12 +340,12 @@ static FORCE_INLINE int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBloc if (pTask->sinkType == TASK_SINK__TABLE) { ASSERT(pTask->dispatchType == TASK_DISPATCH__NONE); pTask->tbSink.tbSinkFunc(pTask, pTask->tbSink.vnode, 0, pBlock->blocks); - taosArrayDestroyEx(pBlock->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(pBlock); } else if (pTask->sinkType == TASK_SINK__SMA) { ASSERT(pTask->dispatchType == TASK_DISPATCH__NONE); pTask->smaSink.smaSink(pTask->smaSink.vnode, pTask->smaSink.smaId, pBlock->blocks); - taosArrayDestroyEx(pBlock->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(pBlock); } else { ASSERT(pTask->dispatchType != TASK_DISPATCH__NONE); diff --git a/include/os/osDef.h b/include/os/osDef.h index 6f6199de7a..14f38eb7ff 100644 --- a/include/os/osDef.h +++ b/include/os/osDef.h @@ -22,7 +22,10 @@ extern "C" { #if defined(_TD_DARWIN_64) // specific +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T typedef int(*__compar_fn_t)(const void *, const void *); +#endif // for send function in tsocket.c #if defined(MSG_NOSIGNAL) @@ -41,7 +44,10 @@ extern "C" { #endif #if defined(_ALPINE) +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T typedef int(*__compar_fn_t)(const void *, const void *); +#endif void error (int, int, const char *); #ifndef PTHREAD_MUTEX_RECURSIVE_NP #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE @@ -54,7 +60,10 @@ extern "C" { char *stpncpy (char *dest, const char *src, size_t n); // specific +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T typedef int (*__compar_fn_t)(const void *, const void *); +#endif #define ssize_t int #define _SSIZE_T_ #define bzero(ptr, size) memset((ptr), 0, (size)) @@ -69,7 +78,6 @@ extern "C" { char * strsep(char **stringp, const char *delim); char * getpass(const char *prefix); char * strndup(const char *s, size_t n); - int gettimeofday(struct timeval *ptv, void *pTimeZone); // for send function in tsocket.c #define MSG_NOSIGNAL 0 diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index ad47348c22..6ad6413159 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -343,7 +343,7 @@ tmq_list_t* tmq_list_new() { int32_t tmq_list_append(tmq_list_t* list, const char* src) { SArray* container = &list->container; - char* topic = strDupUnquo(src); + char* topic = strdup(src); if (taosArrayPush(container, &topic) == NULL) return -1; return 0; } diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 9f5a247d76..47cfa5d410 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1197,15 +1197,28 @@ int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) { return TSDB_CODE_SUCCESS; } +void blockDataFreeRes(SSDataBlock* pBlock) { + int32_t numOfOutput = taosArrayGetSize(pBlock->pDataBlock); + for (int32_t i = 0; i < numOfOutput; ++i) { + SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i); + colDataDestroy(pColInfoData); + } + + taosArrayDestroy(pBlock->pDataBlock); + taosMemoryFreeClear(pBlock->pBlockAgg); + memset(&pBlock->info, 0, sizeof(SDataBlockInfo)); +} + void* blockDataDestroy(SSDataBlock* pBlock) { if (pBlock == NULL) { return NULL; } - blockDestroyInner(pBlock); + blockDataFreeRes(pBlock); taosMemoryFreeClear(pBlock); return NULL; } + int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { ASSERT(src != NULL); diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index b94c60c4ab..9f168e2c83 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -125,7 +125,7 @@ typedef struct SMnode { } SMnode; void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp); -int64_t mndGenerateUid(char *name, int32_t len); +int64_t mndGenerateUid(const char *name, int32_t len); int32_t mndAcquireRpcRef(SMnode *pMnode); void mndReleaseRpcRef(SMnode *pMnode); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index df8dc42d17..29e68ce4e8 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -624,7 +624,7 @@ void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp) { } // Note: uid 0 is reserved -int64_t mndGenerateUid(char *name, int32_t len) { +int64_t mndGenerateUid(const char *name, int32_t len) { int32_t hashval = MurmurHash3_32(name, len); do { int64_t us = taosGetTimestampUs(); diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index c040f0d05b..88629ebc69 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -479,7 +479,8 @@ static void mndDestroySmaObj(SSmaObj *pSmaObj) { } } -static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCreate, SDbObj *pDb, SStbObj *pStb) { +static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCreate, SDbObj *pDb, SStbObj *pStb, + const char *streamName) { SSmaObj smaObj = {0}; memcpy(smaObj.name, pCreate->name, TSDB_TABLE_FNAME_LEN); memcpy(smaObj.stb, pStb->name, TSDB_TABLE_FNAME_LEN); @@ -520,12 +521,12 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea } SStreamObj streamObj = {0}; - tstrncpy(streamObj.name, pCreate->name, TSDB_STREAM_FNAME_LEN); + tstrncpy(streamObj.name, streamName, TSDB_STREAM_FNAME_LEN); tstrncpy(streamObj.sourceDb, pDb->name, TSDB_DB_FNAME_LEN); tstrncpy(streamObj.targetDb, streamObj.sourceDb, TSDB_DB_FNAME_LEN); streamObj.createTime = taosGetTimestampMs(); streamObj.updateTime = streamObj.createTime; - streamObj.uid = mndGenerateUid(pCreate->name, strlen(pCreate->name)); + streamObj.uid = mndGenerateUid(streamName, strlen(streamName)); streamObj.sourceDbUid = pDb->uid; streamObj.targetDbUid = pDb->uid; streamObj.version = 1; @@ -590,7 +591,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea if (pTrans == NULL) goto _OVER; mndTransSetDbName(pTrans, pDb->name, NULL); mndTransSetSerial(pTrans); - mDebug("trans:%d, used to create sma:%s", pTrans->id, pCreate->name); + mDebug("trans:%d, used to create sma:%s stream:%s", pTrans->id, pCreate->name, streamObj.name); if (mndSetCreateSmaRedoLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER; if (mndSetCreateSmaVgroupRedoLogs(pMnode, pTrans, &streamObj.fixedSinkVg) != 0) goto _OVER; @@ -638,6 +639,14 @@ static int32_t mndCheckCreateSmaReq(SMCreateSmaReq *pCreate) { return 0; } +static void mndGetStreamNameFromSmaName(char *streamName, char *smaName) { + SName n; + tNameFromString(&n, smaName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); + streamName[0] = '1'; + streamName[1] = '.'; + strcpy(streamName + 2, tNameGetTableName(&n)); +} + static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; int32_t code = -1; @@ -663,9 +672,12 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) { goto _OVER; } - pStream = mndAcquireStream(pMnode, createReq.name); + char streamName[TSDB_TABLE_FNAME_LEN] = {0}; + mndGetStreamNameFromSmaName(streamName, createReq.name); + + pStream = mndAcquireStream(pMnode, streamName); if (pStream != NULL) { - mError("sma:%s, failed to create since stream:%s already exist", createReq.name, createReq.name); + mError("sma:%s, failed to create since stream:%s already exist", createReq.name, streamName); terrno = TSDB_CODE_MND_STREAM_ALREADY_EXIST; goto _OVER; } @@ -692,7 +704,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) { goto _OVER; } - code = mndCreateSma(pMnode, pReq, &createReq, pDb, pStb); + code = mndCreateSma(pMnode, pReq, &createReq, pDb, pStb, streamName); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; _OVER: @@ -789,7 +801,10 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p mDebug("trans:%d, used to drop sma:%s", pTrans->id, pSma->name); mndTransSetDbName(pTrans, pDb->name, NULL); - SStreamObj *pStream = mndAcquireStream(pMnode, pSma->name); + char streamName[TSDB_TABLE_FNAME_LEN] = {0}; + mndGetStreamNameFromSmaName(streamName, pSma->name); + + SStreamObj *pStream = mndAcquireStream(pMnode, streamName); if (pStream == NULL || pStream->smaId != pSma->uid) { sdbRelease(pMnode->pSdb, pStream); goto _OVER; @@ -838,7 +853,10 @@ int32_t mndDropSmasByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p pVgroup = mndAcquireVgroup(pMnode, pSma->dstVgId); if (pVgroup == NULL) goto _OVER; - SStreamObj *pStream = mndAcquireStream(pMnode, pSma->name); + char streamName[TSDB_TABLE_FNAME_LEN] = {0}; + mndGetStreamNameFromSmaName(streamName, pSma->name); + + SStreamObj *pStream = mndAcquireStream(pMnode, streamName); if (pStream != NULL && pStream->smaId == pSma->uid) { if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) { mError("stream:%s, failed to drop task since %s", pStream->name, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index c2125f75f8..5777df4fa6 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -235,7 +235,8 @@ static int32_t mndStreamGetPlanString(const char *ast, int8_t triggerType, int64 } static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, SCMCreateStreamReq *pCreate) { - SNode *pAst = NULL; + SNode *pAst = NULL; + SQueryPlan *pPlan = NULL; mDebug("stream:%s to create", pCreate->name); memcpy(pObj->name, pCreate->name, TSDB_STREAM_FNAME_LEN); @@ -293,7 +294,6 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, goto FAIL; } - SQueryPlan *pPlan = NULL; SPlanContext cxt = { .pAstRoot = pAst, .topicQuery = false, @@ -317,6 +317,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, FAIL: if (pAst != NULL) nodesDestroyNode(pAst); + if (pPlan != NULL) qDestroyQueryPlan(pPlan); return 0; } @@ -541,7 +542,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { // build stream obj from request SStreamObj streamObj = {0}; if (mndBuildStreamObjFromCreateReq(pMnode, &streamObj, &createStreamReq) < 0) { - ASSERT(0); + /*ASSERT(0);*/ mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); goto _OVER; } @@ -689,7 +690,14 @@ int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { terrno = TSDB_CODE_MND_STREAM_ALREADY_EXIST; return -1; } else { - // TODO drop all task on snode +#if 0 + if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) { + mError("stream:%s, failed to drop task since %s", pStream->name, terrstr()); + sdbRelease(pMnode->pSdb, pStream); + sdbCancelFetch(pSdb, pIter); + return -1; + } +#endif if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) { sdbRelease(pSdb, pStream); sdbCancelFetch(pSdb, pIter); diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index be56d901de..1294f0cff3 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -163,7 +163,6 @@ typedef struct SSdbRow { ESdbType type; ESdbStatus status; int32_t refCount; - int64_t forAlign; char pObj[]; } SSdbRow; diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index 2cf4fd51a9..4a7d4db874 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -214,7 +214,6 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS } pRSmaStat->refId = refId; - // init hash RSMA_INFO_HASH(pRSmaStat) = taosHashInit( RSMA_TASK_INFO_HASH_SLOT, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_ENTRY_LOCK); @@ -256,6 +255,7 @@ static void tdDestroyRSmaStat(void *pRSmaStat) { // step 2: destroy the rsma info and associated fetch tasks // TODO: use taosHashSetFreeFp when taosHashSetFreeFp is ready. +#if 1 if (taosHashGetSize(RSMA_INFO_HASH(pStat)) > 0) { void *infoHash = taosHashIterate(RSMA_INFO_HASH(pStat), NULL); while (infoHash) { @@ -264,6 +264,7 @@ static void tdDestroyRSmaStat(void *pRSmaStat) { infoHash = taosHashIterate(RSMA_INFO_HASH(pStat), infoHash); } } +#endif taosHashCleanup(RSMA_INFO_HASH(pStat)); // step 3: wait all triggered fetch tasks finished @@ -382,4 +383,4 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) { tdUnLockSma(pSma); return TSDB_CODE_SUCCESS; -}; \ No newline at end of file +}; diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 06ffb639de..a6d56acbfb 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -30,7 +30,7 @@ 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); static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat *pStat, SRSmaInfo *pRSmaInfo, - SReadHandle *handle, int8_t idx); + int8_t idx); static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t inputType, SRSmaInfoItem *rsmaItem, STSchema *pTSchema, tb_uid_t suid, int8_t level); static SRSmaInfo *tdGetRSmaInfoBySuid(SSma *pSma, int64_t suid); @@ -256,14 +256,20 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui } static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat *pStat, SRSmaInfo *pRSmaInfo, - SReadHandle *pReadHandle, int8_t idx) { + int8_t idx) { SRetention *pRetention = SMA_RETENTION(pSma); STsdbCfg *pTsdbCfg = SMA_TSDB_CFG(pSma); + SReadHandle handle = { + .meta = pSma->pVnode->pMeta, + .vnode = pSma->pVnode, + .initTqReader = 1, + }; + if (param->qmsg[idx]) { SRSmaInfoItem *pItem = &(pRSmaInfo->items[idx]); pItem->refId = RSMA_REF_ID(pStat); - pItem->taskInfo = qCreateStreamExecTaskInfo(param->qmsg[idx], pReadHandle); + pItem->taskInfo = qCreateStreamExecTaskInfo(param->qmsg[idx], &handle); if (!pItem->taskInfo) { terrno = TSDB_CODE_RSMA_QTASKINFO_CREATE; goto _err; @@ -299,10 +305,6 @@ _err: * @return int32_t */ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, const char *tbName) { - SVnode *pVnode = pSma->pVnode; - SMeta *pMeta = pVnode->pMeta; - SMsgCb *pMsgCb = &pVnode->msgCb; - if ((param->qmsgLen[0] == 0) && (param->qmsgLen[1] == 0)) { smaDebug("vgId:%d, no qmsg1/qmsg2 for rollup table %s %" PRIi64, SMA_VID(pSma), tbName, suid); return TSDB_CODE_SUCCESS; @@ -331,19 +333,6 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con return TSDB_CODE_FAILED; } - STqReader *pReader = tqOpenReader(pVnode); - if (!pReader) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } - - SReadHandle handle = { - .tqReader = pReader, - .meta = pMeta, - .pMsgCb = pMsgCb, - .vnode = pVnode, - }; - STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, -1); if (!pTSchema) { terrno = TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION; @@ -352,11 +341,11 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con pRSmaInfo->pTSchema = pTSchema; pRSmaInfo->suid = suid; - if (tdSetRSmaInfoItemParams(pSma, param, pStat, pRSmaInfo, &handle, 0) < 0) { + if (tdSetRSmaInfoItemParams(pSma, param, pStat, pRSmaInfo, 0) < 0) { goto _err; } - if (tdSetRSmaInfoItemParams(pSma, param, pStat, pRSmaInfo, &handle, 1) < 0) { + if (tdSetRSmaInfoItemParams(pSma, param, pStat, pRSmaInfo, 1) < 0) { goto _err; } @@ -369,7 +358,6 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con return TSDB_CODE_SUCCESS; _err: tdFreeRSmaInfo(pSma, pRSmaInfo); - taosMemoryFree(pReader); return TSDB_CODE_FAILED; } @@ -404,7 +392,7 @@ int32_t tdProcessRSmaCreate(SSma *pSma, SVCreateStbReq *pReq) { * @param pReq * @return int32_t */ -int32_t tdProcessRSmaDrop(SSma *pSma, SVDropStbReq *pReq) { +int32_t tdProcessRSmaDrop(SSma *pSma, SVDropStbReq *pReq) { SVnode *pVnode = pSma->pVnode; if (!VND_IS_RSMA(pVnode)) { smaTrace("vgId:%d, not create rsma for stable %s %" PRIi64 " since vnd is not rsma", TD_VID(pVnode), pReq->name, @@ -412,11 +400,9 @@ int32_t tdProcessRSmaDrop(SSma *pSma, SVDropStbReq *pReq) { return TSDB_CODE_SUCCESS; } - - smaDebug("vgId:%d, drop rsma for table %" PRIi64 " succeed", TD_VID(pVnode), pReq->suid); return TSDB_CODE_SUCCESS; - } +} /** * @brief store suid/[uids], prefer to use array and then hash diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 6f4a04ee09..f36e6f874f 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -82,6 +82,13 @@ void tqClose(STQ* pTq) { if (pTq) { tqOffsetClose(pTq->pOffsetStore); taosHashCleanup(pTq->handles); + void* pIter = NULL; + while (1) { + pIter = taosHashIterate(pTq->pStreamTasks, pIter); + if (pIter == NULL) break; + SStreamTask* pTask = *(SStreamTask**)pIter; + tFreeSStreamTask(pTask); + } taosHashCleanup(pTq->pStreamTasks); taosHashCleanup(pTq->pushMgr); taosMemoryFree(pTq->path); @@ -608,7 +615,8 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) { streamSetupTrigger(pTask); - tqInfo("deploy stream task id %d child id %d on vgId:%d", pTask->taskId, pTask->selfChildId, TD_VID(pTq->pVnode)); + tqInfo("deploy stream task on vg %d, task id %d, child id %d", TD_VID(pTq->pVnode), pTask->taskId, + pTask->selfChildId); taosHashPut(pTq->pStreamTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*)); @@ -634,9 +642,6 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) { pIter = taosHashIterate(pTq->pStreamTasks, pIter); if (pIter == NULL) break; SStreamTask* pTask = *(SStreamTask**)pIter; - if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) { - continue; - } if (!pTask->isDataScan) continue; if (!failed) { @@ -665,11 +670,12 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) { SStreamTaskRunReq* pReq = pMsg->pCont; int32_t taskId = pReq->taskId; SStreamTask* pTask = *(SStreamTask**)taosHashGet(pTq->pStreamTasks, &taskId, sizeof(int32_t)); - if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + if (pTask) { + streamProcessRunReq(pTask); return 0; + } else { + return -1; } - streamProcessRunReq(pTask); - return 0; } int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) { @@ -682,55 +688,62 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) { tDecodeStreamDispatchReq(&decoder, &req); int32_t taskId = req.taskId; SStreamTask* pTask = *(SStreamTask**)taosHashGet(pTq->pStreamTasks, &taskId, sizeof(int32_t)); - if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + if (pTask) { + SRpcMsg rsp = { + .info = pMsg->info, + .code = 0, + }; + streamProcessDispatchReq(pTask, &req, &rsp); return 0; + } else { + return -1; } - SRpcMsg rsp = { - .info = pMsg->info, - .code = 0, - }; - streamProcessDispatchReq(pTask, &req, &rsp); - return 0; } int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg) { SStreamTaskRecoverReq* pReq = pMsg->pCont; int32_t taskId = pReq->taskId; SStreamTask* pTask = *(SStreamTask**)taosHashGet(pTq->pStreamTasks, &taskId, sizeof(int32_t)); - if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + if (pTask) { + streamProcessRecoverReq(pTask, pReq, pMsg); return 0; + } else { + return -1; } - streamProcessRecoverReq(pTask, pReq, pMsg); - return 0; } int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) { SStreamDispatchRsp* pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); int32_t taskId = pRsp->taskId; SStreamTask* pTask = *(SStreamTask**)taosHashGet(pTq->pStreamTasks, &taskId, sizeof(int32_t)); - if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + if (pTask) { + streamProcessDispatchRsp(pTask, pRsp); return 0; + } else { + return -1; } - streamProcessDispatchRsp(pTask, pRsp); - return 0; } int32_t tqProcessTaskRecoverRsp(STQ* pTq, SRpcMsg* pMsg) { SStreamTaskRecoverRsp* pRsp = pMsg->pCont; int32_t taskId = pRsp->taskId; SStreamTask* pTask = *(SStreamTask**)taosHashGet(pTq->pStreamTasks, &taskId, sizeof(int32_t)); - if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + if (pTask) { + streamProcessRecoverRsp(pTask, pRsp); return 0; + } else { + return -1; } - streamProcessRecoverRsp(pTask, pRsp); - return 0; } int32_t tqProcessTaskDropReq(STQ* pTq, char* msg, int32_t msgLen) { SVDropStreamTaskReq* pReq = (SVDropStreamTaskReq*)msg; SStreamTask* pTask = *(SStreamTask**)taosHashGet(pTq->pStreamTasks, &pReq->taskId, sizeof(int32_t)); - atomic_store_8(&pTask->taskStatus, TASK_STATUS__DROPPING); + if (pTask) { + taosHashRemove(pTq->pStreamTasks, &pReq->taskId, sizeof(int32_t)); + atomic_store_8(&pTask->taskStatus, TASK_STATUS__DROPPING); + } // todo // clear queue // push drop req into queue diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 8753ecc47c..47b497b480 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -98,8 +98,21 @@ STqReader* tqOpenReader(SVnode* pVnode) { void tqCloseReader(STqReader* pReader) { // close wal reader + if (pReader->pWalReader) { + walCloseReader(pReader->pWalReader); + } // free cached schema + if (pReader->pSchema) { + taosMemoryFree(pReader->pSchema); + } + if (pReader->pSchemaWrapper) { + tDeleteSSchemaWrapper(pReader->pSchemaWrapper); + } + if (pReader->pColIdList) { + taosArrayDestroy(pReader->pColIdList); + } // free hash + taosHashCleanup(pReader->tbIdHash); taosMemoryFree(pReader); } @@ -319,7 +332,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { return 0; FAIL: - tDeleteSSDataBlock(pBlock); + blockDataFreeRes(pBlock); return -1; } diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 25615f8d5c..449f592ee4 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -147,7 +147,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo const STColumn* pColumn = &pTSchema->columns[k]; SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, k); if (colDataIsNull_s(pColData, j)) { - tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NONE, NULL, false, pColumn->offset, k); + tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NULL, NULL, false, pColumn->offset, k); } else { void* data = colDataGetData(pColData, j); tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NORM, data, true, pColumn->offset, k); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 4aaa80d3ae..5e30fcd5b2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -209,10 +209,10 @@ static void resetDataBlockScanInfo(SHashObj* pTableMap) { p->iterInit = false; p->iiter.hasVal = false; if (p->iter.iter != NULL) { - tsdbTbDataIterDestroy(p->iter.iter); + p->iter.iter = tsdbTbDataIterDestroy(p->iter.iter); } - taosArrayDestroy(p->delSkyline); + p->delSkyline = taosArrayDestroy(p->delSkyline); } } @@ -224,18 +224,15 @@ static void destroyBlockScanInfo(SHashObj* pTableMap) { p->iiter.hasVal = false; if (p->iter.iter != NULL) { - tsdbTbDataIterDestroy(p->iter.iter); - p->iter.iter = NULL; + p->iter.iter = tsdbTbDataIterDestroy(p->iter.iter); } if (p->iiter.iter != NULL) { - tsdbTbDataIterDestroy(p->iiter.iter); - p->iiter.iter = NULL; + p->iiter.iter = tsdbTbDataIterDestroy(p->iiter.iter); } - taosArrayDestroy(p->delSkyline); - taosArrayDestroy(p->pBlockList); - p->delSkyline = NULL; + p->delSkyline = taosArrayDestroy(p->delSkyline); + p->pBlockList = taosArrayDestroy(p->pBlockList); } taosHashCleanup(pTableMap); diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index fde53b7064..3fa419e220 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -206,7 +206,7 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo } case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: { SLastRowScanPhysiNode *lastRowPhysiNode = (SLastRowScanPhysiNode *)pNode; - pPhysiChildren = lastRowPhysiNode->node.pChildren; + pPhysiChildren = lastRowPhysiNode->scan.node.pChildren; break; } case QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT: { @@ -1209,19 +1209,19 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: { SLastRowScanPhysiNode *pLastRowNode = (SLastRowScanPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_LASTROW_SCAN_FORMAT, pLastRowNode->tableName.tname); + EXPLAIN_ROW_NEW(level, EXPLAIN_LASTROW_SCAN_FORMAT, pLastRowNode->scan.tableName.tname); EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); } - EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pLastRowNode->pScanCols->length); + EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, pLastRowNode->scan.pScanCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); - if (pLastRowNode->pScanPseudoCols) { - EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pLastRowNode->pScanPseudoCols->length); + if (pLastRowNode->scan.pScanPseudoCols) { + EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pLastRowNode->scan.pScanPseudoCols->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); } - EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pLastRowNode->node.pOutputDataBlockDesc->totalRowSize); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pLastRowNode->scan.node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); EXPLAIN_ROW_END(); @@ -1230,15 +1230,15 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_OUTPUT_FORMAT); EXPLAIN_ROW_APPEND(EXPLAIN_COLUMNS_FORMAT, - nodesGetOutputNumFromSlotList(pLastRowNode->node.pOutputDataBlockDesc->pSlots)); + nodesGetOutputNumFromSlotList(pLastRowNode->scan.node.pOutputDataBlockDesc->pSlots)); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); - EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pLastRowNode->node.pOutputDataBlockDesc->outputRowSize); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pLastRowNode->scan.node.pOutputDataBlockDesc->outputRowSize); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); - if (pLastRowNode->node.pConditions) { + if (pLastRowNode->scan.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pLastRowNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, + QRY_ERR_RET(nodesNodeToSQL(pLastRowNode->scan.node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 74bb80eed1..201bc5896d 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -147,7 +147,6 @@ typedef struct { SSDataBlock* pullOverBlk; // for streaming SWalFilterCond cond; int64_t lastScanUid; - SStreamQueue* inputQueue; } SStreamTaskInfo; typedef struct SExecTaskInfo { @@ -561,6 +560,7 @@ typedef struct SFillOperatorInfo { SNode* pCondition; SArray* pColMatchColInfo; int32_t primaryTsCol; + uint64_t curGroupId; // current handled group id } SFillOperatorInfo; typedef struct SGroupbyOperatorInfo { diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 0f6817cd6b..9034397d0f 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -40,10 +40,10 @@ SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pScanNode, SRead pInfo->pTableList = pTableList; pInfo->readHandle = *readHandle; - pInfo->pRes = createResDataBlock(pScanNode->node.pOutputDataBlockDesc); + pInfo->pRes = createResDataBlock(pScanNode->scan.node.pOutputDataBlockDesc); int32_t numOfCols = 0; - pInfo->pColMatchInfo = extractColMatchInfo(pScanNode->pScanCols, pScanNode->node.pOutputDataBlockDesc, &numOfCols, + pInfo->pColMatchInfo = extractColMatchInfo(pScanNode->scan.pScanCols, pScanNode->scan.node.pOutputDataBlockDesc, &numOfCols, COL_MATCH_FROM_COL_ID); int32_t code = extractTargetSlotId(pInfo->pColMatchInfo, pTaskInfo, &pInfo->pSlotIds); if (code != TSDB_CODE_SUCCESS) { @@ -53,10 +53,10 @@ SOperatorInfo* createLastrowScanOperator(SLastRowScanPhysiNode* pScanNode, SRead tsdbLastRowReaderOpen(readHandle->vnode, LASTROW_RETRIEVE_TYPE_SINGLE, pTableList, taosArrayGetSize(pInfo->pColMatchInfo), &pInfo->pLastrowReader); - if (pScanNode->pScanPseudoCols != NULL) { + if (pScanNode->scan.pScanPseudoCols != NULL) { SExprSupp* pPseudoExpr = &pInfo->pseudoExprSup; - pPseudoExpr->pExprInfo = createExprInfo(pScanNode->pScanPseudoCols, NULL, &pPseudoExpr->numOfExprs); + pPseudoExpr->pExprInfo = createExprInfo(pScanNode->scan.pScanPseudoCols, NULL, &pPseudoExpr->numOfExprs); pPseudoExpr->pCtx = createSqlFunctionCtx(pPseudoExpr->pExprInfo, pPseudoExpr->numOfExprs, &pPseudoExpr->rowEntryInfoOffset); } diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index 6381d20255..d910b8be34 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -44,13 +44,6 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, goto _error; } - if (model == OPTR_EXEC_MODEL_STREAM) { - (*pTask)->streamInfo.inputQueue = streamQueueOpen(); - if ((*pTask)->streamInfo.inputQueue == NULL) { - goto _error; - } - } - SDataSinkMgtCfg cfg = {.maxDataBlockNum = 1000, .maxDataBlockNumPerQuery = 100}; code = dsDataSinkMgtInit(&cfg); if (code != TSDB_CODE_SUCCESS) { @@ -259,12 +252,14 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) { } } +#if 0 int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); taosWriteQitem(pTaskInfo->streamInfo.inputQueue->queue, pItem); return 0; } +#endif void* qExtractReaderFromStreamScanner(void* scanner) { SStreamScanInfo* pInfo = scanner; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 674bbfef0b..266567ec1b 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1637,8 +1637,6 @@ static int32_t compressQueryColData(SColumnInfoData* pColRes, int32_t numOfRows, int32_t doFillTimeIntervalGapsInResults(struct SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t capacity) { int32_t numOfRows = (int32_t)taosFillResultDataBlock(pFillInfo, pBlock, capacity - pBlock->info.rows); - pBlock->info.rows += numOfRows; - return pBlock->info.rows; } @@ -3344,14 +3342,15 @@ static void doHandleRemainBlockForNewGroupImpl(SFillOperatorInfo* pInfo, SResult taosFillSetInputDataBlock(pInfo->pFillInfo, pInfo->existNewGroupBlock); doFillTimeIntervalGapsInResults(pInfo->pFillInfo, pInfo->pRes, pResultInfo->capacity); + pInfo->curGroupId = pInfo->existNewGroupBlock->info.groupId; pInfo->existNewGroupBlock = NULL; - *newgroup = true; +// *newgroup = true; } static void doHandleRemainBlockFromNewGroup(SFillOperatorInfo* pInfo, SResultInfo* pResultInfo, bool* newgroup, SExecTaskInfo* pTaskInfo) { if (taosFillHasMoreResults(pInfo->pFillInfo)) { - *newgroup = false; +// *newgroup = false; doFillTimeIntervalGapsInResults(pInfo->pFillInfo, pInfo->pRes, (int32_t)pResultInfo->capacity); if (pInfo->pRes->info.rows > pResultInfo->threshold || (!pInfo->multigroupResult)) { return; @@ -3373,10 +3372,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { blockDataCleanup(pResBlock); - // todo handle different group data interpolation - bool n = false; - bool* newgroup = &n; - doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, newgroup, pTaskInfo); + doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, NULL, pTaskInfo); if (pResBlock->info.rows > pResultInfo->threshold || (!pInfo->multigroupResult && pResBlock->info.rows > 0)) { return pResBlock; } @@ -3384,31 +3380,29 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { SOperatorInfo* pDownstream = pOperator->pDownstream[0]; while (1) { SSDataBlock* pBlock = pDownstream->fpSet.getNextFn(pDownstream); - if (*newgroup) { - assert(pBlock != NULL); - } + if (pBlock == NULL) { + if (pInfo->totalInputRows == 0) { + pOperator->status = OP_EXEC_DONE; + return NULL; + } - blockDataUpdateTsWindow(pBlock, pInfo->primaryTsCol); - - if (*newgroup && pInfo->totalInputRows > 0) { // there are already processed current group data block - pInfo->existNewGroupBlock = pBlock; - *newgroup = false; - - // Fill the previous group data block, before handle the data block of new group. - // Close the fill operation for previous group data block taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey); } else { - if (pBlock == NULL) { - if (pInfo->totalInputRows == 0) { - pOperator->status = OP_EXEC_DONE; - return NULL; - } + blockDataUpdateTsWindow(pBlock, pInfo->primaryTsCol); + + if (pInfo->curGroupId == 0 || pInfo->curGroupId == pBlock->info.groupId) { + pInfo->curGroupId = pBlock->info.groupId; // the first data block - taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey); - } else { pInfo->totalInputRows += pBlock->info.rows; + taosFillSetStartInfo(pInfo->pFillInfo, pBlock->info.rows, pBlock->info.window.ekey); taosFillSetInputDataBlock(pInfo->pFillInfo, pBlock); + } else if (pInfo->curGroupId != pBlock->info.groupId) { // the new group data block + pInfo->existNewGroupBlock = pBlock; + + // Fill the previous group data block, before handle the data block of new group. + // Close the fill operation for previous group data block + taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey); } } @@ -3419,17 +3413,17 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { if (pResBlock->info.rows > 0) { // 1. The result in current group not reach the threshold of output result, continue // 2. If multiple group results existing in one SSDataBlock is not allowed, return immediately - if (pResBlock->info.rows > pResultInfo->threshold || pBlock == NULL || (!pInfo->multigroupResult)) { + if (pResBlock->info.rows > pResultInfo->threshold || pBlock == NULL || pInfo->existNewGroupBlock != NULL) { return pResBlock; } - doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, newgroup, pTaskInfo); - if (pResBlock->info.rows > pOperator->resultInfo.threshold || pBlock == NULL) { + doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, NULL, pTaskInfo); + if (pResBlock->info.rows >= pOperator->resultInfo.threshold || pBlock == NULL) { return pResBlock; } } else if (pInfo->existNewGroupBlock) { // try next group assert(pBlock != NULL); - doHandleRemainBlockForNewGroupImpl(pInfo, pResultInfo, newgroup, pTaskInfo); + doHandleRemainBlockForNewGroupImpl(pInfo, pResultInfo, NULL, pTaskInfo); if (pResBlock->info.rows > pResultInfo->threshold) { return pResBlock; } @@ -4444,21 +4438,21 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo // return NULL; // } - int32_t code = extractTableSchemaInfo(pHandle, pScanNode->uid, pTaskInfo); + int32_t code = extractTableSchemaInfo(pHandle, pScanNode->scan.uid, pTaskInfo); if (code != TSDB_CODE_SUCCESS) { pTaskInfo->code = code; return NULL; } pTableListInfo->pTableList = taosArrayInit(4, sizeof(STableKeyInfo)); - if (pScanNode->tableType == TSDB_SUPER_TABLE) { - code = vnodeGetAllTableList(pHandle->vnode, pScanNode->uid, pTableListInfo->pTableList); + if (pScanNode->scan.tableType == TSDB_SUPER_TABLE) { + code = vnodeGetAllTableList(pHandle->vnode, pScanNode->scan.uid, pTableListInfo->pTableList); if (code != TSDB_CODE_SUCCESS) { pTaskInfo->code = terrno; return NULL; } } else { // Create one table group. - STableKeyInfo info = {.lastKey = 0, .uid = pScanNode->uid, .groupId = 0}; + STableKeyInfo info = {.lastKey = 0, .uid = pScanNode->scan.uid, .groupId = 0}; taosArrayPush(pTableListInfo->pTableList, &info); } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 4df8150140..0f44ac48a4 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -39,7 +39,7 @@ static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capac static int32_t buildDbTableInfoBlock(const SSDataBlock* p, const SSysTableMeta* pSysDbTableMeta, size_t size, const char* dbName); -static bool processBlockWithProbability(const SSampleExecInfo* pInfo); +static bool processBlockWithProbability(const SSampleExecInfo* pInfo); bool processBlockWithProbability(const SSampleExecInfo* pInfo) { #if 0 @@ -874,22 +874,22 @@ static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_ return true; } -static STimeWindow getSlidingWindow(TSKEY* tsCol, SInterval* pInterval, SDataBlockInfo* pDataBlockInfo, int32_t* pRowIndex) { - SResultRowInfo dumyInfo; +static STimeWindow getSlidingWindow(TSKEY* tsCol, SInterval* pInterval, SDataBlockInfo* pDataBlockInfo, + int32_t* pRowIndex) { + SResultRowInfo dumyInfo; dumyInfo.cur.pageId = -1; - STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsCol[*pRowIndex], pInterval, - TSDB_ORDER_ASC); + STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsCol[*pRowIndex], pInterval, TSDB_ORDER_ASC); STimeWindow endWin = win; STimeWindow preWin = win; while (1) { - (*pRowIndex) += getNumOfRowsInTimeWindow(pDataBlockInfo, tsCol, *pRowIndex, endWin.ekey, - binarySearchForKey, NULL, TSDB_ORDER_ASC); + (*pRowIndex) += getNumOfRowsInTimeWindow(pDataBlockInfo, tsCol, *pRowIndex, endWin.ekey, binarySearchForKey, NULL, + TSDB_ORDER_ASC); do { preWin = endWin; getNextTimeWindow(pInterval, &endWin, TSDB_ORDER_ASC); } while (tsCol[(*pRowIndex) - 1] >= endWin.skey); endWin = preWin; - if (win.ekey == endWin.ekey || (*pRowIndex) == pDataBlockInfo->rows ) { + if (win.ekey == endWin.ekey || (*pRowIndex) == pDataBlockInfo->rows) { win.ekey = endWin.ekey; return win; } @@ -923,7 +923,8 @@ static bool prepareDataScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32_t t pInfo->updateWin.ekey = tsCols[*pRowIndex - 1]; // win = getActiveTimeWindow(NULL, &dumyInfo, tsCols[*pRowIndex], &pInfo->interval, TSDB_ORDER_ASC); // (*pRowIndex) += - // getNumOfRowsInTimeWindow(&pSDB->info, tsCols, *pRowIndex, win.ekey, binarySearchForKey, NULL, TSDB_ORDER_ASC); + // getNumOfRowsInTimeWindow(&pSDB->info, tsCols, *pRowIndex, win.ekey, binarySearchForKey, NULL, + // TSDB_ORDER_ASC); } needRead = true; } else if (isStateWindow(pInfo)) { @@ -1177,10 +1178,9 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock for (int32_t j = 0; j < blockDataGetNumOfCols(pBlock); ++j) { SColumnInfoData* pResCol = bdGetColumnInfoData(pBlock, j); if (pResCol->info.colId == pColMatchInfo->colId) { - SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId); colDataAssign(pDst, pResCol, pBlock->info.rows, &pInfo->pRes->info); -// taosArraySet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId, pResCol); + // taosArraySet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId, pResCol); colExists = true; break; } @@ -1193,8 +1193,6 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock } } - taosArrayDestroy(pBlock->pDataBlock); - ASSERT(pInfo->pRes->pDataBlock != NULL); // currently only the tbname pseudo column @@ -1202,12 +1200,14 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock int32_t code = addTagPseudoColumnData(&pInfo->readHandle, pInfo->pPseudoExpr, pInfo->numOfPseudoExpr, pInfo->pRes, GET_TASKID(pTaskInfo)); if (code != TSDB_CODE_SUCCESS) { + blockDataFreeRes((SSDataBlock*)pBlock); longjmp(pTaskInfo->env, code); } } doFilter(pInfo->pCondition, pInfo->pRes); blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); + blockDataFreeRes((SSDataBlock*)pBlock); return 0; } @@ -1441,6 +1441,29 @@ SOperatorInfo* createRawScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNo return NULL; } +static void destroyStreamScanOperatorInfo(void* param, int32_t numOfOutput) { + SStreamScanInfo* pStreamScan = (SStreamScanInfo*)param; +#if 1 + if (pStreamScan->pTableScanOp && pStreamScan->pTableScanOp->info) { + STableScanInfo* pTableScanInfo = pStreamScan->pTableScanOp->info; + destroyTableScanOperatorInfo(pTableScanInfo, 1); + } +#endif + if (pStreamScan->tqReader) { + tqCloseReader(pStreamScan->tqReader); + } + if (pStreamScan->pColMatchInfo) { + taosArrayDestroy(pStreamScan->pColMatchInfo); + } + updateInfoDestroy(pStreamScan->pUpdateInfo); + blockDataDestroy(pStreamScan->pRes); + blockDataDestroy(pStreamScan->pUpdateRes); + blockDataDestroy(pStreamScan->pPullDataRes); + blockDataDestroy(pStreamScan->pDeleteDataRes); + taosArrayDestroy(pStreamScan->pBlockLists); + taosMemoryFree(pStreamScan); +} + SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode* pTableScanNode, SExecTaskInfo* pTaskInfo, STimeWindowAggSupp* pTwSup, uint64_t queryId, uint64_t taskId) { @@ -1555,8 +1578,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock); pOperator->pTaskInfo = pTaskInfo; - pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doStreamScan, NULL, NULL, operatorDummyCloseFn, NULL, NULL, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamScan, NULL, NULL, destroyStreamScanOperatorInfo, + NULL, NULL, NULL); return pOperator; diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 959c03a3b1..550938140e 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -71,13 +71,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* SPoint point1, point2, point; int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order); - // set the primary timestamp column value - int32_t index = pFillInfo->numOfCurrent; - SColumnInfoData* pCol0 = taosArrayGet(pBlock->pDataBlock, pFillInfo->tsSlotId); - char* val = colDataGetData(pCol0, index); - - // set the primary timestamp value - *(TSKEY*)val = pFillInfo->currentKey; +// set the primary timestamp column value + int32_t index = pBlock->info.rows; // set the other values if (pFillInfo->type == TSDB_FILL_PREV) { @@ -92,7 +87,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { - colDataAppend(pDstColInfoData, index, (const char*)&ts, false); + colDataAppend(pDstColInfoData, index, (const char*)&pFillInfo->currentKey, false); } else { SGroupKeys* pKey = taosArrayGet(p, i); doSetVal(pDstColInfoData, index, pKey); @@ -101,41 +96,51 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* } else if (pFillInfo->type == TSDB_FILL_NEXT) { SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next : pFillInfo->prev; // todo refactor: start from 0 not 1 - for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; if (TSDB_COL_IS_TAG(pCol->flag)) { continue; } - SGroupKeys* pKey = taosArrayGet(p, i); SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol)); - doSetVal(pDstColInfoData, index, pKey); + + if (pDstColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { + colDataAppend(pDstColInfoData, index, (const char*)&pFillInfo->currentKey, false); + } else { + SGroupKeys* pKey = taosArrayGet(p, i); + doSetVal(pDstColInfoData, index, pKey); + } } } else if (pFillInfo->type == TSDB_FILL_LINEAR) { // TODO : linear interpolation supports NULL value if (outOfBound) { setNullRow(pBlock, pFillInfo->currentKey, index); } else { - for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; if (TSDB_COL_IS_TAG(pCol->flag)) { continue; } - int32_t srcSlotId = GET_SRC_SLOT_ID(pCol); - int32_t dstSlotId = GET_DEST_SLOT_ID(pCol); SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); - int16_t type = pCol->pExpr->base.resSchema.type; + int16_t type = pDstCol->info.type; + if (type == TSDB_DATA_TYPE_TIMESTAMP) { + colDataAppend(pDstCol, index, (const char*)&pFillInfo->currentKey, false); + continue; + } + SGroupKeys* pKey = taosArrayGet(pFillInfo->prev, i); if (IS_VAR_DATA_TYPE(type) || type == TSDB_DATA_TYPE_BOOL || pKey->isNull) { colDataAppendNULL(pDstCol, index); continue; } - SGroupKeys* pKey1 = taosArrayGet(pFillInfo->prev, 0); - int64_t prevTs = *(int64_t*)pKey1->pData; + SGroupKeys* pKey1 = taosArrayGet(pFillInfo->prev, pFillInfo->tsSlotId); + + int64_t prevTs = *(int64_t*)pKey1->pData; + int32_t srcSlotId = GET_SRC_SLOT_ID(pCol); SColumnInfoData* pSrcCol = taosArrayGet(pSrcBlock->pDataBlock, srcSlotId); char* data = colDataGetData(pSrcCol, pFillInfo->index); @@ -153,7 +158,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* } else if (pFillInfo->type == TSDB_FILL_NULL) { // fill with NULL setNullRow(pBlock, pFillInfo->currentKey, index); } else { // fill with user specified value for each column - for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) { + for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; if (TSDB_COL_IS_TAG(pCol->flag) /* || IS_VAR_DATA_TYPE(pCol->schema.type)*/) { continue; @@ -176,6 +181,8 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* colDataAppend(pDst, index, (char*)&v, false); } else if (pDst->info.type == TSDB_DATA_TYPE_TIMESTAMP) { colDataAppend(pDst, index, (const char*)&pFillInfo->currentKey, false); + } else { // varchar/nchar data + colDataAppendNULL(pDst, index); } } } @@ -184,6 +191,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock* SInterval* pInterval = &pFillInfo->interval; pFillInfo->currentKey = taosTimeAdd(pFillInfo->currentKey, pInterval->sliding * step, pInterval->slidingUnit, pInterval->precision); + pBlock->info.rows += 1; pFillInfo->numOfCurrent++; } @@ -234,8 +242,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t outputRows) { pFillInfo->numOfCurrent = 0; - // todo make sure the first column is always the primary timestamp column? - SColumnInfoData* pTsCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, 0); + SColumnInfoData* pTsCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, pFillInfo->tsSlotId); int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order); bool ascFill = FILL_IS_ASC_FILL(pFillInfo); @@ -267,6 +274,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t } } else { assert(pFillInfo->currentKey == ts); + int32_t index = pBlock->info.rows; if (pFillInfo->type == TSDB_FILL_NEXT && (pFillInfo->index + 1) < pFillInfo->numOfRows) { int32_t nextRowIndex = pFillInfo->index + 1; @@ -290,24 +298,24 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t if (i == 0 || (/*pCol->functionId != FUNCTION_COUNT &&*/ !colDataIsNull_s(pSrc, pFillInfo->index)) /*|| (pCol->functionId == FUNCTION_COUNT && GET_INT64_VAL(src) != 0)*/) { bool isNull = colDataIsNull_s(pSrc, pFillInfo->index); - colDataAppend(pDst, pFillInfo->numOfCurrent, src, isNull); + colDataAppend(pDst, index, src, isNull); saveColData(pFillInfo->prev, i, src, isNull); } else { // i > 0 and data is null , do interpolation if (pFillInfo->type == TSDB_FILL_PREV) { SGroupKeys* pKey = taosArrayGet(pFillInfo->prev, i); - doSetVal(pDst, pFillInfo->numOfCurrent, pKey); + doSetVal(pDst, index, pKey); } else if (pFillInfo->type == TSDB_FILL_LINEAR) { bool isNull = colDataIsNull_s(pSrc, pFillInfo->index); - colDataAppend(pDst, pFillInfo->numOfCurrent, src, isNull); + colDataAppend(pDst, index, src, isNull); saveColData(pFillInfo->prev, i, src, isNull); } else if (pFillInfo->type == TSDB_FILL_NULL) { - colDataAppendNULL(pDst, pFillInfo->numOfCurrent); + colDataAppendNULL(pDst, index); } else if (pFillInfo->type == TSDB_FILL_NEXT) { SGroupKeys* pKey = taosArrayGet(pFillInfo->next, i); - doSetVal(pDst, pFillInfo->numOfCurrent, pKey); + doSetVal(pDst, index, pKey); } else { SVariant* pVar = &pFillInfo->pFillCol[i].fillVal; - colDataAppend(pDst, pFillInfo->numOfCurrent, (char*)&pVar->i, false); + colDataAppend(pDst, index, (char*)&pVar->i, false); } } } @@ -318,6 +326,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t pFillInfo->currentKey = taosTimeAdd(pFillInfo->currentKey, pInterval->sliding * step, pInterval->slidingUnit, pInterval->precision); + pBlock->info.rows += 1; pFillInfo->index += 1; pFillInfo->numOfCurrent += 1; } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 74b5a3dab2..acc56af5cd 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1340,13 +1340,13 @@ static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup, void* key = taosHashGetKey(pIte, &keyLen); uint64_t groupId = *(uint64_t*)key; ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); - TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t)); + TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t)); STimeWindow win; win.skey = ts; win.ekey = taosTimeAdd(win.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1; - SWinRes winRe = { - .ts = win.skey, - .groupId = groupId, + SWinRes winRe = { + .ts = win.skey, + .groupId = groupId, }; void* chIds = taosHashGet(pPullDataMap, &winRe, sizeof(SWinRes)); if (isCloseWindow(&win, pSup)) { @@ -1537,7 +1537,6 @@ void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) { for (int32_t i = 0; i < size; i++) { SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, i); destroyStreamFinalIntervalOperatorInfo(pChildOp->info, numOfOutput); - taosMemoryFreeClear(pChildOp->info); taosMemoryFreeClear(pChildOp); } } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 97cb1f0ee1..0245379672 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -80,7 +80,7 @@ typedef struct STopBotRes { } STopBotRes; typedef struct SFirstLastRes { - bool hasResult; + bool hasResult; // used for last_row function only, isNullRes in SResultRowEntry can not be passed to downstream.So, // this attribute is required bool isNull; @@ -402,7 +402,6 @@ typedef struct SGroupKeyInfo { (x) += step; \ } while (0) - #define STATE_COMP(_op, _lval, _param) STATE_COMP_IMPL(_op, _lval, GET_STATE_VAL(_param)) #define GET_STATE_VAL(param) ((param.nType == TSDB_DATA_TYPE_BIGINT) ? (param.i) : (param.d)) @@ -986,8 +985,8 @@ int32_t avgFunctionMerge(SqlFunctionCtx* pCtx) { int32_t start = pInput->startRowIndex; - for(int32_t i = start; i < start + pInput->numOfRows; ++i) { - char* data = colDataGetData(pCol, i); + for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); SAvgRes* pInputInfo = (SAvgRes*)varDataVal(data); avgTransferInfo(pInputInfo, pInfo); } @@ -2559,8 +2558,8 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { int32_t start = pInput->startRowIndex; - for(int32_t i = start; i < start + pInput->numOfRows; ++i) { - char* data = colDataGetData(pCol, i); + for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); SAPercentileInfo* pInputInfo = (SAPercentileInfo*)varDataVal(data); apercentileTransferInfo(pInputInfo, pInfo); } @@ -2925,8 +2924,8 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer int32_t start = pInput->startRowIndex; int32_t numOfElems = 0; - for(int32_t i = start; i < start + pInput->numOfRows; ++i) { - char* data = colDataGetData(pCol, i); + for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data); firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery); if (!numOfElems) { @@ -2951,7 +2950,7 @@ int32_t firstLastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0; SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); - colDataAppend(pCol, pBlock->info.rows, pRes->buf, pRes->isNull||pResInfo->isNullRes); + colDataAppend(pCol, pBlock->info.rows, pRes->buf, pRes->isNull || pResInfo->isNullRes); // handle selectivity STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY)); @@ -3763,8 +3762,8 @@ int32_t spreadFunctionMerge(SqlFunctionCtx* pCtx) { int32_t start = pInput->startRowIndex; - for(int32_t i = start; i < start + pInput->numOfRows; ++i) { - char* data = colDataGetData(pCol, i); + for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); SSpreadInfo* pInputInfo = (SSpreadInfo*)varDataVal(data); spreadTransferInfo(pInputInfo, pInfo); } @@ -3935,8 +3934,8 @@ int32_t elapsedFunctionMerge(SqlFunctionCtx* pCtx) { int32_t start = pInput->startRowIndex; - for(int32_t i = start; i < start + pInput->numOfRows; ++i) { - char* data = colDataGetData(pCol, i); + for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); SElapsedInfo* pInputInfo = (SElapsedInfo*)varDataVal(data); elapsedTransferInfo(pInputInfo, pInfo); } @@ -4200,13 +4199,9 @@ static int32_t histogramFunctionImpl(SqlFunctionCtx* pCtx, bool isPartial) { return TSDB_CODE_SUCCESS; } -int32_t histogramFunction(SqlFunctionCtx* pCtx) { - return histogramFunctionImpl(pCtx, false); -} +int32_t histogramFunction(SqlFunctionCtx* pCtx) { return histogramFunctionImpl(pCtx, false); } -int32_t histogramFunctionPartial(SqlFunctionCtx* pCtx) { - return histogramFunctionImpl(pCtx, true); -} +int32_t histogramFunctionPartial(SqlFunctionCtx* pCtx) { return histogramFunctionImpl(pCtx, true); } static void histogramTransferInfo(SHistoFuncInfo* pInput, SHistoFuncInfo* pOutput) { pOutput->normalized = pInput->normalized; @@ -4228,8 +4223,8 @@ int32_t histogramFunctionMerge(SqlFunctionCtx* pCtx) { int32_t start = pInput->startRowIndex; - for(int32_t i = start; i < start + pInput->numOfRows; ++i) { - char* data = colDataGetData(pCol, i); + for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); SHistoFuncInfo* pInputInfo = (SHistoFuncInfo*)varDataVal(data); histogramTransferInfo(pInputInfo, pInfo); } @@ -4276,9 +4271,9 @@ int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t resultBytes = getHistogramInfoSize(); - char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); + SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + int32_t resultBytes = getHistogramInfoSize(); + char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -4449,8 +4444,8 @@ int32_t hllFunctionMerge(SqlFunctionCtx* pCtx) { int32_t start = pInput->startRowIndex; - for(int32_t i = start; i < start + pInput->numOfRows; ++i) { - char* data = colDataGetData(pCol, i); + for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); SHLLInfo* pInputInfo = (SHLLInfo*)varDataVal(data); hllTransferInfo(pInputInfo, pInfo); } @@ -6007,7 +6002,7 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pInputCol = pInput->pData[0]; - int32_t type = pInputCol->info.type; + int32_t type = pInputCol->info.type; int32_t bytes = pInputCol->info.bytes; pInfo->bytes = bytes; @@ -6019,7 +6014,6 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) { char* data = colDataGetData(pInputCol, i); TSKEY cts = getRowPTs(pInput->pPTS, i); if (pResInfo->numOfRes == 0 || pInfo->ts < cts) { - if (colDataIsNull_s(pInputCol, i)) { pInfo->isNull = true; } else { @@ -6032,9 +6026,6 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) { } pInfo->ts = cts; - pInfo->hasResult = true; - pResInfo->numOfRes = 1; - if (pCtx->subsidiaries.num > 0) { STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); if (!pInfo->hasResult) { @@ -6043,6 +6034,8 @@ int32_t lastrowFunction(SqlFunctionCtx* pCtx) { copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); } } + + pInfo->hasResult = true; } } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index a412b589a9..fd9b588d46 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -296,8 +296,8 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { switch (call->callType) { case TSDB_UDF_CALL_SCALA_PROC: { - tDeleteSSDataBlock(&call->block); - tDeleteSSDataBlock(&subRsp->resultData); + blockDataFreeRes(&call->block); + blockDataFreeRes(&subRsp->resultData); break; } case TSDB_UDF_CALL_AGG_INIT: { @@ -305,7 +305,7 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { break; } case TSDB_UDF_CALL_AGG_PROC: { - tDeleteSSDataBlock(&call->block); + blockDataFreeRes(&call->block); freeUdfInterBuf(&subRsp->resultBuf); break; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index a50df01d44..4955384a9b 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1470,9 +1470,36 @@ static int32_t jsonToPhysiScanNode(const SJson* pJson, void* pObj) { return code; } -static int32_t physiTagScanNodeToJson(const void* pObj, SJson* pJson) { return physiScanNodeToJson(pObj, pJson); } +static const char* jkLastRowScanPhysiPlanGroupTags = "GroupTags"; +static const char* jkLastRowScanPhysiPlanGroupSort = "GroupSort"; -static int32_t jsonToPhysiTagScanNode(const SJson* pJson, void* pObj) { return jsonToPhysiScanNode(pJson, pObj); } +static int32_t physiLastRowScanNodeToJson(const void* pObj, SJson* pJson) { + const SLastRowScanPhysiNode* pNode = (const SLastRowScanPhysiNode*)pObj; + + int32_t code = physiScanNodeToJson(pObj, pJson); + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkLastRowScanPhysiPlanGroupTags, pNode->pGroupTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkLastRowScanPhysiPlanGroupSort, pNode->groupSort); + } + + return code; +} + +static int32_t jsonToPhysiLastRowScanNode(const SJson* pJson, void* pObj) { + SLastRowScanPhysiNode* pNode = (SLastRowScanPhysiNode*)pObj; + + int32_t code = jsonToPhysiScanNode(pJson, pObj); + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkLastRowScanPhysiPlanGroupTags, &pNode->pGroupTags); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkLastRowScanPhysiPlanGroupSort, &pNode->groupSort); + } + + return code; +} static const char* jkTableScanPhysiPlanScanCount = "ScanCount"; static const char* jkTableScanPhysiPlanReverseScanCount = "ReverseScanCount"; @@ -4317,8 +4344,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { return logicPlanToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: + return physiScanNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: - return physiTagScanNodeToJson(pObj, pJson); + return physiLastRowScanNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: @@ -4463,8 +4491,10 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { return jsonToLogicPlan(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: case QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN: + return jsonToPhysiScanNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN: - return jsonToPhysiTagScanNode(pJson, pObj); + + return jsonToPhysiLastRowScanNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 005a7f919a..5ac4476d14 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -1178,6 +1178,13 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, TSKEY tsKey = TD_ROW_KEY(row); checkTimestamp(pDataBlocks, (const char*)&tsKey); } + + if (i < spd->numOfBound - 1) { + NEXT_VALID_TOKEN(pCxt->pSql, sToken); + if (TK_NK_COMMA != sToken.type) { + return buildSyntaxErrMsg(&pCxt->msg, ", expected", sToken.z); + } + } } if (!isParseBindParam) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0542b4eec7..d108e86df1 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5954,7 +5954,8 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S pReq->type = pStmt->dataType.type; pReq->flags = COL_SMA_ON; - pReq->bytes = pStmt->dataType.bytes; + // pReq->bytes = pStmt->dataType.bytes; + pReq->bytes = calcTypeBytes(pStmt->dataType); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 8c9c06be35..c4cc31c535 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -481,8 +481,6 @@ static ENodeType getScanOperatorType(EScanType scanType) { return QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN; case SCAN_TYPE_BLOCK_INFO: return QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN; - case SCAN_TYPE_LAST_ROW: - return QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN; default: break; } @@ -502,6 +500,24 @@ static int32_t createSimpleScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSub return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, pScan, pPhyNode); } +static int32_t createLastRowScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubplan, SScanLogicNode* pScanLogicNode, + SPhysiNode** pPhyNode) { + SLastRowScanPhysiNode* pScan = + (SLastRowScanPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pScanLogicNode, QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN); + if (NULL == pScan) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + pScan->pGroupTags = nodesCloneList(pScanLogicNode->pGroupTags); + if (NULL != pScanLogicNode->pGroupTags && NULL == pScan->pGroupTags) { + nodesDestroyNode((SNode*)pScan); + return TSDB_CODE_OUT_OF_MEMORY; + } + pScan->groupSort = pScanLogicNode->groupSort; + + return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pScan, pPhyNode); +} + static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubplan, SScanLogicNode* pScanLogicNode, SPhysiNode** pPhyNode) { STableScanPhysiNode* pTableScan = (STableScanPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pScanLogicNode, @@ -583,8 +599,9 @@ static int32_t createScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubplan, switch (pScanLogicNode->scanType) { case SCAN_TYPE_TAG: case SCAN_TYPE_BLOCK_INFO: - case SCAN_TYPE_LAST_ROW: return createSimpleScanPhysiNode(pCxt, pSubplan, pScanLogicNode, pPhyNode); + case SCAN_TYPE_LAST_ROW: + return createLastRowScanPhysiNode(pCxt, pSubplan, pScanLogicNode, pPhyNode); case SCAN_TYPE_TABLE: return createTableScanPhysiNode(pCxt, pSubplan, pScanLogicNode, pPhyNode); case SCAN_TYPE_SYSTEM_TABLE: diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 7b9d553501..871bcf015b 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -364,6 +364,8 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic pMergeWindow->node.pTargets = NULL; SNodeList* pChildren = pMergeWindow->node.pChildren; pMergeWindow->node.pChildren = NULL; + SNode* pConditions = pMergeWindow->node.pConditions; + pMergeWindow->node.pConditions = NULL; int32_t code = TSDB_CODE_SUCCESS; SWindowLogicNode* pPartWin = (SWindowLogicNode*)nodesCloneNode((SNode*)pMergeWindow); @@ -373,6 +375,7 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic if (TSDB_CODE_SUCCESS == code) { pMergeWindow->node.pTargets = pTargets; + pMergeWindow->node.pConditions = pConditions; pPartWin->node.pChildren = pChildren; splSetParent((SLogicNode*)pPartWin); code = stbSplRewriteFuns(pFunc, &pPartWin->pFuncs, &pMergeWindow->pFuncs); diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 0d6bab145a..8482698cd3 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -108,6 +108,8 @@ TEST_F(PlanBasicTest, lastRowFunc) { run("SELECT LAST_ROW(c1) FROM st1"); + run("SELECT LAST_ROW(c1) FROM st1 PARTITION BY TBNAME"); + run("SELECT LAST_ROW(c1), SUM(c3) FROM t1"); } diff --git a/source/libs/planner/test/planSubqueryTest.cpp b/source/libs/planner/test/planSubqueryTest.cpp index 4d4f780473..2ba3794d5c 100644 --- a/source/libs/planner/test/planSubqueryTest.cpp +++ b/source/libs/planner/test/planSubqueryTest.cpp @@ -36,6 +36,8 @@ TEST_F(PlanSubqeuryTest, basic) { run("SELECT * FROM (SELECT NOW() FROM t1)"); run("SELECT NOW() FROM (SELECT * FROM t1) ORDER BY ts"); + + run("SELECT * FROM (SELECT AVG(c1) a FROM st1 INTERVAL(10s)) WHERE a > 1"); } TEST_F(PlanSubqeuryTest, doubleGroupBy) { diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 39b2f04f3e..76de4da4fd 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1477,7 +1477,8 @@ void vectorAssign(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, pOut->numOfRows = pLeft->numOfRows; - if (IS_HELPER_NULL(pRight->columnData, 0)) { +// if (IS_HELPER_NULL(pRight->columnData, 0)) { + if(colDataIsNull_s(pRight->columnData, 0)){ for (int32_t i = 0; i < pOut->numOfRows; ++i) { colDataAppend(pOutputCol, i, NULL, true); } diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 2b3307b7f5..8e16b23e56 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -116,7 +116,7 @@ void streamFreeQitem(SStreamQueueItem* data) { blockDataDestroy(((SStreamTrigger*)data)->pBlock); taosFreeQitem(data); } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE) { - taosArrayDestroyEx(((SStreamDataBlock*)data)->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(((SStreamDataBlock*)data)->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(data); } else if (type == STREAM_INPUT__DATA_SUBMIT) { streamDataSubmitRefDec((SStreamDataSubmit*)data); diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 05efce8bc2..e2faf28abe 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -313,7 +313,7 @@ int32_t streamDispatch(SStreamTask* pTask, SMsgCb* pMsgCb) { atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL); return -1; } - taosArrayDestroyEx(pBlock->blocks, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); taosFreeQitem(pBlock); tmsgSendReq(pEpSet, &dispatchMsg); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index d0d81e3343..1e46a9622b 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -74,63 +74,62 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes) } static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { + int32_t cnt = 0; + void* data = NULL; while (1) { - int32_t cnt = 0; - void* data = NULL; - while (1) { - SStreamQueueItem* qItem = streamQueueNextItem(pTask->inputQueue); - if (qItem == NULL) { - qDebug("stream exec over, queue empty"); + SStreamQueueItem* qItem = streamQueueNextItem(pTask->inputQueue); + if (qItem == NULL) { + qDebug("stream exec over, queue empty"); + break; + } + if (data == NULL) { + data = qItem; + streamQueueProcessSuccess(pTask->inputQueue); + continue; + } else { + if (streamAppendQueueItem(data, qItem) < 0) { + streamQueueProcessFail(pTask->inputQueue); break; - } - if (data == NULL) { - data = qItem; - streamQueueProcessSuccess(pTask->inputQueue); - continue; } else { - if (streamAppendQueueItem(data, qItem) < 0) { - streamQueueProcessFail(pTask->inputQueue); - break; - } else { - cnt++; - streamQueueProcessSuccess(pTask->inputQueue); - taosArrayDestroy(((SStreamDataBlock*)qItem)->blocks); - taosFreeQitem(qItem); - } + cnt++; + streamQueueProcessSuccess(pTask->inputQueue); + taosArrayDestroy(((SStreamDataBlock*)qItem)->blocks); + taosFreeQitem(qItem); } } - if (data == NULL) break; + } + if (pTask->taskStatus == TASK_STATUS__DROPPING) { + if (data) streamFreeQitem(data); + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); + return NULL; + } - qDebug("stream task %d exec begin, batch msg: %d", pTask->taskId, cnt); - streamTaskExecImpl(pTask, data, pRes); - qDebug("stream task %d exec end", pTask->taskId); + if (data == NULL) return pRes; - if (pTask->taskStatus == TASK_STATUS__DROPPING) { - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); + qDebug("stream task %d exec begin, msg batch: %d", pTask->taskId, cnt); + streamTaskExecImpl(pTask, data, pRes); + qDebug("stream task %d exec end", pTask->taskId); + + if (taosArrayGetSize(pRes) != 0) { + SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); + if (qRes == NULL) { + streamQueueProcessFail(pTask->inputQueue); + taosArrayDestroy(pRes); return NULL; } - - if (taosArrayGetSize(pRes) != 0) { - SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM); - if (qRes == NULL) { - streamQueueProcessFail(pTask->inputQueue); - taosArrayDestroy(pRes); - return NULL; - } - qRes->type = STREAM_INPUT__DATA_BLOCK; - qRes->blocks = pRes; - if (streamTaskOutput(pTask, qRes) < 0) { - /*streamQueueProcessFail(pTask->inputQueue);*/ - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); - taosFreeQitem(qRes); - return NULL; - } - /*streamQueueProcessSuccess(pTask->inputQueue);*/ - pRes = taosArrayInit(0, sizeof(SSDataBlock)); + qRes->type = STREAM_INPUT__DATA_BLOCK; + qRes->blocks = pRes; + if (streamTaskOutput(pTask, qRes) < 0) { + /*streamQueueProcessFail(pTask->inputQueue);*/ + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); + taosFreeQitem(qRes); + return NULL; } - - streamFreeQitem(data); + /*streamQueueProcessSuccess(pTask->inputQueue);*/ + pRes = taosArrayInit(0, sizeof(SSDataBlock)); } + + streamFreeQitem(data); return pRes; } @@ -155,7 +154,7 @@ int32_t streamExec(SStreamTask* pTask, SMsgCb* pMsgCb) { pRes = streamExecForQall(pTask, pRes); if (pRes == NULL) goto FAIL; - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); atomic_store_8(&pTask->execStatus, TASK_EXEC_STATUS__IDLE); qDebug("stream exec, return result"); return 0; @@ -163,7 +162,7 @@ int32_t streamExec(SStreamTask* pTask, SMsgCb* pMsgCb) { continue; } else if (execStatus == TASK_EXEC_STATUS__EXECUTING) { ASSERT(taosArrayGetSize(pRes) == 0); - taosArrayDestroyEx(pRes, (FDelete)tDeleteSSDataBlock); + taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes); return 0; } else { ASSERT(0); @@ -171,6 +170,11 @@ int32_t streamExec(SStreamTask* pTask, SMsgCb* pMsgCb) { } FAIL: if (pRes) taosArrayDestroy(pRes); - atomic_store_8(&pTask->execStatus, TASK_EXEC_STATUS__IDLE); - return -1; + if (pTask->taskStatus == TASK_STATUS__DROPPING) { + tFreeSStreamTask(pTask); + return 0; + } else { + atomic_store_8(&pTask->execStatus, TASK_EXEC_STATUS__IDLE); + return -1; + } } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 97aa182dc9..7488c009bd 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -163,6 +163,6 @@ void tFreeSStreamTask(SStreamTask* pTask) { streamQueueClose(pTask->inputQueue); streamQueueClose(pTask->outputQueue); if (pTask->exec.qmsg) taosMemoryFree(pTask->exec.qmsg); - qDestroyTask(pTask->exec.executor); + if (pTask->exec.executor) qDestroyTask(pTask->exec.executor); taosMemoryFree(pTask); } diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index a38b14a52d..96723978ae 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -382,7 +382,7 @@ class TDDnode: if self.valgrind == 0: if platform.system().lower() == 'windows': - cmd = "mintty -h never -w hide %s -c %s" % ( + cmd = "mintty -h never %s -c %s" % ( binPath, self.cfgDir) else: cmd = "nohup %s -c %s > /dev/null 2>&1 & " % ( @@ -391,7 +391,7 @@ class TDDnode: valgrindCmdline = "valgrind --log-file=\"%s/../log/valgrind.log\" --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"%self.cfgDir if platform.system().lower() == 'windows': - cmd = "mintty -h never -w hide %s %s -c %s" % ( + cmd = "mintty -h never %s %s -c %s" % ( valgrindCmdline, binPath, self.cfgDir) else: cmd = "nohup %s %s -c %s 2>&1 & " % ( @@ -518,20 +518,20 @@ class TDDnode: if self.running != 0: if platform.system().lower() == 'windows': - os.system("wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId | xargs echo | awk '{print $2}' | xargs taskkill -f -pid"%self.index) + psCmd = "for /f %a in ('wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId ^| xargs echo ^| awk ^'{print $2}^'') do @(ps | grep %a | awk '{print $1}' | xargs kill -INT )" % (self.index) else: psCmd = "ps -ef|grep -w %s| grep dnode%d|grep -v grep | awk '{print $2}'" % (toBeKilled,self.index) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") + + while(processID): + killCmd = "kill -INT %s > /dev/null 2>&1" % processID + os.system(killCmd) + time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") - - while(processID): - killCmd = "kill -INT %s > /dev/null 2>&1" % processID - os.system(killCmd) - time.sleep(1) - processID = subprocess.check_output( - psCmd, shell=True).decode("utf-8") - if self.valgrind: - time.sleep(2) + if self.valgrind: + time.sleep(2) self.running = 0 tdLog.debug("dnode:%d is stopped by kill -INT" % (self.index)) diff --git a/tests/script/general/connection/connection.sim b/tests/script/general/connection/connection.sim deleted file mode 100644 index 1af6e1fda6..0000000000 --- a/tests/script/general/connection/connection.sim +++ /dev/null @@ -1,21 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============= step1 -sql close -print close1 -sql connect - -print ============= step2 -sql close -sql connect - -print ============= step3 -sql close -sql connect - -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/connection/mqtt.sim b/tests/script/general/connection/mqtt.sim deleted file mode 100644 index c2c50ef17e..0000000000 --- a/tests/script/general/connection/mqtt.sim +++ /dev/null @@ -1,19 +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/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 100000 -system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c mqtt -v 1 - -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect -sql create database mqttdb; -sql create table mqttdb.devices(ts timestamp, value double) tags(name binary(32), model binary(32), serial binary(16), param binary(16), unit binary(16)); - -sleep 1000 -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/connection/sim.tar.gz b/tests/script/general/connection/sim.tar.gz deleted file mode 100644 index 10bc1a6bac..0000000000 Binary files a/tests/script/general/connection/sim.tar.gz and /dev/null differ diff --git a/tests/script/general/connection/test_old_data.sim b/tests/script/general/connection/test_old_data.sim deleted file mode 100644 index 83df850f0b..0000000000 --- a/tests/script/general/connection/test_old_data.sim +++ /dev/null @@ -1,32 +0,0 @@ -system sh/stop_dnodes.sh -system sh/mv_old_data.sh - -print ============== deploy - -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -print =============== step1 - -sql use test -sql select * from m1 - -print $rows points data are retrieved -if $rows != 7 then - return -1 -endi - -print =============== step 2 - -sql select * from t1 - -print $rows points data are retrieved -if $rows != 7 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/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim deleted file mode 100644 index 89a32b5a5c..0000000000 --- a/tests/script/general/db/alter_option.sim +++ /dev/null @@ -1,263 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 0 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 - -system sh/exec.sh -n dnode1 -s start - -sleep 2000 -sql connect - -print ============= create database -sql create database db cache 2 blocks 4 duration 10 keep 20 minRows 300 maxRows 400 ctime 120 precision 'ms' comp 2 wal 1 replica 1 -sql show databases -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 != 10 then - return -1 -endi -if $data07 != 20,20,20 then - return -1 -endi -if $data08 != 2 then - return -1 -endi -if $data09 != 4 then - return -1 -endi - -print ============== step name -sql_error alter database db name d1 -sql_error alter database db name d2 - -print ============== step ntables -sql_error alter database db ntables -1 -sql_error alter database db ntables 0 -sql_error alter database db ntables 1 -sql_error alter database db ntables 10 - -print ============== step vgroups -sql_error alter database db vgroups -1 -sql_error alter database db vgroups 0 -sql_error alter database db vgroups 1 -sql_error alter database db vgroups 10 - -print ============== step replica -sql_error alter database db replica 2 -sql_error alter database db replica 3 -sql_error alter database db replica 0 - -sql alter database db replica 1 -sql show databases -print replica $data4_db -if $data4_db != 1 then - return -1 -endi - -print ============== step quorum -sql show databases -print quorum $data5_db -if $data5_db != 1 then - return -1 -endi - -sql alter database db quorum 1 -sql show databases -print quorum $data5_db -if $data5_db != 1 then - return -1 -endi - -sql_error alter database db quorum 2 - -sql_error alter database db quorum 3 - -sql_error alter database db quorum 0 -sql_error alter database db quorum 4 -sql_error alter database db quorum 5 -sql_error alter database db quorum -1 - -print ============== step duration -sql_error alter database db duration 0 -sql_error alter database db duration 1 -sql_error alter database db duration 2 -sql_error alter database db duration 10 -sql_error alter database db duration 50 -sql_error alter database db duration 100 - -print ============== step keep -sql show databases -print keep $data7_db -if $data7_db != 20,20,20 then - return -1 -endi - -sql alter database db keep 20 -sql show databases -print keep $data7_db -if $data7_db != 20,20,20 then - return -1 -endi - -sql alter database db keep 30 -sql show databases -print keep $data7_db -if $data7_db != 30,30,30 then - return -1 -endi - -sql alter database db keep 40 -sql show databases -print keep $data7_db -if $data7_db != 40,40,40 then - return -1 -endi - -sql alter database db keep 40,50 -sql alter database db keep 30,31 -sql alter database db keep 20 -sql_error alter database db keep 10.0 -sql_error alter database db keep 9 -sql_error alter database db keep 1 -sql_error alter database db keep 0 -sql_error alter database db keep -1 -sql_error alter database db keep 365001 - -print ============== step cache -sql_error alter database db cache 60 -sql_error alter database db cache 50 -sql_error alter database db cache 20 -sql_error alter database db cache 3 -sql_error alter database db cache 129 -sql_error alter database db cache 300 -sql_error alter database db cache 0 -sql_error alter database db cache -1 - -print ============== step blocks -sql show databases -print blocks $data9_db -if $data9_db != 4 then - return -1 -endi - -sql alter database db blocks 10 -sql show databases -print blocks $data9_db -if $data9_db != 10 then - return -1 -endi - -sql alter database db blocks 20 -sql show databases -print blocks $data9_db -if $data9_db != 20 then - return -1 -endi - -sql alter database db blocks 30 -sql show databases -print blocks $data9_db -if $data9_db != 30 then - return -1 -endi - -sql alter database db blocks 40 -sql alter database db blocks 30 -sql alter database db blocks 20 -sql alter database db blocks 10 -sql_error alter database db blocks 2 -sql_error alter database db blocks 1 -sql_error alter database db blocks 0 -sql_error alter database db blocks -1 -sql_error alter database db blocks 10001 - -print ============== step minrows -sql_error alter database db minrows 1 -sql_error alter database db minrows 100 -sql_error alter database db minrows 1000 - -print ============== step maxrows -sql_error alter database db maxrows 1 -sql_error alter database db maxrows 100 -sql_error alter database db maxrows 1000 - -print ============== step wallevel -sql show databases -print wallevel $data12_db -if $data12_db != 1 then - return -1 -endi - -sql_error alter database db wal 1 - - -sql_error alter database db wal 1 -sql_error alter database db wal 2 -sql_error alter database db wal 1 -sql_error alter database db wal 2 -sql_error alter database db wal 0 -sql_error alter database db wal 3 -sql_error alter database db wal 4 -sql_error alter database db wal -1 -sql_error alter database db wal 1000 - -print ============== step fsync -sql_error alter database db fsync 0 -sql_error alter database db fsync 1 -sql_error alter database db fsync 3600 -sql_error alter database db fsync 18000 -sql_error alter database db fsync 180000 -sql_error alter database db fsync 180001 -sql_error alter database db fsync -1 - -print ============== step comp -sql show databases -print comp $data14_db -if $data14_db != 2 then - return -1 -endi - -sql alter database db comp 1 -sql show databases -print comp $data14_db -if $data14_db != 1 then - return -1 -endi - -sql alter database db comp 2 -sql show databases -print comp $data14_db -if $data14_db != 2 then - return -1 -endi - -sql alter database db comp 0 -sql show databases -print comp $data14_db -if $data14_db != 0 then - return -1 -endi - -sql_error alter database db comp 3 -sql_error alter database db comp 4 -sql_error alter database db comp 5 -sql_error alter database db comp -1 - - -print ============== step precision -sql_error alter database db prec 'us' - -print ============== step status -sql_error alter database db status 'delete' - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/db/back_insert.sim b/tests/script/general/db/back_insert.sim deleted file mode 100644 index 642df63ff2..0000000000 --- a/tests/script/general/db/back_insert.sim +++ /dev/null @@ -1,9 +0,0 @@ -sql connect -$x = 1 -begin: - sql reset query cache - sleep 1000 - sql insert into db.tb values(now, $x ) -x begin - #print ===> insert successed $x - $x = $x + 1 -goto begin \ No newline at end of file diff --git a/tests/script/general/insert/testSuite.sim b/tests/script/general/insert/testSuite.sim deleted file mode 100644 index da44167be5..0000000000 --- a/tests/script/general/insert/testSuite.sim +++ /dev/null @@ -1,9 +0,0 @@ -run general/insert/basic.sim -run general/insert/insert_drop.sim -run general/insert/query_block1_memory.sim -run general/insert/query_block2_memory.sim -run general/insert/query_block1_file.sim -run general/insert/query_block2_file.sim -run general/insert/query_file_memory.sim -run general/insert/query_multi_file.sim -run general/insert/tcp.sim diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim deleted file mode 100644 index fcd9d49fe5..0000000000 --- a/tests/script/general/parser/testSuite.sim +++ /dev/null @@ -1,68 +0,0 @@ -run general/parser/alter.sim -run general/parser/alter1.sim -run general/parser/alter_stable.sim -run general/parser/auto_create_tb.sim -run general/parser/auto_create_tb_drop_tb.sim -run general/parser/col_arithmetic_operation.sim -run general/parser/columnValue.sim -run general/parser/commit.sim -run general/parser/create_db.sim -run general/parser/create_mt.sim -run general/parser/create_tb.sim -run general/parser/dbtbnameValidate.sim -run general/parser/fill.sim -run general/parser/fill_stb.sim -#run general/parser/fill_us.sim # -run general/parser/first_last.sim -run general/parser/import_commit1.sim -run general/parser/import_commit2.sim -run general/parser/import_commit3.sim -run general/parser/import_file.sim -run general/parser/insert_tb.sim -run general/parser/tags_dynamically_specifiy.sim -run general/parser/interp.sim -run general/parser/lastrow.sim -run general/parser/limit.sim -run general/parser/limit1.sim -run general/parser/limit1_tblocks100.sim -run general/parser/limit2.sim -run general/parser/mixed_blocks.sim -run general/parser/nchar.sim -run general/parser/null_char.sim -run general/parser/selectResNum.sim -run general/parser/select_across_vnodes.sim -run general/parser/select_from_cache_disk.sim -run general/parser/set_tag_vals.sim -run general/parser/single_row_in_tb.sim -run general/parser/slimit.sim -run general/parser/slimit1.sim -run general/parser/slimit_alter_tags.sim -run general/parser/tbnameIn.sim -run general/parser/join.sim -run general/parser/join_multivnode.sim -run general/parser/join_manyblocks.sim -run general/parser/projection_limit_offset.sim -run general/parser/select_with_tags.sim -run general/parser/select_distinct_tag.sim -run general/parser/groupby.sim -run general/parser/tags_filter.sim -run general/parser/topbot.sim -run general/parser/union.sim -run general/parser/constCol.sim -run general/parser/where.sim -run general/parser/timestamp.sim -run general/parser/sliding.sim -run general/parser/function.sim -run general/parser/stableOp.sim -run general/parser/having.sim -run general/parser/having_child.sim -run general/parser/slimit_alter_tags.sim -run general/parser/binary_escapeCharacter.sim -run general/parser/between_and.sim -run general/parser/last_cache.sim -run general/parser/slimit_alter_tags.sim -run general/parser/udf.sim -run general/parser/udf_dll.sim -run general/parser/udf_dll_stable.sim -run general/parser/nestquery.sim -run general/parser/precision_ns.sim diff --git a/tests/script/general/rm_bak/tag/testSuite.sim b/tests/script/general/rm_bak/tag/testSuite.sim deleted file mode 100644 index 45356efac1..0000000000 --- a/tests/script/general/rm_bak/tag/testSuite.sim +++ /dev/null @@ -1,25 +0,0 @@ -run general/tag/3.sim -run general/tag/4.sim -run general/tag/5.sim -run general/tag/6.sim -run general/tag/add.sim -run general/tag/bigint.sim -run general/tag/binary_binary.sim -run general/tag/binary.sim -run general/tag/bool_binary.sim -run general/tag/bool_int.sim -run general/tag/bool.sim -run general/tag/change.sim -run general/tag/column.sim -run general/tag/commit.sim -run general/tag/create.sim -run general/tag/delete.sim -run general/tag/double.sim -run general/tag/filter.sim -run general/tag/float.sim -run general/tag/int_binary.sim -run general/tag/int_float.sim -run general/tag/int.sim -run general/tag/set.sim -run general/tag/smallint.sim -run general/tag/tinyint.sim diff --git a/tests/script/general/table/testSuite.sim b/tests/script/general/table/testSuite.sim deleted file mode 100644 index d6cc88b36a..0000000000 --- a/tests/script/general/table/testSuite.sim +++ /dev/null @@ -1,27 +0,0 @@ -run general/table/autocreate.sim -run general/table/basic1.sim -run general/table/basic2.sim -run general/table/basic3.sim -run general/table/bigint.sim -run general/table/binary.sim -run general/table/bool.sim -run general/table/column_name.sim -run general/table/column_num.sim -run general/table/column_value.sim -run general/table/column2.sim -run general/table/date.sim -run general/table/db.table.sim -run general/table/delete_reuse1.sim -run general/table/delete_reuse2.sim -run general/table/delete_writing.sim -run general/table/describe.sim -run general/table/double.sim -run general/table/fill.sim -run general/table/float.sim -run general/table/int.sim -run general/table/limit.sim -run general/table/smallint.sim -run general/table/table_len.sim -run general/table/table.sim -run general/table/tinyint.sim -run general/table/vgroup.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 3fa0df5a7d..c2c102c241 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -11,17 +11,41 @@ ./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_tables_d2.sim +#./test.sh -f tsim/db/alter_tables_v1.sim +#./test.sh -f tsim/db/alter_tables_v4.sim +#./test.sh -f tsim/db/alter_vgroups.sim ./test.sh -f tsim/db/basic1.sim ./test.sh -f tsim/db/basic2.sim ./test.sh -f tsim/db/basic3.sim +#./test.sh -f tsim/db/basic4.sim +#./test.sh -f tsim/db/basic5.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_reuse1.sim +#./test.sh -f tsim/db/delete_reuse2.sim +#./test.sh -f tsim/db/delete_reusevnode.sim +#./test.sh -f tsim/db/delete_reusevnode2.sim +#./test.sh -f tsim/db/delete_writing1.sim +#./test.sh -f tsim/db/delete_writing2.sim #./test.sh -f tsim/db/delete.sim +#./test.sh -f tsim/db/delete2.sim +#./test.sh -f tsim/db/dropvnodes.sim ./test.sh -f tsim/db/error1.sim +#./test.sh -f tsim/db/keep.sim +#./test.sh -f tsim/db/len.sim +#./test.sh -f tsim/db/nosuchfile.sim +#./test.sh -f tsim/db/repeat.sim +#./test.sh -f tsim/db/show_create_db.sim +#./test.sh -f tsim/db/show_create_table.sim +#./test.sh -f tsim/db/tables.sim ./test.sh -f tsim/db/taosdlog.sim +#./test.sh -f tsim/db/topic1.sim +#./test.sh -f tsim/db/topic2.sim +#./test.sh -f tsim/db/vnodes.sim # ---- dnode # ./test.sh -f tsim/dnode/balance_replica1.sim @@ -52,17 +76,132 @@ ./test.sh -f tsim/import/replica1.sim # ---- insert +./test.sh -f tsim/insert/backquote.sim +./test.sh -f tsim/insert/basic.sim ./test.sh -f tsim/insert/basic0.sim ./test.sh -f tsim/insert/basic1.sim -./test.sh -f tsim/insert/backquote.sim -./test.sh -f tsim/insert/null.sim -./test.sh -f tsim/insert/update0.sim ./test.sh -f tsim/insert/commit-merge0.sim +./test.sh -f tsim/insert/insert_drop.sim ./test.sh -f tsim/insert/insert_select.sim +./test.sh -f tsim/insert/null.sim +./test.sh -f tsim/insert/query_block1_file.sim +./test.sh -f tsim/insert/query_block1_memory.sim +./test.sh -f tsim/insert/query_block2_file.sim +./test.sh -f tsim/insert/query_block2_memory.sim +./test.sh -f tsim/insert/query_file_memory.sim +./test.sh -f tsim/insert/query_multi_file.sim +#./test.sh -f tsim/insert/tcp.sim +./test.sh -f tsim/insert/update0.sim # ---- parser -./test.sh -f tsim/parser/groupby-basic.sim +# ./test.sh -f tsim/parser/alter.sim +# ./test.sh -f tsim/parser/alter1.sim +## ./test.sh -f tsim/parser/alter__for_community_version.sim +## ./test.sh -f tsim/parser/alter_column.sim +# ./test.sh -f tsim/parser/alter_stable.sim +# ./test.sh -f tsim/parser/auto_create_tb.sim +# ./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim +# ./test.sh -f tsim/parser/between_and.sim +# ./test.sh -f tsim/parser/binary_escapeCharacter.sim +# ./test.sh -f tsim/parser/col_arithmetic_operation.sim +## ./test.sh -f tsim/parser/col_arithmetic_query.sim +## ./test.sh -f tsim/parser/columnValue.sim +## ./test.sh -f tsim/parser/columnValue_bigint.sim +## ./test.sh -f tsim/parser/columnValue_bool.sim +## ./test.sh -f tsim/parser/columnValue_double.sim +## ./test.sh -f tsim/parser/columnValue_float.sim +## ./test.sh -f tsim/parser/columnValue_int.sim +## ./test.sh -f tsim/parser/columnValue_smallint.sim +## ./test.sh -f tsim/parser/columnValue_tinyint.sim +## ./test.sh -f tsim/parser/columnValue_unsign.sim +## ./test.sh -f tsim/parser/commit.sim +## ./test.sh -f tsim/parser/condition.sim +## ./test.sh -f tsim/parser/condition_query.sim +## ./test.sh -f tsim/parser/constCol.sim +# ./test.sh -f tsim/parser/create_db.sim +## ./test.sh -f tsim/parser/create_db__for_community_version.sim +# ./test.sh -f tsim/parser/create_mt.sim +# ./test.sh -f tsim/parser/create_tb.sim +## ./test.sh -f tsim/parser/create_tb_with_tag_name.sim +# ./test.sh -f tsim/parser/dbtbnameValidate.sim +##./test.sh -f tsim/parser/distinct.sim +# ./test.sh -f tsim/parser/fill.sim +# ./test.sh -f tsim/parser/fill_stb.sim +## ./test.sh -f tsim/parser/fill_us.sim +# ./test.sh -f tsim/parser/first_last.sim +## ./test.sh -f tsim/parser/first_last_query.sim ./test.sh -f tsim/parser/fourArithmetic-basic.sim +## ./test.sh -f tsim/parser/function.sim +./test.sh -f tsim/parser/groupby-basic.sim +# ./test.sh -f tsim/parser/groupby.sim +## ./test.sh -f tsim/parser/having.sim +# ./test.sh -f tsim/parser/having_child.sim +## ./test.sh -f tsim/parser/import.sim +# ./test.sh -f tsim/parser/import_commit1.sim +# ./test.sh -f tsim/parser/import_commit2.sim +# ./test.sh -f tsim/parser/import_commit3.sim +## ./test.sh -f tsim/parser/import_file.sim +## ./test.sh -f tsim/parser/insert_multiTbl.sim +# ./test.sh -f tsim/parser/insert_tb.sim +## ./test.sh -f tsim/parser/interp.sim +## ./test.sh -f tsim/parser/interp_test.sim +# ./test.sh -f tsim/parser/join.sim +# ./test.sh -f tsim/parser/join_manyblocks.sim +## ./test.sh -f tsim/parser/join_multitables.sim +# ./test.sh -f tsim/parser/join_multivnode.sim +# ./test.sh -f tsim/parser/last_cache.sim +## ./test.sh -f tsim/parser/last_cache_query.sim +## ./test.sh -f tsim/parser/last_groupby.sim +# ./test.sh -f tsim/parser/lastrow.sim +## ./test.sh -f tsim/parser/lastrow_query.sim +## ./test.sh -f tsim/parser/like.sim +# ./test.sh -f tsim/parser/limit.sim +# ./test.sh -f tsim/parser/limit1.sim +## ./test.sh -f tsim/parser/limit1_stb.sim +## ./test.sh -f tsim/parser/limit1_tb.sim +# ./test.sh -f tsim/parser/limit1_tblocks100.sim +## ./test.sh -f tsim/parser/limit2.sim +## ./test.sh -f tsim/parser/limit2_query.sim +## ./test.sh -f tsim/parser/limit2_tblocks100.sim +## ./test.sh -f tsim/parser/limit_stb.sim +## ./test.sh -f tsim/parser/limit_tb.sim +## ./test.sh -f tsim/parser/line_insert.sim +# ./test.sh -f tsim/parser/mixed_blocks.sim +# ./test.sh -f tsim/parser/nchar.sim +# ./test.sh -f tsim/parser/nestquery.sim +# ./test.sh -f tsim/parser/null_char.sim +## ./test.sh -f tsim/parser/precision_ns.sim +# ./test.sh -f tsim/parser/projection_limit_offset.sim +## ./test.sh -f tsim/parser/regex.sim +# ./test.sh -f tsim/parser/repeatAlter.sim +# ./test.sh -f tsim/parser/selectResNum.sim +# ./test.sh -f tsim/parser/select_across_vnodes.sim +# ./test.sh -f tsim/parser/select_distinct_tag.sim +# ./test.sh -f tsim/parser/select_from_cache_disk.sim +# ./test.sh -f tsim/parser/select_with_tags.sim +# ./test.sh -f tsim/parser/set_tag_vals.sim +# ./test.sh -f tsim/parser/single_row_in_tb.sim +## ./test.sh -f tsim/parser/single_row_in_tb_query.sim +# ./test.sh -f tsim/parser/sliding.sim +# ./test.sh -f tsim/parser/slimit.sim +# ./test.sh -f tsim/parser/slimit1.sim +## ./test.sh -f tsim/parser/slimit1_query.sim +# ./test.sh -f tsim/parser/slimit_alter_tags.sim +## ./test.sh -f tsim/parser/slimit_query.sim +# ./test.sh -f tsim/parser/stableOp.sim +# ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim +# ./test.sh -f tsim/parser/tags_filter.sim +# ./test.sh -f tsim/parser/tbnameIn.sim +## ./test.sh -f tsim/parser/tbnameIn_query.sim +# ./test.sh -f tsim/parser/timestamp.sim +## ./test.sh -f tsim/parser/timestamp_query.sim +## ./test.sh -f tsim/parser/top_groupby.sim +# ./test.sh -f tsim/parser/topbot.sim +# ./test.sh -f tsim/parser/udf.sim +# ./test.sh -f tsim/parser/udf_dll.sim +# ./test.sh -f tsim/parser/udf_dll_stable.sim +# ./test.sh -f tsim/parser/union.sim +# ./test.sh -f tsim/parser/where.sim # ---- query ./test.sh -f tsim/query/interval.sim @@ -94,7 +233,33 @@ ./test.sh -f tsim/show/basic.sim # ---- table +./test.sh -f tsim/table/autocreate.sim ./test.sh -f tsim/table/basic1.sim +./test.sh -f tsim/table/basic2.sim +./test.sh -f tsim/table/basic3.sim +./test.sh -f tsim/table/bigint.sim +./test.sh -f tsim/table/binary.sim +./test.sh -f tsim/table/bool.sim +./test.sh -f tsim/table/column_name.sim +./test.sh -f tsim/table/column_num.sim +./test.sh -f tsim/table/column_value.sim +./test.sh -f tsim/table/column2.sim +./test.sh -f tsim/table/createmulti.sim +./test.sh -f tsim/table/date.sim +./test.sh -f tsim/table/db.table.sim +# ./test.sh -f tsim/table/delete_reuse1.sim +# ./test.sh -f tsim/table/delete_reuse2.sim +# ./test.sh -f tsim/table/delete_writing.sim +./test.sh -f tsim/table/describe.sim +./test.sh -f tsim/table/double.sim +./test.sh -f tsim/table/float.sim +./test.sh -f tsim/table/int.sim +./test.sh -f tsim/table/limit.sim +./test.sh -f tsim/table/smallint.sim +./test.sh -f tsim/table/table_len.sim +./test.sh -f tsim/table/table.sim +./test.sh -f tsim/table/tinyint.sim +./test.sh -f tsim/table/vgroup.sim # ---- stream ./test.sh -f tsim/stream/basic0.sim @@ -161,7 +326,7 @@ ./test.sh -f tsim/db/basic3.sim -m ./test.sh -f tsim/db/error1.sim -m ./test.sh -f tsim/insert/backquote.sim -m -./test.sh -f tsim/parser/fourArithmetic-basic.sim -m +# ./test.sh -f tsim/parser/fourArithmetic-basic.sim -m ./test.sh -f tsim/query/interval-offset.sim -m ./test.sh -f tsim/tmq/basic3.sim -m ./test.sh -f tsim/stable/vnode3.sim -m @@ -209,7 +374,7 @@ # ---- alter ./test.sh -f tsim/alter/cached_schema_after_alter.sim ./test.sh -f tsim/alter/dnode.sim -#./test.sh -f tsim/alter/table.sim +./test.sh -f tsim/alter/table.sim # ---- cache ./test.sh -f tsim/cache/new_metrics.sim @@ -228,23 +393,23 @@ ./test.sh -f tsim/compress/uncompress.sim # ---- compute -#./test.sh -f tsim/compute/avg.sim +./test.sh -f tsim/compute/avg.sim #./test.sh -f tsim/compute/block_dist.sim -#./test.sh -f tsim/compute/bottom.sim -#./test.sh -f tsim/compute/count.sim -#./test.sh -f tsim/compute/diff.sim -#./test.sh -f tsim/compute/diff2.sim -#./test.sh -f tsim/compute/first.sim -#./test.sh -f tsim/compute/interval.sim +./test.sh -f tsim/compute/bottom.sim +./test.sh -f tsim/compute/count.sim +./test.sh -f tsim/compute/diff.sim +./test.sh -f tsim/compute/diff2.sim +./test.sh -f tsim/compute/first.sim +./test.sh -f tsim/compute/interval.sim #./test.sh -f tsim/compute/last_row.sim -#./test.sh -f tsim/compute/last.sim -#./test.sh -f tsim/compute/leastsquare.sim -#./test.sh -f tsim/compute/max.sim -#./test.sh -f tsim/compute/min.sim +./test.sh -f tsim/compute/last.sim +./test.sh -f tsim/compute/leastsquare.sim +./test.sh -f tsim/compute/max.sim +./test.sh -f tsim/compute/min.sim #./test.sh -f tsim/compute/null.sim ./test.sh -f tsim/compute/percentile.sim ./test.sh -f tsim/compute/stddev.sim -#./test.sh -f tsim/compute/sum.sim +./test.sh -f tsim/compute/sum.sim ./test.sh -f tsim/compute/top.sim # ---- field @@ -280,4 +445,38 @@ # ---- wal ./test.sh -f tsim/wal/kill.sim +# ---- issue +#./test.sh -f tsim/issue/TD-2677.sim +#./test.sh -f tsim/issue/TD-2680.sim +#./test.sh -f tsim/issue/TD-2713.sim +#./test.sh -f tsim/issue/TD-3300.sim + +# ---- tag +./test.sh -f tsim/tag/3.sim +./test.sh -f tsim/tag/4.sim +./test.sh -f tsim/tag/5.sim +#./test.sh -f tsim/tag/6.sim +#./test.sh -f tsim/tag/add.sim +./test.sh -f tsim/tag/bigint.sim +./test.sh -f tsim/tag/binary_binary.sim +./test.sh -f tsim/tag/binary.sim +./test.sh -f tsim/tag/bool_binary.sim +./test.sh -f tsim/tag/bool_int.sim +./test.sh -f tsim/tag/bool.sim +#./test.sh -f tsim/tag/change.sim +#./test.sh -f tsim/tag/column.sim +#./test.sh -f tsim/tag/commit.sim +#./test.sh -f tsim/tag/create.sim +#./test.sh -f tsim/tag/delete.sim +#./test.sh -f tsim/tag/double.sim +#./test.sh -f tsim/tag/filter.sim +#./test.sh -f tsim/tag/float.sim +./test.sh -f tsim/tag/int_binary.sim +./test.sh -f tsim/tag/int_float.sim +./test.sh -f tsim/tag/int.sim +#./test.sh -f tsim/tag/set.sim +./test.sh -f tsim/tag/smallint.sim +./test.sh -f tsim/tag/tinyint.sim + + #======================b1-end=============== diff --git a/tests/script/sh/exec.bat b/tests/script/sh/exec.bat index e4c998c25b..88dd43349e 100644 --- a/tests/script/sh/exec.bat +++ b/tests/script/sh/exec.bat @@ -77,7 +77,10 @@ goto :eof :check_offline sleep 1 for /f "tokens=2" %%C in ('wmic process where "name='taosd.exe' and CommandLine like '%%%NODE_NAME%%%'" get processId ^| xargs echo') do ( - echo check taosd offline - goto :check_offline + for /f "tokens=1" %%D in ('ps ^| grep %%C') do ( + echo kill -INT %%D + echo check taosd offline %NODE_NAME% %%C %%D + goto :check_offline + ) ) goto :eof \ No newline at end of file diff --git a/tests/script/test-all.bat b/tests/script/test-all.bat index f771f8fcb6..056d989e6b 100644 --- a/tests/script/test-all.bat +++ b/tests/script/test-all.bat @@ -24,7 +24,7 @@ for /F "usebackq tokens=*" %%i in (!caseFile!) do ( ) ) ) -exit !exitNum! +exit /b !exitNum! :colorEcho set timeNow=%time% diff --git a/tests/script/tsim/alter/table.sim b/tests/script/tsim/alter/table.sim index cc995d171f..348bef21fe 100644 --- a/tests/script/tsim/alter/table.sim +++ b/tests/script/tsim/alter/table.sim @@ -660,8 +660,8 @@ endi print ======= over sql drop database d1 sql show databases -if $rows != 0 then +if $rows != 2 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 diff --git a/tests/script/tsim/cache/new_metrics.sim b/tests/script/tsim/cache/new_metrics.sim index af7db90070..82d7d43e0f 100644 --- a/tests/script/tsim/cache/new_metrics.sim +++ b/tests/script/tsim/cache/new_metrics.sim @@ -83,10 +83,6 @@ while $i < 10 $i = $i + 1 endw -print ==> sleep 1 seconds to renew cache -sql reset query cache -sleep 1000 - print =============== step5 sql select * from $tb order by ts desc print ===>rows $rows, data $data01 diff --git a/tests/script/tsim/cache/restart_metrics.sim b/tests/script/tsim/cache/restart_metrics.sim index e144a49bf7..e346357633 100644 --- a/tests/script/tsim/cache/restart_metrics.sim +++ b/tests/script/tsim/cache/restart_metrics.sim @@ -48,9 +48,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start print =============== step3 -print ==> sleep 1 seconds to renew cache sql reset query cache -sleep 1000 print =============== step4 sql create database $db diff --git a/tests/script/tsim/cache/restart_table.sim b/tests/script/tsim/cache/restart_table.sim index b450f6c654..d28ef51419 100644 --- a/tests/script/tsim/cache/restart_table.sim +++ b/tests/script/tsim/cache/restart_table.sim @@ -32,9 +32,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start print =============== step3 -print ==> sleep 1 seconds to renew cache sql reset query cache -sleep 1000 print =============== step4 sql create database $db diff --git a/tests/script/tsim/compress/commitlog.sim b/tests/script/tsim/compress/commitlog.sim index d90780bd6c..bc9c231a9e 100644 --- a/tests/script/tsim/compress/commitlog.sim +++ b/tests/script/tsim/compress/commitlog.sim @@ -57,15 +57,7 @@ $tb = $tbPrefix . $i sql create database $db sql use $db - -$x = 0 -step3: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi -sql create table $tb (ts timestamp, b bool, t tinyint, s smallint, i int, big bigint, f float, d double, str binary(256)) -x step3 +sql create table $tb (ts timestamp, b bool, t tinyint, s smallint, i int, big bigint, f float, d double, str binary(256)) $count = 0 while $count < $N diff --git a/tests/script/tsim/compute/avg.sim b/tests/script/tsim/compute/avg.sim index 2805b65fff..c366de5f4c 100644 --- a/tests/script/tsim/compute/avg.sim +++ b/tests/script/tsim/compute/avg.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i @@ -69,13 +67,13 @@ endi print =============== step5 sql select avg(tbcol) as b from $tb interval(1m) print ===> $data01 -if $data11 != 1.000000000 then +if $data10 != 1.000000000 then return -1 endi sql select avg(tbcol) as b from $tb interval(1d) print ===> $data01 -if $data01 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi @@ -84,7 +82,7 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select avg(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data01 -if $data41 != 4.000000000 then +if $data40 != 4.000000000 then return -1 endi if $rows != 5 then @@ -123,14 +121,14 @@ endi print =============== step9 sql select avg(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1.000000000 then +print ===> $data10 +if $data10 != 1.000000000 then return -1 endi sql select avg(tbcol) as b from $mt interval(1d) print ===> $data01 -if $data01 != 9.500000000 then +if $data00 != 9.500000000 then return -1 endi @@ -148,9 +146,9 @@ endi print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql select avg(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1.000000000 then +sql select avg(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) +print ===> $data10 +if $data10 != 1.000000000 then return -1 endi if $rows != 50 then diff --git a/tests/script/tsim/compute/block_dist.sim b/tests/script/tsim/compute/block_dist.sim index 201d222af7..1583e838c6 100644 --- a/tests/script/tsim/compute/block_dist.sim +++ b/tests/script/tsim/compute/block_dist.sim @@ -47,8 +47,6 @@ while $x < $rowNum $x = $x + 1 endw -sleep 100 - print =============== step2 $i = 0 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/compute/bottom.sim b/tests/script/tsim/compute/bottom.sim index cfac02d6d5..a17584734b 100644 --- a/tests/script/tsim/compute/bottom.sim +++ b/tests/script/tsim/compute/bottom.sim @@ -38,15 +38,13 @@ while $i < $tbNum $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 +print ===> $data00 +if $data00 != 0 then return -1 endi @@ -54,25 +52,25 @@ print =============== step3 $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select bottom(tbcol, 1) from $tb where ts > $ms -print ===> $data01 -if $data01 != 5 then +print ===> $data00 +if $data00 != 5 then return -1 endi print =============== step4 sql select bottom(tbcol, 1) as b from $tb -print ===> $data01 -if $data01 != 0 then +print ===> $data00 +if $data00 != 0 then return -1 endi print =============== step5 sql select bottom(tbcol, 2) as b from $tb -print ===> $data01 $data11 -if $data01 != 0 then +print ===> $data00 $data10 +if $data00 != 1 then return -1 endi -if $data11 != 1 then +if $data10 != 0 then return -1 endi @@ -80,11 +78,11 @@ print =============== step6 $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select bottom(tbcol, 2) as b from $tb where ts > $ms -print ===> $data01 $data11 -if $data01 != 5 then +print ===> $data00 $data10 +if $data00 != 6 then return -1 endi -if $data11 != 6 then +if $data10 != 5 then return -1 endi diff --git a/tests/script/tsim/compute/count.sim b/tests/script/tsim/compute/count.sim index 0a6ce93077..cf2ad933bc 100644 --- a/tests/script/tsim/compute/count.sim +++ b/tests/script/tsim/compute/count.sim @@ -38,13 +38,10 @@ while $i < $tbNum $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 @@ -81,14 +78,14 @@ endi print =============== step5 sql select count(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 1 then +print ===> $data00 +if $data00 != 1 then return -1 endi sql select count(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != $rowNum then +print ===> $data00 +if $data00 != $rowNum then return -1 endi @@ -96,8 +93,8 @@ print =============== step6 $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select count(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data01 -if $data01 != 1 then +print ===> $data00 +if $data00 != 1 then return -1 endi if $rows != 5 then @@ -149,17 +146,17 @@ endi print =============== step9 sql select count(tbcol) as b from $mt interval(1m) -print ===> $data01 -if $data01 != 10 then +print ===> $data00 +if $data00 != 10 then return -1 endi -if $data11 != 10 then +if $data10 != 10 then return -1 endi sql select count(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 200 then +print ===> $data00 +if $data00 != 200 then return -1 endi @@ -177,9 +174,9 @@ endi print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql select count(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol +sql select count(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) print ===> $data01 -if $data01 != 1 then +if $data00 != 1 then return -1 endi if $rows != 50 then diff --git a/tests/script/tsim/compute/diff.sim b/tests/script/tsim/compute/diff.sim index ba4b32ddbb..6043f18b27 100644 --- a/tests/script/tsim/compute/diff.sim +++ b/tests/script/tsim/compute/diff.sim @@ -37,15 +37,13 @@ while $i < $tbNum $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 +print ===> $data10 +if $data10 != 1 then return -1 endi @@ -53,23 +51,23 @@ print =============== step3 $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select diff(tbcol) from $tb where ts > $ms -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select diff(tbcol) from $tb where ts <= $ms -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi print =============== step4 sql select diff(tbcol) as b from $tb -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi diff --git a/tests/script/tsim/compute/diff2.sim b/tests/script/tsim/compute/diff2.sim index 08b52cb37b..021fcf6e8b 100644 --- a/tests/script/tsim/compute/diff2.sim +++ b/tests/script/tsim/compute/diff2.sim @@ -1,5 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 131 system sh/exec.sh -n dnode1 -s start sql connect @@ -39,91 +40,90 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i sql select diff(c1) from $tb -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select diff(c2) from $tb -print ===> $data11 -if $data11 != 1.00000 then +print ===> $data10 +if $data10 != 1.000000000 then return -1 endi sql select diff(c3) from $tb -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select diff(c4) from $tb -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select diff(c5) from $tb -print ===> $data11 -if $data11 != 0 then +print ===> $data10 +if $data10 != 0 then return -1 endi sql select diff(c6) from $tb -print ===> $data11 -if $data11 != 1.000000000 then +print ===> $data10 +if $data10 != 1.000000000 then return -1 endi -sql_error select diff(c7) from $tb + +sql select diff(c7) from $tb sql_error select diff(c8) from $tb sql_error select diff(c9) from $tb sql_error select diff(ts) from $tb sql_error select diff(c1), diff(c2) from $tb -#sql_error select 2+diff(c1) from $tb -sql_error select diff(c1+2) from $tb + +sql select 2+diff(c1) from $tb +sql select diff(c1+2) from $tb sql_error select diff(c1) from $tb where ts > 0 and ts < now + 100m interval(10m) -sql_error select diff(c1) from $mt +sql select diff(c1) from $mt sql_error select diff(diff(c1)) from $tb sql_error select diff(c1) from m_di_tb1 where c2 like '2%' - print =============== step3 sql select diff(c1) from $tb where c1 > 5 -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select diff(c2) from $tb where c2 > 5 -print ===> $data11 -if $data11 != 1.00000 then +print ===> $data10 +if $data10 != 1.000000000 then return -1 endi sql select diff(c3) from $tb where c3 > 5 -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select diff(c4) from $tb where c4 > 5 -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select diff(c5) from $tb where c5 > 5 -print ===> $data11 -if $data11 != 0 then +print ===> $data10 +if $data10 != 0 then return -1 endi sql select diff(c6) from $tb where c6 > 5 -print ===> $data11 -if $data11 != 1.000000000 then +print ===> $data10 +if $data10 != 1.000000000 then return -1 endi print =============== step4 sql select diff(c1) from $tb where c1 > 5 and c2 < $rowNum -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi @@ -131,8 +131,8 @@ sql select diff(c1) from $tb where c9 like '%9' and c1 <= 20 if $rows != 1 then return -1 endi -print ===> $data11 -if $data01 != 10 then +print ===> $data10 +if $data00 != 10 then return -1 endi diff --git a/tests/script/tsim/compute/first.sim b/tests/script/tsim/compute/first.sim index cf1160dbdb..f8efeee513 100644 --- a/tests/script/tsim/compute/first.sim +++ b/tests/script/tsim/compute/first.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i @@ -68,14 +66,14 @@ endi print =============== step5 sql select first(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0 then +print ===> $data00 +if $data00 != 0 then return -1 endi sql select first(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 0 then +print ===> $data00 +if $data00 != 0 then return -1 endi @@ -83,8 +81,8 @@ print =============== step6 $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select first(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data01 -if $data41 != 4 then +print ===> $data00 +if $data40 != 4 then return -1 endi if $rows != 5 then @@ -124,14 +122,14 @@ 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 +print ===> $data10 +if $data10 != 1 then return -1 endi sql select first(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 0 then +print ===> $data00 +if $data00 != 0 then return -1 endi @@ -149,9 +147,9 @@ endi print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql select first(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then +sql select first(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) +print ===> $data10 +if $data10 != 1 then return -1 endi print ===> $rows diff --git a/tests/script/tsim/compute/interval.sim b/tests/script/tsim/compute/interval.sim index a8539701c7..2e38990975 100644 --- a/tests/script/tsim/compute/interval.sim +++ b/tests/script/tsim/compute/interval.sim @@ -47,10 +47,10 @@ print ===> $rows if $rows < $rowNum then return -1 endi -if $data01 != 1 then +if $data00 != 1 then return -1 endi -if $data05 != 1 then +if $data04 != 1 then return -1 endi @@ -65,10 +65,10 @@ endi if $rows < 3 then return -1 endi -if $data01 != 1 then +if $data00 != 1 then return -1 endi -if $data05 != 1 then +if $data04 != 1 then return -1 endi @@ -87,10 +87,10 @@ endi if $rows > 22 then return -1 endi -if $data01 != 1 then +if $data00 != 1 then return -1 endi -if $data05 != 1 then +if $data04 != 1 then return -1 endi @@ -109,10 +109,10 @@ endi if $rows > 50 then return -1 endi -if $data21 != 1 then +if $data20 != 1 then return -1 endi -if $data25 != 1 then +if $data24 != 1 then return -1 endi @@ -125,10 +125,10 @@ endi if $rows > 22 then return -1 endi -if $data11 > 15 then +if $data10 > 15 then return -1 endi -if $data11 < 5 then +if $data10 < 5 then return -1 endi @@ -143,10 +143,10 @@ endi if $rows > 7 then return -1 endi -if $data11 > 15 then +if $data10 > 15 then return -1 endi -if $data11 < 5 then +if $data10 < 5 then return -1 endi @@ -165,10 +165,10 @@ endi if $rows > 22 then return -1 endi -if $data11 > 15 then +if $data10 > 15 then return -1 endi -if $data11 < 5 then +if $data10 < 5 then return -1 endi @@ -186,10 +186,10 @@ endi if $rows > 50 then return -1 endi -if $data11 > 15 then +if $data10 > 15 then return -1 endi -if $data11 < 5 then +if $data10 < 5 then return -1 endi diff --git a/tests/script/tsim/compute/last.sim b/tests/script/tsim/compute/last.sim index aa9b041ca9..6080a2fa97 100644 --- a/tests/script/tsim/compute/last.sim +++ b/tests/script/tsim/compute/last.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i @@ -69,14 +67,14 @@ endi print =============== step5 sql select last(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select last(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 19 then +print ===> $data00 +if $data00 != 19 then return -1 endi @@ -85,8 +83,8 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select last(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi if $rows != 5 then @@ -127,14 +125,14 @@ endi print =============== step9 sql select last(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select last(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 19 then +print ===> $data00 +if $data00 != 19 then return -1 endi @@ -153,9 +151,9 @@ print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql select last(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then +sql select last(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) +print ===> $data10 +if $data10 != 1 then return -1 endi print ===> $rows diff --git a/tests/script/tsim/compute/last_row.sim b/tests/script/tsim/compute/last_row.sim index 867f64fa2e..590fada86a 100644 --- a/tests/script/tsim/compute/last_row.sim +++ b/tests/script/tsim/compute/last_row.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i @@ -53,6 +51,7 @@ endi print =============== step3 $cc = 4 * 60000 $ms = 1601481600000 + $cc +print select last_row(tbcol) from $tb where ts <= $ms sql select last_row(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 4 then @@ -98,8 +97,6 @@ if $data00 != 4 then return -1 endi - - print =============== step10 sql select last_row(tbcol) as b from $mt group by tgcol print ===> $data00 diff --git a/tests/script/tsim/compute/leastsquare.sim b/tests/script/tsim/compute/leastsquare.sim index aa83a4e14e..59a5213620 100644 --- a/tests/script/tsim/compute/leastsquare.sim +++ b/tests/script/tsim/compute/leastsquare.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i @@ -65,21 +63,21 @@ endi print =============== step5 sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1m) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then +print ===> $data00 +if $data00 != @{slop:1.000000, intercept:1.000000}@ then return -1 endi sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) -print ===> $data01 -if $data01 != @{slop:1.000000, intercept:1.000000}@ then +print ===> $data00 +if $data00 != @{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 +print ===> $data00 +if $data00 != @{slop:1.000000, intercept:1.000000}@ then return -1 endi print ===> $rows diff --git a/tests/script/tsim/compute/max.sim b/tests/script/tsim/compute/max.sim index 1b3fac5820..7101359026 100644 --- a/tests/script/tsim/compute/max.sim +++ b/tests/script/tsim/compute/max.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i @@ -69,14 +67,14 @@ endi print =============== step5 sql select max(tbcol) as b from $tb interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select max(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 19 then +print ===> $data00 +if $data00 != 19 then return -1 endi @@ -85,8 +83,8 @@ $cc = 4 * 60000 $ms = 1601481600000 + $cc sql select max(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi if $rows != 5 then @@ -127,14 +125,14 @@ endi print =============== step9 sql select max(tbcol) as b from $mt interval(1m) -print ===> $data11 -if $data11 != 1 then +print ===> $data10 +if $data10 != 1 then return -1 endi sql select max(tbcol) as b from $mt interval(1d) -print ===> $data01 -if $data01 != 19 then +print ===> $data00 +if $data00 != 19 then return -1 endi @@ -153,9 +151,9 @@ print =============== step11 $cc = 4 * 60000 $ms = 1601481600000 + $cc -sql select max(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol -print ===> $data11 -if $data11 != 1 then +sql select max(tbcol) as b from $mt where ts <= $ms partition by tgcol interval(1m) +print ===> $data10 +if $data10 != 1 then return -1 endi print ===> $rows diff --git a/tests/script/tsim/compute/min.sim b/tests/script/tsim/compute/min.sim index 33e9eb0f3e..1ffdf19ac2 100644 --- a/tests/script/tsim/compute/min.sim +++ b/tests/script/tsim/compute/min.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/compute/null.sim b/tests/script/tsim/compute/null.sim index 30860da48b..b5647a1e34 100644 --- a/tests/script/tsim/compute/null.sim +++ b/tests/script/tsim/compute/null.sim @@ -100,9 +100,10 @@ if $rows != 1 then return -1 endi -sql_error select * from $tb where tbcol = NULL - -return +sql select * from $tb where tbcol = NULL +if $rows != 0 then + return -1 +endi print =============== step5 sql create table tt using $mt tags( NULL ) diff --git a/tests/script/tsim/compute/percentile.sim b/tests/script/tsim/compute/percentile.sim index 5cba3ad856..93b4640442 100644 --- a/tests/script/tsim/compute/percentile.sim +++ b/tests/script/tsim/compute/percentile.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/compute/stddev.sim b/tests/script/tsim/compute/stddev.sim index 7048399112..dbdcde9a16 100644 --- a/tests/script/tsim/compute/stddev.sim +++ b/tests/script/tsim/compute/stddev.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/compute/sum.sim b/tests/script/tsim/compute/sum.sim index c53568f98f..950b861b4c 100644 --- a/tests/script/tsim/compute/sum.sim +++ b/tests/script/tsim/compute/sum.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/compute/top.sim b/tests/script/tsim/compute/top.sim index 9899a8a9ea..d10b3803e3 100644 --- a/tests/script/tsim/compute/top.sim +++ b/tests/script/tsim/compute/top.sim @@ -38,8 +38,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index f24e32279d..1eb4e36da6 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -6,64 +6,36 @@ system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect sql create dnode $hostname port 7200 sql create dnode $hostname port 7300 -$loop_cnt = 0 -check_dnode_ready_1: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then print ====> dnode not ready! return -1 endi sql show dnodes -print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data20 $data21 $data22 $data23 $data24 $data25 -if $data00 != 1 then +if $rows != 3 then return -1 endi -system_content printf %OS% -if $system_content == Windows_NT then - system_content printf %COMPUTERNAME%:7100 - if $data01 != $system_content then - return -1 - endi -else - if $data01 != localhost:7100 then - return -1 - endi +if $data(1)[4] != ready then + goto step1 endi -if $data04 != ready then - goto check_dnode_ready_1 +if $data(2)[4] != ready then + goto step1 endi -if $data14 != ready then - goto check_dnode_ready_1 -endi -if $data24 != ready then - goto check_dnode_ready_1 +if $data(3)[4] != ready then + goto step1 endi + print ============= create database #database_option: { # | BUFFER value [3~16384, default: 96] @@ -137,7 +109,6 @@ if $data17_db != ns then # precision return -1 endi -sleep 3000 #sql show db.vgroups #if $data[0][4] == leader then # if $data[0][6] != follower then diff --git a/tests/script/general/db/alter_tables_d2.sim b/tests/script/tsim/db/alter_tables_d2.sim similarity index 100% rename from tests/script/general/db/alter_tables_d2.sim rename to tests/script/tsim/db/alter_tables_d2.sim diff --git a/tests/script/general/db/alter_tables_v1.sim b/tests/script/tsim/db/alter_tables_v1.sim similarity index 100% rename from tests/script/general/db/alter_tables_v1.sim rename to tests/script/tsim/db/alter_tables_v1.sim diff --git a/tests/script/general/db/alter_tables_v4.sim b/tests/script/tsim/db/alter_tables_v4.sim similarity index 100% rename from tests/script/general/db/alter_tables_v4.sim rename to tests/script/tsim/db/alter_tables_v4.sim diff --git a/tests/script/general/db/alter_vgroups.sim b/tests/script/tsim/db/alter_vgroups.sim similarity index 100% rename from tests/script/general/db/alter_vgroups.sim rename to tests/script/tsim/db/alter_vgroups.sim diff --git a/tests/script/tsim/db/back_insert.sim b/tests/script/tsim/db/back_insert.sim index 43831cca95..642df63ff2 100644 --- a/tests/script/tsim/db/back_insert.sim +++ b/tests/script/tsim/db/back_insert.sim @@ -1,6 +1,8 @@ sql connect $x = 1 begin: + sql reset query cache + sleep 1000 sql insert into db.tb values(now, $x ) -x begin #print ===> insert successed $x $x = $x + 1 diff --git a/tests/script/general/db/basic4.sim b/tests/script/tsim/db/basic4.sim similarity index 100% rename from tests/script/general/db/basic4.sim rename to tests/script/tsim/db/basic4.sim diff --git a/tests/script/general/db/basic5.sim b/tests/script/tsim/db/basic5.sim similarity index 100% rename from tests/script/general/db/basic5.sim rename to tests/script/tsim/db/basic5.sim diff --git a/tests/script/general/db/delete.sim b/tests/script/tsim/db/delete2.sim similarity index 100% rename from tests/script/general/db/delete.sim rename to tests/script/tsim/db/delete2.sim diff --git a/tests/script/general/db/delete_reuse1.sim b/tests/script/tsim/db/delete_reuse1.sim similarity index 100% rename from tests/script/general/db/delete_reuse1.sim rename to tests/script/tsim/db/delete_reuse1.sim diff --git a/tests/script/general/db/delete_reuse2.sim b/tests/script/tsim/db/delete_reuse2.sim similarity index 100% rename from tests/script/general/db/delete_reuse2.sim rename to tests/script/tsim/db/delete_reuse2.sim diff --git a/tests/script/general/db/delete_reusevnode.sim b/tests/script/tsim/db/delete_reusevnode.sim similarity index 100% rename from tests/script/general/db/delete_reusevnode.sim rename to tests/script/tsim/db/delete_reusevnode.sim diff --git a/tests/script/general/db/delete_reusevnode2.sim b/tests/script/tsim/db/delete_reusevnode2.sim similarity index 100% rename from tests/script/general/db/delete_reusevnode2.sim rename to tests/script/tsim/db/delete_reusevnode2.sim diff --git a/tests/script/general/db/delete_writing1.sim b/tests/script/tsim/db/delete_writing1.sim similarity index 100% rename from tests/script/general/db/delete_writing1.sim rename to tests/script/tsim/db/delete_writing1.sim diff --git a/tests/script/general/db/delete_writing2.sim b/tests/script/tsim/db/delete_writing2.sim similarity index 100% rename from tests/script/general/db/delete_writing2.sim rename to tests/script/tsim/db/delete_writing2.sim diff --git a/tests/script/general/db/dropdnodes.sim b/tests/script/tsim/db/dropdnodes.sim similarity index 100% rename from tests/script/general/db/dropdnodes.sim rename to tests/script/tsim/db/dropdnodes.sim diff --git a/tests/script/general/db/backup/keep.sim b/tests/script/tsim/db/keep.sim similarity index 100% rename from tests/script/general/db/backup/keep.sim rename to tests/script/tsim/db/keep.sim diff --git a/tests/script/general/db/len.sim b/tests/script/tsim/db/len.sim similarity index 100% rename from tests/script/general/db/len.sim rename to tests/script/tsim/db/len.sim diff --git a/tests/script/general/db/nosuchfile.sim b/tests/script/tsim/db/nosuchfile.sim similarity index 100% rename from tests/script/general/db/nosuchfile.sim rename to tests/script/tsim/db/nosuchfile.sim diff --git a/tests/script/general/db/repeat.sim b/tests/script/tsim/db/repeat.sim similarity index 100% rename from tests/script/general/db/repeat.sim rename to tests/script/tsim/db/repeat.sim diff --git a/tests/script/general/db/show_create_db.sim b/tests/script/tsim/db/show_create_db.sim similarity index 100% rename from tests/script/general/db/show_create_db.sim rename to tests/script/tsim/db/show_create_db.sim diff --git a/tests/script/general/db/show_create_table.sim b/tests/script/tsim/db/show_create_table.sim similarity index 100% rename from tests/script/general/db/show_create_table.sim rename to tests/script/tsim/db/show_create_table.sim diff --git a/tests/script/general/db/tables.sim b/tests/script/tsim/db/tables.sim similarity index 100% rename from tests/script/general/db/tables.sim rename to tests/script/tsim/db/tables.sim diff --git a/tests/script/general/db/testSuite.sim b/tests/script/tsim/db/testSuite.sim similarity index 100% rename from tests/script/general/db/testSuite.sim rename to tests/script/tsim/db/testSuite.sim diff --git a/tests/script/general/db/topic1.sim b/tests/script/tsim/db/topic1.sim similarity index 100% rename from tests/script/general/db/topic1.sim rename to tests/script/tsim/db/topic1.sim diff --git a/tests/script/general/db/topic2.sim b/tests/script/tsim/db/topic2.sim similarity index 100% rename from tests/script/general/db/topic2.sim rename to tests/script/tsim/db/topic2.sim diff --git a/tests/script/general/db/vnodes.sim b/tests/script/tsim/db/vnodes.sim similarity index 100% rename from tests/script/general/db/vnodes.sim rename to tests/script/tsim/db/vnodes.sim diff --git a/tests/script/tsim/insert/backquote.sim b/tests/script/tsim/insert/backquote.sim index ba50e70afa..db2cddd2ca 100644 --- a/tests/script/tsim/insert/backquote.sim +++ b/tests/script/tsim/insert/backquote.sim @@ -1,9 +1,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 50 sql connect + print =============== create database sql create database `database` sql create database `DataBase` @@ -184,23 +184,6 @@ print =============== stop and restart taosd system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql show databases print rows: $rows print $data00 $data01 diff --git a/tests/script/general/insert/basic.sim b/tests/script/tsim/insert/basic.sim similarity index 93% rename from tests/script/general/insert/basic.sim rename to tests/script/tsim/insert/basic.sim index 88eb30a1ad..20b39c8f00 100644 --- a/tests/script/general/insert/basic.sim +++ b/tests/script/tsim/insert/basic.sim @@ -1,10 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index 6de904eca1..1f3c93a4bf 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -271,23 +271,6 @@ print =============== stop and restart taosd, then again do query above system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - print =============== query data from child table sql select * from ct1 print rows: $rows diff --git a/tests/script/tsim/insert/basic1.sim b/tests/script/tsim/insert/basic1.sim index 6d31dcdffb..b8458b1b51 100644 --- a/tests/script/tsim/insert/basic1.sim +++ b/tests/script/tsim/insert/basic1.sim @@ -2,6 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start sql connect + print =============== create database sql create database d1 sql show databases diff --git a/tests/script/tsim/insert/commit-merge0.sim b/tests/script/tsim/insert/commit-merge0.sim index 56e818654f..5fe7cc57b3 100644 --- a/tests/script/tsim/insert/commit-merge0.sim +++ b/tests/script/tsim/insert/commit-merge0.sim @@ -1,7 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 50 sql connect print =============== create database @@ -64,23 +63,6 @@ reboot_and_check: system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - print =============== insert duplicated records to memory - loop $reboot_max - $reboot_cnt sql use db sql insert into ct1 values ('2022-05-01 18:30:27.001', 0.0); diff --git a/tests/script/general/insert/insert_drop.sim b/tests/script/tsim/insert/insert_drop.sim similarity index 89% rename from tests/script/general/insert/insert_drop.sim rename to tests/script/tsim/insert/insert_drop.sim index 8592637626..020fd367ae 100644 --- a/tests/script/general/insert/insert_drop.sim +++ b/tests/script/tsim/insert/insert_drop.sim @@ -1,10 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $tbNum = 10 @@ -19,7 +15,7 @@ $stb = stb sql drop database $db -x step1 step1: -sql create database $db ctime 30 +sql create database $db print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int) tags(t1 int) @@ -43,13 +39,9 @@ print ====== tables created print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sql reset query cache -sleep 1000 - sql use $db sql drop table tb5 $i = 0 @@ -69,13 +61,9 @@ endw print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sql reset query cache -sleep 1000 - sql use $db sql create table tb5 using $stb tags(5) diff --git a/tests/script/tsim/insert/null.sim b/tests/script/tsim/insert/null.sim index 98a494c960..1b7017038a 100644 --- a/tests/script/tsim/insert/null.sim +++ b/tests/script/tsim/insert/null.sim @@ -1,7 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 50 sql connect print =============== create database @@ -211,66 +210,48 @@ endi #=================================================================== #print =============== query data from stb -#sql select * from stb -#print ===> -#print ===> rows: $rows -#print ===> rows0: $data00 $data01 $data02 $data03 $data04 -#if $rows != 4 then -# return -1 -#endi +sql select * from stb +print ===> +print ===> rows: $rows +print ===> rows0: $data00 $data01 $data02 $data03 $data04 +if $rows != 12 then + return -1 +endi + #print =============== select count(*) from supter table -#sql select count(*) from stb -#print $data00 $data01 $data02 -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 12 then -# return -1 -#endi +sql select count(*) from stb +print $data00 $data01 $data02 +if $rows != 1 then + return -1 +endi +if $data00 != 12 then + return -1 +endi #print =============== select count(column) from supter table -#sql select count(ts), count(c1), count(c2), count(c3) from stb -#print $data00 $data01 $data02 $data03 -#if $data00 != 12 then -# return -1 -#endi -#if $data01 != 8 then -# return -1 -#endi -#if $data02 != 8 then -# return -1 -#endi -#if $data03 != 8 then -# return -1 -#endi +sql select count(ts), count(c1), count(c2), count(c3) from stb +print $data00 $data01 $data02 $data03 +if $data00 != 12 then + return -1 +endi +if $data01 != 8 then + return -1 +endi +if $data02 != 8 then + return -1 +endi +if $data03 != 8 then + return -1 +endi -#=================================================================== #=================================================================== print =============== stop and restart taosd, then again do query above system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -print ===> waiting dnode ready -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi +#=================================================================== -#=================================================================== -#=================================================================== print =============== query data from child table sql select * from ct1 print ===> select * from ct1 @@ -292,15 +273,15 @@ endi if $data03 != 3.000000000 then return -1 endi -#if $data41 != -14 then -# return -1 -#endi -#if $data42 != -2.40000 then -# return -1 -#endi -#if $data43 != -3.400000000 then -# return -1 -#endi +if $data41 != 12 then + return -1 +endi +if $data42 != 2.20000 then + return -1 +endi +if $data43 != NULL then + return -1 +endi print =============== select count(*) from child table sql select count(*) from ct1 @@ -435,40 +416,39 @@ if $data92 != 3.600000000 then return -1 endi #=================================================================== -#=================================================================== -#print =============== query data from stb -#sql select * from stb -#print ===> -#print ===> rows: $rows -#print ===> rows0: $data00 $data01 $data02 $data03 $data04 -#if $rows != 4 then -# return -1 -#endi -#print =============== select count(*) from supter table -#sql select count(*) from stb -#print $data00 $data01 $data02 -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 12 then -# return -1 -#endi +print =============== query data from stb +sql select * from stb +print ===> +print ===> rows: $rows +print ===> rows0: $data00 $data01 $data02 $data03 $data04 +if $rows != 12 then + return -1 +endi +print =============== select count(*) from supter table +sql select count(*) from stb +print $data00 $data01 $data02 +if $rows != 1 then + return -1 +endi +if $data00 != 12 then + return -1 +endi -#print =============== select count(column) from supter table -#sql select count(ts), count(c1), count(c2), count(c3) from stb -#print $data00 $data01 $data02 $data03 -#if $data00 != 12 then -# return -1 -#endi -#if $data01 != 8 then -# return -1 -#endi -#if $data02 != 8 then -# return -1 -#endi -#if $data03 != 8 then -# return -1 -#endi +print =============== select count(column) from supter table +sql select count(ts), count(c1), count(c2), count(c3) from stb +print $data00 $data01 $data02 $data03 +if $data00 != 12 then + return -1 +endi +if $data01 != 8 then + return -1 +endi +if $data02 != 8 then + return -1 +endi +if $data03 != 8 then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/insert/query_block1_file.sim b/tests/script/tsim/insert/query_block1_file.sim similarity index 98% rename from tests/script/general/insert/query_block1_file.sim rename to tests/script/tsim/insert/query_block1_file.sim index 636b9530f9..e4e8928bf8 100644 --- a/tests/script/general/insert/query_block1_file.sim +++ b/tests/script/tsim/insert/query_block1_file.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -190,7 +185,7 @@ clear: sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/insert/query_block1_memory.sim b/tests/script/tsim/insert/query_block1_memory.sim similarity index 97% rename from tests/script/general/insert/query_block1_memory.sim rename to tests/script/tsim/insert/query_block1_memory.sim index 823e466ee9..a8e1a0439c 100644 --- a/tests/script/general/insert/query_block1_memory.sim +++ b/tests/script/tsim/insert/query_block1_memory.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -175,7 +170,7 @@ clear: sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/insert/query_block2_file.sim b/tests/script/tsim/insert/query_block2_file.sim similarity index 94% rename from tests/script/general/insert/query_block2_file.sim rename to tests/script/tsim/insert/query_block2_file.sim index 5b7438875e..5557621e0f 100644 --- a/tests/script/general/insert/query_block2_file.sim +++ b/tests/script/tsim/insert/query_block2_file.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -19,15 +14,7 @@ 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 +sql create table $tb (ts timestamp, speed int) #commit to file will trigger if insert 82 rows $N = 82 @@ -204,7 +191,7 @@ clear: sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/insert/query_block2_memory.sim b/tests/script/tsim/insert/query_block2_memory.sim similarity index 97% rename from tests/script/general/insert/query_block2_memory.sim rename to tests/script/tsim/insert/query_block2_memory.sim index fb41981c89..910207d13b 100644 --- a/tests/script/general/insert/query_block2_memory.sim +++ b/tests/script/tsim/insert/query_block2_memory.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -167,7 +162,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/insert/query_file_memory.sim b/tests/script/tsim/insert/query_file_memory.sim similarity index 94% rename from tests/script/general/insert/query_file_memory.sim rename to tests/script/tsim/insert/query_file_memory.sim index f920c215c0..c0aafd2686 100644 --- a/tests/script/general/insert/query_file_memory.sim +++ b/tests/script/tsim/insert/query_file_memory.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -20,14 +15,7 @@ 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 +sql create table $tb (ts timestamp, speed int) #commit to file will trigger if insert 82 rows @@ -202,7 +190,7 @@ clear: sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/insert/query_multi_file.sim b/tests/script/tsim/insert/query_multi_file.sim similarity index 76% rename from tests/script/general/insert/query_multi_file.sim rename to tests/script/tsim/insert/query_multi_file.sim index bbca53d309..f996317721 100644 --- a/tests/script/general/insert/query_multi_file.sim +++ b/tests/script/tsim/insert/query_multi_file.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -20,14 +15,7 @@ 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 +sql create table $tb (ts timestamp, speed int) $N = 20000 @@ -49,7 +37,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/insert/tcp.sim b/tests/script/tsim/insert/tcp.sim similarity index 91% rename from tests/script/general/insert/tcp.sim rename to tests/script/tsim/insert/tcp.sim index 002d84dcae..2dc720a0d4 100644 --- a/tests/script/general/insert/tcp.sim +++ b/tests/script/tsim/insert/tcp.sim @@ -1,10 +1,7 @@ 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 debugflag -v 131 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect sql create database d1; diff --git a/tests/script/issue/TD-2677.sim b/tests/script/tsim/issue/TD-2677.sim similarity index 100% rename from tests/script/issue/TD-2677.sim rename to tests/script/tsim/issue/TD-2677.sim diff --git a/tests/script/issue/TD-2680.sim b/tests/script/tsim/issue/TD-2680.sim similarity index 100% rename from tests/script/issue/TD-2680.sim rename to tests/script/tsim/issue/TD-2680.sim diff --git a/tests/script/issue/TD-2713.sim b/tests/script/tsim/issue/TD-2713.sim similarity index 100% rename from tests/script/issue/TD-2713.sim rename to tests/script/tsim/issue/TD-2713.sim diff --git a/tests/script/issue/TD-3300.sim b/tests/script/tsim/issue/TD-3300.sim similarity index 100% rename from tests/script/issue/TD-3300.sim rename to tests/script/tsim/issue/TD-3300.sim diff --git a/tests/script/general/parser/README.txt b/tests/script/tsim/parser/README.txt similarity index 100% rename from tests/script/general/parser/README.txt rename to tests/script/tsim/parser/README.txt diff --git a/tests/script/general/parser/alter.sim b/tests/script/tsim/parser/alter.sim similarity index 100% rename from tests/script/general/parser/alter.sim rename to tests/script/tsim/parser/alter.sim diff --git a/tests/script/general/parser/alter1.sim b/tests/script/tsim/parser/alter1.sim similarity index 100% rename from tests/script/general/parser/alter1.sim rename to tests/script/tsim/parser/alter1.sim diff --git a/tests/script/general/parser/alter__for_community_version.sim b/tests/script/tsim/parser/alter__for_community_version.sim similarity index 100% rename from tests/script/general/parser/alter__for_community_version.sim rename to tests/script/tsim/parser/alter__for_community_version.sim diff --git a/tests/script/general/parser/alter_column.sim b/tests/script/tsim/parser/alter_column.sim similarity index 100% rename from tests/script/general/parser/alter_column.sim rename to tests/script/tsim/parser/alter_column.sim diff --git a/tests/script/general/parser/alter_stable.sim b/tests/script/tsim/parser/alter_stable.sim similarity index 100% rename from tests/script/general/parser/alter_stable.sim rename to tests/script/tsim/parser/alter_stable.sim diff --git a/tests/script/general/parser/auto_create_tb.sim b/tests/script/tsim/parser/auto_create_tb.sim similarity index 100% rename from tests/script/general/parser/auto_create_tb.sim rename to tests/script/tsim/parser/auto_create_tb.sim diff --git a/tests/script/general/parser/auto_create_tb_drop_tb.sim b/tests/script/tsim/parser/auto_create_tb_drop_tb.sim similarity index 100% rename from tests/script/general/parser/auto_create_tb_drop_tb.sim rename to tests/script/tsim/parser/auto_create_tb_drop_tb.sim diff --git a/tests/script/general/parser/between_and.sim b/tests/script/tsim/parser/between_and.sim similarity index 100% rename from tests/script/general/parser/between_and.sim rename to tests/script/tsim/parser/between_and.sim diff --git a/tests/script/general/parser/binary_escapeCharacter.sim b/tests/script/tsim/parser/binary_escapeCharacter.sim similarity index 100% rename from tests/script/general/parser/binary_escapeCharacter.sim rename to tests/script/tsim/parser/binary_escapeCharacter.sim diff --git a/tests/script/general/parser/col_arithmetic_operation.sim b/tests/script/tsim/parser/col_arithmetic_operation.sim similarity index 100% rename from tests/script/general/parser/col_arithmetic_operation.sim rename to tests/script/tsim/parser/col_arithmetic_operation.sim diff --git a/tests/script/general/parser/col_arithmetic_query.sim b/tests/script/tsim/parser/col_arithmetic_query.sim similarity index 100% rename from tests/script/general/parser/col_arithmetic_query.sim rename to tests/script/tsim/parser/col_arithmetic_query.sim diff --git a/tests/script/general/parser/columnValue.sim b/tests/script/tsim/parser/columnValue.sim similarity index 100% rename from tests/script/general/parser/columnValue.sim rename to tests/script/tsim/parser/columnValue.sim diff --git a/tests/script/general/parser/columnValue_bigint.sim b/tests/script/tsim/parser/columnValue_bigint.sim similarity index 100% rename from tests/script/general/parser/columnValue_bigint.sim rename to tests/script/tsim/parser/columnValue_bigint.sim diff --git a/tests/script/general/parser/columnValue_bool.sim b/tests/script/tsim/parser/columnValue_bool.sim similarity index 100% rename from tests/script/general/parser/columnValue_bool.sim rename to tests/script/tsim/parser/columnValue_bool.sim diff --git a/tests/script/general/parser/columnValue_double.sim b/tests/script/tsim/parser/columnValue_double.sim similarity index 100% rename from tests/script/general/parser/columnValue_double.sim rename to tests/script/tsim/parser/columnValue_double.sim diff --git a/tests/script/general/parser/columnValue_float.sim b/tests/script/tsim/parser/columnValue_float.sim similarity index 100% rename from tests/script/general/parser/columnValue_float.sim rename to tests/script/tsim/parser/columnValue_float.sim diff --git a/tests/script/general/parser/columnValue_int.sim b/tests/script/tsim/parser/columnValue_int.sim similarity index 100% rename from tests/script/general/parser/columnValue_int.sim rename to tests/script/tsim/parser/columnValue_int.sim diff --git a/tests/script/general/parser/columnValue_smallint.sim b/tests/script/tsim/parser/columnValue_smallint.sim similarity index 100% rename from tests/script/general/parser/columnValue_smallint.sim rename to tests/script/tsim/parser/columnValue_smallint.sim diff --git a/tests/script/general/parser/columnValue_tinyint.sim b/tests/script/tsim/parser/columnValue_tinyint.sim similarity index 100% rename from tests/script/general/parser/columnValue_tinyint.sim rename to tests/script/tsim/parser/columnValue_tinyint.sim diff --git a/tests/script/general/parser/columnValue_unsign.sim b/tests/script/tsim/parser/columnValue_unsign.sim similarity index 100% rename from tests/script/general/parser/columnValue_unsign.sim rename to tests/script/tsim/parser/columnValue_unsign.sim diff --git a/tests/script/general/parser/commit.sim b/tests/script/tsim/parser/commit.sim similarity index 100% rename from tests/script/general/parser/commit.sim rename to tests/script/tsim/parser/commit.sim diff --git a/tests/script/general/parser/condition.sim b/tests/script/tsim/parser/condition.sim similarity index 100% rename from tests/script/general/parser/condition.sim rename to tests/script/tsim/parser/condition.sim diff --git a/tests/script/general/parser/condition_query.sim b/tests/script/tsim/parser/condition_query.sim similarity index 100% rename from tests/script/general/parser/condition_query.sim rename to tests/script/tsim/parser/condition_query.sim diff --git a/tests/script/general/parser/constCol.sim b/tests/script/tsim/parser/constCol.sim similarity index 100% rename from tests/script/general/parser/constCol.sim rename to tests/script/tsim/parser/constCol.sim diff --git a/tests/script/general/parser/create_db.sim b/tests/script/tsim/parser/create_db.sim similarity index 100% rename from tests/script/general/parser/create_db.sim rename to tests/script/tsim/parser/create_db.sim diff --git a/tests/script/general/parser/create_db__for_community_version.sim b/tests/script/tsim/parser/create_db__for_community_version.sim similarity index 100% rename from tests/script/general/parser/create_db__for_community_version.sim rename to tests/script/tsim/parser/create_db__for_community_version.sim diff --git a/tests/script/general/parser/create_mt.sim b/tests/script/tsim/parser/create_mt.sim similarity index 100% rename from tests/script/general/parser/create_mt.sim rename to tests/script/tsim/parser/create_mt.sim diff --git a/tests/script/general/parser/create_tb.sim b/tests/script/tsim/parser/create_tb.sim similarity index 100% rename from tests/script/general/parser/create_tb.sim rename to tests/script/tsim/parser/create_tb.sim diff --git a/tests/script/general/parser/create_tb_with_tag_name.sim b/tests/script/tsim/parser/create_tb_with_tag_name.sim similarity index 100% rename from tests/script/general/parser/create_tb_with_tag_name.sim rename to tests/script/tsim/parser/create_tb_with_tag_name.sim diff --git a/tests/script/general/parser/dbtbnameValidate.sim b/tests/script/tsim/parser/dbtbnameValidate.sim similarity index 100% rename from tests/script/general/parser/dbtbnameValidate.sim rename to tests/script/tsim/parser/dbtbnameValidate.sim diff --git a/tests/script/general/parser/distinct.sim b/tests/script/tsim/parser/distinct.sim similarity index 100% rename from tests/script/general/parser/distinct.sim rename to tests/script/tsim/parser/distinct.sim diff --git a/tests/script/general/parser/fill.sim b/tests/script/tsim/parser/fill.sim similarity index 100% rename from tests/script/general/parser/fill.sim rename to tests/script/tsim/parser/fill.sim diff --git a/tests/script/general/parser/fill_stb.sim b/tests/script/tsim/parser/fill_stb.sim similarity index 100% rename from tests/script/general/parser/fill_stb.sim rename to tests/script/tsim/parser/fill_stb.sim diff --git a/tests/script/general/parser/fill_us.sim b/tests/script/tsim/parser/fill_us.sim similarity index 100% rename from tests/script/general/parser/fill_us.sim rename to tests/script/tsim/parser/fill_us.sim diff --git a/tests/script/general/parser/first_last.sim b/tests/script/tsim/parser/first_last.sim similarity index 100% rename from tests/script/general/parser/first_last.sim rename to tests/script/tsim/parser/first_last.sim diff --git a/tests/script/general/parser/first_last_query.sim b/tests/script/tsim/parser/first_last_query.sim similarity index 100% rename from tests/script/general/parser/first_last_query.sim rename to tests/script/tsim/parser/first_last_query.sim diff --git a/tests/script/general/parser/function.sim b/tests/script/tsim/parser/function.sim similarity index 100% rename from tests/script/general/parser/function.sim rename to tests/script/tsim/parser/function.sim diff --git a/tests/script/general/parser/gendata.sh b/tests/script/tsim/parser/gendata.sh similarity index 100% rename from tests/script/general/parser/gendata.sh rename to tests/script/tsim/parser/gendata.sh diff --git a/tests/script/general/parser/groupby.sim b/tests/script/tsim/parser/groupby.sim similarity index 100% rename from tests/script/general/parser/groupby.sim rename to tests/script/tsim/parser/groupby.sim diff --git a/tests/script/general/parser/having.sim b/tests/script/tsim/parser/having.sim similarity index 100% rename from tests/script/general/parser/having.sim rename to tests/script/tsim/parser/having.sim diff --git a/tests/script/general/parser/having_child.sim b/tests/script/tsim/parser/having_child.sim similarity index 100% rename from tests/script/general/parser/having_child.sim rename to tests/script/tsim/parser/having_child.sim diff --git a/tests/script/general/parser/import.sim b/tests/script/tsim/parser/import.sim similarity index 100% rename from tests/script/general/parser/import.sim rename to tests/script/tsim/parser/import.sim diff --git a/tests/script/general/parser/import_commit1.sim b/tests/script/tsim/parser/import_commit1.sim similarity index 100% rename from tests/script/general/parser/import_commit1.sim rename to tests/script/tsim/parser/import_commit1.sim diff --git a/tests/script/general/parser/import_commit2.sim b/tests/script/tsim/parser/import_commit2.sim similarity index 100% rename from tests/script/general/parser/import_commit2.sim rename to tests/script/tsim/parser/import_commit2.sim diff --git a/tests/script/general/parser/import_commit3.sim b/tests/script/tsim/parser/import_commit3.sim similarity index 100% rename from tests/script/general/parser/import_commit3.sim rename to tests/script/tsim/parser/import_commit3.sim diff --git a/tests/script/general/parser/import_file.sim b/tests/script/tsim/parser/import_file.sim similarity index 100% rename from tests/script/general/parser/import_file.sim rename to tests/script/tsim/parser/import_file.sim diff --git a/tests/script/general/parser/insert_multiTbl.sim b/tests/script/tsim/parser/insert_multiTbl.sim similarity index 100% rename from tests/script/general/parser/insert_multiTbl.sim rename to tests/script/tsim/parser/insert_multiTbl.sim diff --git a/tests/script/general/parser/insert_tb.sim b/tests/script/tsim/parser/insert_tb.sim similarity index 100% rename from tests/script/general/parser/insert_tb.sim rename to tests/script/tsim/parser/insert_tb.sim diff --git a/tests/script/general/parser/interp.sim b/tests/script/tsim/parser/interp.sim similarity index 100% rename from tests/script/general/parser/interp.sim rename to tests/script/tsim/parser/interp.sim diff --git a/tests/script/general/parser/interp_test.sim b/tests/script/tsim/parser/interp_test.sim similarity index 100% rename from tests/script/general/parser/interp_test.sim rename to tests/script/tsim/parser/interp_test.sim diff --git a/tests/script/general/parser/join.sim b/tests/script/tsim/parser/join.sim similarity index 100% rename from tests/script/general/parser/join.sim rename to tests/script/tsim/parser/join.sim diff --git a/tests/script/general/parser/join_manyblocks.sim b/tests/script/tsim/parser/join_manyblocks.sim similarity index 100% rename from tests/script/general/parser/join_manyblocks.sim rename to tests/script/tsim/parser/join_manyblocks.sim diff --git a/tests/script/general/parser/join_multitables.sim b/tests/script/tsim/parser/join_multitables.sim similarity index 100% rename from tests/script/general/parser/join_multitables.sim rename to tests/script/tsim/parser/join_multitables.sim diff --git a/tests/script/general/parser/join_multivnode.sim b/tests/script/tsim/parser/join_multivnode.sim similarity index 100% rename from tests/script/general/parser/join_multivnode.sim rename to tests/script/tsim/parser/join_multivnode.sim diff --git a/tests/script/general/parser/last_cache.sim b/tests/script/tsim/parser/last_cache.sim similarity index 100% rename from tests/script/general/parser/last_cache.sim rename to tests/script/tsim/parser/last_cache.sim diff --git a/tests/script/general/parser/last_cache_query.sim b/tests/script/tsim/parser/last_cache_query.sim similarity index 100% rename from tests/script/general/parser/last_cache_query.sim rename to tests/script/tsim/parser/last_cache_query.sim diff --git a/tests/script/general/parser/last_groupby.sim b/tests/script/tsim/parser/last_groupby.sim similarity index 100% rename from tests/script/general/parser/last_groupby.sim rename to tests/script/tsim/parser/last_groupby.sim diff --git a/tests/script/general/parser/lastrow.sim b/tests/script/tsim/parser/lastrow.sim similarity index 100% rename from tests/script/general/parser/lastrow.sim rename to tests/script/tsim/parser/lastrow.sim diff --git a/tests/script/general/parser/lastrow_query.sim b/tests/script/tsim/parser/lastrow_query.sim similarity index 100% rename from tests/script/general/parser/lastrow_query.sim rename to tests/script/tsim/parser/lastrow_query.sim diff --git a/tests/script/general/parser/like.sim b/tests/script/tsim/parser/like.sim similarity index 100% rename from tests/script/general/parser/like.sim rename to tests/script/tsim/parser/like.sim diff --git a/tests/script/general/parser/limit.sim b/tests/script/tsim/parser/limit.sim similarity index 100% rename from tests/script/general/parser/limit.sim rename to tests/script/tsim/parser/limit.sim diff --git a/tests/script/general/parser/limit1.sim b/tests/script/tsim/parser/limit1.sim similarity index 100% rename from tests/script/general/parser/limit1.sim rename to tests/script/tsim/parser/limit1.sim diff --git a/tests/script/general/parser/limit1_stb.sim b/tests/script/tsim/parser/limit1_stb.sim similarity index 100% rename from tests/script/general/parser/limit1_stb.sim rename to tests/script/tsim/parser/limit1_stb.sim diff --git a/tests/script/general/parser/limit1_tb.sim b/tests/script/tsim/parser/limit1_tb.sim similarity index 100% rename from tests/script/general/parser/limit1_tb.sim rename to tests/script/tsim/parser/limit1_tb.sim diff --git a/tests/script/general/parser/limit1_tblocks100.sim b/tests/script/tsim/parser/limit1_tblocks100.sim similarity index 100% rename from tests/script/general/parser/limit1_tblocks100.sim rename to tests/script/tsim/parser/limit1_tblocks100.sim diff --git a/tests/script/general/parser/limit2.sim b/tests/script/tsim/parser/limit2.sim similarity index 100% rename from tests/script/general/parser/limit2.sim rename to tests/script/tsim/parser/limit2.sim diff --git a/tests/script/general/parser/limit2_query.sim b/tests/script/tsim/parser/limit2_query.sim similarity index 100% rename from tests/script/general/parser/limit2_query.sim rename to tests/script/tsim/parser/limit2_query.sim diff --git a/tests/script/general/parser/limit2_tblocks100.sim b/tests/script/tsim/parser/limit2_tblocks100.sim similarity index 100% rename from tests/script/general/parser/limit2_tblocks100.sim rename to tests/script/tsim/parser/limit2_tblocks100.sim diff --git a/tests/script/general/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim similarity index 100% rename from tests/script/general/parser/limit_stb.sim rename to tests/script/tsim/parser/limit_stb.sim diff --git a/tests/script/general/parser/limit_tb.sim b/tests/script/tsim/parser/limit_tb.sim similarity index 100% rename from tests/script/general/parser/limit_tb.sim rename to tests/script/tsim/parser/limit_tb.sim diff --git a/tests/script/general/parser/line_insert.sim b/tests/script/tsim/parser/line_insert.sim similarity index 100% rename from tests/script/general/parser/line_insert.sim rename to tests/script/tsim/parser/line_insert.sim diff --git a/tests/script/general/parser/mixed_blocks.sim b/tests/script/tsim/parser/mixed_blocks.sim similarity index 100% rename from tests/script/general/parser/mixed_blocks.sim rename to tests/script/tsim/parser/mixed_blocks.sim diff --git a/tests/script/general/parser/nchar.sim b/tests/script/tsim/parser/nchar.sim similarity index 100% rename from tests/script/general/parser/nchar.sim rename to tests/script/tsim/parser/nchar.sim diff --git a/tests/script/general/parser/nestquery.sim b/tests/script/tsim/parser/nestquery.sim similarity index 100% rename from tests/script/general/parser/nestquery.sim rename to tests/script/tsim/parser/nestquery.sim diff --git a/tests/script/general/parser/null_char.sim b/tests/script/tsim/parser/null_char.sim similarity index 100% rename from tests/script/general/parser/null_char.sim rename to tests/script/tsim/parser/null_char.sim diff --git a/tests/script/general/parser/precision_ns.sim b/tests/script/tsim/parser/precision_ns.sim similarity index 100% rename from tests/script/general/parser/precision_ns.sim rename to tests/script/tsim/parser/precision_ns.sim diff --git a/tests/script/general/parser/projection_limit_offset.sim b/tests/script/tsim/parser/projection_limit_offset.sim similarity index 100% rename from tests/script/general/parser/projection_limit_offset.sim rename to tests/script/tsim/parser/projection_limit_offset.sim diff --git a/tests/script/general/parser/regex.sim b/tests/script/tsim/parser/regex.sim similarity index 100% rename from tests/script/general/parser/regex.sim rename to tests/script/tsim/parser/regex.sim diff --git a/tests/script/general/parser/repeatAlter.sim b/tests/script/tsim/parser/repeatAlter.sim similarity index 100% rename from tests/script/general/parser/repeatAlter.sim rename to tests/script/tsim/parser/repeatAlter.sim diff --git a/tests/script/general/parser/selectResNum.sim b/tests/script/tsim/parser/selectResNum.sim similarity index 100% rename from tests/script/general/parser/selectResNum.sim rename to tests/script/tsim/parser/selectResNum.sim diff --git a/tests/script/general/parser/select_across_vnodes.sim b/tests/script/tsim/parser/select_across_vnodes.sim similarity index 100% rename from tests/script/general/parser/select_across_vnodes.sim rename to tests/script/tsim/parser/select_across_vnodes.sim diff --git a/tests/script/general/parser/select_distinct_tag.sim b/tests/script/tsim/parser/select_distinct_tag.sim similarity index 100% rename from tests/script/general/parser/select_distinct_tag.sim rename to tests/script/tsim/parser/select_distinct_tag.sim diff --git a/tests/script/general/parser/select_from_cache_disk.sim b/tests/script/tsim/parser/select_from_cache_disk.sim similarity index 100% rename from tests/script/general/parser/select_from_cache_disk.sim rename to tests/script/tsim/parser/select_from_cache_disk.sim diff --git a/tests/script/general/parser/select_with_tags.sim b/tests/script/tsim/parser/select_with_tags.sim similarity index 100% rename from tests/script/general/parser/select_with_tags.sim rename to tests/script/tsim/parser/select_with_tags.sim diff --git a/tests/script/general/parser/set_tag_vals.sim b/tests/script/tsim/parser/set_tag_vals.sim similarity index 100% rename from tests/script/general/parser/set_tag_vals.sim rename to tests/script/tsim/parser/set_tag_vals.sim diff --git a/tests/script/general/parser/single_row_in_tb.sim b/tests/script/tsim/parser/single_row_in_tb.sim similarity index 100% rename from tests/script/general/parser/single_row_in_tb.sim rename to tests/script/tsim/parser/single_row_in_tb.sim diff --git a/tests/script/general/parser/single_row_in_tb_query.sim b/tests/script/tsim/parser/single_row_in_tb_query.sim similarity index 100% rename from tests/script/general/parser/single_row_in_tb_query.sim rename to tests/script/tsim/parser/single_row_in_tb_query.sim diff --git a/tests/script/general/parser/sliding.sim b/tests/script/tsim/parser/sliding.sim similarity index 100% rename from tests/script/general/parser/sliding.sim rename to tests/script/tsim/parser/sliding.sim diff --git a/tests/script/general/parser/slimit.sim b/tests/script/tsim/parser/slimit.sim similarity index 100% rename from tests/script/general/parser/slimit.sim rename to tests/script/tsim/parser/slimit.sim diff --git a/tests/script/general/parser/slimit1.sim b/tests/script/tsim/parser/slimit1.sim similarity index 100% rename from tests/script/general/parser/slimit1.sim rename to tests/script/tsim/parser/slimit1.sim diff --git a/tests/script/general/parser/slimit1_query.sim b/tests/script/tsim/parser/slimit1_query.sim similarity index 100% rename from tests/script/general/parser/slimit1_query.sim rename to tests/script/tsim/parser/slimit1_query.sim diff --git a/tests/script/general/parser/slimit_alter_tags.sim b/tests/script/tsim/parser/slimit_alter_tags.sim similarity index 100% rename from tests/script/general/parser/slimit_alter_tags.sim rename to tests/script/tsim/parser/slimit_alter_tags.sim diff --git a/tests/script/general/parser/slimit_query.sim b/tests/script/tsim/parser/slimit_query.sim similarity index 100% rename from tests/script/general/parser/slimit_query.sim rename to tests/script/tsim/parser/slimit_query.sim diff --git a/tests/script/general/parser/stableOp.sim b/tests/script/tsim/parser/stableOp.sim similarity index 100% rename from tests/script/general/parser/stableOp.sim rename to tests/script/tsim/parser/stableOp.sim diff --git a/tests/script/general/parser/tags_dynamically_specifiy.sim b/tests/script/tsim/parser/tags_dynamically_specifiy.sim similarity index 100% rename from tests/script/general/parser/tags_dynamically_specifiy.sim rename to tests/script/tsim/parser/tags_dynamically_specifiy.sim diff --git a/tests/script/general/parser/tags_filter.sim b/tests/script/tsim/parser/tags_filter.sim similarity index 100% rename from tests/script/general/parser/tags_filter.sim rename to tests/script/tsim/parser/tags_filter.sim diff --git a/tests/script/general/parser/tbnameIn.sim b/tests/script/tsim/parser/tbnameIn.sim similarity index 100% rename from tests/script/general/parser/tbnameIn.sim rename to tests/script/tsim/parser/tbnameIn.sim diff --git a/tests/script/general/parser/tbnameIn_query.sim b/tests/script/tsim/parser/tbnameIn_query.sim similarity index 100% rename from tests/script/general/parser/tbnameIn_query.sim rename to tests/script/tsim/parser/tbnameIn_query.sim diff --git a/tests/script/general/parser/timestamp.sim b/tests/script/tsim/parser/timestamp.sim similarity index 100% rename from tests/script/general/parser/timestamp.sim rename to tests/script/tsim/parser/timestamp.sim diff --git a/tests/script/general/parser/timestamp_query.sim b/tests/script/tsim/parser/timestamp_query.sim similarity index 100% rename from tests/script/general/parser/timestamp_query.sim rename to tests/script/tsim/parser/timestamp_query.sim diff --git a/tests/script/general/parser/top_groupby.sim b/tests/script/tsim/parser/top_groupby.sim similarity index 100% rename from tests/script/general/parser/top_groupby.sim rename to tests/script/tsim/parser/top_groupby.sim diff --git a/tests/script/general/parser/topbot.sim b/tests/script/tsim/parser/topbot.sim similarity index 100% rename from tests/script/general/parser/topbot.sim rename to tests/script/tsim/parser/topbot.sim diff --git a/tests/script/general/parser/udf.sim b/tests/script/tsim/parser/udf.sim similarity index 100% rename from tests/script/general/parser/udf.sim rename to tests/script/tsim/parser/udf.sim diff --git a/tests/script/general/parser/udf_dll.sim b/tests/script/tsim/parser/udf_dll.sim similarity index 100% rename from tests/script/general/parser/udf_dll.sim rename to tests/script/tsim/parser/udf_dll.sim diff --git a/tests/script/general/parser/udf_dll_stable.sim b/tests/script/tsim/parser/udf_dll_stable.sim similarity index 100% rename from tests/script/general/parser/udf_dll_stable.sim rename to tests/script/tsim/parser/udf_dll_stable.sim diff --git a/tests/script/general/parser/union.sim b/tests/script/tsim/parser/union.sim similarity index 100% rename from tests/script/general/parser/union.sim rename to tests/script/tsim/parser/union.sim diff --git a/tests/script/general/parser/where.sim b/tests/script/tsim/parser/where.sim similarity index 100% rename from tests/script/general/parser/where.sim rename to tests/script/tsim/parser/where.sim diff --git a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim index 6cca47423a..868207c80b 100644 --- a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim +++ b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim @@ -41,7 +41,8 @@ print =============== show streams ================================ sql show streams; print $data00 $data01 $data02 -if $data00 != d1 then +if $data00 != sma_index_name1 then + print $data00 return -1 endi diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 44f96cbefa..1ffca2a67b 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -239,5 +239,131 @@ if $data32 != 6 then goto loop0 endi +print step 4 + +sql create database test1 vgroups 1 +sql use test1 +sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams11 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams12 trigger at_once into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); + +sql insert into t1 values(1648791213000,1,2,3,1.0); +sql insert into t1 values(1648791223001,2,2,3,1.1); +sql insert into t1 values(1648791233002,3,2,3,2.1); +sql insert into t1 values(1648791243003,4,2,3,3.1); +sql insert into t1 values(1648791213004,4,2,3,4.1); + +sql insert into t2 values(1648791213000,1,2,3,1.0); +sql insert into t2 values(1648791223001,2,2,3,1.1); +sql insert into t2 values(1648791233002,3,2,3,2.1); +sql insert into t2 values(1648791243003,4,2,3,3.1); +sql insert into t2 values(1648791213004,4,2,3,4.1); + +$loop_count = 0 + +loop1: +sleep 300 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt + +# row 0 +if $data01 != 2 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 5 then + print =====data02=$data02 + goto loop1 +endi + +# row 1 +if $data11 != 1 then + print =====data11=$data11 + goto loop1 +endi + +if $data12 != 2 then + print =====data12=$data12 + goto loop1 +endi + +# row 2 +if $data21 != 1 then + print =====data21=$data21 + goto loop1 +endi + +if $data22 != 3 then + print =====data22=$data22 + goto loop1 +endi + +# row 3 +if $data31 != 1 then + print =====data31=$data31 + goto loop1 +endi + +if $data32 != 4 then + print =====data32=$data32 + goto loop1 +endi + +print step 5 + +sql select * from streamt2 + +# row 0 +if $data01 != 4 then + print =====data01=$data01 + goto loop1 +endi + +if $data02 != 10 then + print =====data02=$data02 + goto loop1 +endi + +# row 1 +if $data11 != 2 then + print =====data11=$data11 + goto loop1 +endi + +if $data12 != 4 then + print =====data12=$data12 + goto loop1 +endi + +# row 2 +if $data21 != 2 then + print =====data21=$data21 + goto loop1 +endi + +if $data22 != 6 then + print =====data22=$data22 + goto loop1 +endi + +# row 3 +if $data31 != 2 then + print =====data31=$data31 + goto loop1 +endi + +if $data32 != 8 then + print =====data32=$data32 + goto loop1 +endi system sh/stop_dnodes.sh \ No newline at end of file diff --git a/tests/script/general/table/autocreate.sim b/tests/script/tsim/table/autocreate.sim similarity index 98% rename from tests/script/general/table/autocreate.sim rename to tests/script/tsim/table/autocreate.sim index 404c714ab4..1267e33932 100644 --- a/tests/script/general/table/autocreate.sim +++ b/tests/script/tsim/table/autocreate.sim @@ -1,13 +1,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect print =============== create database sql create database db sql show databases -if $rows != 1 then +if $rows != 3 then return -1 endi diff --git a/tests/script/general/table/back_insert.sim b/tests/script/tsim/table/back_insert.sim similarity index 100% rename from tests/script/general/table/back_insert.sim rename to tests/script/tsim/table/back_insert.sim diff --git a/tests/script/tsim/table/basic1.sim b/tests/script/tsim/table/basic1.sim index 913ced74aa..6cb5bc54f7 100644 --- a/tests/script/tsim/table/basic1.sim +++ b/tests/script/tsim/table/basic1.sim @@ -213,23 +213,6 @@ endi system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - print =============== query data sql select * from c1 print rows: $rows diff --git a/tests/script/general/table/basic2.sim b/tests/script/tsim/table/basic2.sim similarity index 93% rename from tests/script/general/table/basic2.sim rename to tests/script/tsim/table/basic2.sim index 4286f9ee4a..297ae3d333 100644 --- a/tests/script/general/table/basic2.sim +++ b/tests/script/tsim/table/basic2.sim @@ -1,7 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect print =============== one table @@ -21,11 +20,11 @@ endi print =============== show sql show databases -if $data02 != 2 then +if $data22 != 2 then return -1 endi -if $data03 != 1 then +if $data24 != 1 then return -1 endi @@ -34,7 +33,7 @@ if $data00 != 2 then return -1 endi -if $data01 != 2 then +if $data01 != d1 then return -1 endi diff --git a/tests/script/general/table/basic3.sim b/tests/script/tsim/table/basic3.sim similarity index 97% rename from tests/script/general/table/basic3.sim rename to tests/script/tsim/table/basic3.sim index 41c276ae98..c9335b6d1b 100644 --- a/tests/script/general/table/basic3.sim +++ b/tests/script/tsim/table/basic3.sim @@ -1,13 +1,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect print =============== create database sql create database db sql show databases -if $rows != 1 then +if $rows != 3 then return -1 endi diff --git a/tests/script/general/table/bigint.sim b/tests/script/tsim/table/bigint.sim similarity index 95% rename from tests/script/general/table/bigint.sim rename to tests/script/tsim/table/bigint.sim index d75f406d77..4611db112f 100644 --- a/tests/script/general/table/bigint.sim +++ b/tests/script/tsim/table/bigint.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -66,7 +63,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/binary.sim b/tests/script/tsim/table/binary.sim similarity index 93% rename from tests/script/general/table/binary.sim rename to tests/script/tsim/table/binary.sim index 47915530ef..a2cfc77796 100644 --- a/tests/script/general/table/binary.sim +++ b/tests/script/tsim/table/binary.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -56,7 +53,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/bool.sim b/tests/script/tsim/table/bool.sim similarity index 95% rename from tests/script/general/table/bool.sim rename to tests/script/tsim/table/bool.sim index e49637448f..454bf47d33 100644 --- a/tests/script/general/table/bool.sim +++ b/tests/script/tsim/table/bool.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -85,7 +82,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/column2.sim b/tests/script/tsim/table/column2.sim similarity index 87% rename from tests/script/general/table/column2.sim rename to tests/script/tsim/table/column2.sim index 441766f2d4..e540835c14 100644 --- a/tests/script/general/table/column2.sim +++ b/tests/script/tsim/table/column2.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print =============== step1 @@ -19,7 +16,7 @@ endi sql drop database db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/column_name.sim b/tests/script/tsim/table/column_name.sim similarity index 94% rename from tests/script/general/table/column_name.sim rename to tests/script/tsim/table/column_name.sim index 47fcfab5a8..bad6c95bb1 100644 --- a/tests/script/general/table/column_name.sim +++ b/tests/script/tsim/table/column_name.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -79,7 +76,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/column_num.sim b/tests/script/tsim/table/column_num.sim similarity index 96% rename from tests/script/general/table/column_num.sim rename to tests/script/tsim/table/column_num.sim index a18173bc8f..0a5d151adf 100644 --- a/tests/script/general/table/column_num.sim +++ b/tests/script/tsim/table/column_num.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -78,7 +75,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/column_value.sim b/tests/script/tsim/table/column_value.sim similarity index 95% rename from tests/script/general/table/column_value.sim rename to tests/script/tsim/table/column_value.sim index 1edf8c2992..861e2f1a8d 100644 --- a/tests/script/general/table/column_value.sim +++ b/tests/script/tsim/table/column_value.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -68,7 +65,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/createmulti.sim b/tests/script/tsim/table/createmulti.sim similarity index 97% rename from tests/script/general/table/createmulti.sim rename to tests/script/tsim/table/createmulti.sim index 0da1ce96a7..e204bd4f3d 100644 --- a/tests/script/general/table/createmulti.sim +++ b/tests/script/tsim/table/createmulti.sim @@ -1,13 +1,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 sql connect print =============== create database sql create database db sql show databases -if $rows != 1 then +if $rows != 3 then return -1 endi diff --git a/tests/script/general/table/date.sim b/tests/script/tsim/table/date.sim similarity index 81% rename from tests/script/general/table/date.sim rename to tests/script/tsim/table/date.sim index 23188e12e0..f2361cf4f5 100644 --- a/tests/script/general/table/date.sim +++ b/tests/script/tsim/table/date.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -27,18 +24,18 @@ if $data00 != @17-01-01 08:00:00.001@ then endi print =============== step2 -sql insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2) -#sql insert into $tb values ('2017-08-28 00:23:46cd .429', 2) +sql_error insert into $tb values ('2017-08-28 00:23:46.429+ 1a', 2) +sql_error insert into $tb values ('2017-08-28 00:23:46cd .429', 2) sql select ts from $tb -if $rows != 2 then +if $rows != 1 then return -1 endi print =============== step3 -#sql insert into $tb values ('1970-01-01 08:00:00.000', 3) -#sql insert into $tb values ('1970-01-01 08:00:00.000', 3) +sql_error insert into $tb values ('1970-01-01 08:00:00.000', 3) +sql_error insert into $tb values ('1970-01-01 08:00:00.000', 3) sql select ts from $tb -if $rows != 2 then +if $rows != 1 then return -1 endi @@ -57,7 +54,7 @@ print =============== step5 sql_error insert into $tb values ('9999-12-31 213:59:59.999', 13) sql select ts from $tb print $rows -if $rows != 8 then +if $rows != 7 then return -1 endi @@ -65,7 +62,7 @@ print =============== step6 sql_error insert into $tb values ('9999-12-99 23:59:59.999', 13) sql select ts from $tb -if $rows != 8 then +if $rows != 7 then return -1 endi @@ -83,7 +80,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/db.table.sim b/tests/script/tsim/table/db.table.sim similarity index 90% rename from tests/script/general/table/db.table.sim rename to tests/script/tsim/table/db.table.sim index 906396402a..b5d8294b6e 100644 --- a/tests/script/general/table/db.table.sim +++ b/tests/script/tsim/table/db.table.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -40,7 +37,7 @@ sql drop table $table sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/delete_reuse1.sim b/tests/script/tsim/table/delete_reuse1.sim similarity index 100% rename from tests/script/general/table/delete_reuse1.sim rename to tests/script/tsim/table/delete_reuse1.sim diff --git a/tests/script/general/table/delete_reuse2.sim b/tests/script/tsim/table/delete_reuse2.sim similarity index 100% rename from tests/script/general/table/delete_reuse2.sim rename to tests/script/tsim/table/delete_reuse2.sim diff --git a/tests/script/general/table/delete_writing.sim b/tests/script/tsim/table/delete_writing.sim similarity index 100% rename from tests/script/general/table/delete_writing.sim rename to tests/script/tsim/table/delete_writing.sim diff --git a/tests/script/general/table/describe.sim b/tests/script/tsim/table/describe.sim similarity index 90% rename from tests/script/general/table/describe.sim rename to tests/script/tsim/table/describe.sim index e59371e530..28690e5794 100644 --- a/tests/script/general/table/describe.sim +++ b/tests/script/tsim/table/describe.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -42,7 +39,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/double.sim b/tests/script/tsim/table/double.sim similarity index 96% rename from tests/script/general/table/double.sim rename to tests/script/tsim/table/double.sim index ab3f2428bd..08f0dc7663 100644 --- a/tests/script/general/table/double.sim +++ b/tests/script/tsim/table/double.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -91,7 +88,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/float.sim b/tests/script/tsim/table/float.sim similarity index 96% rename from tests/script/general/table/float.sim rename to tests/script/tsim/table/float.sim index 2d0ea0e5ea..c53b4bb1a4 100644 --- a/tests/script/general/table/float.sim +++ b/tests/script/tsim/table/float.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -91,7 +88,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/int.sim b/tests/script/tsim/table/int.sim similarity index 71% rename from tests/script/general/table/int.sim rename to tests/script/tsim/table/int.sim index f30b5b28f5..7e3cefc7ca 100644 --- a/tests/script/general/table/int.sim +++ b/tests/script/tsim/table/int.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -27,12 +24,10 @@ if $data01 != NULL then endi print =============== step2 -sql insert into $tb values (now+1m, -2147483648) -x step2 - return -1 -step2: -sql insert into $tb values (now+1m, NULL) +sql insert into $tb values (now+1m, -2147483648) +sql insert into $tb values (now+2m, NULL) sql select * from $tb order by ts desc -if $rows != 2 then +if $rows != 3 then return -1 endi if $data01 != NULL then @@ -40,9 +35,9 @@ if $data01 != NULL then endi print =============== step3 -sql insert into $tb values (now+2m, 2147483647) +sql insert into $tb values (now+3m, 2147483647) sql select * from $tb order by ts desc -if $rows != 3 then +if $rows != 4 then return -1 endi if $data01 != 2147483647 then @@ -50,12 +45,10 @@ if $data01 != 2147483647 then endi print =============== step4 -sql insert into $tb values (now+3m, 2147483648) -x step4 - return -1 -step4: -sql insert into $tb values (now+3m, NULL) +sql_error insert into $tb values (now+4m, 2147483648) +sql insert into $tb values (now+5m, NULL) sql select * from $tb order by ts desc -if $rows != 4 then +if $rows != 5 then return -1 endi if $data01 != NULL then @@ -63,10 +56,10 @@ if $data01 != NULL then endi print =============== step5 -sql_error insert into $tb values (now+4m, a2) -sql insert into $tb values (now+4m, 0) +sql_error insert into $tb values (now+6m, a2) +sql insert into $tb values (now+7m, 0) sql select * from $tb order by ts desc -if $rows != 5 then +if $rows != 6 then return -1 endi if $data01 != 0 then @@ -74,19 +67,8 @@ if $data01 != 0 then endi print =============== step6 -sql_error insert into $tb values (now+5m, 2a) -sql insert into $tb values (now+5m, 2) -sql select * from $tb order by ts desc -if $rows != 6 then - return -1 -endi -if $data01 != 2 then - return -1 -endi - -print =============== step7 -sql_error insert into $tb values (now+6m, 2a'1) -sql insert into $tb values (now+6m, 2) +sql_error insert into $tb values (now+8m, 2a) +sql insert into $tb values (now+9m, 2) sql select * from $tb order by ts desc if $rows != 7 then return -1 @@ -95,18 +77,19 @@ if $data01 != 2 then return -1 endi -print =============== step8 -sql insert into $tb values (now+8m, "NULL") +print =============== step7 +sql_error insert into $tb values (now+10m, 2a'1) +sql insert into $tb values (now+11m, 2) sql select * from $tb order by ts desc if $rows != 8 then return -1 endi -if $data01 != NULL then +if $data01 != 2 then return -1 endi -print =============== step9 -sql insert into $tb values (now+9m, 'NULL') +print =============== step8 +sql insert into $tb values (now+12m, "NULL") sql select * from $tb order by ts desc if $rows != 9 then return -1 @@ -115,19 +98,29 @@ if $data01 != NULL then return -1 endi -print =============== step10 -sql insert into $tb values (now+10m, -123) +print =============== step9 +sql insert into $tb values (now+13m, 'NULL') sql select * from $tb order by ts desc if $rows != 10 then return -1 endi +if $data01 != NULL then + return -1 +endi + +print =============== step10 +sql insert into $tb values (now+14m, -123) +sql select * from $tb order by ts desc +if $rows != 11 then + return -1 +endi if $data01 != -123 then return -1 endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/limit.sim b/tests/script/tsim/table/limit.sim similarity index 86% rename from tests/script/general/table/limit.sim rename to tests/script/tsim/table/limit.sim index dd38453d0c..d20938367e 100644 --- a/tests/script/general/table/limit.sim +++ b/tests/script/tsim/table/limit.sim @@ -1,11 +1,6 @@ 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 129 -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 8 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ============================ dnode1 start @@ -17,10 +12,10 @@ $db = $dbPrefix . $i $tb = $tbPrefix . $i print =================== step 0 -sql create database $db +sql create database $db vgroups 8 sql use $db sql show vgroups -if $rows != 0 then +if $rows != 8 then return -1 endi @@ -87,7 +82,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/smallint.sim b/tests/script/tsim/table/smallint.sim similarity index 71% rename from tests/script/general/table/smallint.sim rename to tests/script/tsim/table/smallint.sim index f622ce7853..87140c561a 100644 --- a/tests/script/general/table/smallint.sim +++ b/tests/script/tsim/table/smallint.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -28,12 +25,10 @@ if $data01 != NULL then endi print =============== step2 -sql insert into $tb values (now+1m, -32768) -x step2 - return -1 -step2: -sql insert into $tb values (now+1m, NULL) +sql insert into $tb values (now+1m, -32768) +sql insert into $tb values (now+2m, NULL) sql select * from $tb order by ts desc -if $rows != 2 then +if $rows != 3 then return -1 endi if $data01 != NULL then @@ -41,9 +36,9 @@ if $data01 != NULL then endi print =============== step3 -sql insert into $tb values (now+2m, 32767) +sql insert into $tb values (now+3m, 32767) sql select * from $tb order by ts desc -if $rows != 3 then +if $rows != 4 then return -1 endi if $data01 != 32767 then @@ -51,12 +46,12 @@ if $data01 != 32767 then endi print =============== step4 -sql insert into $tb values (now+3m, 32768) -x step4 +sql insert into $tb values (now+4m, 32768) -x step4 return -1 step4: -sql insert into $tb values (now+3m, NULL) +sql insert into $tb values (now+5m, NULL) sql select * from $tb order by ts desc -if $rows != 4 then +if $rows != 5 then return -1 endi if $data01 != NULL then @@ -64,10 +59,10 @@ if $data01 != NULL then endi print =============== step5 -sql_error insert into $tb values (now+4m, a2) -sql insert into $tb values (now+4m, 0) +sql_error insert into $tb values (now+6m, a2) +sql insert into $tb values (now+7m, 0) sql select * from $tb order by ts desc -if $rows != 5 then +if $rows != 6 then return -1 endi if $data01 != 0 then @@ -75,19 +70,8 @@ if $data01 != 0 then endi print =============== step6 -sql_error insert into $tb values (now+5m, 2a) -sql insert into $tb values (now+5m, 2) -sql select * from $tb order by ts desc -if $rows != 6 then - return -1 -endi -if $data01 != 2 then - return -1 -endi - -print =============== step7 -sql_error insert into $tb values (now+6m, 2a'1) -sql insert into $tb values (now+6m, 2) +sql_error insert into $tb values (now+8m, 2a) +sql insert into $tb values (now+9m, 2) sql select * from $tb order by ts desc if $rows != 7 then return -1 @@ -96,9 +80,20 @@ if $data01 != 2 then return -1 endi +print =============== step7 +sql_error insert into $tb values (now+10m, 2a'1) +sql insert into $tb values (now+11m, 2) +sql select * from $tb order by ts desc +if $rows != 8 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +return sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/table.sim b/tests/script/tsim/table/table.sim similarity index 95% rename from tests/script/general/table/table.sim rename to tests/script/tsim/table/table.sim index c9806c40c6..65774dd03c 100644 --- a/tests/script/general/table/table.sim +++ b/tests/script/tsim/table/table.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ============================ dnode1 start @@ -200,16 +197,15 @@ if $data01 != 7 then endi print =============== step10 -$i = 1 $tb = $tbPrefix . $i -sql create table $tb (ts timestamp, val tinyint, val2 tinyint) +sql_error 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_error create table $tb (ts timestamp, val float, val2 double) sql show tables if $rows != 7 then return -1 @@ -217,7 +213,7 @@ endi sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/table_len.sim b/tests/script/tsim/table/table_len.sim similarity index 96% rename from tests/script/general/table/table_len.sim rename to tests/script/tsim/table/table_len.sim index d95c9ab0aa..e48c5d419e 100644 --- a/tests/script/general/table/table_len.sim +++ b/tests/script/tsim/table/table_len.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -98,7 +95,7 @@ step8: sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/tinyint.sim b/tests/script/tsim/table/tinyint.sim similarity index 71% rename from tests/script/general/table/tinyint.sim rename to tests/script/tsim/table/tinyint.sim index afa931fc79..4764600b5b 100644 --- a/tests/script/general/table/tinyint.sim +++ b/tests/script/tsim/table/tinyint.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect $i = 0 @@ -27,12 +24,10 @@ if $data01 != NULL then endi print =============== step2 -sql insert into $tb values (now+1m, -128) -x step2 - return -1 -step2: -sql insert into $tb values (now+1m, NULL) +sql insert into $tb values (now+1m, -128) +sql insert into $tb values (now+2m, NULL) sql select * from $tb order by ts desc -if $rows != 2 then +if $rows != 3 then return -1 endi if $data01 != NULL then @@ -40,9 +35,9 @@ if $data01 != NULL then endi print =============== step3 -sql insert into $tb values (now+2m, 127) +sql insert into $tb values (now+3m, 127) sql select * from $tb order by ts desc -if $rows != 3 then +if $rows != 4 then return -1 endi if $data01 != 127 then @@ -50,12 +45,12 @@ if $data01 != 127 then endi print =============== step4 -sql insert into $tb values (now+3m, 128) -x step4 +sql insert into $tb values (now+4m, 128) -x step4 return -1 step4: -sql insert into $tb values (now+3m, NULL) +sql insert into $tb values (now+5m, NULL) sql select * from $tb -if $rows != 4 then +if $rows != 5 then return -1 endi if $data01 != NULL then @@ -63,10 +58,10 @@ if $data01 != NULL then endi print =============== step5 -sql_error insert into $tb values (now+4m, a2) -sql insert into $tb values (now+4m, 0) +sql_error insert into $tb values (now+6m, a2) +sql insert into $tb values (now+7m, 0) sql select * from $tb order by ts desc -if $rows != 5 then +if $rows != 6 then return -1 endi if $data01 != 0 then @@ -74,19 +69,8 @@ if $data01 != 0 then endi print =============== step6 -sql_error insert into $tb values (now+5m, 2a) -sql insert into $tb values (now+5m, 2) -sql select * from $tb order by ts desc -if $rows != 6 then - return -1 -endi -if $data01 != 2 then - return -1 -endi - -print =============== step7 -sql_error insert into $tb values (now+6m, 2a'1) -sql insert into $tb values (now+6m, 2) +sql_error insert into $tb values (now+8m, 2a) +sql insert into $tb values (now+9m, 2) sql select * from $tb order by ts desc if $rows != 7 then return -1 @@ -95,9 +79,20 @@ if $data01 != 2 then return -1 endi +print =============== step7 +sql_error insert into $tb values (now+10m, 2a'1) +sql insert into $tb values (now+11m, 2) +sql select * from $tb order by ts desc +if $rows != 8 then + return -1 +endi +if $data01 != 2 then + return -1 +endi + sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/table/vgroup.sim b/tests/script/tsim/table/vgroup.sim similarity index 86% rename from tests/script/general/table/vgroup.sim rename to tests/script/tsim/table/vgroup.sim index d306a4731d..2925e9de4c 100644 --- a/tests/script/general/table/vgroup.sim +++ b/tests/script/tsim/table/vgroup.sim @@ -1,12 +1,8 @@ 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 maxVgroupsPerDb -v 4 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect + print ============================ dnode1 start $i = 0 @@ -16,10 +12,10 @@ $db = $dbPrefix . $i $tb = $tbPrefix . $i print =================== step 1 -sql create database $db +sql create database $db vgroups 4 sql use $db sql show vgroups -if $rows != 0 then +if $rows != 4 then return -1 endi @@ -28,7 +24,7 @@ sql create table table2 (ts timestamp, speed int) sql create table table3 (ts timestamp, speed int) sql create table table4 (ts timestamp, speed int) sql show vgroups -if $rows != 1 then +if $rows != 4 then return -1 endi @@ -37,7 +33,7 @@ sql create table table6 (ts timestamp, speed int) sql create table table7 (ts timestamp, speed int) sql create table table8 (ts timestamp, speed int) sql show vgroups -if $rows != 2 then +if $rows != 4 then return -1 endi @@ -46,7 +42,7 @@ sql create table table10 (ts timestamp, speed int) sql create table table11 (ts timestamp, speed int) sql create table table12 (ts timestamp, speed int) sql show vgroups -if $rows != 3 then +if $rows != 4 then return -1 endi @@ -58,7 +54,7 @@ endi sql drop table table13 sql show vgroups -if $rows != 3 then +if $rows != 4 then return -1 endi @@ -72,10 +68,10 @@ print =================== step 2 $i = 1 $db = $dbPrefix . $i -sql create database $db +sql create database $db vgroups 2 sql use $db sql show vgroups -if $rows != 0 then +if $rows != 2 then return -1 endi @@ -88,13 +84,13 @@ $db = $dbPrefix . $i sql use $db sql create table table2 (ts timestamp, speed int) sql show vgroups -if $rows != 1 then +if $rows != 2 then return -1 endi sql drop table table2 sql show vgroups -if $rows != 0 then +if $rows != 2 then return -1 endi @@ -104,7 +100,7 @@ sql create table table3 (ts timestamp, speed int) sql create table table4 (ts timestamp, speed int) sql drop table table1 sql show vgroups -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -133,7 +129,7 @@ sql create database $db sql use $db sql show databases -if $rows != 5 then +if $rows != 7 then return -1 endi @@ -144,7 +140,7 @@ while $i < 5 $i = $i + 1 endw sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/3.sim b/tests/script/tsim/tag/3.sim similarity index 97% rename from tests/script/general/rm_bak/tag/3.sim rename to tests/script/tsim/tag/3.sim index 20185f5f01..d816aec3e3 100644 --- a/tests/script/general/rm_bak/tag/3.sim +++ b/tests/script/tsim/tag/3.sim @@ -1,9 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -494,28 +491,28 @@ if $data00 != 25 then 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 +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 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol2 +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 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol3 +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 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/4.sim b/tests/script/tsim/tag/4.sim similarity index 97% rename from tests/script/general/rm_bak/tag/4.sim rename to tests/script/tsim/tag/4.sim index ee3c8efa6c..fcdb146fb9 100644 --- a/tests/script/general/rm_bak/tag/4.sim +++ b/tests/script/tsim/tag/4.sim @@ -1,13 +1,7 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect -sql reset query cache print ======================== dnode1 start @@ -681,34 +675,34 @@ if $data00 != 25 then 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 +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 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol2 +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 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol3 +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 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol4 +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 partition by tgcol4 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/5.sim b/tests/script/tsim/tag/5.sim similarity index 97% rename from tests/script/general/rm_bak/tag/5.sim rename to tests/script/tsim/tag/5.sim index 895b1a9492..92695ddfcf 100644 --- a/tests/script/general/rm_bak/tag/5.sim +++ b/tests/script/tsim/tag/5.sim @@ -1,13 +1,7 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect -sql reset query cache print ======================== dnode1 start @@ -798,40 +792,40 @@ 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 +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 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol2 +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 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol3 +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 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol4 +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 partition by tgcol4 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol5 +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 partition by tgcol5 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/6.sim b/tests/script/tsim/tag/6.sim similarity index 98% rename from tests/script/general/rm_bak/tag/6.sim rename to tests/script/tsim/tag/6.sim index 9190998bb3..4f7f5b88d1 100644 --- a/tests/script/general/rm_bak/tag/6.sim +++ b/tests/script/tsim/tag/6.sim @@ -1,13 +1,7 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect -sql reset query cache print ======================== dnode1 start @@ -947,46 +941,46 @@ if $data00 != 25 then 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 +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 partition by tgcol1 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol2 +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 partition by tgcol2 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol3 +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 partition by tgcol3 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol4 +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 partition by tgcol4 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol5 +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 partition by tgcol5 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +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 interval(1d) group by tgcol6 +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 partition by tgcol6 interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/add.sim b/tests/script/tsim/tag/add.sim similarity index 99% rename from tests/script/general/rm_bak/tag/add.sim rename to tests/script/tsim/tag/add.sim index 4a3871235e..2901614889 100644 --- a/tests/script/general/rm_bak/tag/add.sim +++ b/tests/script/tsim/tag/add.sim @@ -1,10 +1,6 @@ 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 ======================== dnode1 start @@ -849,7 +845,7 @@ step142: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bigint.sim b/tests/script/tsim/tag/bigint.sim similarity index 96% rename from tests/script/general/rm_bak/tag/bigint.sim rename to tests/script/tsim/tag/bigint.sim index 3e5d528980..565688270c 100644 --- a/tests/script/general/rm_bak/tag/bigint.sim +++ b/tests/script/tsim/tag/bigint.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -226,18 +220,17 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/binary.sim b/tests/script/tsim/tag/binary.sim similarity index 96% rename from tests/script/general/rm_bak/tag/binary.sim rename to tests/script/tsim/tag/binary.sim index 960f45675d..f3f89d6659 100644 --- a/tests/script/general/rm_bak/tag/binary.sim +++ b/tests/script/tsim/tag/binary.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -226,18 +220,17 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/binary_binary.sim b/tests/script/tsim/tag/binary_binary.sim similarity index 97% rename from tests/script/general/rm_bak/tag/binary_binary.sim rename to tests/script/tsim/tag/binary_binary.sim index 3a0fb56848..071b457b44 100644 --- a/tests/script/general/rm_bak/tag/binary_binary.sim +++ b/tests/script/tsim/tag/binary_binary.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -295,16 +290,16 @@ if $data00 != 25 then 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bool.sim b/tests/script/tsim/tag/bool.sim similarity index 95% rename from tests/script/general/rm_bak/tag/bool.sim rename to tests/script/tsim/tag/bool.sim index e37cba669b..25c7b2d967 100644 --- a/tests/script/general/rm_bak/tag/bool.sim +++ b/tests/script/tsim/tag/bool.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -223,19 +217,18 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) +print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bool_binary.sim b/tests/script/tsim/tag/bool_binary.sim similarity index 97% rename from tests/script/general/rm_bak/tag/bool_binary.sim rename to tests/script/tsim/tag/bool_binary.sim index 9f6e4f7344..3fcb085e37 100644 --- a/tests/script/general/rm_bak/tag/bool_binary.sim +++ b/tests/script/tsim/tag/bool_binary.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -295,16 +290,16 @@ if $data00 != 25 then 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/bool_int.sim b/tests/script/tsim/tag/bool_int.sim similarity index 97% rename from tests/script/general/rm_bak/tag/bool_int.sim rename to tests/script/tsim/tag/bool_int.sim index 60345c2d68..2ff640b329 100644 --- a/tests/script/general/rm_bak/tag/bool_int.sim +++ b/tests/script/tsim/tag/bool_int.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -311,16 +306,16 @@ if $data00 != 25 then 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/change.sim b/tests/script/tsim/tag/change.sim similarity index 99% rename from tests/script/general/rm_bak/tag/change.sim rename to tests/script/tsim/tag/change.sim index 6f294c0f48..f58e387217 100644 --- a/tests/script/general/rm_bak/tag/change.sim +++ b/tests/script/tsim/tag/change.sim @@ -1,10 +1,6 @@ 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 ======================== dnode1 start @@ -508,7 +504,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/column.sim b/tests/script/tsim/tag/column.sim similarity index 95% rename from tests/script/general/rm_bak/tag/column.sim rename to tests/script/tsim/tag/column.sim index 5a0cd169c5..c73999230f 100644 --- a/tests/script/general/rm_bak/tag/column.sim +++ b/tests/script/tsim/tag/column.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -89,7 +84,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/commit.sim b/tests/script/tsim/tag/commit.sim similarity index 99% rename from tests/script/general/rm_bak/tag/commit.sim rename to tests/script/tsim/tag/commit.sim index bcd9d7c618..18128fc464 100644 --- a/tests/script/general/rm_bak/tag/commit.sim +++ b/tests/script/tsim/tag/commit.sim @@ -1,10 +1,6 @@ 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 ======================== dnode1 start @@ -1177,7 +1173,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/create.sim b/tests/script/tsim/tag/create.sim similarity index 99% rename from tests/script/general/rm_bak/tag/create.sim rename to tests/script/tsim/tag/create.sim index 95b4166543..e25f1eb71f 100644 --- a/tests/script/general/rm_bak/tag/create.sim +++ b/tests/script/tsim/tag/create.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/rm_bak/tag/delete.sim b/tests/script/tsim/tag/delete.sim similarity index 99% rename from tests/script/general/rm_bak/tag/delete.sim rename to tests/script/tsim/tag/delete.sim index 2a0aa27bde..bcfd822dbd 100644 --- a/tests/script/general/rm_bak/tag/delete.sim +++ b/tests/script/tsim/tag/delete.sim @@ -1,10 +1,6 @@ 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 ======================== dnode1 start @@ -820,7 +816,7 @@ step145: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/double.sim b/tests/script/tsim/tag/double.sim similarity index 96% rename from tests/script/general/rm_bak/tag/double.sim rename to tests/script/tsim/tag/double.sim index f17043393f..b8292b64e8 100644 --- a/tests/script/general/rm_bak/tag/double.sim +++ b/tests/script/tsim/tag/double.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -228,16 +222,16 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/filter.sim b/tests/script/tsim/tag/filter.sim similarity index 99% rename from tests/script/general/rm_bak/tag/filter.sim rename to tests/script/tsim/tag/filter.sim index 7a899a7e67..b9f2df0cc6 100644 --- a/tests/script/general/rm_bak/tag/filter.sim +++ b/tests/script/tsim/tag/filter.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -142,7 +140,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/float.sim b/tests/script/tsim/tag/float.sim similarity index 96% rename from tests/script/general/rm_bak/tag/float.sim rename to tests/script/tsim/tag/float.sim index 35bf7d6090..26a09e2973 100644 --- a/tests/script/general/rm_bak/tag/float.sim +++ b/tests/script/tsim/tag/float.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -228,16 +222,16 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/int.sim b/tests/script/tsim/tag/int.sim similarity index 96% rename from tests/script/general/rm_bak/tag/int.sim rename to tests/script/tsim/tag/int.sim index 4eea02c9cd..13255eb2ba 100644 --- a/tests/script/general/rm_bak/tag/int.sim +++ b/tests/script/tsim/tag/int.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -226,18 +220,17 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/int_binary.sim b/tests/script/tsim/tag/int_binary.sim similarity index 97% rename from tests/script/general/rm_bak/tag/int_binary.sim rename to tests/script/tsim/tag/int_binary.sim index 9a75697676..01d73cf0c2 100644 --- a/tests/script/general/rm_bak/tag/int_binary.sim +++ b/tests/script/tsim/tag/int_binary.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -295,16 +290,16 @@ if $data00 != 25 then 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/int_float.sim b/tests/script/tsim/tag/int_float.sim similarity index 97% rename from tests/script/general/rm_bak/tag/int_float.sim rename to tests/script/tsim/tag/int_float.sim index a03c4b7148..0b20ff3d62 100644 --- a/tests/script/general/rm_bak/tag/int_float.sim +++ b/tests/script/tsim/tag/int_float.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -311,16 +306,16 @@ if $data00 != 25 then 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/set.sim b/tests/script/tsim/tag/set.sim similarity index 99% rename from tests/script/general/rm_bak/tag/set.sim rename to tests/script/tsim/tag/set.sim index cbc964fad7..2c14313a07 100644 --- a/tests/script/general/rm_bak/tag/set.sim +++ b/tests/script/tsim/tag/set.sim @@ -1,10 +1,6 @@ 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 ======================== dnode1 start @@ -452,7 +448,7 @@ endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/smallint.sim b/tests/script/tsim/tag/smallint.sim similarity index 96% rename from tests/script/general/rm_bak/tag/smallint.sim rename to tests/script/tsim/tag/smallint.sim index e69eef05f2..70c5ee0771 100644 --- a/tests/script/general/rm_bak/tag/smallint.sim +++ b/tests/script/tsim/tag/smallint.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -226,18 +220,17 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/general/rm_bak/tag/tinyint.sim b/tests/script/tsim/tag/tinyint.sim similarity index 96% rename from tests/script/general/rm_bak/tag/tinyint.sim rename to tests/script/tsim/tag/tinyint.sim index 2d70dc7d48..b7f7616cf4 100644 --- a/tests/script/general/rm_bak/tag/tinyint.sim +++ b/tests/script/tsim/tag/tinyint.sim @@ -1,11 +1,6 @@ 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/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start @@ -51,7 +46,6 @@ while $i < 10 endw print =============== step2 -sleep 100 sql select * from $tb if $rows != $rowNum then return -1 @@ -226,18 +220,17 @@ 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 +sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt partition by tgcol interval(1d) print $data00 $data01 $data02 $data03 $data04 $data05 $data06 -if $data01 != 100 then +if $data00 != 100 then return -1 endi print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/vector/metrics_field.sim b/tests/script/tsim/vector/metrics_field.sim index 4d0f9e19fc..b75ba9cffe 100644 --- a/tests/script/tsim/vector/metrics_field.sim +++ b/tests/script/tsim/vector/metrics_field.sim @@ -41,8 +41,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/metrics_mix.sim b/tests/script/tsim/vector/metrics_mix.sim index fd36a62332..fa93f0b2e3 100644 --- a/tests/script/tsim/vector/metrics_mix.sim +++ b/tests/script/tsim/vector/metrics_mix.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/metrics_query.sim b/tests/script/tsim/vector/metrics_query.sim index 8a334acef2..5d433486e8 100644 --- a/tests/script/tsim/vector/metrics_query.sim +++ b/tests/script/tsim/vector/metrics_query.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/metrics_tag.sim b/tests/script/tsim/vector/metrics_tag.sim index 0b275336f9..c8380590d5 100644 --- a/tests/script/tsim/vector/metrics_tag.sim +++ b/tests/script/tsim/vector/metrics_tag.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/metrics_time.sim b/tests/script/tsim/vector/metrics_time.sim index bcd93cb582..efa1ae4c84 100644 --- a/tests/script/tsim/vector/metrics_time.sim +++ b/tests/script/tsim/vector/metrics_time.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/multi.sim b/tests/script/tsim/vector/multi.sim index dcedbe73c9..1b592cdd0a 100644 --- a/tests/script/tsim/vector/multi.sim +++ b/tests/script/tsim/vector/multi.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/single.sim b/tests/script/tsim/vector/single.sim index c9d794456c..4da7c78110 100644 --- a/tests/script/tsim/vector/single.sim +++ b/tests/script/tsim/vector/single.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/table_field.sim b/tests/script/tsim/vector/table_field.sim index 5ad60b2a35..d5bdad8be2 100644 --- a/tests/script/tsim/vector/table_field.sim +++ b/tests/script/tsim/vector/table_field.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/table_mix.sim b/tests/script/tsim/vector/table_mix.sim index 358d6cf87f..79ecb09d81 100644 --- a/tests/script/tsim/vector/table_mix.sim +++ b/tests/script/tsim/vector/table_mix.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/table_query.sim b/tests/script/tsim/vector/table_query.sim index 0e4562716e..d69d16eba5 100644 --- a/tests/script/tsim/vector/table_query.sim +++ b/tests/script/tsim/vector/table_query.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/vector/table_time.sim b/tests/script/tsim/vector/table_time.sim index 1e6bdb2cde..f16c95ad4a 100644 --- a/tests/script/tsim/vector/table_time.sim +++ b/tests/script/tsim/vector/table_time.sim @@ -37,8 +37,6 @@ while $i < $tbNum $i = $i + 1 endw -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/wtest.bat b/tests/script/wtest.bat index e3bbff9db5..f674277df9 100644 --- a/tests/script/wtest.bat +++ b/tests/script/wtest.bat @@ -44,9 +44,10 @@ echo serverPort 7100 >> %TAOS_CFG% echo logDir %LOG_DIR% >> %TAOS_CFG% echo scriptDir %SCRIPT_DIR% >> %TAOS_CFG% echo numOfLogLines 100000000 >> %TAOS_CFG% -echo rpcDebugFlag 135 >> %TAOS_CFG% +echo rpcDebugFlag 143 >> %TAOS_CFG% echo tmrDebugFlag 131 >> %TAOS_CFG% echo cDebugFlag 135 >> %TAOS_CFG% +echo qDebugFlag 143 >> %TAOS_CFG% echo udebugFlag 135 >> %TAOS_CFG% echo wal 0 >> %TAOS_CFG% echo asyncLog 0 >> %TAOS_CFG% diff --git a/tests/system-test/2-query/json_tag.py b/tests/system-test/2-query/json_tag.py index 70aca9fd93..b817b1afb4 100644 --- a/tests/system-test/2-query/json_tag.py +++ b/tests/system-test/2-query/json_tag.py @@ -197,7 +197,7 @@ class TDTestCase: tdSql.checkData(0, 0, "true") # test select json tag->'key', value is null tdSql.query("select jtag->'tag1' from jsons1_4") - tdSql.checkData(0, 0, None) + tdSql.checkData(0, 0, "null") # test select json tag->'key', value is double tdSql.query("select jtag->'tag1' from jsons1_5") tdSql.checkData(0, 0, "1.232000000") @@ -394,16 +394,15 @@ class TDTestCase: # test distinct tdSql.execute("insert into jsons1_14 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '你就会', 'dws')") tdSql.query("select distinct jtag->'tag1' from jsons1") - tdSql.checkRows(7) - # tdSql.query("select distinct jtag from jsons1") - # tdSql.checkRows(9) + tdSql.checkRows(8) + tdSql.error("select distinct jtag from jsons1") #test dumplicate key with normal colomn tdSql.execute("INSERT INTO jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"datastr\":\"是是是\"}') values(1591060828000, 4, false, 'jjsf', \"你就会\")") tdSql.query("select * from jsons1 where jtag->'datastr' match '是' and datastr match 'js'") tdSql.checkRows(1) - # tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'") - # tdSql.checkRows(1) + tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_15'") + tdSql.checkRows(1) # test join tdSql.execute("create table if not exists jsons2(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)") @@ -477,15 +476,10 @@ class TDTestCase: tdSql.query("select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'") tdSql.checkRows(11) tdSql.checkData(0, 1, None) - #tdSql.checkData(2, 0, 24) - #tdSql.checkData(3, 0, 3) - #tdSql.checkData(3, 1, "false") - #tdSql.checkData(8, 0, 2) - #tdSql.checkData(10, 1, '"femail"') # test having - # tdSql.query("select count(*),jtag->'tag1' from jsons1 group by jtag->'tag1' having count(*) > 1") - # tdSql.checkRows(3) + tdSql.query("select count(*),jtag->'tag1' from jsons1 group by jtag->'tag1' having count(*) > 1") + tdSql.checkRows(3) # subquery with json tag tdSql.query("select * from (select jtag, dataint from jsons1) order by dataint") @@ -495,10 +489,7 @@ class TDTestCase: tdSql.error("select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)") tdSql.error("select t->'tag1' from (select jtag->'tag1' as t, dataint from jsons1)") - # tdSql.query("select ts,jtag->'tag1' from (select jtag->'tag1',tbname,ts from jsons1 order by ts)") - # tdSql.checkRows(11) - # tdSql.checkData(1, 1, "jsons1_1") - # tdSql.checkData(1, 2, '"femail"') + tdSql.error("select ts,jtag->'tag1' from (select jtag->'tag1',tbname,ts from jsons1 order by ts)") # union all tdSql.query("select jtag->'tag1' from jsons1 union all select jtag->'tag2' from jsons2") diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index d24e5ea283..8180f511e2 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -8,7 +8,13 @@ from util.sql import * from util.cases import * class TDTestCase: - + + clientCfgDict = {'queryproxy': '1','debugFlag': 135} + clientCfgDict["debugFlag"] = 131 + updatecfgDict = {'clientCfg': {}} + updatecfgDict = {'debugFlag': 131} + updatecfgDict["clientCfg"] = clientCfgDict + def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor(), True) @@ -55,14 +61,37 @@ class TDTestCase: def tsbsIotQuery(self): tdSql.execute("use db_tsbs") + + # test interval and partition + tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet; ") + parRows=tdSql.queryRows tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m); ") - tdSql.checkRows(1) + # tdSql.checkRows(parRows) + + + # test insert into + tdSql.execute("create table testsnode (ts timestamp, c1 float,c2 binary(30),c3 binary(30),c4 binary(30)) ;") + tdSql.query("insert into testsnode SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") + + tdSql.query("insert into testsnode(ts,c1,c2,c3,c4) SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);") + # test paitition interval fill + # tdSql.query("SELECT name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0) ;") + + # # test partition interval limit + # tdSql.query("SELECT ts,model,floor(2*(sum(nzs)/count(nzs)))/floor(2*(sum(nzs)/count(nzs))) AS broken_down FROM (SELECT ts,model, status/status AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model,ts interval(10m) limit 10;") + # tdSql.checkRows(10) + + # test partition interval Pseudo time-column + tdSql.query("SELECT count(ms1)/144 FROM (SELECT _wstartts as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;") + + + # test def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdLog.printNoPrefix("==========step1:create database and table,insert data ==============") - self.tsbsIotQuery() + self.prepareData() self.tsbsIotQuery() diff --git a/tests/system-test/7-tmq/dataFromTsdbNWal.py b/tests/system-test/7-tmq/dataFromTsdbNWal.py index a55fbbfd18..227ce9d5a5 100644 --- a/tests/system-test/7-tmq/dataFromTsdbNWal.py +++ b/tests/system-test/7-tmq/dataFromTsdbNWal.py @@ -38,9 +38,9 @@ class TDTestCase: 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, - 'ctbNum': 10, + 'ctbNum': 100, 'rowsPerTbl': 10000, - 'batchNum': 1000, + 'batchNum': 3000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 10, 'showMsg': 1, @@ -64,9 +64,7 @@ class TDTestCase: ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) - tdLog.info("restart taosd to ensure that the data falls into the disk") - # tdDnodes.stop(1) - # tdDnodes.start(1) + tdLog.info("flush db to let data falls into the disk") tdSql.query("flush database %s"%(paraDict['dbName'])) return @@ -85,7 +83,7 @@ class TDTestCase: 'ctbStartIdx': 0, 'ctbNum': 10, 'rowsPerTbl': 10000, - 'batchNum': 10, + 'batchNum': 100, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 3, 'showMsg': 1, @@ -95,8 +93,6 @@ class TDTestCase: paraDict['vgroups'] = self.vgroups paraDict['ctbNum'] = self.ctbNum paraDict['rowsPerTbl'] = self.rowsPerTbl - paraDict['batchNum'] = 100 - paraDict['startTs'] = paraDict['startTs'] + self.rowsPerTbl topicNameList = ['topic1'] expectRowsList = [] @@ -125,6 +121,8 @@ class TDTestCase: tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) # after start consume, continue insert some data + paraDict['batchNum'] = 100 + paraDict['startTs'] = paraDict['startTs'] + self.rowsPerTbl tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) @@ -137,11 +135,12 @@ class TDTestCase: expectRows = 1 resultList = tmqCom.selectConsumeResult(expectRows) + + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) if expectRowsList[0] != resultList[0]: - tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("%d tmq consume rows error!"%consumerId) - tmqCom.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) time.sleep(10) for i in range(len(topicNameList)): diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 98c9e37132..151558a33a 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -428,7 +428,7 @@ class TMQCom: pThread.start() return pThread - def checkFileContent(self, consumerId, queryString): + def checkFileContent(self, consumerId, queryString, skipRowsOfCons=0): buildPath = tdCom.getBuildPath() cfgPath = tdCom.getClientCfgPath() dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) @@ -444,6 +444,11 @@ class TMQCom: # skip first line for it is schema queryFile.readline() + + # skip offset for consumer + for i in range(0,skipRowsOfCons): + consumeFile.readline() + lines = 0 while True: dst = queryFile.readline() diff --git a/tests/system-test/7-tmq/tmqDelete-1ctb.py b/tests/system-test/7-tmq/tmqDelete-1ctb.py new file mode 100644 index 0000000000..c5f7510a07 --- /dev/null +++ b/tests/system-test/7-tmq/tmqDelete-1ctb.py @@ -0,0 +1,275 @@ + +import taos +import sys +import time +import socket +import os +import threading +from enum import Enum + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.vgroups = 4 + self.ctbNum = 1 + self.rowsPerTbl = 10000 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 100000, + 'batchNum': 1200, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def delData(self,tsql,dbName,ctbPrefix,ctbNum,startTs=0,endTs=0,ctbStartIdx=0): + tdLog.debug("start to del data ............") + for i in range(ctbNum): + sql = "delete from %s.%s%d where _c0 >= %d and _c0 <= %d "%(dbName,ctbPrefix,i+ctbStartIdx,startTs,endTs) + tsql.execute(sql) + + tdLog.debug("del data ............ [OK]") + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 100000, + 'batchNum': 3000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'endTs': 0, + 'pollDelay': 5, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + # del some data + rowsOfDelete = int(paraDict["rowsPerTbl"] / 4) + paraDict["endTs"] = paraDict["startTs"] + rowsOfDelete - 1 + self.delData(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],ctbNum=paraDict["ctbNum"], + startTs=paraDict["startTs"], endTs=paraDict["endTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + # paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 0 + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("insert process end, and start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsInserted = tdSql.getRows() + + tdLog.info("act consume rows: %d, expect consume rows: %d, act insert rows: %d"%(totalConsumeRows, expectrowcnt, totalRowsInserted)) + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + + tmqCom.checkFileContent(consumerId, queryString, rowsOfDelete) + + tdSql.query("drop topic %s"%topicFromStb1) + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 5000, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 5, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['snapshot'] = self.snapshot + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("restart taosd to ensure that the data falls into the disk") + tdSql.query("flush database %s"%(paraDict['dbName'])) + + # update to 1/4 rows and insert 3/4 new rows + paraDict['startTs'] = paraDict['startTs'] + int(self.rowsPerTbl * 3 / 4) + # paraDict['rowsPerTbl'] = self.rowsPerTbl + tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # del some data + rowsOfDelete = int(self.rowsPerTbl / 4 ) + paraDict["endTs"] = paraDict["startTs"] + rowsOfDelete - 1 + self.delData(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"],ctbNum=paraDict["ctbNum"], + startTs=paraDict["startTs"], endTs=paraDict["endTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tmqCom.initConsumerTable() + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + # paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + consumerId = 1 + + if self.snapshot == 0: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1/4 + 3/4)) + elif self.snapshot == 1: + expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 - 1/4 + 1/4 + 3/4 - 1/4)) + + topicList = topicFromStb1 + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:true,\ + auto.commit.interval.ms:1000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsInserted = tdSql.getRows() + + tdLog.info("act consume rows: %d, act insert rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsInserted, expectrowcnt)) + + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tdSql.query("drop topic %s"%topicFromStb1) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + tdSql.prepare() + self.prepareTestEnv() + tdLog.printNoPrefix("=============================================") + tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + self.tmqCase1() + self.tmqCase2() + + self.prepareTestEnv() + tdLog.printNoPrefix("====================================================================") + tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") + self.snapshot = 1 + self.tmqCase1() + self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqUpdate-1ctb.py b/tests/system-test/7-tmq/tmqUpdate-1ctb.py index 8513092be9..de11f0f9ab 100644 --- a/tests/system-test/7-tmq/tmqUpdate-1ctb.py +++ b/tests/system-test/7-tmq/tmqUpdate-1ctb.py @@ -235,18 +235,18 @@ class TDTestCase: def run(self): tdSql.prepare() - # self.prepareTestEnv() - # tdLog.printNoPrefix("=============================================") - # tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") - # self.tmqCase1() - # self.tmqCase2() + self.prepareTestEnv() + tdLog.printNoPrefix("=============================================") + tdLog.printNoPrefix("======== snapshot is 0: only consume from wal") + self.tmqCase1() + self.tmqCase2() self.prepareTestEnv() tdLog.printNoPrefix("====================================================================") tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal") self.snapshot = 1 self.tmqCase1() - # self.tmqCase2() + self.tmqCase2() def stop(self): diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 2c116113bc..8bafe3c966 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -180,6 +180,7 @@ python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py #python3 ./test.py -f 7-tmq/tmqDnodeRestart.py #python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb.py +#python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py #------------querPolicy 2----------- diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 48b1223d83..136eeba531 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -38,12 +38,13 @@ def checkRunTimeError(): time.sleep(1) timeCount = timeCount + 1 print("checkRunTimeError",timeCount) - if (timeCount>900): + if (timeCount>600): print("stop the test.") os.system("TASKKILL /F /IM taosd.exe") os.system("TASKKILL /F /IM taos.exe") os.system("TASKKILL /F /IM tmq_sim.exe") os.system("TASKKILL /F /IM mintty.exe") + os.system("TASKKILL /F /IM python.exe") quit(0) hwnd = win32gui.FindWindow(None, "Microsoft Visual C++ Runtime Library") if hwnd: @@ -234,6 +235,22 @@ if __name__ == "__main__": tdDnodes.deploy(1,updateCfgDict) tdDnodes.start(1) tdCases.logSql(logSql) + if queryPolicy != 1: + queryPolicy=int(queryPolicy) + conn = taos.connect( + host, + config=tdDnodes.getSimCfgPath()) + tdSql.init(conn.cursor()) + tdSql.execute("create qnode on dnode 1") + tdSql.execute('alter local "queryPolicy" "%d"'%queryPolicy) + tdSql.query("show local variables;") + for i in range(tdSql.queryRows): + if tdSql.queryResult[i][0] == "queryPolicy" : + if int(tdSql.queryResult[i][1]) == int(queryPolicy): + tdLog.success('alter queryPolicy to %d successfully'%queryPolicy) + else : + tdLog.debug(tdSql.queryResult) + tdLog.exit("alter queryPolicy to %d failed"%queryPolicy) else : tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums)) dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums,mnodeNums=mnodeNums)