diff --git a/.travis.yml b/.travis.yml index b0911716c56d03659443a6316c7bbc7b84f18581..2e268ae04a1a7d34869fb1c5e66b118d43973948 100644 --- a/.travis.yml +++ b/.travis.yml @@ -111,7 +111,7 @@ matrix: description: TDengine # Where email notification of build analysis results will be sent - notification_email: sdsang@taosdata.com + notification_email: sdsang@taosdata.com, slguan@taosdata.com # Commands to prepare for build_command # ** likely specific to your build ** @@ -178,7 +178,7 @@ matrix: cd ${TRAVIS_BUILD_DIR} lcov -d . --capture --rc lcov_branch_coverage=1 -o coverage.info - lcov --remove coverage.info '*tests*' '*deps*' -o coverage.info + lcov --remove coverage.info '*/tests/*' '*/test/*' '*/deps/*' -o coverage.info lcov -l --rc lcov_branch_coverage=1 coverage.info || travis_terminate $? gem install coveralls-lcov diff --git a/packaging/release.sh b/packaging/release.sh index a4562d21d2bd15fa6c4ba3067f6046427bf60c2c..7a585431a2cc5e85d8670b8824b782d9f6b6eb91 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -162,18 +162,18 @@ done # output the version info to the buildinfo file. build_time=$(date +"%F %R") -echo "char version[64] = \"${version}\";" > ${versioninfo} -echo "char compatible_version[64] = \"${compatible_version}\";" >> ${versioninfo} -echo "char gitinfo[128] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo} +echo "char version[12] = \"${version}\";" > ${versioninfo} +echo "char compatible_version[12] = \"${compatible_version}\";" >> ${versioninfo} +echo "char gitinfo[48] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo} if [ "$verMode" != "cluster" ]; then - echo "char gitinfoOfInternal[128] = \"\";" >> ${versioninfo} + echo "char gitinfoOfInternal[48] = \"\";" >> ${versioninfo} else enterprise_dir="${top_dir}/../enterprise" cd ${enterprise_dir} - echo "char gitinfoOfInternal[128] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo} + echo "char gitinfoOfInternal[48] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo} cd ${curr_dir} fi -echo "char buildinfo[512] = \"Built by ${USER} at ${build_time}\";" >> ${versioninfo} +echo "char buildinfo[64] = \"Built by ${USER} at ${build_time}\";" >> ${versioninfo} echo "" >> ${versioninfo} tmp_version=$(echo $version | tr -s "." "_") if [ "$verMode" == "cluster" ]; then diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index b82551dd94e9c2a996ff6d5b98a28dbda792d6ad..c03e3be4eddcc3184e96ec314edf76f66df2a5ea 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -401,6 +401,7 @@ TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void *param, void **taos); void waitForQueryRsp(void *param, TAOS_RES *tres, int code) ; +int doAsyncParseSql(SSqlObj* pSql); void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, void (*fp)(), void *param, const char *sqlstr, size_t sqlLen); void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql); diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 177ea4201dcc9d80fae55a94bd4e8613919127a8..602b8cc430d915d133fd0761185b1671d6a17dd0 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -40,39 +40,38 @@ static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRo static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows); static void tscAsyncFetchSingleRowProxy(void *param, TAOS_RES *tres, int numOfRows); -void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const char* sqlstr, size_t sqlLen) { - SSqlCmd *pCmd = &pSql->cmd; - SSqlRes *pRes = &pSql->res; +int doAsyncParseSql(SSqlObj* pSql) { + SSqlCmd* pCmd = &pSql->cmd; + SSqlRes* pRes = &pSql->res; + int32_t code = tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE); + if (code != TSDB_CODE_SUCCESS) { + tscError("failed to malloc payload"); + tscQueueAsyncError(pSql->fp, pSql->param, TSDB_CODE_TSC_OUT_OF_MEMORY); + return code; + } + pRes->qhandle = 0; + pRes->numOfRows = 1; + + tscDump("%p SQL: %s", pSql, pSql->sqlstr); + return tsParseSql(pSql, true); +} + +void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const char* sqlstr, size_t sqlLen) { pSql->signature = pSql; pSql->param = param; pSql->pTscObj = pObj; pSql->maxRetry = TSDB_MAX_REPLICA_NUM; pSql->fp = fp; - - sem_init(&pSql->rspSem, 0, 0); - if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE)) { - tscError("failed to malloc payload"); - tscQueueAsyncError(fp, param, TSDB_CODE_TSC_OUT_OF_MEMORY); - return; - } - - // todo check for OOM problem pSql->sqlstr = calloc(1, sqlLen + 1); if (pSql->sqlstr == NULL) { tscError("%p failed to malloc sql string buffer", pSql); - tscQueueAsyncError(fp, param, TSDB_CODE_TSC_OUT_OF_MEMORY); - free(pCmd->payload); + tscQueueAsyncError(pSql->fp, pSql->param, TSDB_CODE_TSC_OUT_OF_MEMORY); return; } - - pRes->qhandle = 0; - pRes->numOfRows = 1; - strtolower(pSql->sqlstr, sqlstr); - tscDump("%p SQL: %s", pSql, pSql->sqlstr); - int32_t code = tsParseSql(pSql, true); + int32_t code = doAsyncParseSql(pSql); if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) return; if (code != TSDB_CODE_SUCCESS) { @@ -525,15 +524,11 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { if (pSql->pStream) { tscTrace("%p stream:%p meta is updated, start new query, command:%d", pSql, pSql->pStream, pSql->cmd.command); - /* - * NOTE: - * transfer the sql function for super table query before get meter/metric meta, - * since in callback functions, only tscProcessSql(pStream->pSql) is executed! - */ - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - - tscTansformSQLFuncForSTableQuery(pQueryInfo); - tscIncStreamExecutionCount(pSql->pStream); + if (!pSql->cmd.parseFinished) { + tsParseSql(pSql, false); + sem_post(&pSql->rspSem); + } + return; } else { tscTrace("%p get tableMeta successfully", pSql); } diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 8375552b93f86b0aa111447c4172a5e3cf31ea5d..f29c886cba823e04dba966a0df680df4b126aa32 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -517,7 +517,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { } } - pSql->cmd.parseFinished = true; + pCmd->parseFinished = 1; return TSDB_CODE_SUCCESS; // do not build query message here } diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index b8b2a0f8eb13c89756fc4c71d4b8b211b7869758..c4413f85414f67d8db3cb5422acc5e34e5eb87c3 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -19,6 +19,7 @@ #include "tscLog.h" #include "tscUtil.h" #include "tsched.h" +#include "tcache.h" #include "tsclient.h" #include "ttime.h" #include "ttimer.h" @@ -77,30 +78,23 @@ static void tscProcessStreamLaunchQuery(SSchedMsg *pMsg) { int code = tscGetTableMeta(pSql, pTableMetaInfo); pSql->res.code = code; - if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) return; - if (code == 0 && UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { code = tscGetSTableVgroupInfo(pSql, 0); pSql->res.code = code; - - if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) return; } - tscTansformSQLFuncForSTableQuery(pQueryInfo); - // failed to get meter/metric meta, retry in 10sec. if (code != TSDB_CODE_SUCCESS) { int64_t retryDelayTime = tscGetRetryDelayTime(pStream->slidingTime, pStream->precision); tscError("%p stream:%p,get metermeta failed, retry in %" PRId64 "ms", pStream->pSql, pStream, retryDelayTime); - tscSetRetryTimer(pStream, pSql, retryDelayTime); - return; - } - - tscTrace("%p stream:%p start stream query on:%s", pSql, pStream, pTableMetaInfo->name); - tscProcessSql(pStream->pSql); - tscIncStreamExecutionCount(pStream); + } else { + tscTansformSQLFuncForSTableQuery(pQueryInfo); + tscTrace("%p stream:%p start stream query on:%s", pSql, pStream, pTableMetaInfo->name); + tscDoQuery(pStream->pSql); + tscIncStreamExecutionCount(pStream); + } } static void tscProcessStreamTimer(void *handle, void *tmrId) { @@ -147,7 +141,8 @@ static void tscProcessStreamQueryCallback(void *param, TAOS_RES *tres, int numOf retryDelay); STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pStream->pSql->cmd, 0, 0); - tscClearTableMetaInfo(pTableMetaInfo, true); + taosCacheRelease(tscCacheHandle, (void**)&(pTableMetaInfo->pTableMeta), true); + tfree(pTableMetaInfo->vgroupList); tscSetRetryTimer(pStream, pStream->pSql, retryDelay); return; @@ -259,7 +254,9 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf pStream->numOfRes); // release the metric/meter meta information reference, so data in cache can be updated - tscClearTableMetaInfo(pTableMetaInfo, false); + + taosCacheRelease(tscCacheHandle, (void**)&(pTableMetaInfo->pTableMeta), false); + tfree(pTableMetaInfo->vgroupList); tscSetNextLaunchTimer(pStream, pSql); } } @@ -480,44 +477,37 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p SSqlObj *pSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); if (pSql == NULL) { - setErrorInfo(pSql, TSDB_CODE_TSC_OUT_OF_MEMORY, NULL); return NULL; } pSql->signature = pSql; + pSql->param = pSql; pSql->pTscObj = pObj; + SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; - int ret = tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE); - if (TSDB_CODE_SUCCESS != ret) { - setErrorInfo(pSql, ret, NULL); - free(pSql); + + SSqlStream *pStream = (SSqlStream *)calloc(1, sizeof(SSqlStream)); + if (pStream == NULL) { + tscError("%p open stream failed, sql:%s, reason:%s, code:%d", pSql, sqlstr, pCmd->payload, pRes->code); + tscFreeSqlObj(pSql); return NULL; } + pSql->pStream = pStream; - pSql->sqlstr = strdup(sqlstr); + pSql->sqlstr = calloc(1, strlen(sqlstr) + 1); if (pSql->sqlstr == NULL) { - setErrorInfo(pSql, TSDB_CODE_TSC_OUT_OF_MEMORY, NULL); - - tfree(pSql); - return NULL; + tscError("%p failed to malloc sql string buffer", pSql); + tscFreeSqlObj(pSql); + return NULL;; } + strtolower(pSql->sqlstr, sqlstr); tsem_init(&pSql->rspSem, 0, 0); - - SSqlInfo SQLInfo = qSQLParse(pSql->sqlstr); - tscResetSqlCmdObj(&pSql->cmd); - - ret = tscAllocPayload(&pSql->cmd, TSDB_DEFAULT_PAYLOAD_SIZE); - if (TSDB_CODE_SUCCESS != ret) { - setErrorInfo(pSql, ret, NULL); - tscError("%p open stream failed, sql:%s, code:%d", pSql, sqlstr, TSDB_CODE_TSC_OUT_OF_MEMORY); - tscFreeSqlObj(pSql); - return NULL; + int32_t code = doAsyncParseSql(pSql); + if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) { + sem_wait(&pSql->rspSem); } - - pRes->code = tscToSQLCmd(pSql, &SQLInfo); - SQLInfoDestroy(&SQLInfo); if (pRes->code != TSDB_CODE_SUCCESS) { setErrorInfo(pSql, pRes->code, pCmd->payload); @@ -527,15 +517,6 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p return NULL; } - SSqlStream *pStream = (SSqlStream *)calloc(1, sizeof(SSqlStream)); - if (pStream == NULL) { - setErrorInfo(pSql, TSDB_CODE_TSC_OUT_OF_MEMORY, NULL); - - tscError("%p open stream failed, sql:%s, reason:%s, code:%d", pSql, sqlstr, pCmd->payload, pRes->code); - tscFreeSqlObj(pSql); - return NULL; - } - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); @@ -549,13 +530,13 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p pStream->ctime = taosGetTimestamp(pStream->precision); pStream->etime = pQueryInfo->window.ekey; - pSql->pStream = pStream; tscAddIntoStreamList(pStream); tscSetSlidingWindowInfo(pSql, pStream); pStream->stime = tscGetStreamStartTimestamp(pSql, pStream, stime); int64_t starttime = tscGetLaunchTimestamp(pStream); + pCmd->command = TSDB_SQL_SELECT; taosTmrReset(tscProcessStreamTimer, starttime, pStream, tscTmr, &pStream->pTimer); tscTrace("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql, diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index 3a84ce8f6f3ad369e9f6972d79d3356451c4ef25..ec4e544e18c44653ea1013759cb2db1ea26fb100 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -145,6 +145,7 @@ void tdFreeDataRow(SDataRow row); void tdInitDataRow(SDataRow row, STSchema *pSchema); SDataRow tdDataRowDup(SDataRow row); +// offset here not include dataRow header length static FORCE_INLINE int tdAppendColVal(SDataRow row, void *value, int8_t type, int32_t bytes, int32_t offset) { ASSERT(value != NULL); int32_t toffset = offset + TD_DATA_ROW_HEAD_SIZE; diff --git a/src/cq/src/cqMain.c b/src/cq/src/cqMain.c index 9406a2fdce90713d784758d479e953aa18aacdb9..edb588b5544531d538529e3e027cf3dedeb44a0d 100644 --- a/src/cq/src/cqMain.c +++ b/src/cq/src/cqMain.c @@ -38,6 +38,7 @@ typedef struct { int vgId; char user[TSDB_USER_LEN]; char pass[TSDB_PASSWORD_LEN]; + char db[TSDB_DB_NAME_LEN]; FCqWrite cqWrite; void *ahandle; int num; // number of continuous streams @@ -48,7 +49,8 @@ typedef struct { } SCqContext; typedef struct SCqObj { - int tid; // table ID + uint64_t uid; + int32_t tid; // table ID int rowSize; // bytes of a row char * sqlStr; // SQL string STSchema * pSchema; // pointer to schema array @@ -73,6 +75,14 @@ void *cqOpen(void *ahandle, const SCqCfg *pCfg) { strcpy(pContext->user, pCfg->user); strcpy(pContext->pass, pCfg->pass); + const char* db = pCfg->db; + for (const char* p = db; *p != 0; p++) { + if (*p == '.') { + db = p + 1; + break; + } + } + strcpy(pContext->db, db); pContext->vgId = pCfg->vgId; pContext->cqWrite = pCfg->cqWrite; pContext->ahandle = ahandle; @@ -153,17 +163,19 @@ void cqStop(void *handle) { pthread_mutex_unlock(&pContext->mutex); } -void *cqCreate(void *handle, int tid, char *sqlStr, STSchema *pSchema) { +void *cqCreate(void *handle, uint64_t uid, int tid, char *sqlStr, STSchema *pSchema) { SCqContext *pContext = handle; SCqObj *pObj = calloc(sizeof(SCqObj), 1); if (pObj == NULL) return NULL; + pObj->uid = uid; pObj->tid = tid; pObj->sqlStr = malloc(strlen(sqlStr)+1); strcpy(pObj->sqlStr, sqlStr); pObj->pSchema = tdDupSchema(pSchema); + pObj->rowSize = schemaTLen(pSchema); cTrace("vgId:%d, id:%d CQ:%s is created", pContext->vgId, pObj->tid, pObj->sqlStr); @@ -207,16 +219,16 @@ void cqDrop(void *handle) { } static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) { - if (pContext->dbConn == NULL) { - pContext->dbConn = taos_connect("localhost", pContext->user, pContext->pass, NULL, 0); + pContext->dbConn = taos_connect("localhost", pContext->user, pContext->pass, pContext->db, 0); if (pContext->dbConn == NULL) { cError("vgId:%d, failed to connect to TDengine(%s)", pContext->vgId, tstrerror(terrno)); + return; } - return; } int64_t lastKey = 0; + pObj->pContext = pContext; pObj->pStream = taos_open_stream(pContext->dbConn, pObj->sqlStr, cqProcessStreamRes, lastKey, pObj, NULL); if (pObj->pStream) { pContext->num++; @@ -229,29 +241,49 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj) { static void cqProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) { SCqObj *pObj = (SCqObj *)param; SCqContext *pContext = pObj->pContext; + STSchema *pSchema = pObj->pSchema; if (pObj->pStream == NULL) return; cTrace("vgId:%d, id:%d CQ:%s stream result is ready", pContext->vgId, pObj->tid, pObj->sqlStr); - // construct data - int size = sizeof(SWalHead) + sizeof(SSubmitMsg) + sizeof(SSubmitBlk) + pObj->rowSize; + int size = sizeof(SWalHead) + sizeof(SSubmitMsg) + sizeof(SSubmitBlk) + TD_DATA_ROW_HEAD_SIZE + pObj->rowSize; char *buffer = calloc(size, 1); SWalHead *pHead = (SWalHead *)buffer; - pHead->msgType = TSDB_MSG_TYPE_SUBMIT; - pHead->len = size - sizeof(SWalHead); - - SSubmitMsg *pSubmit = (SSubmitMsg *) (buffer + sizeof(SWalHead)); - // to do: fill in the SSubmitMsg structure - pSubmit->numOfBlocks = 1; + SSubmitMsg *pMsg = (SSubmitMsg *) (buffer + sizeof(SWalHead)); + SSubmitBlk *pBlk = (SSubmitBlk *) (buffer + sizeof(SWalHead) + sizeof(SSubmitMsg)); + SDataRow trow = (SDataRow)pBlk->data; + tdInitDataRow(trow, pSchema); - SSubmitBlk *pBlk = (SSubmitBlk *) (buffer + sizeof(SWalHead) + sizeof(SSubmitMsg)); - // to do: fill in the SSubmitBlk strucuture - pBlk->tid = pObj->tid; + for (int32_t i = 0; i < pSchema->numOfCols; i++) { + STColumn *c = pSchema->columns + i; + char* val = (char*)row[i]; + if (IS_VAR_DATA_TYPE(c->type)) { + val -= sizeof(VarDataLenT); + } + tdAppendColVal(trow, val, c->type, c->bytes, c->offset); + } + pBlk->len = htonl(dataRowLen(trow)); + + pBlk->uid = htobe64(pObj->uid); + pBlk->tid = htonl(pObj->tid); + pBlk->numOfRows = htons(1); + pBlk->sversion = htonl(pSchema->version); + pBlk->padding = 0; + pHead->len = sizeof(SSubmitMsg) + sizeof(SSubmitBlk) + dataRowLen(trow); + + pMsg->header.vgId = htonl(pContext->vgId); + pMsg->header.contLen = htonl(pHead->len); + pMsg->length = pMsg->header.contLen; + pMsg->numOfBlocks = htonl(1); + + pHead->msgType = TSDB_MSG_TYPE_SUBMIT; + pHead->version = 0; // write into vnode write queue pContext->cqWrite(pContext->ahandle, pHead, TAOS_QTYPE_CQ); + free(buffer); } diff --git a/src/cq/test/cqtest.c b/src/cq/test/cqtest.c index fbe3c95b8642c45dea67daef2fa6fdaa702da314..1416a591bec5e4ec61e7a4581db955e91feec2e8 100644 --- a/src/cq/test/cqtest.c +++ b/src/cq/test/cqtest.c @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) { tdDestroyTSchemaBuilder(&schemaBuilder); for (int sid =1; sid<10; ++sid) { - cqCreate(pCq, sid, "select avg(speed) from demo.t1 sliding(1s) interval(5s)", pSchema); + cqCreate(pCq, sid, sid, "select avg(speed) from demo.t1 sliding(1s) interval(5s)", pSchema); } tdFreeSchema(pSchema); diff --git a/src/dnode/inc/dnodeModule.h b/src/dnode/inc/dnodeModule.h index 8618de324446ca3f2504d15a6422bcca3a4b51b0..6a6da0a2a52844e4a2c42bad64658c93b48fffae 100644 --- a/src/dnode/inc/dnodeModule.h +++ b/src/dnode/inc/dnodeModule.h @@ -22,6 +22,7 @@ extern "C" { int32_t dnodeInitModules(); void dnodeStartModules(); +void dnodeStartStream(); void dnodeCleanupModules(); void dnodeProcessModuleStatus(uint32_t moduleStatus); diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 7683843371ab4ba0a0bfb6d3b119fbbeca031b8d..73bc2923b25f6d0d4b433a6247cc531a1d98325f 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -124,6 +124,7 @@ int32_t dnodeInitSystem() { dnodeStartModules(); dnodeSetRunStatus(TSDB_DNODE_RUN_STATUS_RUNING); + dnodeStartStream(); dPrint("TDengine is initialized successfully"); diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 69e91fd4ee41dc13c552523e253a6ff8a999224f..4b448837fe9c9f0f4dd8a997b54b8011096f9657 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -260,11 +260,27 @@ static int32_t dnodeOpenVnodes() { } free(vnodeList); - dPrint("there are total vnodes:%d, openned:%d failed:%d", numOfVnodes, numOfVnodes-failed, failed); return TSDB_CODE_SUCCESS; } +void dnodeStartStream() { + int32_t vnodeList[TSDB_MAX_VNODES]; + int32_t numOfVnodes = 0; + int32_t status = dnodeGetVnodeList(vnodeList, &numOfVnodes); + + if (status != TSDB_CODE_SUCCESS) { + dPrint("Get dnode list failed"); + return; + } + + for (int32_t i = 0; i < numOfVnodes; ++i) { + vnodeStartStream(vnodeList[i]); + } + + dPrint("streams started"); +} + static void dnodeCloseVnodes() { int32_t *vnodeList = (int32_t *)malloc(sizeof(int32_t) * TSDB_MAX_VNODES); int32_t numOfVnodes; diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index 7f1a5b2580b8d34ceb00398c19e7f6660faea606..2f9e9a0af9d6e573892a8e8cd01e3075b2a2bf7b 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -192,13 +192,14 @@ void dnodeSendRpcReadRsp(void *pVnode, SReadMsg *pRead, int32_t code) { if (code == TSDB_CODE_VND_ACTION_IN_PROGRESS) return; if (code == TSDB_CODE_VND_ACTION_NEED_REPROCESSED) { dnodeContinueExecuteQuery(pVnode, pRead->rspRet.qhandle, pRead); + code = TSDB_CODE_SUCCESS; } SRpcMsg rpcRsp = { .handle = pRead->rpcMsg.handle, .pCont = pRead->rspRet.rsp, .contLen = pRead->rspRet.len, - .code = pRead->rspRet.code, + .code = code, }; rpcSendResponse(&rpcRsp); @@ -216,7 +217,7 @@ static void *dnodeProcessReadQueue(void *param) { break; } - dTrace("%p, msg:%s will be processed", pReadMsg->rpcMsg.ahandle, taosMsg[pReadMsg->rpcMsg.msgType]); + dTrace("%p, msg:%s will be processed in vread queue", pReadMsg->rpcMsg.ahandle, taosMsg[pReadMsg->rpcMsg.msgType]); int32_t code = vnodeProcessRead(pVnode, pReadMsg->rpcMsg.msgType, pReadMsg->pCont, pReadMsg->contLen, &pReadMsg->rspRet); dnodeSendRpcReadRsp(pVnode, pReadMsg, code); taosFreeQitem(pReadMsg); diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index 53533b818388b7ff44674dbd8c841b0c347b3a55..e61364355d4a23dca823ed27a0876ee179a6fe19 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -216,7 +216,7 @@ static void *dnodeProcessWriteQueue(void *param) { pHead->msgType = pWrite->rpcMsg.msgType; pHead->version = 0; pHead->len = pWrite->contLen; - dTrace("%p, msg:%s will be processed", pWrite->rpcMsg.ahandle, taosMsg[pWrite->rpcMsg.msgType]); + dTrace("%p, msg:%s will be processed in vwrite queue", pWrite->rpcMsg.ahandle, taosMsg[pWrite->rpcMsg.msgType]); } else { pHead = (SWalHead *)item; } diff --git a/src/inc/tcq.h b/src/inc/tcq.h index e025afaa0ae428b9545b5a23308830f8aa455002..9d987da468eaa83a0324d106fa19563c95608e6d 100644 --- a/src/inc/tcq.h +++ b/src/inc/tcq.h @@ -27,6 +27,7 @@ typedef struct { int vgId; char user[TSDB_USER_LEN]; char pass[TSDB_PASSWORD_LEN]; + char db[TSDB_DB_NAME_LEN + 1]; FCqWrite cqWrite; } SCqCfg; @@ -41,7 +42,7 @@ void cqStart(void *handle); void cqStop(void *handle); // cqCreate is called by TSDB to start an instance of CQ -void *cqCreate(void *handle, int sid, char *sqlStr, STSchema *pSchema); +void *cqCreate(void *handle, uint64_t uid, int sid, char *sqlStr, STSchema *pSchema); // cqDrop is called by TSDB to stop an instance of CQ, handle is the return value of cqCreate void cqDrop(void *handle); diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 2dc9b977b46449602381606ade0508035ab01a26..a678f213bb5318980a56aa8a7bfb5c466e717c5c 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -43,7 +43,7 @@ typedef struct { void *cqH; int (*notifyStatus)(void *, int status); int (*eventCallBack)(void *); - void *(*cqCreateFunc)(void *handle, int sid, char *sqlStr, STSchema *pSchema); + void *(*cqCreateFunc)(void *handle, uint64_t uid, int sid, char *sqlStr, STSchema *pSchema); void (*cqDropFunc)(void *handle); void *(*configFunc)(int32_t vgId, int32_t sid); } STsdbAppH; @@ -118,6 +118,7 @@ int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId); int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg); int tsdbUpdateTagValue(TsdbRepoT *repo, SUpdateTableTagValMsg *pMsg); TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, uint64_t uid); +void tsdbStartStream(TsdbRepoT *repo); uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, uint32_t eindex, int32_t *size); diff --git a/src/inc/vnode.h b/src/inc/vnode.h index f4fb8060feabc12e0f6bfcb933572ed4090ebb6e..069f99263deeddfe0794437aa010b2b330dd4db9 100644 --- a/src/inc/vnode.h +++ b/src/inc/vnode.h @@ -30,7 +30,6 @@ typedef enum _VN_STATUS { typedef struct { int len; - int code; void *rsp; void *qhandle; //used by query and retrieve msg } SRspRet; @@ -38,6 +37,7 @@ typedef struct { int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg); int32_t vnodeDrop(int32_t vgId); int32_t vnodeOpen(int32_t vgId, char *rootDir); +int32_t vnodeStartStream(int32_t vgId); int32_t vnodeAlter(void *pVnode, SMDCreateVnodeMsg *pVnodeCfg); int32_t vnodeClose(int32_t vgId); diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 8f102795b5bf07888a09438b8f1a13bf2d03b231..5e32a9e7d76a2767203a887ec10383f2a28ce80a 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -473,6 +473,18 @@ TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, uint64_t uid) { return TSDB_GET_TABLE_LAST_KEY(pTable); } +void tsdbStartStream(TsdbRepoT *repo) { + STsdbRepo *pRepo = (STsdbRepo *)repo; + STsdbMeta *pMeta = pRepo->tsdbMeta; + + for (int i = 0; i < pRepo->config.maxTables; i++) { + STable *pTable = pMeta->tables[i]; + if (pTable && pTable->type == TSDB_STREAM_TABLE) { + pTable->cqhandle = (*pRepo->appH.cqCreateFunc)(pRepo->appH.cqH, pTable->tableId.uid, pTable->tableId.tid, pTable->sql, tsdbGetTableSchema(pMeta, pTable)); + } + } +} + STableInfo *tsdbGetTableInfo(TsdbRepoT *pRepo, STableId tableId) { // TODO return NULL; diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 34d3c2789365ff10a6d95a65e347cafe2cb1bd78..05c3b303773bd2542f9c35e535fb6309f5eb58ce 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -150,7 +150,6 @@ int tsdbRestoreTable(void *pHandle, void *cont, int contLen) { void tsdbOrgMeta(void *pHandle) { STsdbMeta *pMeta = (STsdbMeta *)pHandle; - STsdbRepo *pRepo = (STsdbRepo *)pMeta->pRepo; for (int i = 1; i < pMeta->maxTables; i++) { STable *pTable = pMeta->tables[i]; @@ -158,13 +157,6 @@ void tsdbOrgMeta(void *pHandle) { tsdbAddTableIntoIndex(pMeta, pTable); } } - - for (int i = 0; i < pMeta->maxTables; i++) { - STable *pTable = pMeta->tables[i]; - if (pTable && pTable->type == TSDB_STREAM_TABLE) { - pTable->cqhandle = (*pRepo->appH.cqCreateFunc)(pRepo->appH.cqH, i, pTable->sql, tsdbGetTableSchema(pMeta, pTable)); - } - } } /** @@ -683,7 +675,7 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx) { tsdbAddTableIntoIndex(pMeta, pTable); } if (pTable->type == TSDB_STREAM_TABLE && addIdx) { - pTable->cqhandle = (*pRepo->appH.cqCreateFunc)(pRepo->appH.cqH, pTable->tableId.tid, pTable->sql, tsdbGetTableSchema(pMeta, pTable)); + pTable->cqhandle = (*pRepo->appH.cqCreateFunc)(pRepo->appH.cqH, pTable->tableId.uid, pTable->tableId.tid, pTable->sql, tsdbGetTableSchema(pMeta, pTable)); } pMeta->nTables++; diff --git a/src/util/src/version.c b/src/util/src/version.c index b6e10d8b7ecef6f864c3d90e891705fbddf7db25..0d5e08ce750ca5b0f6f6896cefdbdf8acd9dd6c8 100644 --- a/src/util/src/version.c +++ b/src/util/src/version.c @@ -1,7 +1,7 @@ -char version[64] = "2.0.0.0"; -char compatible_version[64] = "2.0.0.0"; -char gitinfo[128] = "3264067e97300c84caa61ac909d548c9ca56de6b"; -char gitinfoOfInternal[128] = "da88f4a2474737d1f9c76adcf0ff7fd0975e7342"; -char buildinfo[512] = "Built by root at 2020-04-01 14:38"; +char version[12] = "2.0.0.0"; +char compatible_version[12] = "2.0.0.0"; +char gitinfo[48] = "3264067e97300c84caa61ac909d548c9ca56de6b"; +char gitinfoOfInternal[48] = "da88f4a2474737d1f9c76adcf0ff7fd0975e7342"; +char buildinfo[64] = "Built by root at 2020-04-01 14:38"; void libtaos_1_6_5_4_Linux_x64() {}; diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index d1dfa24cbeaa692d64602c4f0ee319c8953d316b..256ef3c72baf0ccc5dd0c39b1f6452a9dfd204d6 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -208,8 +208,9 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { } SCqCfg cqCfg = {0}; - sprintf(cqCfg.user, "root"); + sprintf(cqCfg.user, "_root"); strcpy(cqCfg.pass, tsInternalPass); + strcpy(cqCfg.db, pVnode->db); cqCfg.vgId = vnode; cqCfg.cqWrite = vnodeWriteToQueue; pVnode->cq = cqOpen(pVnode, &cqCfg); @@ -277,6 +278,15 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { return TSDB_CODE_SUCCESS; } +int32_t vnodeStartStream(int32_t vnode) { + SVnodeObj* pVnode = vnodeAccquireVnode(vnode); + if (pVnode != NULL) { + tsdbStartStream(pVnode->tsdb); + vnodeRelease(pVnode); + } + return TSDB_CODE_SUCCESS; +} + int32_t vnodeClose(int32_t vgId) { SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t)); if (ppVnode == NULL || *ppVnode == NULL) return 0; diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 2cf72bb15d68bbceb45eb4816b4b3f29099e8acb..f198c2ffe417ae918b14e291b7390466c62b11a5 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -39,15 +39,21 @@ void vnodeInitReadFp(void) { int32_t vnodeProcessRead(void *param, int msgType, void *pCont, int32_t contLen, SRspRet *ret) { SVnodeObj *pVnode = (SVnodeObj *)param; - if (vnodeProcessReadMsgFp[msgType] == NULL) + if (vnodeProcessReadMsgFp[msgType] == NULL) { + vTrace("vgId:%d, msgType:%s not processed, no handle", pVnode->vgId, taosMsg[msgType]); return TSDB_CODE_VND_MSG_NOT_PROCESSED; + } - if (pVnode->status == TAOS_VN_STATUS_DELETING || pVnode->status == TAOS_VN_STATUS_CLOSING) + if (pVnode->status == TAOS_VN_STATUS_DELETING || pVnode->status == TAOS_VN_STATUS_CLOSING) { + vTrace("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[msgType], pVnode->status); return TSDB_CODE_VND_INVALID_VGROUP_ID; + } // TODO: Later, let slave to support query - if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) + if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) { + vTrace("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[msgType], pVnode->syncCfg.replica, pVnode->role); return TSDB_CODE_RPC_NOT_READY; + } return (*vnodeProcessReadMsgFp[msgType])(pVnode, pCont, contLen, ret); } @@ -60,11 +66,11 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont qinfo_t pQInfo = NULL; if (contLen != 0) { - pRet->code = qCreateQueryInfo(pVnode->tsdb, pVnode->vgId, pQueryTableMsg, &pQInfo); + code = qCreateQueryInfo(pVnode->tsdb, pVnode->vgId, pQueryTableMsg, &pQInfo); SQueryTableRsp *pRsp = (SQueryTableRsp *) rpcMallocCont(sizeof(SQueryTableRsp)); pRsp->qhandle = htobe64((uint64_t) (pQInfo)); - pRsp->code = pRet->code; + pRsp->code = code; pRet->len = sizeof(SQueryTableRsp); pRet->rsp = pRsp; @@ -74,9 +80,11 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont assert(pCont != NULL); pQInfo = pCont; code = TSDB_CODE_VND_ACTION_IN_PROGRESS; + vTrace("vgId:%d, QInfo:%p, dnode query msg in progress", pVnode->vgId, pQInfo); } if (pQInfo != NULL) { + vTrace("vgId:%d, QInfo:%p, do qTableQuery", pVnode->vgId, pQInfo); qTableQuery(pQInfo); // do execute query } @@ -88,18 +96,16 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t cont void *pQInfo = (void*) htobe64(pRetrieve->qhandle); memset(pRet, 0, sizeof(SRspRet)); - int32_t code = TSDB_CODE_SUCCESS; - vTrace("vgId:%d, QInfo:%p, retrieve msg is received", pVnode->vgId, pQInfo); - pRet->code = qRetrieveQueryResultInfo(pQInfo); - if (pRet->code != TSDB_CODE_SUCCESS) { + int32_t code = qRetrieveQueryResultInfo(pQInfo); + if (code != TSDB_CODE_SUCCESS) { //TODO pRet->rsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp)); memset(pRet->rsp, 0, sizeof(SRetrieveTableRsp)); } else { // todo check code and handle error in build result set - pRet->code = qDumpRetrieveResult(pQInfo, (SRetrieveTableRsp **)&pRet->rsp, &pRet->len); + code = qDumpRetrieveResult(pQInfo, (SRetrieveTableRsp **)&pRet->rsp, &pRet->len); if (qHasMoreResultsToRetrieve(pQInfo)) { pRet->qhandle = pQInfo; diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh new file mode 100755 index 0000000000000000000000000000000000000000..e1d4c6348b22bb4a688d7621a3e03456d7fc8e88 --- /dev/null +++ b/tests/pytest/regressiontest.sh @@ -0,0 +1,136 @@ +#!/bin/bash +ulimit -c unlimited + +python3 ./test.py -f insert/basic.py +python3 ./test.py -f insert/int.py +python3 ./test.py -f insert/float.py +python3 ./test.py -f insert/bigint.py +python3 ./test.py -f insert/bool.py +python3 ./test.py -f insert/double.py +python3 ./test.py -f insert/smallint.py +python3 ./test.py -f insert/tinyint.py +python3 ./test.py -f insert/date.py +python3 ./test.py -f insert/binary.py +python3 ./test.py -f insert/nchar.py +# python3 ./test.py -f insert/nchar-boundary.py +# python3 ./test.py -f insert/nchar-unicode.py +python3 ./test.py -f insert/multi.py +python3 ./test.py -f insert/randomNullCommit.py + +python3 ./test.py -f table/column_name.py +python3 ./test.py -f table/column_num.py +python3 ./test.py -f table/db_table.py +# python3 ./test.py -f table/tablename-boundary.py + +# tag +python3 ./test.py -f tag_lite/filter.py +python3 ./test.py -f tag_lite/create-tags-boundary.py +python3 ./test.py -f tag_lite/3.py +python3 ./test.py -f tag_lite/4.py +python3 ./test.py -f tag_lite/5.py +python3 ./test.py -f tag_lite/6.py +# python3 ./test.py -f tag_lite/add.py +python3 ./test.py -f tag_lite/bigint.py +python3 ./test.py -f tag_lite/binary_binary.py +python3 ./test.py -f tag_lite/binary.py +python3 ./test.py -f tag_lite/bool_binary.py +python3 ./test.py -f tag_lite/bool_int.py +python3 ./test.py -f tag_lite/bool.py +python3 ./test.py -f tag_lite/change.py +python3 ./test.py -f tag_lite/column.py +# python3 ./test.py -f tag_lite/commit.py +python3 ./test.py -f tag_lite/create.py +# python3 ./test.py -f tag_lite/datatype.py +python3 ./test.py -f tag_lite/datatype-without-alter.py +# python3 ./test.py -f tag_lite/delete.py +python3 ./test.py -f tag_lite/double.py +python3 ./test.py -f tag_lite/float.py +python3 ./test.py -f tag_lite/int_binary.py +python3 ./test.py -f tag_lite/int_float.py +python3 ./test.py -f tag_lite/int.py +# python3 ./test.py -f tag_lite/set.py +python3 ./test.py -f tag_lite/smallint.py +python3 ./test.py -f tag_lite/tinyint.py + +# python3 ./test.py -f dbmgmt/database-name-boundary.py + +python3 ./test.py -f import_merge/importBlock1HO.py +python3 ./test.py -f import_merge/importBlock1HPO.py +python3 ./test.py -f import_merge/importBlock1H.py +python3 ./test.py -f import_merge/importBlock1S.py +python3 ./test.py -f import_merge/importBlock1Sub.py +python3 ./test.py -f import_merge/importBlock1TO.py +python3 ./test.py -f import_merge/importBlock1TPO.py +python3 ./test.py -f import_merge/importBlock1T.py +python3 ./test.py -f import_merge/importBlock2HO.py +python3 ./test.py -f import_merge/importBlock2HPO.py +python3 ./test.py -f import_merge/importBlock2H.py +python3 ./test.py -f import_merge/importBlock2S.py +python3 ./test.py -f import_merge/importBlock2Sub.py +python3 ./test.py -f import_merge/importBlock2TO.py +python3 ./test.py -f import_merge/importBlock2TPO.py +python3 ./test.py -f import_merge/importBlock2T.py +python3 ./test.py -f import_merge/importBlockbetween.py +python3 ./test.py -f import_merge/importCacheFileHO.py +python3 ./test.py -f import_merge/importCacheFileHPO.py +python3 ./test.py -f import_merge/importCacheFileH.py +python3 ./test.py -f import_merge/importCacheFileS.py +python3 ./test.py -f import_merge/importCacheFileSub.py +python3 ./test.py -f import_merge/importCacheFileTO.py +python3 ./test.py -f import_merge/importCacheFileTPO.py +python3 ./test.py -f import_merge/importCacheFileT.py +python3 ./test.py -f import_merge/importDataH2.py +# python3 ./test.py -f import_merge/importDataHO2.py +# python3 ./test.py -f import_merge/importDataHO.py +python3 ./test.py -f import_merge/importDataHPO.py +python3 ./test.py -f import_merge/importDataLastHO.py +python3 ./test.py -f import_merge/importDataLastHPO.py +python3 ./test.py -f import_merge/importDataLastH.py +python3 ./test.py -f import_merge/importDataLastS.py +python3 ./test.py -f import_merge/importDataLastSub.py +python3 ./test.py -f import_merge/importDataLastTO.py +python3 ./test.py -f import_merge/importDataLastTPO.py +python3 ./test.py -f import_merge/importDataLastT.py +python3 ./test.py -f import_merge/importDataS.py +# python3 ./test.py -f import_merge/importDataSub.py +python3 ./test.py -f import_merge/importDataTO.py +python3 ./test.py -f import_merge/importDataTPO.py +python3 ./test.py -f import_merge/importDataT.py +python3 ./test.py -f import_merge/importHeadOverlap.py +python3 ./test.py -f import_merge/importHeadPartOverlap.py +python3 ./test.py -f import_merge/importHead.py +python3 ./test.py -f import_merge/importHORestart.py +python3 ./test.py -f import_merge/importHPORestart.py +python3 ./test.py -f import_merge/importHRestart.py +python3 ./test.py -f import_merge/importLastHO.py +python3 ./test.py -f import_merge/importLastHPO.py +python3 ./test.py -f import_merge/importLastH.py +python3 ./test.py -f import_merge/importLastS.py +python3 ./test.py -f import_merge/importLastSub.py +python3 ./test.py -f import_merge/importLastTO.py +python3 ./test.py -f import_merge/importLastTPO.py +python3 ./test.py -f import_merge/importLastT.py +python3 ./test.py -f import_merge/importSpan.py +python3 ./test.py -f import_merge/importSRestart.py +python3 ./test.py -f import_merge/importSubRestart.py +python3 ./test.py -f import_merge/importTailOverlap.py +python3 ./test.py -f import_merge/importTailPartOverlap.py +python3 ./test.py -f import_merge/importTail.py +python3 ./test.py -f import_merge/importToCommit.py +python3 ./test.py -f import_merge/importTORestart.py +python3 ./test.py -f import_merge/importTPORestart.py +python3 ./test.py -f import_merge/importTRestart.py +python3 ./test.py -f import_merge/importInsertThenImport.py + +# user +python3 ./test.py -f user/user_create.py +python3 ./test.py -f user/pass_len.py + +# table +#python3 ./test.py -f table/del_stable.py + +#query +python3 ./test.py -f query/filter.py +# python3 ./test.py -f query/filterCombo.py +# python3 ./test.py -f query/queryNormal.py +# python3 ./test.py -f query/queryError.py diff --git a/tests/pytest/stream/stream1.py b/tests/pytest/stream/stream1.py new file mode 100644 index 0000000000000000000000000000000000000000..7a9d88da3b2aa7bedae0824cac89349dcbeb5040 --- /dev/null +++ b/tests/pytest/stream/stream1.py @@ -0,0 +1,131 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import time +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tbNum = 10 + rowNum = 20 + + tdSql.prepare() + + tdLog.info("===== step1 =====") + tdSql.execute("create table stb0(ts timestamp, col1 int, col2 float) tags(tgcol int)") + for i in range(tbNum): + tdSql.execute("create table tb%d using stb0 tags(%d)" % (i, i)) + for j in range(rowNum): + tdSql.execute("insert into tb%d values (now - %dm, %d, %d)" % (i, 1440 - j, j, j)) + time.sleep(0.1) + + tdLog.info("===== step2 =====") + tdSql.query("select count(*), count(col1), count(col2) from tb0 interval(1d)") + tdSql.checkData(0, 1, rowNum) + tdSql.checkData(0, 2, rowNum) + tdSql.checkData(0, 3, rowNum) + tdSql.query("show tables") + tdSql.checkRows(tbNum) + tdSql.execute("create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + + tdLog.info("===== step3 =====") + tdLog.info("sleeping 120 seconds") + time.sleep(120) + tdSql.query("select * from s0") + tdSql.checkData(0, 1, rowNum) + tdSql.checkData(0, 2, rowNum) + tdSql.checkData(0, 3, rowNum) + + tdLog.info("===== step4 =====") + tdSql.execute("drop table s0") + tdSql.query("show tables") + tdSql.checkRows(tbNum) + + tdLog.info("===== step5 =====") + tdSql.error("select * from s0") + + tdLog.info("===== step6 =====") + time.sleep(0.1) + tdSql.execute("create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + + tdLog.info("===== step7 =====") + tdLog.info("sleeping 120 seconds") + time.sleep(120) + + tdSql.query("select * from s0") + tdSql.checkData(0, 1, rowNum) + tdSql.checkData(0, 2, rowNum) + tdSql.checkData(0, 3, rowNum) + + tdLog.info("===== step8 =====") + tdSql.query("select count(*), count(col1), count(col2) from stb0 interval(1d)") + tdSql.checkData(0, 1, rowNum * tbNum) + tdSql.checkData(0, 2, rowNum * tbNum) + tdSql.checkData(0, 3, rowNum * tbNum) + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + + tdSql.execute("create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 2) + + tdLog.info("===== step9 =====") + tdLog.info("sleeping 120 seconds") + time.sleep(120) + + tdSql.query("select * from s1") + tdSql.checkData(0, 1, rowNum * tbNum) + tdSql.checkData(0, 2, rowNum * tbNum) + tdSql.checkData(0, 3, rowNum * tbNum) + + tdLog.info("===== step10 =====") + tdSql.execute("drop table s1") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + + tdLog.info("===== step11 =====") + tdSql.error("select * from s1") + + tdLog.info("===== step12 =====") + tdSql.execute("create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 2) + + tdLog.info("===== step13 =====") + tdLog.info("sleeping 120 seconds") + time.sleep(120) + tdSql.query("select * from s1") + tdSql.checkData(0, 1, rowNum * tbNum) + tdSql.checkData(0, 2, rowNum * tbNum) + tdSql.checkData(0, 3, rowNum * tbNum) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/stream/stream2.py b/tests/pytest/stream/stream2.py new file mode 100644 index 0000000000000000000000000000000000000000..96eff3131d5bec3eb7e16f7d002aae25da560bf2 --- /dev/null +++ b/tests/pytest/stream/stream2.py @@ -0,0 +1,122 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import time +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + + def run(self): + tbNum = 10 + rowNum = 20 + totalNum = tbNum * rowNum + + tdSql.prepare() + + tdLog.info("===== step1 =====") + tdSql.execute("create table stb0(ts timestamp, col1 int, col2 float) tags(tgcol int)") + for i in range(tbNum): + tdSql.execute("create table tb%d using stb0 tags(%d)" % (i, i)) + for j in range(rowNum): + tdSql.execute("insert into tb%d values (now - %dm, %d, %d)" % (i, 1440 - j, j, j)) + time.sleep(0.1) + + tdLog.info("===== step2 =====") + tdSql.query("select count(col1) from tb0 interval(1d)") + tdSql.checkData(0, 1, rowNum) + tdSql.query("show tables") + tdSql.checkRows(tbNum) + tdSql.execute("create table s0 as select count(col1) from tb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + + tdLog.info("===== step3 =====") + time.sleep(120) + tdSql.query("select * from s0") + tdSql.checkData(0, 1, rowNum) + + tdLog.info("===== step4 =====") + tdSql.execute("drop table s0") + tdSql.query("show tables") + tdSql.checkRows(tbNum) + + tdLog.info("===== step5 =====") + tdSql.error("select * from s0") + + tdLog.info("===== step6 =====") + tdSql.execute("create table s0 as select count(*), count(col1), count(col2) from tb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + + tdLog.info("===== step7 =====") + time.sleep(120) + tdSql.query("select * from s0") + tdSql.checkData(0, 1, rowNum) + tdSql.checkData(0, 2, rowNum) + tdSql.checkData(0, 3, rowNum) + + tdLog.info("===== step8 =====") + tdSql.query("select count(*), count(col1), count(col2) from stb0 interval(1d)") + tdSql.checkData(0, 1, totalNum) + tdSql.checkData(0, 2, totalNum) + tdSql.checkData(0, 3, totalNum) + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + tdSql.execute("create table s1 as select count(*), count(col1), count(col2) from stb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 2) + + tdLog.info("===== step9 =====") + time.sleep(120) + tdSql.query("select * from s1") + tdSql.checkData(0, 1, totalNum) + tdSql.checkData(0, 2, totalNum) + tdSql.checkData(0, 3, totalNum) + + tdLog.info("===== step10 =====") + tdSql.execute("drop table s1") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 1) + + tdLog.info("===== step11 =====") + tdSql.error("select * from s1") + + tdLog.info("===== step12 =====") + tdSql.execute("create table s1 as select count(col1) from stb0 interval(1d)") + tdSql.query("show tables") + tdSql.checkRows(tbNum + 2) + + tdLog.info("===== step13 =====") + time.sleep(120) + tdSql.query("select * from s1") + tdSql.checkData(0, 1, totalNum) + #tdSql.checkData(0, 2, None) + #tdSql.checkData(0, 3, None) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 50d054a3015696cd6f202d8b0db4cfec16a833bb..f3ccd58432948739bf96d2a63afb43422c955ac5 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -194,13 +194,13 @@ class TDDnode: selfPath = os.path.dirname(os.path.realpath(__file__)) binPath = "" - if ("TDinternal" in selfPath): + if ("community" in selfPath): projPath = selfPath + "/../../../../" for root, dirs, files in os.walk(projPath): if ("taosd" in files): rootRealPath = os.path.dirname(os.path.realpath(root)) - if ("community" not in rootRealPath): + if ("packaging" not in rootRealPath): binPath = os.path.join(root, "taosd") break else: @@ -213,7 +213,7 @@ class TDDnode: break if (binPath == ""): - tdLog.exit("taosd not found!s") + tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % rootRealPath) diff --git a/tests/script/general/stream/metrics_1.sim b/tests/script/general/stream/metrics_1.sim index c60bde6b2f00c6b888899faef75c21a2c732db9e..94498cb92591966b6d289c440d675c93fa752005 100644 --- a/tests/script/general/stream/metrics_1.sim +++ b/tests/script/general/stream/metrics_1.sim @@ -205,8 +205,8 @@ if $data01 != 20 then endi print =============== step21 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step22 $st = $stPrefix . c1 diff --git a/tests/script/general/stream/metrics_del.sim b/tests/script/general/stream/metrics_del.sim index c856871e93b7be436cd7da6d665cb90439c9ae7f..e21fa5999aa1b6ce0c063af54172f222aeb983e1 100644 --- a/tests/script/general/stream/metrics_del.sim +++ b/tests/script/general/stream/metrics_del.sim @@ -76,20 +76,20 @@ endw sql drop table $mt print =============== step4 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step5 $st = $stPrefix . c3 sql select * from $st print ===> select * from $st print ===> $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data01 != NULL then +if $data01 != null then return -1 endi -if $data02 != NULL then +if $data02 != null then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi diff --git a/tests/script/general/stream/metrics_n.sim b/tests/script/general/stream/metrics_n.sim index 47089403dd2f64c3cb5b216ed8258433d74c40d6..7fc08064b29cc6f1681116be16ca460da0e41580 100644 --- a/tests/script/general/stream/metrics_n.sim +++ b/tests/script/general/stream/metrics_n.sim @@ -187,8 +187,8 @@ $st = $stPrefix . as #sql create table $st as select avg(tbcol) as a1, sum(tbcol) as a2, min(tbcol) as a3, max(tbcol) as a4, first(tbcol) as a5, last(tbcol) as a6, count(tbcol) as a7, avg(tbcol) as a8, sum(tbcol) as a9, min(tbcol) as a3, max(tbcol) as a4, first(tbcol) as a5, last(tbcol) as a6, count(tbcol) as a7 from $mt where ts < now + 4m interval(1d) print =============== step9 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step10 $st = $stPrefix . c3 diff --git a/tests/script/general/stream/metrics_replica1_vnoden.sim b/tests/script/general/stream/metrics_replica1_vnoden.sim index 13cd18adf312e01781482ed82918c47b7ce3e1cb..ee071fd681ae117ec6ff0b7b2846a197a7950d97 100644 --- a/tests/script/general/stream/metrics_replica1_vnoden.sim +++ b/tests/script/general/stream/metrics_replica1_vnoden.sim @@ -163,8 +163,8 @@ $st = $stPrefix . as sql create table $st as select count(tbcol) as c from $mt interval(1d) print =============== step13 -print sleep 22 seconds -sleep 32000 +print sleep 120 seconds +sleep 120000 print =============== step14 $st = $stPrefix . c1 diff --git a/tests/script/general/stream/new_stream.sim b/tests/script/general/stream/new_stream.sim index 8aa0a898705d67590212db7cec0e81ceecb3d8f2..abc06faaef7418e1d86450831853c9e8ad65e434 100644 --- a/tests/script/general/stream/new_stream.sim +++ b/tests/script/general/stream/new_stream.sim @@ -1,12 +1,12 @@ -system sh/stop_dnodes.sh +#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 tableMetaKeepTimer -v 10 -system sh/exec.sh -n dnode1 -s start +#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 tableMetaKeepTimer -v 10 +#system sh/exec.sh -n dnode1 -s start -sleep 3000 +#sleep 3000 sql connect print ======================== dnode1 start @@ -56,14 +56,14 @@ print $data00 $data01 $data02 $data03 sql create table $st as select count(*), count(tbcol), count(tbcol2) from $mt interval(10s) print =============== step3 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step4 sql select * from $st print $st ==> $rows1 $data00 $data01 $data02 $data03 -if $data13 >= 51 then +if $data03 >= 51 then return -1 endi @@ -90,8 +90,8 @@ while $i < $tbNum endw print =============== step6 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step7 diff --git a/tests/script/general/stream/restart_stream.sim b/tests/script/general/stream/restart_stream.sim index aa16934f330c2cf7a1e8e67f1738f737ef846eb5..138e2a6e2ef6e6aeb46c14b7e8fceb851e36eaa8 100644 --- a/tests/script/general/stream/restart_stream.sim +++ b/tests/script/general/stream/restart_stream.sim @@ -73,8 +73,8 @@ print =============== step3 sql create table $stt as select count(*) from $tb interval(1d) sql create table $stm as select count(*) from $mt interval(1d) -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $stt print select count(*) from $stt ===> $data00 $data01 @@ -152,8 +152,8 @@ print =============== step8 sql create table $stt as select count(*) from $tb interval(1d) sql create table $stm as select count(*) from $mt interval(1d) -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $stt sleep 1000 diff --git a/tests/script/general/stream/stream_1.sim b/tests/script/general/stream/stream_1.sim index 2309d341c1464cd455055691a68a5fefad03b762..958c877ee57725edaf18e5c586d96c98540bfa79 100644 --- a/tests/script/general/stream/stream_1.sim +++ b/tests/script/general/stream/stream_1.sim @@ -78,8 +78,8 @@ if $rows != 11 then endi print =============== step3 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 if $data01 != 20 then @@ -112,8 +112,8 @@ if $rows != 11 then endi print =============== step7 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 if $data01 != 20 then @@ -155,8 +155,8 @@ if $rows != 12 then endi print =============== step9 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 if $data01 != 200 then @@ -190,8 +190,8 @@ if $rows != 12 then endi print =============== step13 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 if $data01 != 200 then diff --git a/tests/script/general/stream/stream_2.sim b/tests/script/general/stream/stream_2.sim index 13aac983374b40258f12f6a4b5d7e7e7dd143a0b..057529b427b5e76dd778fd6e8cbca9504a52e1af 100644 --- a/tests/script/general/stream/stream_2.sim +++ b/tests/script/general/stream/stream_2.sim @@ -72,8 +72,8 @@ if $rows != 11 then endi print =============== step3 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 if $data01 != 20 then @@ -100,8 +100,8 @@ if $rows != 11 then endi print =============== step7 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 if $data01 != 20 then @@ -143,8 +143,8 @@ if $rows != 12 then endi print =============== step9 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 $data02, $data03 if $data01 != 200 then @@ -178,17 +178,17 @@ if $rows != 12 then endi print =============== step13 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 sql select * from $st print select * from $st => $data01 $data02, $data03 if $data01 != 200 then return -1 endi -if $data02 != NULL then +if $data02 != null then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi diff --git a/tests/script/general/stream/stream_3.sim b/tests/script/general/stream/stream_3.sim index 914ecd848492dd837024417c2341d135cad25c1d..88105a77d667e9cad499ec55cad7f0d7f8fc0c3f 100644 --- a/tests/script/general/stream/stream_3.sim +++ b/tests/script/general/stream/stream_3.sim @@ -79,8 +79,8 @@ $st = $stPrefix . c3 sql create table $st as select count(tbcol2) from $tb interval(1d) print =============== step5 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step6 $st = $stPrefix . c1 @@ -173,8 +173,8 @@ $st = $stPrefix . c3 sql create table $st as select count(*), count(tbcol), count(tbcol2) from $tb interval(1d) print =============== step10 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step11 #$st = $stPrefix . c3 diff --git a/tests/script/general/stream/stream_restart.sim b/tests/script/general/stream/stream_restart.sim index d5fbef49083d266d38c8702990aaec61039252c9..480b23055e90f59bd597d3319a5fe139eba83bab 100644 --- a/tests/script/general/stream/stream_restart.sim +++ b/tests/script/general/stream/stream_restart.sim @@ -79,8 +79,8 @@ sleep 1000 system sh/exec.sh -n dnode1 -s start print =============== step4 -print sleep 23 seconds -sleep 23000 +print sleep 120 seconds +sleep 120000 print =============== step5 $i = 1 diff --git a/tests/script/general/stream/table_1.sim b/tests/script/general/stream/table_1.sim index efc7c370cab780919442fdf705e26bd273b15364..f028b1626d156a65a3ff805f1479e9cb178a8d30 100644 --- a/tests/script/general/stream/table_1.sim +++ b/tests/script/general/stream/table_1.sim @@ -214,8 +214,8 @@ sql select count(tbcol) from $tb where ts < now + 4m interval(1d) group by tgcol step20: print =============== step21 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step22 $st = $stPrefix . c1 diff --git a/tests/script/general/stream/table_del.sim b/tests/script/general/stream/table_del.sim index 66fd58308f06cd053e063cde8b77b1ec18515169..ce4065a1a85ba2c4f8f79b77d1d82c5118091e9c 100644 --- a/tests/script/general/stream/table_del.sim +++ b/tests/script/general/stream/table_del.sim @@ -71,20 +71,20 @@ print =============== step3 sql drop table $tb print =============== step4 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step5 $st = $stPrefix . c3 sql select * from $st print ===> select * from $st print ===> $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data01 != NULL then +if $data01 != null then return -1 endi -if $data02 != NULL then +if $data02 != null then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi diff --git a/tests/script/general/stream/table_n.sim b/tests/script/general/stream/table_n.sim index e6037c5292b9e0da7f5fbd57a67fda88795a26ee..d1b4a87a9ea641a8f4d58e0d9fc61bd9ac7c7477 100644 --- a/tests/script/general/stream/table_n.sim +++ b/tests/script/general/stream/table_n.sim @@ -191,8 +191,8 @@ $st = $stPrefix . as #sql create table $st as select avg(tbcol) as a1, sum(tbcol) as a2, min(tbcol) as a3, max(tbcol) as a4, first(tbcol) as a5, last(tbcol) as a6, stddev(tbcol) as a7, percentile(tbcol, 1) as a8, count(tbcol) as a9, leastsquares(tbcol, 1, 1) as a10 from $tb where ts < now + 4m interval(1d) print =============== step10 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step11 $st = $stPrefix . c3 diff --git a/tests/script/general/stream/table_replica1_vnoden.sim b/tests/script/general/stream/table_replica1_vnoden.sim index 44d4008dbd36594575472477b4a36887bc5f25ba..e1d5a9babf5147ed9d4815ba00608d116d5b3773 100644 --- a/tests/script/general/stream/table_replica1_vnoden.sim +++ b/tests/script/general/stream/table_replica1_vnoden.sim @@ -196,8 +196,8 @@ $st = $stPrefix . as sql create table $st as select count(tbcol) as c from $tb interval(1d) print =============== step16 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step17 $st = $stPrefix . c1 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index c6f3082a88200904cae6859b9e169af632bb7c95..191e3212b60201ff7b5be94b69da69ce160046a0 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -307,78 +307,3 @@ cd ../../../debug; make ./test.sh -f unique/vnode/replica3_basic.sim ./test.sh -f unique/vnode/replica3_repeat.sim ./test.sh -f unique/vnode/replica3_vgroup.sim - -./test.sh -f unique/account/account_create.sim -./test.sh -f unique/account/account_delete.sim -./test.sh -f unique/account/account_len.sim -./test.sh -f unique/account/authority.sim -./test.sh -f unique/account/basic.sim -./test.sh -f unique/account/paras.sim -./test.sh -f unique/account/pass_alter.sim -./test.sh -f unique/account/pass_len.sim -./test.sh -f unique/account/usage.sim -./test.sh -f unique/account/user_create.sim -./test.sh -f unique/account/user_len.sim - -./test.sh -f unique/big/balance.sim -./test.sh -f unique/big/maxvnodes.sim -./test.sh -f unique/big/tcp.sim - -./test.sh -f unique/cluster/balance1.sim -./test.sh -f unique/cluster/balance2.sim -./test.sh -f unique/cluster/balance3.sim -./test.sh -f unique/cluster/cache.sim - -./test.sh -f unique/column/replica3.sim - -./test.sh -f unique/db/commit.sim -./test.sh -f unique/db/delete.sim -./test.sh -f unique/db/delete_part.sim -./test.sh -f unique/db/replica_add12.sim -./test.sh -f unique/db/replica_add13.sim -./test.sh -f unique/db/replica_add23.sim -./test.sh -f unique/db/replica_reduce21.sim -./test.sh -f unique/db/replica_reduce32.sim -./test.sh -f unique/db/replica_reduce31.sim -./test.sh -f unique/db/replica_part.sim - -./test.sh -f unique/dnode/balance1.sim -./test.sh -f unique/dnode/balance2.sim -./test.sh -f unique/dnode/balance3.sim -./test.sh -f unique/dnode/balancex.sim -./test.sh -f unique/dnode/offline1.sim -./test.sh -f unique/dnode/offline2.sim -./test.sh -f unique/dnode/remove1.sim -./test.sh -f unique/dnode/remove2.sim -./test.sh -f unique/dnode/vnode_clean.sim - -./test.sh -f unique/http/admin.sim -./test.sh -f unique/http/opentsdb.sim - -./test.sh -f unique/import/replica2.sim -./test.sh -f unique/import/replica3.sim - -./test.sh -f unique/stable/balance_replica1.sim -./test.sh -f unique/stable/dnode2_stop.sim -./test.sh -f unique/stable/dnode2.sim -./test.sh -f unique/stable/dnode3.sim -./test.sh -f unique/stable/replica2_dnode4.sim -./test.sh -f unique/stable/replica2_vnode3.sim -./test.sh -f unique/stable/replica3_dnode6.sim -./test.sh -f unique/stable/replica3_vnode3.sim - -./test.sh -f unique/mnode/mgmt22.sim -./test.sh -f unique/mnode/mgmt23.sim -./test.sh -f unique/mnode/mgmt24.sim -./test.sh -f unique/mnode/mgmt25.sim -./test.sh -f unique/mnode/mgmt26.sim -./test.sh -f unique/mnode/mgmt33.sim -./test.sh -f unique/mnode/mgmt34.sim -./test.sh -f unique/mnode/mgmtr2.sim - -./test.sh -f unique/vnode/many.sim -./test.sh -f unique/vnode/replica2_basic2.sim -./test.sh -f unique/vnode/replica2_repeat.sim -./test.sh -f unique/vnode/replica3_basic.sim -./test.sh -f unique/vnode/replica3_repeat.sim -./test.sh -f unique/vnode/replica3_vgroup.sim diff --git a/tests/script/regressionSuite.sim b/tests/script/regressionSuite.sim new file mode 100644 index 0000000000000000000000000000000000000000..67f54523dfee3b09521f9e34ea8e7897979e01cf --- /dev/null +++ b/tests/script/regressionSuite.sim @@ -0,0 +1,213 @@ +#unsupport run general/alter/cached_schema_after_alter.sim +#unsupport run general/alter/count.sim +#unsupport run general/alter/import.sim +#unsupport run general/alter/insert1.sim +#unsupport run general/alter/insert2.sim +#unsupport run general/alter/metrics.sim +#unsupport run general/alter/table.sim +run general/cache/new_metrics.sim +run general/cache/restart_metrics.sim +run general/cache/restart_table.sim +run general/connection/connection.sim +run general/column/commit.sim +run general/column/metrics.sim +run general/column/table.sim +run general/compress/commitlog.sim +run general/compress/compress.sim +run general/compress/compress2.sim +run general/compress/uncompress.sim +run general/compute/avg.sim +run general/compute/bottom.sim +run general/compute/count.sim +run general/compute/diff.sim +run general/compute/diff2.sim +run general/compute/first.sim +run general/compute/interval.sim +run general/compute/last.sim +run general/compute/leastsquare.sim +run general/compute/max.sim +run general/compute/min.sim +run general/compute/null.sim +run general/compute/percentile.sim +run general/compute/stddev.sim +run general/compute/sum.sim +run general/compute/top.sim +run general/db/alter_option.sim +run general/db/alter_tables_d2.sim +run general/db/alter_tables_v1.sim +run general/db/alter_tables_v4.sim +run general/db/alter_vgroups.sim +run general/db/basic.sim +run general/db/basic1.sim +run general/db/basic2.sim +run general/db/basic3.sim +run general/db/basic4.sim +run general/db/basic5.sim +run general/db/delete_reuse1.sim +run general/db/delete_reuse2.sim +run general/db/delete_reusevnode.sim +run general/db/delete_reusevnode2.sim +run general/db/delete_writing1.sim +run general/db/delete_writing2.sim +run general/db/delete.sim +run general/db/len.sim +run general/db/repeat.sim +run general/db/tables.sim +run general/db/vnodes.sim +run general/field/2.sim +run general/field/3.sim +run general/field/4.sim +run general/field/5.sim +run general/field/6.sim +run general/field/bigint.sim +run general/field/binary.sim +run general/field/bool.sim +run general/field/single.sim +run general/field/smallint.sim +run general/field/tinyint.sim +run general/http/restful.sim +run general/http/restful_insert.sim +run general/http/restful_limit.sim +run general/http/restful_full.sim +run general/http/prepare.sim +run general/http/telegraf.sim +# run general/http/grafana_bug.sim +# run general/http/grafana.sim +run general/import/basic.sim +run general/import/commit.sim +run general/import/large.sim +run general/import/replica1.sim +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 +#unsupport run general/parser/alter.sim +#unsupport run general/parser/alter1.sim +#unsupport 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/import_commit1.sim +run general/parser/import_commit2.sim +run general/parser/import_commit3.sim +run general/parser/insert_tb.sim +# run general/parser/first_last.sim +#unsupport run general/parser/import_file.sim +# run general/parser/lastrow.sim +run general/parser/nchar.sim +#unsupport run general/parser/null_char.sim +# run general/parser/single_row_in_tb.sim +run general/parser/select_from_cache_disk.sim +# run general/parser/limit.sim +# run general/parser/limit1.sim +# run general/parser/limit1_tblocks100.sim +# run general/parser/mixed_blocks.sim +# run general/parser/selectResNum.sim +run general/parser/select_across_vnodes.sim +run general/parser/slimit1.sim +run general/parser/tbnameIn.sim +run general/parser/binary_escapeCharacter.sim +# run general/parser/projection_limit_offset.sim +run general/parser/limit2.sim +# run general/parser/slimit.sim +run general/parser/fill.sim +# run general/parser/fill_stb.sim +# run general/parser/interp.sim +# run general/parser/where.sim +#unsupport run general/parser/join.sim +#unsupport run general/parser/join_multivnode.sim +# run general/parser/select_with_tags.sim +#unsupport run general/parser/groupby.sim +#unsupport run general/parser/bug.sim +#unsupport run general/parser/tags_dynamically_specifiy.sim +#unsupport run general/parser/set_tag_vals.sim +#unsupport run general/parser/repeatAlter.sim +#unsupport run general/parser/slimit_alter_tags.sim +#unsupport run general/parser/stream_on_sys.sim +#unsupport run general/parser/stream.sim +#unsupport run general/parser/repeatStream.sim +run general/stable/disk.sim +run general/stable/dnode3.sim +run general/stable/metrics.sim +run general/stable/values.sim +run general/stable/vnode3.sim +# 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 +run general/tag/3.sim +run general/tag/4.sim +run general/tag/5.sim +run general/tag/6.sim +#unsupport 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 +#unsupport run general/tag/change.sim +run general/tag/column.sim +#unsupport run general/tag/commit.sim +run general/tag/create.sim +#unsupport 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 +#unsupport run general/tag/set.sim +run general/tag/smallint.sim +run general/tag/tinyint.sim +run general/user/authority.sim +run general/user/monitor.sim +run general/user/pass_alter.sim +run general/user/pass_len.sim +run general/user/user_create.sim +run general/user/user_len.sim +run general/vector/metrics_field.sim +run general/vector/metrics_mix.sim +run general/vector/metrics_query.sim +run general/vector/metrics_tag.sim +run general/vector/metrics_time.sim +run general/vector/multi.sim +run general/vector/single.sim +run general/vector/table_field.sim +run general/vector/table_mix.sim +run general/vector/table_query.sim +run general/vector/table_time.sim diff --git a/tests/script/unique/vnode/many.sim b/tests/script/unique/vnode/many.sim index bd07d5f171b5f2ce20a69441a1e3ef4c330bc6c8..2ac203a9b7208261c3fa652aed3a93640266a8d3 100644 --- a/tests/script/unique/vnode/many.sim +++ b/tests/script/unique/vnode/many.sim @@ -57,23 +57,21 @@ run_back unique/vnode/back_insert_many.sim sleep 5000 print ======== step3 -system sh/exec.sh -n dnode2 -s stop -sleep 5000 $x = 0 loop: print ======== step4 -system sh/exec.sh -n dnode2 -s start -sleep 5000 system sh/exec.sh -n dnode3 -s stop sleep 5000 - -print ======== step5 system sh/exec.sh -n dnode3 -s start sleep 5000 + +print ======== step5 system sh/exec.sh -n dnode2 -s stop sleep 5000 +system sh/exec.sh -n dnode2 -s start +sleep 5000 print ======== step6 sql select count(*) from db1.tb1 diff --git a/tests/script/unique/vnode/replica2_basic2.sim b/tests/script/unique/vnode/replica2_basic2.sim index 5bd35159d5e67b381574cc7ddbc59da743f2a01d..2aa470843ae57591efd0fdcdc6ead754b85c6560 100644 --- a/tests/script/unique/vnode/replica2_basic2.sim +++ b/tests/script/unique/vnode/replica2_basic2.sim @@ -138,25 +138,25 @@ sleep 5000 #sql insert into d3.t3 values(now, 3) #sql insert into d4.t4 values(now, 3) -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi +#sql select * from d1.t1 +#if $rows != 2 then +# return -1 +#endi + +#sql select * from d2.t2 +#if $rows != 2 then +# return -1 +#endi + +#sql select * from d3.t3 +#if $rows != 2 then +# return -1 +#endi + +#sql select * from d4.t4 +#if $rows != 2 then +# return -1 +#endi print ========= step4 system sh/exec.sh -n dnode2 -s start @@ -169,25 +169,25 @@ sleep 5000 #sql insert into d3.t3 values(now, 4) #sql insert into d4.t4 values(now, 4) -sql select * from d1.t1 -if $rows != 2 then - return -1 -endi - -sql select * from d2.t2 -if $rows != 2 then - return -1 -endi - -sql select * from d3.t3 -if $rows != 2 then - return -1 -endi - -sql select * from d4.t4 -if $rows != 2 then - return -1 -endi +#sql select * from d1.t1 +#if $rows != 2 then +# return -1 +#endi + +#sql select * from d2.t2 +#if $rows != 2 then +# return -1 +#endi + +#sql select * from d3.t3 +#if $rows != 2 then +# return -1 +#endi + +#sql select * from d4.t4 +#if $rows != 2 then +# return -1 +#endi print ========= step5 system sh/exec.sh -n dnode3 -s start diff --git a/tests/script/unique/vnode/replica2_repeat.sim b/tests/script/unique/vnode/replica2_repeat.sim index 73e71c149ec9c071dad542f12866f59ab5caf4a6..44a86763eda227116b792f3674cb1b77ed66d8fb 100644 --- a/tests/script/unique/vnode/replica2_repeat.sim +++ b/tests/script/unique/vnode/replica2_repeat.sim @@ -37,22 +37,20 @@ run_back unique/vnode/back_insert.sim sleep 3000 print ======== step3 -system sh/exec.sh -n dnode2 -s stop -sleep 5000 $x = 0 loop: print ======== step4 -system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode2 -s stop sleep 5000 -system sh/exec.sh -n dnode3 -s stop +system sh/exec.sh -n dnode2 -s start sleep 5000 print ======== step5 -system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode3 -s stop sleep 5000 -system sh/exec.sh -n dnode2 -s stop +system sh/exec.sh -n dnode3 -s start sleep 5000 print ======== step6 diff --git a/tests/test-all.sh b/tests/test-all.sh index cd5444858ebf87246bca0849fe2cfeb522032d2b..cee638e03c9996d15201928e076f2d2d400a612c 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -24,14 +24,19 @@ GREEN_DARK='\033[0;32m' GREEN_UNDERLINE='\033[4;32m' NC='\033[0m' -echo "### run TSIM script ###" +echo "### run TSIM test case ###" cd script [ -f out.log ] && rm -f out.log if [ "$1" == "cron" ]; then + echo "### run TSIM regression test ###" + runSimCaseOneByOne regressionSuite.sim +elif [ "$1" == "full" ]; then + echo "### run TSIM full test ###" runSimCaseOneByOne fullGeneralSuite.sim else + echo "### run TSIM smoke test ###" runSimCaseOneByOne basicSuite.sim fi @@ -53,14 +58,19 @@ if [ "$totalFailed" -ne "0" ]; then # exit $totalFailed fi -echo "### run Python script ###" +echo "### run Python test case ###" cd ../pytest [ -f pytest-out.log ] && rm -f pytest-out.log if [ "$1" == "cron" ]; then + echo "### run Python regression test ###" + runPyCaseOneByOne regressiontest.sh +elif [ "$1" == "full" ]; then + echo "### run Python full test ###" runPyCaseOneByOne fulltest.sh else + echo "### run Python smoke test ###" runPyCaseOneByOne smoketest.sh fi totalPySuccess=`grep 'successfully executed' pytest-out.log | wc -l`