diff --git a/.gitignore b/.gitignore index 47eae4dc03..67cc2929b4 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,27 @@ pysim/ # Doxygen Generated files html/ +/.vs +/CMakeFiles/3.10.2 +/CMakeCache.txt +/Makefile +/*.cmake +/deps +/src/cq/test/CMakeFiles/cqtest.dir/*.cmake +*.cmake +/src/cq/test/CMakeFiles/cqtest.dir/*.make +*.make +link.txt +*.internal +*.includecache +*.marks +Makefile +CMakeError.log +*.log +/CMakeFiles/CMakeRuleHashes.txt +/CMakeFiles/Makefile2 +/CMakeFiles/TargetDirectories.txt +/CMakeFiles/cmake.check_cache +/out/isenseconfig/WSL-Clang-Debug +/out/isenseconfig/WSL-GCC-Debug +/test/cfg diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000000..4b54f10f2f --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,25 @@ +{ + "configurations": [ + { + "name": "WSL-GCC-Debug", + "generator": "Unix Makefiles", + "configurationType": "Debug", + "buildRoot": "${projectDir}\\build\\", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeExecutable": "/usr/bin/cmake", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "linux_x64" ], + "wslPath": "${defaultWSLPath}", + "addressSanitizerRuntimeFlags": "detect_leaks=0", + "variables": [ + { + "name": "CMAKE_INSTALL_PREFIX", + "value": "/mnt/d/TDengine/TDengine/build", + "type": "PATH" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/client/inc/tscLog.h b/src/client/inc/tscLog.h index 346e1a6795..5e57847daa 100644 --- a/src/client/inc/tscLog.h +++ b/src/client/inc/tscLog.h @@ -30,7 +30,7 @@ extern int32_t cDebugFlag; } #define tscWarn(...) \ if (cDebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN TSC ", cDebugFlag, __VA_ARGS__); \ + taosPrintLog("WARN TSC ", cDebugFlag, __VA_ARGS__); \ } #define tscTrace(...) \ if (cDebugFlag & DEBUG_TRACE) { \ diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index b51fd32a0b..08536a505d 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -53,11 +53,7 @@ typedef struct STableComInfo { } STableComInfo; typedef struct STableMeta { - // super table if it is created according to super table, otherwise, tableInfo is used - union { - struct STableMeta *pSTable; - STableComInfo tableInfo; - }; + STableComInfo tableInfo; uint8_t tableType; int16_t sversion; SCMVgroupInfo vgroupInfo; @@ -214,7 +210,7 @@ typedef struct SQueryInfo { int16_t numOfTables; STableMetaInfo **pTableMetaInfo; struct STSBuf * tsBuf; - int64_t * defaultVal; // default value for interpolation + int64_t * fillVal; // default value for interpolation char * msg; // pointer to the pCmd->payload to keep error message temporarily int64_t clauseLimit; // limit for current sub clause @@ -226,11 +222,8 @@ typedef struct { int command; uint8_t msgType; - union { - bool existsCheck; // check if the table exists or not - bool autoCreated; // if the table is missing, on-the-fly create it. during getmeterMeta - int8_t dataSourceType; // load data from file or not - }; + bool autoCreated; // if the table is missing, on-the-fly create it. during getmeterMeta + int8_t dataSourceType; // load data from file or not union { int32_t count; diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 26de2a51a8..6fba0efd97 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -48,7 +48,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const pSql->param = param; pSql->pTscObj = pObj; pSql->maxRetry = TSDB_MAX_REPLICA_NUM; - pSql->fp = fp; + pSql->fp = fp; if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE)) { tscError("failed to malloc payload"); diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c index f3e24e43a9..81602d17f4 100644 --- a/src/client/src/tscFunctionImpl.c +++ b/src/client/src/tscFunctionImpl.c @@ -390,16 +390,16 @@ static void function_finalizer(SQLFunctionCtx *pCtx) { if (pResInfo->hasResult != DATA_SET_FLAG) { tscTrace("no result generated, result is set to NULL"); - setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + if (pCtx->outputType == TSDB_DATA_TYPE_BINARY || pCtx->outputType == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(pCtx->aOutputBuf, pCtx->outputType); + } else { + setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + } } doFinalizer(pCtx); } -static bool usePreVal(SQLFunctionCtx *pCtx) { - return pCtx->preAggVals.isSet && pCtx->size == pCtx->preAggVals.size; -} - /* * count function does need the finalize, if data is missing, the default value, which is 0, is used * count function does not use the pCtx->interResBuf to keep the intermediate buffer @@ -412,7 +412,7 @@ static void count_function(SQLFunctionCtx *pCtx) { * 2. for general non-primary key columns, pCtx->hasNull may be true or false, pCtx->preAggVals.isSet == true; * 3. for primary key column, pCtx->hasNull always be false, pCtx->preAggVals.isSet == false; */ - if (usePreVal(pCtx)) { + if (pCtx->preAggVals.isSet) { numOfElem = pCtx->size - pCtx->preAggVals.statis.numOfNull; } else { if (pCtx->hasNull) { @@ -537,7 +537,7 @@ static void do_sum(SQLFunctionCtx *pCtx) { int32_t notNullElems = 0; // Only the pre-computing information loaded and actual data does not loaded - if (pCtx->preAggVals.isSet && pCtx->preAggVals.size == pCtx->size) { + if (pCtx->preAggVals.isSet) { notNullElems = pCtx->size - pCtx->preAggVals.statis.numOfNull; assert(pCtx->size >= pCtx->preAggVals.statis.numOfNull); @@ -768,7 +768,7 @@ static void avg_function(SQLFunctionCtx *pCtx) { SAvgInfo *pAvgInfo = (SAvgInfo *)pResInfo->interResultBuf; double * pVal = &pAvgInfo->sum; - if (usePreVal(pCtx)) { + if (pCtx->preAggVals.isSet) { // Pre-aggregation notNullElems = pCtx->size - pCtx->preAggVals.statis.numOfNull; assert(notNullElems >= 0); @@ -932,7 +932,7 @@ static void avg_finalizer(SQLFunctionCtx *pCtx) { static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, int32_t *notNullElems) { // data in current data block are qualified to the query - if (usePreVal(pCtx)) { + if (pCtx->preAggVals.isSet) { *notNullElems = pCtx->size - pCtx->preAggVals.statis.numOfNull; assert(*notNullElems >= 0); @@ -947,18 +947,21 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin, index = pCtx->preAggVals.statis.maxIndex; } - /** - * NOTE: work around the bug caused by invalid pre-calculated function. - * Here the selectivity + ts will not return correct value. - * - * The following codes of 3 lines will be removed later. - */ - if (index < 0 || index >= pCtx->size + pCtx->startOffset) { - index = 0; + TSKEY key = TSKEY_INITIAL_VAL; + if (pCtx->ptsList != NULL) { + /** + * NOTE: work around the bug caused by invalid pre-calculated function. + * Here the selectivity + ts will not return correct value. + * + * The following codes of 3 lines will be removed later. + */ + if (index < 0 || index >= pCtx->size + pCtx->startOffset) { + index = 0; + } + + key = pCtx->ptsList[index]; } - TSKEY key = pCtx->ptsList[index]; - if (pCtx->inputType >= TSDB_DATA_TYPE_TINYINT && pCtx->inputType <= TSDB_DATA_TYPE_BIGINT) { int64_t val = GET_INT64_VAL(tval); if (pCtx->inputType == TSDB_DATA_TYPE_TINYINT) { @@ -1865,12 +1868,22 @@ static void last_row_finalizer(SQLFunctionCtx *pCtx) { SResultInfo *pResInfo = GET_RES_INFO(pCtx); if (pCtx->currentStage == SECONDARY_STAGE_MERGE) { if (pResInfo->hasResult != DATA_SET_FLAG) { - setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + if (pCtx->outputType == TSDB_DATA_TYPE_BINARY || pCtx->outputType == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(pCtx->aOutputBuf, pCtx->outputType); + } else { + setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + } + return; } } else { if (pResInfo->hasResult != DATA_SET_FLAG) { - setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + if (pCtx->outputType == TSDB_DATA_TYPE_BINARY || pCtx->outputType == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(pCtx->aOutputBuf, pCtx->outputType); + } else { + setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + } + return; } } @@ -2886,7 +2899,12 @@ static void leastsquares_finalizer(SQLFunctionCtx *pCtx) { SLeastsquareInfo *pInfo = pResInfo->interResultBuf; if (pInfo->num == 0) { - setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + if (pCtx->outputType == TSDB_DATA_TYPE_BINARY || pCtx->outputType == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(pCtx->aOutputBuf, pCtx->outputType); + } else { + setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + } + return; } @@ -2913,10 +2931,6 @@ static void leastsquares_finalizer(SQLFunctionCtx *pCtx) { } static void date_col_output_function(SQLFunctionCtx *pCtx) { - if (pCtx->scanFlag == REVERSE_SCAN) { - return; - } - SET_VAL(pCtx, pCtx->size, 1); *(int64_t *)(pCtx->aOutputBuf) = pCtx->nStartQueryTimestamp; } @@ -3081,7 +3095,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { pOutput += 1; pTimestamp += 1; } else { - *pOutput = pData[i] - pData[i - step]; + *pOutput = pData[i] - pCtx->param[1].i64Key; // direct previous may be null *pTimestamp = pCtx->ptsList[i]; pOutput += 1; @@ -3113,7 +3127,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { pOutput += 1; pTimestamp += 1; } else { - *pOutput = pData[i] - pData[i - step]; + *pOutput = pData[i] - pCtx->param[1].i64Key; *pTimestamp = pCtx->ptsList[i]; pOutput += 1; @@ -3144,7 +3158,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { pOutput += 1; pTimestamp += 1; } else { - *pOutput = pData[i] - pData[i - step]; + *pOutput = pData[i] - pCtx->param[1].dKey; *pTimestamp = pCtx->ptsList[i]; pOutput += 1; pTimestamp += 1; @@ -3175,7 +3189,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { pOutput += 1; pTimestamp += 1; } else { - *pOutput = pData[i] - pData[i - step]; + *pOutput = pData[i] - pCtx->param[1].dKey; *pTimestamp = pCtx->ptsList[i]; pOutput += 1; @@ -3207,7 +3221,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { pOutput += 1; pTimestamp += 1; } else { - *pOutput = pData[i] - pData[i - step]; + *pOutput = pData[i] - pCtx->param[1].i64Key; *pTimestamp = pCtx->ptsList[i]; pOutput += 1; @@ -3239,7 +3253,7 @@ static void diff_function(SQLFunctionCtx *pCtx) { pOutput += 1; pTimestamp += 1; } else { - *pOutput = pData[i] - pData[i - step]; + *pOutput = pData[i] - pCtx->param[1].i64Key; *pTimestamp = pCtx->ptsList[i]; pOutput += 1; @@ -3420,7 +3434,7 @@ static void spread_function(SQLFunctionCtx *pCtx) { // todo : opt with pre-calculated result // column missing cause the hasNull to be true - if (usePreVal(pCtx)) { + if (pCtx->preAggVals.isSet) { numOfElems = pCtx->size - pCtx->preAggVals.statis.numOfNull; // all data are null in current data block, ignore current data block @@ -3446,14 +3460,8 @@ static void spread_function(SQLFunctionCtx *pCtx) { pInfo->max = GET_DOUBLE_VAL(&(pCtx->preAggVals.statis.max)); } } - } else { -// if (pInfo->min > pCtx->param[1].dKey) { -// pInfo->min = pCtx->param[1].dKey; -// } -// -// if (pInfo->max < pCtx->param[2].dKey) { -// pInfo->max = pCtx->param[2].dKey; -// } + + goto _spread_over; } void *pData = GET_INPUT_CHAR(pCtx); @@ -3873,7 +3881,11 @@ static void interp_function(SQLFunctionCtx *pCtx) { *(TSKEY *)pCtx->aOutputBuf = pInfoDetail->ts; } else { if (pInfoDetail->type == TSDB_FILL_NULL) { - setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + if (pCtx->outputType == TSDB_DATA_TYPE_BINARY || pCtx->outputType == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(pCtx->aOutputBuf, pCtx->outputType); + } else { + setNull(pCtx->aOutputBuf, pCtx->outputType, pCtx->outputBytes); + } } else if (pInfoDetail->type == TSDB_FILL_SET_VALUE) { tVariantDump(&pCtx->param[1], pCtx->aOutputBuf, pCtx->inputType); } else if (pInfoDetail->type == TSDB_FILL_PREV) { @@ -3925,7 +3937,11 @@ static void interp_function(SQLFunctionCtx *pCtx) { } } else { - setNull(pCtx->aOutputBuf, srcType, pCtx->inputBytes); + if (srcType == TSDB_DATA_TYPE_BINARY || srcType == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(pCtx->aOutputBuf, pCtx->inputBytes); + } else { + setNull(pCtx->aOutputBuf, srcType, pCtx->inputBytes); + } } } } diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 2da786d1d8..5ffdcd2167 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -56,7 +56,7 @@ static int32_t getToStringLength(const char *pData, int32_t length, int32_t type } break; case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_BIGINT: - len = sprintf(buf, "%" PRId64 "", *(int64_t *)pData); + len = sprintf(buf, "%" PRId64, *(int64_t *)pData); break; case TSDB_DATA_TYPE_BOOL: len = MAX_BOOL_TYPE_LENGTH; @@ -384,13 +384,10 @@ int tscProcessLocalCmd(SSqlObj *pSql) { // keep the code in local variable in order to avoid invalid read in case of async query int32_t code = pSql->res.code; - - if (pSql->fp != NULL) { // callback function - if (code == 0) { - (*pSql->fp)(pSql->param, pSql, 0); - } else { - tscQueueAsyncRes(pSql); - } + if (code == TSDB_CODE_SUCCESS) { + (*pSql->fp)(pSql->param, pSql, 0); + } else { + tscQueueAsyncRes(pSql); } return code; diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 059345128e..9202203fac 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -42,35 +42,42 @@ enum { static int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int32_t * numOfRows); static int32_t tscToInteger(SSQLToken *pToken, int64_t *value, char **endPtr) { -// int32_t numType = isValidNumber(pToken); -// if (TK_ILLEGAL == numType) { -// return numType; -// } - + if (pToken->n == 0) { + return TK_ILLEGAL; + } + int32_t radix = 10; - if (pToken->type == TK_HEX) { - radix = 16; - } else if (pToken->type == TK_OCT) { - radix = 8; - } else if (pToken->type == TK_BIN) { - radix = 2; + + int32_t radixList[3] = {16, 8, 2}; + if (pToken->type == TK_HEX || pToken->type == TK_OCT || pToken->type == TK_BIN) { + radix = radixList[pToken->type - TK_HEX]; } errno = 0; *value = strtoll(pToken->z, endPtr, radix); + + // not a valid integer number, return error + if ((pToken->type == TK_STRING || pToken->type == TK_ID) && ((*endPtr - pToken->z) != pToken->n)) { + return TK_ILLEGAL; + } return pToken->type; } static int32_t tscToDouble(SSQLToken *pToken, double *value, char **endPtr) { -// int32_t numType = isValidNumber(pToken); -// if (TK_ILLEGAL == numType) { -// return numType; -// } - + if (pToken->n == 0) { + return TK_ILLEGAL; + } + errno = 0; *value = strtod(pToken->z, endPtr); - return pToken->type; + + // not a valid integer number, return error + if ((pToken->type == TK_STRING || pToken->type == TK_ID) && ((*endPtr - pToken->z) != pToken->n)) { + return TK_ILLEGAL; + } else { + return pToken->type; + } } int tsParseTime(SSQLToken *pToken, int64_t *time, char **next, char *error, int16_t timePrec) { @@ -305,8 +312,7 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload, case TSDB_DATA_TYPE_BINARY: // binary data cannot be null-terminated char string, otherwise the last char of the string is lost if (pToken->type == TK_NULL) { - varDataSetLen(payload, sizeof(int8_t)); - *(uint8_t*) varDataVal(payload) = TSDB_DATA_BINARY_NULL; + setVardataNull(payload, TSDB_DATA_TYPE_BINARY); } else { // too long values will return invalid sql, not be truncated automatically if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { //todo refactor return tscInvalidSQLErrMsg(msg, "string data overflow", pToken->z); @@ -319,8 +325,7 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload, case TSDB_DATA_TYPE_NCHAR: if (pToken->type == TK_NULL) { - varDataSetLen(payload, sizeof(int32_t)); - *(uint32_t*) varDataVal(payload) = TSDB_DATA_NCHAR_NULL; + setVardataNull(payload, TSDB_DATA_TYPE_NCHAR); } else { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' size_t output = 0; @@ -422,9 +427,9 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[ return -1; } - if (((sToken.type != TK_NOW) && (sToken.type != TK_INTEGER) && (sToken.type != TK_STRING) && - (sToken.type != TK_FLOAT) && (sToken.type != TK_BOOL) && (sToken.type != TK_NULL)) || - (sToken.n == 0) || (sToken.type == TK_RP)) { + int16_t type = sToken.type; + if ((type != TK_NOW && type != TK_INTEGER && type != TK_STRING && type != TK_FLOAT && type != TK_BOOL && + type != TK_NULL && type != TK_HEX && type != TK_OCT && type != TK_BIN) || (sToken.n == 0) || (type == TK_RP)) { tscInvalidSQLErrMsg(error, "invalid data or symbol", sToken.z); *code = TSDB_CODE_INVALID_SQL; return -1; @@ -779,7 +784,6 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { STagData *pTag = (STagData *)pCmd->payload; memset(pTag, 0, sizeof(STagData)); - pCmd->payloadLen = sizeof(STagData); /* * the source super table is moved to the secondary position of the pTableMetaInfo list @@ -928,6 +932,14 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { } } + // 3. calculate the actual data size of STagData + pCmd->payloadLen = sizeof(pTag->name) + sizeof(pTag->dataLen); + for (int32_t t = 0; t < numOfTags; ++t) { + pTag->dataLen += pTagSchema[t].bytes; + pCmd->payloadLen += pTagSchema[t].bytes; + } + pTag->dataLen = htonl(pTag->dataLen); + if (tscValidateName(&tableToken) != TSDB_CODE_SUCCESS) { return tscInvalidSQLErrMsg(pCmd->payload, "invalid table name", *sqlstr); } @@ -949,7 +961,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { } else { sql = sToken.z; } - code = tscGetTableMeta(pSql, pTableMetaInfo); + code = tscGetMeterMetaEx(pSql, pTableMetaInfo, false); if (pCmd->curSql == NULL) { assert(code == TSDB_CODE_ACTION_IN_PROGRESS); @@ -1299,8 +1311,7 @@ int tsParseInsertSql(SSqlObj *pSql) { SQueryInfo *pQueryInfo = NULL; tscGetQueryInfoDetailSafely(pCmd, pCmd->clauseIndex, &pQueryInfo); - uint16_t type = (sToken.type == TK_INSERT)? TSDB_QUERY_TYPE_INSERT:TSDB_QUERY_TYPE_IMPORT; - TSDB_QUERY_SET_TYPE(pQueryInfo->type, type); + TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_INSERT); sToken = tStrGetToken(pSql->sqlstr, &index, false, 0, NULL); if (sToken.type != TK_INTO) { diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index f9ce16471a..82460b6a76 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -13,7 +13,8 @@ * along with this program. If not, see . */ -#define _XOPEN_SOURCE +#define _BSD_SOURCE +#define _XOPEN_SOURCE 500 #define _DEFAULT_SOURCE #include "os.h" @@ -3290,14 +3291,15 @@ static int32_t setExprToCond(tSQLExpr** parent, tSQLExpr* pExpr, const char* msg static int32_t handleExprInQueryCond(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, SCondExpr* pCondExpr, int32_t* type, int32_t parentOptr) { - const char* msg1 = "meter query cannot use tags filter"; + const char* msg1 = "table query cannot use tags filter"; const char* msg2 = "illegal column name"; const char* msg3 = "only one query time range allowed"; const char* msg4 = "only one join condition allowed"; const char* msg5 = "not support ordinary column join"; const char* msg6 = "only one query condition on tbname allowed"; const char* msg7 = "only in/like allowed in filter table name"; - + const char* msg8 = "wildcard string should be less than 20 characters"; + tSQLExpr* pLeft = (*pExpr)->pLeft; tSQLExpr* pRight = (*pExpr)->pRight; @@ -3344,7 +3346,7 @@ static int32_t handleExprInQueryCond(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, S // check for like expression if ((*pExpr)->nSQLOptr == TK_LIKE) { if (pRight->val.nLen > TSDB_PATTERN_STRING_MAX_LEN) { - return TSDB_CODE_INVALID_SQL; + return invalidSqlErrMsg(pQueryInfo->msg, msg8); } SSchema* pSchema = tscGetTableSchema(pTableMetaInfo->pTableMeta); @@ -3360,6 +3362,10 @@ static int32_t handleExprInQueryCond(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, S if (!validTableNameOptr(*pExpr)) { return invalidSqlErrMsg(pQueryInfo->msg, msg7); } + + if (!UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { + return invalidSqlErrMsg(pQueryInfo->msg, msg1); + } if (pCondExpr->pTableCond == NULL) { pCondExpr->pTableCond = *pExpr; @@ -3808,9 +3814,7 @@ int32_t parseWhereClause(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, SSqlObj* pSql const char* msg2 = "invalid filter expression"; int32_t ret = TSDB_CODE_SUCCESS; - - pQueryInfo->window.skey = 0; - pQueryInfo->window.ekey = INT64_MAX; + pQueryInfo->window = TSWINDOW_INITIALIZER; // tags query condition may be larger than 512bytes, therefore, we need to prepare enough large space SStringBuilder sb; memset(&sb, 0, sizeof(sb)); @@ -4012,9 +4016,9 @@ int32_t parseFillClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySQL) { size_t size = tscSqlExprNumOfExprs(pQueryInfo); - if (pQueryInfo->defaultVal == NULL) { - pQueryInfo->defaultVal = calloc(size, sizeof(int64_t)); - if (pQueryInfo->defaultVal == NULL) { + if (pQueryInfo->fillVal == NULL) { + pQueryInfo->fillVal = calloc(size, sizeof(int64_t)); + if (pQueryInfo->fillVal == NULL) { return TSDB_CODE_CLI_OUT_OF_MEMORY; } } @@ -4025,7 +4029,11 @@ int32_t parseFillClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySQL) { pQueryInfo->fillType = TSDB_FILL_NULL; for (int32_t i = START_INTERPO_COL_IDX; i < size; ++i) { TAOS_FIELD* pFields = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); - setNull((char*)&pQueryInfo->defaultVal[i], pFields->type, pFields->bytes); + if (pFields->type == TSDB_DATA_TYPE_BINARY || pFields->type == TSDB_DATA_TYPE_NCHAR) { + setVardataNull((char*) &pQueryInfo->fillVal[i], pFields->type); + } else { + setNull((char*)&pQueryInfo->fillVal[i], pFields->type, pFields->bytes); + }; } } else if (strncasecmp(pItem->pVar.pz, "prev", 4) == 0 && pItem->pVar.nLen == 4) { pQueryInfo->fillType = TSDB_FILL_PREV; @@ -4058,11 +4066,11 @@ int32_t parseFillClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySQL) { TAOS_FIELD* pFields = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); if (pFields->type == TSDB_DATA_TYPE_BINARY || pFields->type == TSDB_DATA_TYPE_NCHAR) { - setNull((char*)(&pQueryInfo->defaultVal[i]), pFields->type, pFields->bytes); + setVardataNull((char*) &pQueryInfo->fillVal[i], pFields->type); continue; } - int32_t ret = tVariantDump(&pFillToken->a[j].pVar, (char*)&pQueryInfo->defaultVal[i], pFields->type); + int32_t ret = tVariantDump(&pFillToken->a[j].pVar, (char*)&pQueryInfo->fillVal[i], pFields->type); if (ret != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(pQueryInfo->msg, msg); } @@ -4076,9 +4084,9 @@ int32_t parseFillClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySQL) { TAOS_FIELD* pFields = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); if (pFields->type == TSDB_DATA_TYPE_BINARY || pFields->type == TSDB_DATA_TYPE_NCHAR) { - setNull((char*)(&pQueryInfo->defaultVal[i]), pFields->type, pFields->bytes); + setVardataNull((char*) &pQueryInfo->fillVal[i], pFields->type); } else { - tVariantDump(&lastItem->pVar, (char*)&pQueryInfo->defaultVal[i], pFields->type); + tVariantDump(&lastItem->pVar, (char*)&pQueryInfo->fillVal[i], pFields->type); } } } @@ -4416,6 +4424,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(pQueryInfo->msg, msg13); } + pAlterSQL->tagData.dataLen = pTagsSchema->bytes; // validate the length of binary if ((pTagsSchema->type == TSDB_DATA_TYPE_BINARY || pTagsSchema->type == TSDB_DATA_TYPE_NCHAR) && @@ -4539,11 +4548,13 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { return TSDB_CODE_INVALID_SQL; } - const SDNodeDynConfOption DNODE_DYNAMIC_CFG_OPTIONS[14] = { - {"resetLog", 8}, {"resetQueryCache", 15}, {"dDebugFlag", 10}, {"rpcDebugFlag", 12}, - {"tmrDebugFlag", 12}, {"cDebugFlag", 10}, {"uDebugFlag", 10}, {"mDebugFlag", 10}, - {"sdbDebugFlag", 12}, {"httpDebugFlag", 13}, {"monitorDebugFlag", 16}, {"qDebugflag", 10}, - {"debugFlag", 9}, {"monitor", 7}}; + const int DNODE_DYNAMIC_CFG_OPTIONS_SIZE = 17; + const SDNodeDynConfOption DNODE_DYNAMIC_CFG_OPTIONS[] = { + {"resetLog", 8}, {"resetQueryCache", 15}, {"debugFlag", 9}, {"mDebugFlag", 10}, + {"dDebugFlag", 10}, {"sdbDebugFlag", 12}, {"vDebugFlag", 10}, {"cDebugFlag", 10}, + {"httpDebugFlag", 13}, {"monitorDebugFlag", 16}, {"rpcDebugFlag", 12}, {"uDebugFlag", 10}, + {"tmrDebugFlag", 12}, {"qDebugflag", 10}, {"sDebugflag", 10}, {"tsdbDebugFlag", 13}, + {"monitor", 7}}; SSQLToken* pOptionToken = &pOptions->a[1]; @@ -4555,8 +4566,8 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { return TSDB_CODE_SUCCESS; } } - } else if ((strncasecmp(DNODE_DYNAMIC_CFG_OPTIONS[13].name, pOptionToken->z, pOptionToken->n) == 0) && - (DNODE_DYNAMIC_CFG_OPTIONS[13].len == pOptionToken->n)) { + } else if ((strncasecmp(DNODE_DYNAMIC_CFG_OPTIONS[DNODE_DYNAMIC_CFG_OPTIONS_SIZE - 1].name, pOptionToken->z, pOptionToken->n) == 0) && + (DNODE_DYNAMIC_CFG_OPTIONS[DNODE_DYNAMIC_CFG_OPTIONS_SIZE - 1].len == pOptionToken->n)) { SSQLToken* pValToken = &pOptions->a[2]; int32_t val = strtol(pValToken->z, NULL, 10); if (val != 0 && val != 1) { @@ -4572,7 +4583,7 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { return TSDB_CODE_INVALID_SQL; } - for (int32_t i = 2; i < tListLen(DNODE_DYNAMIC_CFG_OPTIONS) - 1; ++i) { + for (int32_t i = 2; i < DNODE_DYNAMIC_CFG_OPTIONS_SIZE - 1; ++i) { const SDNodeDynConfOption* pOption = &DNODE_DYNAMIC_CFG_OPTIONS[i]; if ((strncasecmp(pOption->name, pOptionToken->z, pOptionToken->n) == 0) && (pOption->len == pOptionToken->n)) { @@ -5331,13 +5342,6 @@ int32_t doLocalQueryProcess(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql) { } } - SColumnIndex ind = {0}; - SSqlExpr* pExpr1 = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TAG_DUMMY, &ind, TSDB_DATA_TYPE_INT, - tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize, tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize, false); - - const char* name = (pExprList->a[0].aliasName != NULL)? pExprList->a[0].aliasName:functionsInfo[index].name; - strncpy(pExpr1->aliasName, name, tListLen(pExpr1->aliasName)); - switch (index) { case 0: pQueryInfo->command = TSDB_SQL_CURRENT_DB; @@ -5356,6 +5360,13 @@ int32_t doLocalQueryProcess(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql) { return TSDB_CODE_SUCCESS; default: { return invalidSqlErrMsg(pQueryInfo->msg, msg3); } } + + SColumnIndex ind = {0}; + SSqlExpr* pExpr1 = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TAG_DUMMY, &ind, TSDB_DATA_TYPE_INT, + tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize, tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize, false); + + const char* name = (pExprList->a[0].aliasName != NULL)? pExprList->a[0].aliasName:functionsInfo[index].name; + strncpy(pExpr1->aliasName, name, tListLen(pExpr1->aliasName)); } // can only perform the parameters based on the macro definitation @@ -5550,11 +5561,11 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { // too long tag values will return invalid sql, not be truncated automatically SSchema* pTagSchema = tscGetTableTagSchema(pStableMeterMetaInfo->pTableMeta); - char* tagVal = pCreateTable->usingInfo.tagdata.data; + STagData* pTag = &pCreateTable->usingInfo.tagdata; + char* tagVal = pTag->data; int32_t ret = TSDB_CODE_SUCCESS; for (int32_t i = 0; i < pList->nExpr; ++i) { - if (pTagSchema[i].type == TSDB_DATA_TYPE_BINARY || pTagSchema[i].type == TSDB_DATA_TYPE_NCHAR) { // validate the length of binary if (pList->a[i].pVar.nLen + VARSTR_HEADER_SIZE > pTagSchema[i].bytes) { @@ -5593,6 +5604,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { return ret; } + pTag->dataLen = tagVal - pTag->data; return TSDB_CODE_SUCCESS; } @@ -5602,7 +5614,8 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) { const char* msg3 = "fill only available for interval query"; const char* msg4 = "fill option not supported in stream computing"; const char* msg5 = "sql too long"; // todo ADD support - + const char* msg6 = "from missing in subclause"; + SSqlCmd* pCmd = &pSql->cmd; SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); assert(pQueryInfo->numOfTables == 1); @@ -5617,10 +5630,13 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) { if (tscValidateName(pzTableName) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } - + tVariantList* pSrcMeterName = pInfo->pCreateTableInfo->pSelect->from; - tVariant* pVar = &pSrcMeterName->a[0].pVar; - + if (pSrcMeterName == NULL || pSrcMeterName->nExpr == 0) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6); + } + + tVariant* pVar = &pSrcMeterName->a[0].pVar; SSQLToken srcToken = {.z = pVar->pz, .n = pVar->nLen, .type = TK_STRING}; if (tscValidateName(&srcToken) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(pQueryInfo->msg, msg1); diff --git a/src/client/src/tscSecondaryMerge.c b/src/client/src/tscSecondaryMerge.c index 251d4079e3..7617621e5f 100644 --- a/src/client/src/tscSecondaryMerge.c +++ b/src/client/src/tscSecondaryMerge.c @@ -145,7 +145,7 @@ static SFillColInfo* createFillColInfo(SQueryInfo* pQueryInfo) { pFillCol[i].flag = pExpr->colInfo.flag; pFillCol[i].col.offset = offset; pFillCol[i].functionId = pExpr->functionId; - pFillCol[i].defaultVal.i = pQueryInfo->defaultVal[i]; + pFillCol[i].fillVal.i = pQueryInfo->fillVal[i]; offset += pExpr->resBytes; } @@ -638,7 +638,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - (*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * 1); + (*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * pSql->numOfSubs); if (*pMemBuffer == NULL) { tscError("%p failed to allocate memory", pSql); pRes->code = TSDB_CODE_CLI_OUT_OF_MEMORY; @@ -946,8 +946,7 @@ static void doInterpolateResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, boo } while (1) { - int64_t newRows = -1; - taosGenerateDataBlock(pFillInfo, pResPages, &newRows, pLocalReducer->resColModel->capacity); + int64_t newRows = taosGenerateDataBlock(pFillInfo, pResPages, pLocalReducer->resColModel->capacity); if (pQueryInfo->limit.offset < newRows) { newRows -= pQueryInfo->limit.offset; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index e36fb0d86a..7d0ac09e66 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -571,7 +571,6 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char pTableIdInfo->key = htobe64(tscGetSubscriptionProgress(pSql->pSubscription, pTableMeta->uid, dfltKey)); pQueryMsg->numOfTables = htonl(1); // set the number of tables - pMsg += sizeof(STableIdInfo); } else { int32_t index = pTableMetaInfo->vgroupIndex; @@ -601,8 +600,8 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char } } - tscTrace("%p vgId:%d, query on table:%s, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), pTableMetaInfo->name, - pTableMeta->uid); + tscTrace("%p vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), pTableMetaInfo->name, + pTableMeta->sid, pTableMeta->uid); return pMsg; } @@ -782,8 +781,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { if (pQueryInfo->fillType != TSDB_FILL_NONE) { for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) { - *((int64_t *)pMsg) = htobe64(pQueryInfo->defaultVal[i]); - pMsg += sizeof(pQueryInfo->defaultVal[0]); + *((int64_t *)pMsg) = htobe64(pQueryInfo->fillVal[i]); + pMsg += sizeof(pQueryInfo->fillVal[0]); } } @@ -1213,8 +1212,13 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int8_t type = pInfo->pCreateTableInfo->type; if (type == TSQL_CREATE_TABLE_FROM_STABLE) { // create by using super table, tags value - memcpy(pMsg, &pInfo->pCreateTableInfo->usingInfo.tagdata, sizeof(STagData)); - pMsg += sizeof(STagData); + STagData* pTag = &pInfo->pCreateTableInfo->usingInfo.tagdata; + *(int32_t*)pMsg = htonl(pTag->dataLen); + pMsg += sizeof(int32_t); + memcpy(pMsg, pTag->name, sizeof(pTag->name)); + pMsg += sizeof(pTag->name); + memcpy(pMsg, pTag->data, pTag->dataLen); + pMsg += pTag->dataLen; } else { // create (super) table pSchema = (SSchema *)pCreateTableMsg->schema; @@ -1281,9 +1285,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { strcpy(pAlterTableMsg->tableId, pTableMetaInfo->name); pAlterTableMsg->type = htons(pAlterInfo->type); - pAlterTableMsg->numOfCols = tscNumOfFields(pQueryInfo); - memcpy(pAlterTableMsg->tagVal, pAlterInfo->tagData.data, TSDB_MAX_TAGS_LEN); - + pAlterTableMsg->numOfCols = htons(tscNumOfFields(pQueryInfo)); SSchema *pSchema = pAlterTableMsg->schema; for (int i = 0; i < pAlterTableMsg->numOfCols; ++i) { TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); @@ -1295,6 +1297,9 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } pMsg = (char *)pSchema; + pAlterTableMsg->tagValLen = htonl(pAlterInfo->tagData.dataLen); + memcpy(pMsg, pAlterInfo->tagData.data, pAlterInfo->tagData.dataLen); + pMsg += pAlterInfo->tagData.dataLen; msgLen = pMsg - (char*)pAlterTableMsg; pCmd->payloadLen = msgLen; @@ -1863,6 +1868,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { } free(pTableMeta); + tscTrace("%p recv table meta: %"PRId64 ", tid:%d, name:%s", pSql, pTableMeta->uid, pTableMeta->sid, pTableMetaInfo->name); return TSDB_CODE_SUCCESS; } diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index f42bf819ca..1b1aaa54c9 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -165,7 +165,7 @@ static void tscSetTimestampForRes(SSqlStream *pStream, SSqlObj *pSql) { if (timestamp != actualTimestamp) { // reset the timestamp of each agg point by using start time of each interval *((int64_t *)pRes->data) = actualTimestamp; - tscWarn("%p stream:%p, timestamp of points is:%" PRId64 ", reset to %" PRId64 "", pSql, pStream, timestamp, actualTimestamp); + tscWarn("%p stream:%p, timestamp of points is:%" PRId64 ", reset to %" PRId64, pSql, pStream, timestamp, actualTimestamp); } } @@ -223,7 +223,7 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf int16_t offset = tscFieldInfoGetOffset(pQueryInfo, i); TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); - assignVal(pSql->res.data + offset, (char *)(&pQueryInfo->defaultVal[i]), pField->bytes, pField->type); + assignVal(pSql->res.data + offset, (char *)(&pQueryInfo->fillVal[i]), pField->bytes, pField->type); row[i] = pSql->res.data + offset; } @@ -287,10 +287,10 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer) return; } - tscTrace("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64 "", pStream->pSql, pStream, + tscTrace("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream, now + timer, timer, delay, pStream->stime, etime); } else { - tscTrace("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64 "", pStream->pSql, pStream, + tscTrace("%p stream:%p, next start at %" PRId64 ", in %" PRId64 "ms. delay:%" PRId64 "ms qrange %" PRId64 "-%" PRId64, pStream->pSql, pStream, pStream->stime, timer, delay, pStream->stime - pStream->interval, pStream->stime - 1); } @@ -380,7 +380,7 @@ static void tscSetSlidingWindowInfo(SSqlObj *pSql, SSqlStream *pStream) { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); if (pQueryInfo->intervalTime < minIntervalTime) { - tscWarn("%p stream:%p, original sample interval:%ld too small, reset to:%" PRId64 "", pSql, pStream, + tscWarn("%p stream:%p, original sample interval:%ld too small, reset to:%" PRId64, pSql, pStream, pQueryInfo->intervalTime, minIntervalTime); pQueryInfo->intervalTime = minIntervalTime; } @@ -397,14 +397,14 @@ static void tscSetSlidingWindowInfo(SSqlObj *pSql, SSqlStream *pStream) { if (pQueryInfo->slidingTime == -1) { pQueryInfo->slidingTime = pQueryInfo->intervalTime; } else if (pQueryInfo->slidingTime < minSlidingTime) { - tscWarn("%p stream:%p, original sliding value:%" PRId64 " too small, reset to:%" PRId64 "", pSql, pStream, + tscWarn("%p stream:%p, original sliding value:%" PRId64 " too small, reset to:%" PRId64, pSql, pStream, pQueryInfo->slidingTime, minSlidingTime); pQueryInfo->slidingTime = minSlidingTime; } if (pQueryInfo->slidingTime > pQueryInfo->intervalTime) { - tscWarn("%p stream:%p, sliding value:%" PRId64 " can not be larger than interval range, reset to:%" PRId64 "", pSql, pStream, + tscWarn("%p stream:%p, sliding value:%" PRId64 " can not be larger than interval range, reset to:%" PRId64, pSql, pStream, pQueryInfo->slidingTime, pQueryInfo->intervalTime); pQueryInfo->slidingTime = pQueryInfo->intervalTime; @@ -433,11 +433,11 @@ static int64_t tscGetStreamStartTimestamp(SSqlObj *pSql, SSqlStream *pStream, in } else { // timewindow based aggregation stream if (stime == 0) { // no data in meter till now stime = ((int64_t)taosGetTimestamp(pStream->precision) / pStream->interval) * pStream->interval; - tscWarn("%p stream:%p, last timestamp:0, reset to:%" PRId64 "", pSql, pStream, stime); + tscWarn("%p stream:%p, last timestamp:0, reset to:%" PRId64, pSql, pStream, stime); } else { int64_t newStime = (stime / pStream->interval) * pStream->interval; if (newStime != stime) { - tscWarn("%p stream:%p, last timestamp:%" PRId64 ", reset to:%" PRId64 "", pSql, pStream, stime, newStime); + tscWarn("%p stream:%p, last timestamp:%" PRId64 ", reset to:%" PRId64, pSql, pStream, stime, newStime); stime = newStime; } } diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 9092fdd0b3..5831ddad4a 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -61,7 +61,7 @@ TSKEY tscGetSubscriptionProgress(void* sub, int64_t uid, TSKEY dflt) { SSub* pSub = (SSub*)sub; SSubscriptionProgress target = {.uid = uid, .key = 0}; - SSubscriptionProgress* p = taosArraySearch(pSub->progress, tscCompareSubscriptionProgress, &target); + SSubscriptionProgress* p = taosArraySearch(pSub->progress, &target, tscCompareSubscriptionProgress); if (p == NULL) { return dflt; } @@ -74,7 +74,7 @@ void tscUpdateSubscriptionProgress(void* sub, int64_t uid, TSKEY ts) { SSub* pSub = (SSub*)sub; SSubscriptionProgress target = {.uid = uid, .key = ts}; - SSubscriptionProgress* p = taosArraySearch(pSub->progress, tscCompareSubscriptionProgress, &target); + SSubscriptionProgress* p = taosArraySearch(pSub->progress, &target, tscCompareSubscriptionProgress); if (p != NULL) { p->key = ts; } @@ -211,7 +211,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { STableMeta * pTableMeta = pTableMetaInfo->pTableMeta; SSubscriptionProgress target = {.uid = pTableMeta->uid, .key = 0}; - SSubscriptionProgress* p = taosArraySearch(pSub->progress, tscCompareSubscriptionProgress, &target); + SSubscriptionProgress* p = taosArraySearch(pSub->progress, &target, tscCompareSubscriptionProgress); if (p == NULL) { taosArrayClear(pSub->progress); taosArrayPush(pSub->progress, &target); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 296ffe3333..ec9908ae96 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -281,7 +281,7 @@ void tscClearInterpInfo(SQueryInfo* pQueryInfo) { } pQueryInfo->fillType = TSDB_FILL_NONE; - tfree(pQueryInfo->defaultVal); + tfree(pQueryInfo->fillVal); } int32_t tscCreateResPointerInfo(SSqlRes* pRes, SQueryInfo* pQueryInfo) { @@ -1616,7 +1616,7 @@ static void freeQueryInfoImpl(SQueryInfo* pQueryInfo) { pQueryInfo->tsBuf = tsBufDestory(pQueryInfo->tsBuf); - tfree(pQueryInfo->defaultVal); + tfree(pQueryInfo->fillVal); } void tscClearSubqueryInfo(SSqlCmd* pCmd) { @@ -1768,7 +1768,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void pNewQueryInfo->order = pQueryInfo->order; pNewQueryInfo->clauseLimit = pQueryInfo->clauseLimit; pNewQueryInfo->pTableMetaInfo = NULL; - pNewQueryInfo->defaultVal = NULL; + pNewQueryInfo->fillVal = NULL; pNewQueryInfo->numOfTables = 0; pNewQueryInfo->tsBuf = NULL; @@ -1780,8 +1780,8 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void tscTagCondCopy(&pNewQueryInfo->tagCond, &pQueryInfo->tagCond); if (pQueryInfo->fillType != TSDB_FILL_NONE) { - pNewQueryInfo->defaultVal = malloc(pQueryInfo->fieldsInfo.numOfOutput * sizeof(int64_t)); - memcpy(pNewQueryInfo->defaultVal, pQueryInfo->defaultVal, pQueryInfo->fieldsInfo.numOfOutput * sizeof(int64_t)); + pNewQueryInfo->fillVal = malloc(pQueryInfo->fieldsInfo.numOfOutput * sizeof(int64_t)); + memcpy(pNewQueryInfo->fillVal, pQueryInfo->fillVal, pQueryInfo->fieldsInfo.numOfOutput * sizeof(int64_t)); } if (tscAllocPayload(pnCmd, TSDB_DEFAULT_PAYLOAD_SIZE) != TSDB_CODE_SUCCESS) { diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index 3ad6b39869..497279fb27 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -154,8 +154,8 @@ typedef struct SDataCol { static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; } void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints); -void dataColAppendVal(SDataCol *pCol, void *value, int numOfPoints, int maxPoints); -void dataColPopPoints(SDataCol *pCol, int pointsToPop, int numOfPoints); +void dataColAppendVal(SDataCol *pCol, void *value, int numOfRows, int maxPoints); +void dataColPopPoints(SDataCol *pCol, int pointsToPop, int numOfRows); void dataColSetOffset(SDataCol *pCol, int nEle); bool isNEleNull(SDataCol *pCol, int nEle); @@ -195,7 +195,7 @@ typedef struct { int maxPoints; // max number of points int bufSize; - int numOfPoints; + int numOfRows; int numOfCols; // Total number of cols int sversion; // TODO: set sversion void * buf; @@ -205,7 +205,7 @@ typedef struct { #define keyCol(pCols) (&((pCols)->cols[0])) // Key column #define dataColsKeyAt(pCols, idx) ((TSKEY *)(keyCol(pCols)->pData))[(idx)] #define dataColsKeyFirst(pCols) dataColsKeyAt(pCols, 0) -#define dataColsKeyLast(pCols) ((pCols->numOfPoints == 0) ? 0 : dataColsKeyAt(pCols, (pCols)->numOfPoints - 1)) +#define dataColsKeyLast(pCols) ((pCols->numOfRows == 0) ? 0 : dataColsKeyAt(pCols, (pCols)->numOfRows - 1)) SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows); void tdResetDataCols(SDataCols *pCols); diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index da8f3cd1e1..319772b606 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -103,6 +103,7 @@ extern int32_t tsOfflineThreshold; extern int32_t tsMgmtEqualVnodeNum; extern int32_t tsEnableHttpModule; +extern int32_t tsEnableMqttModule; extern int32_t tsEnableMonitorModule; extern int32_t tsRestRowLimit; @@ -147,6 +148,7 @@ extern int32_t jniDebugFlag; extern int32_t tmrDebugFlag; extern int32_t sdbDebugFlag; extern int32_t httpDebugFlag; +extern int32_t mqttDebugFlag; extern int32_t monitorDebugFlag; extern int32_t uDebugFlag; extern int32_t rpcDebugFlag; diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 8165fb84c7..38d82f628b 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -319,29 +319,29 @@ void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints) } -void dataColAppendVal(SDataCol *pCol, void *value, int numOfPoints, int maxPoints) { +void dataColAppendVal(SDataCol *pCol, void *value, int numOfRows, int maxPoints) { ASSERT(pCol != NULL && value != NULL); switch (pCol->type) { case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: // set offset - pCol->dataOff[numOfPoints] = pCol->len; + pCol->dataOff[numOfRows] = pCol->len; // Copy data memcpy(POINTER_SHIFT(pCol->pData, pCol->len), value, varDataTLen(value)); // Update the length pCol->len += varDataTLen(value); break; default: - ASSERT(pCol->len == TYPE_BYTES[pCol->type] * numOfPoints); + ASSERT(pCol->len == TYPE_BYTES[pCol->type] * numOfRows); memcpy(POINTER_SHIFT(pCol->pData, pCol->len), value, pCol->bytes); pCol->len += pCol->bytes; break; } } -void dataColPopPoints(SDataCol *pCol, int pointsToPop, int numOfPoints) { - int pointsLeft = numOfPoints - pointsToPop; +void dataColPopPoints(SDataCol *pCol, int pointsToPop, int numOfRows) { + int pointsLeft = numOfRows - pointsToPop; ASSERT(pointsLeft > 0); @@ -353,7 +353,7 @@ void dataColPopPoints(SDataCol *pCol, int pointsToPop, int numOfPoints) { memmove(pCol->pData, POINTER_SHIFT(pCol->pData, toffset), pCol->len); dataColSetOffset(pCol, pointsLeft); } else { - ASSERT(pCol->len == TYPE_BYTES[pCol->type] * numOfPoints); + ASSERT(pCol->len == TYPE_BYTES[pCol->type] * numOfRows); pCol->len = TYPE_BYTES[pCol->type] * pointsLeft; memmove(pCol->pData, POINTER_SHIFT(pCol->pData, TYPE_BYTES[pCol->type] * pointsToPop), pCol->len); } @@ -454,7 +454,7 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) { pRet->numOfCols = pDataCols->numOfCols; pRet->sversion = pDataCols->sversion; - if (keepData) pRet->numOfPoints = pDataCols->numOfPoints; + if (keepData) pRet->numOfRows = pDataCols->numOfRows; for (int i = 0; i < pDataCols->numOfCols; i++) { pRet->cols[i].type = pDataCols->cols[i].type; @@ -484,7 +484,7 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) { } void tdResetDataCols(SDataCols *pCols) { - pCols->numOfPoints = 0; + pCols->numOfRows = 0; for (int i = 0; i < pCols->maxCols; i++) { dataColReset(pCols->cols + i); } @@ -497,14 +497,14 @@ void tdAppendDataRowToDataCol(SDataRow row, SDataCols *pCols) { SDataCol *pCol = pCols->cols + i; void * value = tdGetRowDataOfCol(row, pCol->type, pCol->offset); - dataColAppendVal(pCol, value, pCols->numOfPoints, pCols->maxPoints); + dataColAppendVal(pCol, value, pCols->numOfRows, pCols->maxPoints); } - pCols->numOfPoints++; + pCols->numOfRows++; } // Pop pointsToPop points from the SDataCols void tdPopDataColsPoints(SDataCols *pCols, int pointsToPop) { - int pointsLeft = pCols->numOfPoints - pointsToPop; + int pointsLeft = pCols->numOfRows - pointsToPop; if (pointsLeft <= 0) { tdResetDataCols(pCols); return; @@ -512,14 +512,14 @@ void tdPopDataColsPoints(SDataCols *pCols, int pointsToPop) { for (int iCol = 0; iCol < pCols->numOfCols; iCol++) { SDataCol *pCol = pCols->cols + iCol; - dataColPopPoints(pCol, pointsToPop, pCols->numOfPoints); + dataColPopPoints(pCol, pointsToPop, pCols->numOfRows); } - pCols->numOfPoints = pointsLeft; + pCols->numOfRows = pointsLeft; } int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge) { - ASSERT(rowsToMerge > 0 && rowsToMerge <= source->numOfPoints); - ASSERT(target->numOfPoints + rowsToMerge <= target->maxPoints); + ASSERT(rowsToMerge > 0 && rowsToMerge <= source->numOfRows); + ASSERT(target->numOfRows + rowsToMerge <= target->maxPoints); ASSERT(target->numOfCols == source->numOfCols); SDataCols *pTarget = NULL; @@ -527,10 +527,10 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge) { if (dataColsKeyLast(target) < dataColsKeyFirst(source)) { // No overlap for (int i = 0; i < rowsToMerge; i++) { for (int j = 0; j < source->numOfCols; j++) { - dataColAppendVal(target->cols + j, tdGetColDataOfRow(source->cols + j, i), target->numOfPoints, + dataColAppendVal(target->cols + j, tdGetColDataOfRow(source->cols + j, i), target->numOfRows, target->maxPoints); } - target->numOfPoints++; + target->numOfRows++; } } else { pTarget = tdDupDataCols(target, true); @@ -538,7 +538,7 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge) { int iter1 = 0; int iter2 = 0; - tdMergeTwoDataCols(target, pTarget, &iter1, source, &iter2, pTarget->numOfPoints + rowsToMerge); + tdMergeTwoDataCols(target, pTarget, &iter1, source, &iter2, pTarget->numOfRows + rowsToMerge); } tdFreeDataCols(pTarget); @@ -553,33 +553,31 @@ void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, SDataCol // TODO: add resolve duplicate key here tdResetDataCols(target); - while (target->numOfPoints < tRows) { - if (*iter1 >= src1->numOfPoints && *iter2 >= src2->numOfPoints) break; + while (target->numOfRows < tRows) { + if (*iter1 >= src1->numOfRows && *iter2 >= src2->numOfRows) break; - TSKEY key1 = (*iter1 >= src1->numOfPoints) ? INT64_MAX : ((TSKEY *)(src1->cols[0].pData))[*iter1]; - TSKEY key2 = (*iter2 >= src2->numOfPoints) ? INT64_MAX : ((TSKEY *)(src2->cols[0].pData))[*iter2]; + TSKEY key1 = (*iter1 >= src1->numOfRows) ? INT64_MAX : ((TSKEY *)(src1->cols[0].pData))[*iter1]; + TSKEY key2 = (*iter2 >= src2->numOfRows) ? INT64_MAX : ((TSKEY *)(src2->cols[0].pData))[*iter2]; - if (key1 < key2) { + if (key1 <= key2) { for (int i = 0; i < src1->numOfCols; i++) { ASSERT(target->cols[i].type == src1->cols[i].type); - dataColAppendVal(target->cols[i].pData, tdGetColDataOfRow(src1->cols + i, *iter1), target->numOfPoints, + dataColAppendVal(&(target->cols[i]), tdGetColDataOfRow(src1->cols + i, *iter1), target->numOfRows, target->maxPoints); } - target->numOfPoints++; + target->numOfRows++; (*iter1)++; - } else if (key1 > key2) { + if (key1 == key2) (*iter2)++; + } else { for (int i = 0; i < src2->numOfCols; i++) { ASSERT(target->cols[i].type == src2->cols[i].type); - dataColAppendVal(target->cols[i].pData, tdGetColDataOfRow(src2->cols + i, *iter2), target->numOfPoints, + dataColAppendVal(&(target->cols[i]), tdGetColDataOfRow(src2->cols + i, *iter2), target->numOfRows, target->maxPoints); } - target->numOfPoints++; + target->numOfRows++; (*iter2)++; - } else { - // TODO: deal with duplicate keys - ASSERT(false); } } } \ No newline at end of file diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index c711aa25c3..763b3f5c22 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -107,7 +107,6 @@ int32_t tsReplications = TSDB_DEFAULT_REPLICA_NUM; int16_t tsAffectedRowsMod = 0; int32_t tsNumOfMPeers = 3; int32_t tsMaxShellConns = 2000; -int32_t tsMaxTables = 100000; char tsDefaultDB[TSDB_DB_NAME_LEN] = {0}; char tsDefaultUser[64] = "root"; @@ -121,6 +120,7 @@ int32_t tsOfflineThreshold = 86400*100; // seconds 10days int32_t tsMgmtEqualVnodeNum = 4; int32_t tsEnableHttpModule = 1; +int32_t tsEnableMqttModule = 0; // not finished yet, not started it by default int32_t tsEnableMonitorModule = 0; int32_t tsRestRowLimit = 10240; @@ -135,13 +135,14 @@ int32_t cDebugFlag = 135; int32_t jniDebugFlag = 131; int32_t odbcDebugFlag = 131; int32_t httpDebugFlag = 131; +int32_t mqttDebugFlag = 131; int32_t monitorDebugFlag = 131; int32_t qDebugFlag = 131; int32_t rpcDebugFlag = 135; int32_t uDebugFlag = 131; int32_t debugFlag = 131; int32_t sDebugFlag = 135; -int32_t tsdbDebugFlag = 131; +int32_t tsdbDebugFlag = 135; // the maximum number of results for projection query on super table that are returned from // one virtual node, to order according to timestamp @@ -201,6 +202,8 @@ char tsTimezone[64] = {0}; char tsLocale[TSDB_LOCALE_LEN] = {0}; char tsCharset[TSDB_LOCALE_LEN] = {0}; // default encode string +int32_t tsMaxBinaryDisplayWidth = 30; + static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT; void taosSetAllDebugFlag() { @@ -213,6 +216,7 @@ void taosSetAllDebugFlag() { jniDebugFlag = debugFlag; odbcDebugFlag = debugFlag; httpDebugFlag = debugFlag; + mqttDebugFlag = debugFlag; monitorDebugFlag = debugFlag; rpcDebugFlag = debugFlag; uDebugFlag = debugFlag; @@ -891,6 +895,17 @@ static void doInitGlobalConfig() { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + + cfg.option = "mqtt"; + cfg.ptr = &tsEnableMqttModule; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; + cfg.minValue = 0; + cfg.maxValue = 1; + cfg.ptrLength = 1; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + cfg.option = "monitor"; cfg.ptr = &tsEnableMonitorModule; cfg.valType = TAOS_CFG_VTYPE_INT32; @@ -1113,6 +1128,17 @@ static void doInitGlobalConfig() { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + cfg.option = "mqttDebugFlag"; + cfg.ptr = &mqttDebugFlag; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG; + cfg.minValue = 0; + cfg.maxValue = 255; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); + + cfg.option = "monitorDebugFlag"; cfg.ptr = &monitorDebugFlag; cfg.valType = TAOS_CFG_VTYPE_INT32; @@ -1203,6 +1229,16 @@ static void doInitGlobalConfig() { cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); + + cfg.option = "maxBinaryDisplayWidth"; + cfg.ptr = &tsMaxBinaryDisplayWidth; + cfg.valType = TAOS_CFG_VTYPE_INT32; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT; + cfg.minValue = 1; + cfg.maxValue = 0x7fffffff; + cfg.ptrLength = 0; + cfg.unitType = TAOS_CFG_UTYPE_NONE; + taosInitConfigOption(cfg); } void taosInitGlobalCfg() { diff --git a/src/common/src/tname.c b/src/common/src/tname.c index 29236ed0ff..3566f26abd 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -29,6 +29,7 @@ void extractTableName(const char* tableId, char* name) { size_t s2 = strcspn(&tableId[s1 + 1], &TS_PATH_DELIMITER[0]); strncpy(name, &tableId[s1 + s2 + 2], TSDB_TABLE_NAME_LEN); + name[TSDB_TABLE_NAME_LEN] = 0; } char* extractDBName(const char* tableId, char* name) { diff --git a/src/common/src/ttypes.c b/src/common/src/ttypes.c index 0037c6c688..f97a146a1e 100644 --- a/src/common/src/ttypes.c +++ b/src/common/src/ttypes.c @@ -42,9 +42,6 @@ static void getStatics_i8(const TSKEY *primaryKey, const void *pData, int32_t nu ASSERT(numOfRow <= INT16_MAX); - // int64_t lastKey = 0; - // int8_t lastVal = TSDB_DATA_TINYINT_NULL; - for (int32_t i = 0; i < numOfRow; ++i) { if (isNull((char *)&data[i], TSDB_DATA_TYPE_TINYINT)) { (*numOfNull) += 1; @@ -213,15 +210,6 @@ static void getStatics_f(const TSKEY *primaryKey, const void *pData, int32_t num fmax = fv; *maxIndex = i; } - - // if (isNull(&lastVal, TSDB_DATA_TYPE_FLOAT)) { - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } else { - // *wsum = lastVal * (primaryKey[i] - lastKey); - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } } double csum = 0; @@ -232,9 +220,9 @@ static void getStatics_f(const TSKEY *primaryKey, const void *pData, int32_t num SET_DOUBLE_VAL_ALIGN(max, &fmax); SET_DOUBLE_VAL_ALIGN(min, &fmin); #else - *sum = csum; - *max = fmax; - *min = fmin; + *(double*)sum = csum; + *(double*)max = fmax; + *(double*)min = fmin; #endif } @@ -267,15 +255,6 @@ static void getStatics_d(const TSKEY *primaryKey, const void *pData, int32_t num dmax = dv; *maxIndex = i; } - - // if (isNull(&lastVal, TSDB_DATA_TYPE_DOUBLE)) { - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } else { - // *wsum = lastVal * (primaryKey[i] - lastKey); - // lastKey = primaryKey[i]; - // lastVal = data[i]; - // } } double csum = 0; @@ -285,27 +264,67 @@ static void getStatics_d(const TSKEY *primaryKey, const void *pData, int32_t num #ifdef _TD_ARM_32_ SET_DOUBLE_VAL_ALIGN(sum, &csum); - SET_DOUBLE_VAL_ALIGN(max, &dmax); - SET_DOUBLE_VAL_ALIGN(min, &dmin); + SET_DOUBLE_VAL_ALIGN(max, &dmax); + SET_DOUBLE_VAL_ALIGN(min, &dmin); #else - *sum = csum; - *max = dmax; - *min = dmin; + *(double*) sum = csum; + *(double*) max = dmax; + *(double*) min = dmin; #endif } +static void getStatics_bin(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, + int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { + const char* data = pData; + ASSERT(numOfRow <= INT16_MAX); + + for (int32_t i = 0; i < numOfRow; ++i) { + if (isNull((const char*) varDataVal(data), TSDB_DATA_TYPE_BINARY)) { + (*numOfNull) += 1; + } + + data += varDataLen(data); + } + + *sum = 0; + *max = 0; + *min = 0; + *minIndex = 0; + *maxIndex = 0; +} + +static void getStatics_nchr(const TSKEY *primaryKey, const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, + int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) { + const char* data = pData; + ASSERT(numOfRow <= INT16_MAX); + + for (int32_t i = 0; i < numOfRow; ++i) { + if (isNull((const char*) varDataVal(data), TSDB_DATA_TYPE_NCHAR)) { + (*numOfNull) += 1; + } + + data += varDataLen(data); + } + + *sum = 0; + *max = 0; + *min = 0; + *minIndex = 0; + *maxIndex = 0; +} + tDataTypeDescriptor tDataTypeDesc[11] = { {TSDB_DATA_TYPE_NULL, 6, 1, "NOTYPE", NULL, NULL, NULL}, - {TSDB_DATA_TYPE_BOOL, 4, CHAR_BYTES, "BOOL", tsCompressBool, tsDecompressBool, NULL}, + {TSDB_DATA_TYPE_BOOL, 4, CHAR_BYTES, "BOOL", tsCompressBool, tsDecompressBool, getStatics_i8}, {TSDB_DATA_TYPE_TINYINT, 7, CHAR_BYTES, "TINYINT", tsCompressTinyint, tsDecompressTinyint, getStatics_i8}, {TSDB_DATA_TYPE_SMALLINT, 8, SHORT_BYTES, "SMALLINT", tsCompressSmallint, tsDecompressSmallint, getStatics_i16}, {TSDB_DATA_TYPE_INT, 3, INT_BYTES, "INT", tsCompressInt, tsDecompressInt, getStatics_i32}, {TSDB_DATA_TYPE_BIGINT, 6, LONG_BYTES, "BIGINT", tsCompressBigint, tsDecompressBigint, getStatics_i64}, {TSDB_DATA_TYPE_FLOAT, 5, FLOAT_BYTES, "FLOAT", tsCompressFloat, tsDecompressFloat, getStatics_f}, {TSDB_DATA_TYPE_DOUBLE, 6, DOUBLE_BYTES, "DOUBLE", tsCompressDouble, tsDecompressDouble, getStatics_d}, - {TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", tsCompressString, tsDecompressString, NULL}, - {TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", tsCompressTimestamp, tsDecompressTimestamp, NULL}, - {TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", tsCompressString, tsDecompressString, NULL}, + {TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", tsCompressString, tsDecompressString, getStatics_bin}, + {TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", tsCompressTimestamp, tsDecompressTimestamp, getStatics_i64}, + {TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", tsCompressString, tsDecompressString, getStatics_nchr}, }; char tTokenTypeSwitcher[13] = { @@ -362,6 +381,18 @@ bool isNull(const char *val, int32_t type) { }; } +void setVardataNull(char* val, int32_t type) { + if (type == TSDB_DATA_TYPE_BINARY) { + varDataSetLen(val, sizeof(int8_t)); + *(uint8_t*) varDataVal(val) = TSDB_DATA_BINARY_NULL; + } else if (type == TSDB_DATA_TYPE_NCHAR) { + varDataSetLen(val, sizeof(int32_t)); + *(uint32_t*) varDataVal(val) = TSDB_DATA_NCHAR_NULL; + } else { + assert(0); + } +} + void setNull(char *val, int32_t type, int32_t bytes) { setNullN(val, type, bytes, 1); } void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) { @@ -464,7 +495,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { break; }; case TSDB_DATA_TYPE_NCHAR: { - wcsncpy((wchar_t*)val, (wchar_t*)src, len / TSDB_NCHAR_SIZE); + varDataCopy(val, src); break; }; default: { diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java index c297fb67b0..f4c9ec765a 100755 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java @@ -188,7 +188,7 @@ public class TSDBDriver implements java.sql.Driver { } public boolean acceptsURL(String url) throws SQLException { - return true; + return StringUtils.isNotBlank(url) && url.startsWith(URL_PREFIX); } public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { @@ -355,4 +355,4 @@ public class TSDBDriver implements java.sql.Driver { public String database(Properties props) { return props.getProperty(PROPERTY_KEY_DBNAME); } -} \ No newline at end of file +} diff --git a/src/connector/python/linux/python2/taos/cursor.py b/src/connector/python/linux/python2/taos/cursor.py index 3d738ab22d..7ea52aa5ad 100644 --- a/src/connector/python/linux/python2/taos/cursor.py +++ b/src/connector/python/linux/python2/taos/cursor.py @@ -34,6 +34,7 @@ class TDengineCursor(object): self._block_rows = -1 self._block_iter = 0 self._affected_rows = 0 + self._logfile = "" if connection is not None: self._connection = connection @@ -83,6 +84,9 @@ class TDengineCursor(object): """ pass + def log(self, logfile): + self._logfile = logfile + def close(self): """Close the cursor. """ @@ -113,6 +117,11 @@ class TDengineCursor(object): pass res = CTaosInterface.query(self._connection._conn, stmt) + + if (self._logfile): + with open(self._logfile, "a") as logfile: + logfile.write("%s;\n" % operation) + if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: self._affected_rows += CTaosInterface.affectedRows( diff --git a/src/connector/python/linux/python3/taos/cursor.py b/src/connector/python/linux/python3/taos/cursor.py index ea7e9e5404..dc038a72ba 100644 --- a/src/connector/python/linux/python3/taos/cursor.py +++ b/src/connector/python/linux/python3/taos/cursor.py @@ -36,6 +36,7 @@ class TDengineCursor(object): self._block_rows = -1 self._block_iter = 0 self._affected_rows = 0 + self._logfile = "" if connection is not None: self._connection = connection @@ -85,6 +86,9 @@ class TDengineCursor(object): """ pass + def log(self, logfile): + self._logfile = logfile + def close(self): """Close the cursor. """ @@ -121,6 +125,10 @@ class TDengineCursor(object): res = CTaosInterface.query(self._connection._conn, stmt) # print(" << Query ({}) Exec Done".format(localSeqNum)) + if (self._logfile): + with open(self._logfile, "a") as logfile: + logfile.write("%s;\n" % operation) + if res == 0: if CTaosInterface.fieldsCount(self._connection._conn) == 0: self._affected_rows += CTaosInterface.affectedRows( diff --git a/src/cq/src/cqMain.c b/src/cq/src/cqMain.c index 7935bb7ff5..5cc3ce0159 100644 --- a/src/cq/src/cqMain.c +++ b/src/cq/src/cqMain.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "taosdef.h" #include "taosmsg.h" #include "tglobal.h" @@ -64,7 +65,10 @@ static void cqCreateStream(SCqContext *pContext, SCqObj *pObj); void *cqOpen(void *ahandle, const SCqCfg *pCfg) { SCqContext *pContext = calloc(sizeof(SCqContext), 1); - if (pContext == NULL) return NULL; + if (pContext == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return NULL; + } strcpy(pContext->user, pCfg->user); strcpy(pContext->pass, pCfg->pass); @@ -82,6 +86,7 @@ void *cqOpen(void *ahandle, const SCqCfg *pCfg) { void cqClose(void *handle) { SCqContext *pContext = handle; + if (handle == NULL) return; // stop all CQs cqStop(pContext); @@ -106,9 +111,9 @@ void cqClose(void *handle) { void cqStart(void *handle) { SCqContext *pContext = handle; - cTrace("vgId:%d, start all CQs", pContext->vgId); if (pContext->dbConn || pContext->master) return; + cTrace("vgId:%d, start all CQs", pContext->vgId); pthread_mutex_lock(&pContext->mutex); pContext->master = 1; diff --git a/src/dnode/CMakeLists.txt b/src/dnode/CMakeLists.txt index af2dc2d777..de6e15e6b9 100644 --- a/src/dnode/CMakeLists.txt +++ b/src/dnode/CMakeLists.txt @@ -16,7 +16,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) AUX_SOURCE_DIRECTORY(src SRC) ADD_EXECUTABLE(taosd ${SRC}) - TARGET_LINK_LIBRARIES(taosd mnode taos_static monitor http tsdb twal vnode cJson lz4) + TARGET_LINK_LIBRARIES(taosd mnode taos_static monitor http mqtt tsdb twal vnode cJson lz4) IF (TD_ACCOUNT) TARGET_LINK_LIBRARIES(taosd account) diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 2f693c61fb..68fe986989 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -37,6 +37,7 @@ static SDnodeRunStatus tsDnodeRunStatus = TSDB_DNODE_RUN_STATUS_STOPPED; int32_t dnodeInitSystem() { dnodeSetRunStatus(TSDB_DNODE_RUN_STATUS_INITIALIZE); tscEmbedded = 1; + taosBlockSIGPIPE(); taosResolveCRC(); taosInitGlobalCfg(); taosReadGlobalLogCfg(); diff --git a/src/dnode/src/dnodeModule.c b/src/dnode/src/dnodeModule.c index 86193fcebc..2f3008c33e 100644 --- a/src/dnode/src/dnodeModule.c +++ b/src/dnode/src/dnodeModule.c @@ -20,6 +20,7 @@ #include "trpc.h" #include "mnode.h" #include "http.h" +#include "mqtt.h" #include "monitor.h" #include "dnodeInt.h" #include "dnodeModule.h" @@ -62,6 +63,16 @@ static void dnodeAllocModules() { dnodeSetModuleStatus(TSDB_MOD_HTTP); } + tsModule[TSDB_MOD_MQTT].enable = (tsEnableMqttModule == 1); + tsModule[TSDB_MOD_MQTT].name = "mqtt"; + tsModule[TSDB_MOD_MQTT].initFp = mqttInitSystem; + tsModule[TSDB_MOD_MQTT].cleanUpFp = mqttCleanUpSystem; + tsModule[TSDB_MOD_MQTT].startFp = mqttStartSystem; + tsModule[TSDB_MOD_MQTT].stopFp = mqttStopSystem; + if (tsEnableMqttModule) { + dnodeSetModuleStatus(TSDB_MOD_MQTT); + } + tsModule[TSDB_MOD_MONITOR].enable = (tsEnableMonitorModule == 1); tsModule[TSDB_MOD_MONITOR].name = "monitor"; tsModule[TSDB_MOD_MONITOR].initFp = monitorInitSystem; @@ -114,18 +125,20 @@ void dnodeStartModules() { } void dnodeProcessModuleStatus(uint32_t moduleStatus) { - bool enableMgmtModule = moduleStatus & (1 << TSDB_MOD_MGMT); - if (!tsModule[TSDB_MOD_MGMT].enable && enableMgmtModule) { - dPrint("module status is received, start mgmt module", tsModuleStatus, moduleStatus); - tsModule[TSDB_MOD_MGMT].enable = true; - dnodeSetModuleStatus(TSDB_MOD_MGMT); - (*tsModule[TSDB_MOD_MGMT].startFp)(); - } + for (int32_t module = TSDB_MOD_MGMT; module < TSDB_MOD_HTTP; ++module) { + bool enableModule = moduleStatus & (1 << module); + if (!tsModule[module].enable && enableModule) { + dPrint("module status:%u is received, start %s module", tsModuleStatus, tsModule[module].name); + tsModule[module].enable = true; + dnodeSetModuleStatus(module); + (*tsModule[module].startFp)(); + } - if (tsModule[TSDB_MOD_MGMT].enable && !enableMgmtModule) { - dPrint("module status is received, stop mgmt module", tsModuleStatus, moduleStatus); - tsModule[TSDB_MOD_MGMT].enable = false; - dnodeUnSetModuleStatus(TSDB_MOD_MGMT); - (*tsModule[TSDB_MOD_MGMT].stopFp)(); + if (tsModule[module].enable && !enableModule) { + dPrint("module status:%u is received, stop %s module", tsModuleStatus, tsModule[module].name); + tsModule[module].enable = false; + dnodeUnSetModuleStatus(module); + (*tsModule[module].stopFp)(); + } } } diff --git a/src/inc/mqtt.h b/src/inc/mqtt.h new file mode 100644 index 0000000000..710737e79a --- /dev/null +++ b/src/inc/mqtt.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_MQTT_H +#define TDENGINE_MQTT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int32_t mqttGetReqCount(); +int32_t mqttInitSystem(); +int32_t mqttStartSystem(); +void mqttStopSystem(); +void mqttCleanUpSystem(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index aeccd92d9a..b87a6b3118 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -157,6 +157,7 @@ extern tDataTypeDescriptor tDataTypeDesc[11]; bool isValidDataType(int32_t type, int32_t length); bool isNull(const char *val, int32_t type); +void setVardataNull(char* val, int32_t type); void setNull(char *val, int32_t type, int32_t bytes); void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems); @@ -326,8 +327,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_QUERY_TYPE_TAG_FILTER_QUERY 0x400u #define TSDB_QUERY_TYPE_INSERT 0x100u // insert type -#define TSDB_QUERY_TYPE_IMPORT 0x200u // import data -#define TSDB_QUERY_TYPE_MULTITABLE_QUERY 0x800u +#define TSDB_QUERY_TYPE_MULTITABLE_QUERY 0x200u #define TSDB_QUERY_HAS_TYPE(x, _type) (((x) & (_type)) != 0) #define TSDB_QUERY_SET_TYPE(x, _type) ((x) |= (_type)) @@ -340,13 +340,14 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_SESSIONS_PER_VNODE (300) #define TSDB_SESSIONS_PER_DNODE (TSDB_SESSIONS_PER_VNODE * TSDB_MAX_VNODES) -#define TSDB_MAX_MNODES 5 -#define TSDB_MAX_DNODES 10 -#define TSDB_MAX_ACCOUNTS 10 -#define TSDB_MAX_USERS 20 -#define TSDB_MAX_DBS 100 -#define TSDB_MAX_VGROUPS 1000 -#define TSDB_MAX_SUPER_TABLES 100 +#define TSDB_DEFAULT_MNODES_HASH_SIZE 5 +#define TSDB_DEFAULT_DNODES_HASH_SIZE 10 +#define TSDB_DEFAULT_ACCOUNTS_HASH_SIZE 10 +#define TSDB_DEFAULT_USERS_HASH_SIZE 20 +#define TSDB_DEFAULT_DBS_HASH_SIZE 100 +#define TSDB_DEFAULT_VGROUPS_HASH_SIZE 100 +#define TSDB_DEFAULT_STABLES_HASH_SIZE 100 +#define TSDB_DEFAULT_CTABLES_HASH_SIZE 10000 #define TSDB_PORT_DNODESHELL 0 #define TSDB_PORT_DNODEDNODE 5 @@ -375,6 +376,7 @@ typedef enum { TSDB_MOD_MGMT, TSDB_MOD_HTTP, TSDB_MOD_MONITOR, + TSDB_MOD_MQTT, TSDB_MOD_MAX } EModuleType; diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index 1390d66113..ae30efd93e 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -156,6 +156,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SERV_OUT_OF_MEMORY, 0, 405, "server out of m TAOS_DEFINE_ERROR(TSDB_CODE_NO_DISK_PERMISSIONS, 0, 406, "no disk permissions") TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, 0, 407, "file corrupted") TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, 0, 408, "memory corrupted") +TAOS_DEFINE_ERROR(TSDB_CODE_NOT_SUCH_FILE_OR_DIR, 0, 409, "no such file or directory") // client TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CLIENT_VERSION, 0, 451, "invalid client version") diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index e09e0cef78..17b975c193 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -269,9 +269,11 @@ typedef struct { char tableId[TSDB_TABLE_ID_LEN + 1]; char db[TSDB_DB_NAME_LEN + 1]; int16_t type; /* operation type */ - char tagVal[TSDB_MAX_BYTES_PER_ROW]; - int8_t numOfCols; /* number of schema */ + int16_t numOfCols; /* number of schema */ + int32_t tagValLen; SSchema schema[]; + // tagVal is padded after schema + // char tagVal[]; } SCMAlterTableMsg; typedef struct { @@ -441,7 +443,7 @@ typedef struct { int16_t numOfOutput; // final output columns numbers int16_t tagNameRelType; // relation of tag criteria and tbname criteria int16_t fillType; // interpolate type - uint64_t defaultVal; // default value array list + uint64_t fillVal; // default value array list int32_t tsOffset; // offset value in current msg body, NOTE: ts list is compressed int32_t tsLen; // total length of ts comp block int32_t tsNumOfBlocks; // ts comp block numbers @@ -647,6 +649,7 @@ typedef struct SMultiTableMeta { } SMultiTableMeta; typedef struct { + int32_t dataLen; char name[TSDB_TABLE_ID_LEN + 1]; char data[TSDB_MAX_TAGS_LEN]; } STagData; @@ -722,6 +725,8 @@ typedef struct { typedef struct { uint32_t queryId; uint32_t streamId; + uint32_t totalDnodes; + uint32_t onlineDnodes; int8_t killConnection; SRpcIpSet ipList; } SCMHeartBeatRsp; diff --git a/src/inc/tsync.h b/src/inc/tsync.h index 05d1d93cf6..fcf26d22c3 100644 --- a/src/inc/tsync.h +++ b/src/inc/tsync.h @@ -94,8 +94,8 @@ typedef void* tsync_h; tsync_h syncStart(const SSyncInfo *); void syncStop(tsync_h shandle); -int syncReconfig(tsync_h shandle, const SSyncCfg *); -int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype); +int32_t syncReconfig(tsync_h shandle, const SSyncCfg *); +int32_t syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype); void syncConfirmForward(tsync_h shandle, uint64_t version, int32_t code); void syncRecover(tsync_h shandle); // recover from other nodes: int syncGetNodesRole(tsync_h shandle, SNodesRole *); diff --git a/src/kit/shell/inc/shell.h b/src/kit/shell/inc/shell.h index 549b0ef977..5400d9c5ba 100644 --- a/src/kit/shell/inc/shell.h +++ b/src/kit/shell/inc/shell.h @@ -29,18 +29,6 @@ #define MAX_COMMAND_SIZE 65536 #define HISTORY_FILE ".taos_history" -#define BOOL_OUTPUT_LENGTH 6 -#define TINYINT_OUTPUT_LENGTH 6 -#define SMALLINT_OUTPUT_LENGTH 7 -#define INT_OUTPUT_LENGTH 11 -#define BIGINT_OUTPUT_LENGTH 21 -#define FLOAT_OUTPUT_LENGTH 20 -#define DOUBLE_OUTPUT_LENGTH 25 -#define BINARY_OUTPUT_LENGTH 20 - -// dynamic config timestamp width according to maximum time precision -extern int32_t TIMESTAMP_OUTPUT_LENGTH; - typedef struct SShellHistory { char* hist[MAX_HISTORY_SIZE]; int hstart; @@ -80,7 +68,7 @@ void get_history_path(char* history); void cleanup_handler(void* arg); void exitShell(); int shellDumpResult(TAOS* con, char* fname, int* error_no, bool printMode); -void shellPrintNChar(char* str, int width, bool printMode); +void shellPrintNChar(const char* str, int length, int width); void shellGetGrantInfo(void *con); int isCommentLine(char *line); diff --git a/src/kit/shell/src/shellDarwin.c b/src/kit/shell/src/shellDarwin.c index cd2fe6df33..e4ef06c403 100644 --- a/src/kit/shell/src/shellDarwin.c +++ b/src/kit/shell/src/shellDarwin.c @@ -352,37 +352,31 @@ void *shellLoopQuery(void *arg) { return NULL; } -void shellPrintNChar(char *str, int width, bool printMode) { - int col_left = width; - wchar_t wc; - while (col_left > 0) { - if (*str == '\0') break; - char *tstr = str; - int byte_width = mbtowc(&wc, tstr, MB_CUR_MAX); - if (byte_width <= 0) break; - int col_width = wcwidth(wc); - if (col_width <= 0) { - str += byte_width; - continue; +void shellPrintNChar(const char *str, int length, int width) { + int pos = 0, cols = 0; + while (pos < length) { + wchar_t wc; + pos += mbtowc(&wc, str + pos, MB_CUR_MAX); + if (pos > length) { + break; + } + + int w = wcwidth(wc); + if (w > 0) { + if (width > 0 && cols + w > width) { + break; + } + printf("%lc", wc); + cols += w; } - if (col_left < col_width) break; - printf("%lc", wc); - str += byte_width; - col_left -= col_width; } - while (col_left > 0) { - printf(" "); - col_left--; - } - - if (!printMode) { - printf("|"); - } else { - printf("\n"); + for (; cols < width; cols++) { + putchar(' '); } } + int get_old_terminal_mode(struct termios *tio) { /* Make sure stdin is a terminal. */ if (!isatty(STDIN_FILENO)) { diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index dbb05f6a35..93818d7d73 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -13,6 +13,8 @@ * along with this program. If not, see . */ +#define _BSD_SOURCE +#define _GNU_SOURCE #define _XOPEN_SOURCE #define _DEFAULT_SOURCE @@ -35,6 +37,9 @@ int prompt_size = 6; TAOS_RES *result = NULL; SShellHistory history; +#define DEFAULT_MAX_BINARY_DISPLAY_WIDTH 30 +extern int32_t tsMaxBinaryDisplayWidth; + /* * FUNCTION: Initialize the shell. */ @@ -195,7 +200,15 @@ int32_t shellRunCommand(TAOS *con, char *command) { } else if (regex_match(command, "^[\t ]*clear[ \t;]*$", REG_EXTENDED | REG_ICASE)) { // If clear the screen. system("clear"); - return 0; + } else if (regex_match(command, "^[\t ]*set[ \t]+max_binary_display_width[ \t]+(default|[1-9][0-9]*)[ \t;]*$", REG_EXTENDED | REG_ICASE)) { + strtok(command, " \t"); + strtok(NULL, " \t"); + char* p = strtok(NULL, " \t"); + if (strcasecmp(p, "default") == 0) { + tsMaxBinaryDisplayWidth = DEFAULT_MAX_BINARY_DISPLAY_WIDTH; + } else { + tsMaxBinaryDisplayWidth = atoi(p); + } } else if (regex_match(command, "^[ \t]*source[\t ]+[^ ]+[ \t;]*$", REG_EXTENDED | REG_ICASE)) { /* If source file. */ char *c_ptr = strtok(command, " ;"); @@ -310,360 +323,347 @@ int regex_match(const char *s, const char *reg, int cflags) { return 0; } -int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) { - TAOS_ROW row = NULL; - int numOfRows = 0; - time_t tt; - char buf[25] = "\0"; - struct tm *ptm; - int output_bytes = 0; - FILE * fp = NULL; - int num_fields = taos_field_count(con); - wordexp_t full_path; - assert(num_fields != 0); +static char* formatTimestamp(char* buf, int64_t val, int precision) { + if (args.is_raw_time) { + sprintf(buf, "%" PRId64, val); + return buf; + } - result = taos_use_result(con); + time_t tt; + if (precision == TSDB_TIME_PRECISION_MICRO) { + tt = (time_t)(val / 1000000); + } else { + tt = (time_t)(val / 1000); + } + + struct tm* ptm = localtime(&tt); + size_t pos = strftime(buf, 32, "%Y-%m-%d %H:%M:%S", ptm); + + if (precision == TSDB_TIME_PRECISION_MICRO) { + sprintf(buf + pos, ".%06d", (int)(val % 1000000)); + } else { + sprintf(buf + pos, ".%03d", (int)(val % 1000)); + } + + return buf; +} + + +static void dumpFieldToFile(FILE* fp, const char* val, TAOS_FIELD* field, int32_t length, int precision) { + if (val == NULL) { + fprintf(fp, "%s", TSDB_DATA_NULL_STR); + return; + } + + char buf[TSDB_MAX_BYTES_PER_ROW]; + switch (field->type) { + case TSDB_DATA_TYPE_BOOL: + fprintf(fp, "%d", ((((int)(*((char *)val))) == 1) ? 1 : 0)); + break; + case TSDB_DATA_TYPE_TINYINT: + fprintf(fp, "%d", (int)(*((char *)val))); + break; + case TSDB_DATA_TYPE_SMALLINT: + fprintf(fp, "%d", (int)(*((short *)val))); + break; + case TSDB_DATA_TYPE_INT: + fprintf(fp, "%d", *((int *)val)); + break; + case TSDB_DATA_TYPE_BIGINT: + fprintf(fp, "%" PRId64, *((int64_t *)val)); + break; + case TSDB_DATA_TYPE_FLOAT: + fprintf(fp, "%.5f", GET_FLOAT_VAL(val)); + break; + case TSDB_DATA_TYPE_DOUBLE: + fprintf(fp, "%.9f", GET_DOUBLE_VAL(val)); + break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: + memcpy(buf, val, length); + buf[length] = 0; + fprintf(fp, "\'%s\'", buf); + break; + case TSDB_DATA_TYPE_TIMESTAMP: + formatTimestamp(buf, *(int64_t*)val, precision); + fprintf(fp, "'%s'", buf); + break; + default: + break; + } +} + +static int dumpResultToFile(const char* fname, TAOS_RES* result) { + TAOS_ROW row = taos_fetch_row(result); + if (row == NULL) { + return 0; + } + + wordexp_t full_path; + + if (wordexp(fname, &full_path, 0) != 0) { + fprintf(stderr, "ERROR: invalid file name: %s\n", fname); + return -1; + } + + FILE* fp = fopen(full_path.we_wordv[0], "w"); + if (fp == NULL) { + fprintf(stderr, "ERROR: failed to open file: %s\n", full_path.we_wordv[0]); + wordfree(&full_path); + return -1; + } + + wordfree(&full_path); + + int num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + int32_t* length = taos_fetch_lengths(result); + int precision = taos_result_precision(result); + + for (int col = 0; col < num_fields; col++) { + if (col > 0) { + fprintf(fp, ","); + } + fprintf(fp, "%s", fields[col].name); + } + fputc('\n', fp); + + int numOfRows = 0; + do { + for (int i = 0; i < num_fields; i++) { + if (i > 0) { + fputc(',', fp); + } + dumpFieldToFile(fp, row[i], fields +i, length[i], precision); + } + fputc('\n', fp); + + numOfRows++; + row = taos_fetch_row(result); + } while( row != NULL); + + fclose(fp); + return numOfRows; +} + + +static void printField(const char* val, TAOS_FIELD* field, int width, int32_t length, int precision) { + if (val == NULL) { + int w = width; + if (field->type < TSDB_DATA_TYPE_TINYINT || field->type > TSDB_DATA_TYPE_DOUBLE) { + w = 0; + } + w = printf("%*s", w, TSDB_DATA_NULL_STR); + for (; w < width; w++) { + putchar(' '); + } + return; + } + + char buf[TSDB_MAX_BYTES_PER_ROW]; + switch (field->type) { + case TSDB_DATA_TYPE_BOOL: + printf("%*s", width, ((((int)(*((char *)val))) == 1) ? "true" : "false")); + break; + case TSDB_DATA_TYPE_TINYINT: + printf("%*d", width, (int)(*((char *)val))); + break; + case TSDB_DATA_TYPE_SMALLINT: + printf("%*d", width, (int)(*((short *)val))); + break; + case TSDB_DATA_TYPE_INT: + printf("%*d", width, *((int *)val)); + break; + case TSDB_DATA_TYPE_BIGINT: + printf("%*" PRId64, width, *((int64_t *)val)); + break; + case TSDB_DATA_TYPE_FLOAT: + printf("%*.5f", width, GET_FLOAT_VAL(val)); + break; + case TSDB_DATA_TYPE_DOUBLE: + printf("%*.9f", width, GET_DOUBLE_VAL(val)); + break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: + shellPrintNChar(val, length, width); + break; + case TSDB_DATA_TYPE_TIMESTAMP: + formatTimestamp(buf, *(int64_t*)val, precision); + printf("%s", buf); + break; + default: + break; + } +} + + +static int verticalPrintResult(TAOS_RES* result) { + TAOS_ROW row = taos_fetch_row(result); + if (row == NULL) { + return 0; + } + + int num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + int32_t* length = taos_fetch_lengths(result); + int precision = taos_result_precision(result); + + int maxColNameLen = 0; + for (int col = 0; col < num_fields; col++) { + int len = strlen(fields[col].name); + if (len > maxColNameLen) { + maxColNameLen = len; + } + } + + int numOfRows = 0; + do { + printf("*************************** %d.row ***************************\n", numOfRows + 1); + for (int i = 0; i < num_fields; i++) { + TAOS_FIELD* field = fields + i; + + int padding = (int)(maxColNameLen - strlen(field->name)); + printf("%*.s%s: ", padding, " ", field->name); + + printField(row[i], field, 0, length[i], precision); + putchar('\n'); + } + + numOfRows++; + row = taos_fetch_row(result); + } while(row != NULL); + + return numOfRows; +} + + +static int calcColWidth(TAOS_FIELD* field, int precision) { + int width = strlen(field->name); + + switch (field->type) { + case TSDB_DATA_TYPE_BOOL: + return MAX(5, width); // 'false' + + case TSDB_DATA_TYPE_TINYINT: + return MAX(4, width); // '-127' + + case TSDB_DATA_TYPE_SMALLINT: + return MAX(6, width); // '-32767' + + case TSDB_DATA_TYPE_INT: + return MAX(11, width); // '-2147483648' + + case TSDB_DATA_TYPE_BIGINT: + return MAX(21, width); // '-9223372036854775807' + + case TSDB_DATA_TYPE_FLOAT: + return MAX(20, width); + + case TSDB_DATA_TYPE_DOUBLE: + return MAX(25, width); + + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: + if (field->bytes > tsMaxBinaryDisplayWidth) { + return MAX(tsMaxBinaryDisplayWidth, width); + } else { + return MAX(field->bytes, width); + } + + case TSDB_DATA_TYPE_TIMESTAMP: + if (args.is_raw_time) { + return MAX(14, width); + } else if (precision == TSDB_TIME_PRECISION_MICRO) { + return MAX(26, width); // '2020-01-01 00:00:00.000000' + } else { + return MAX(23, width); // '2020-01-01 00:00:00.000' + } + + default: + assert(false); + } + + return 0; +} + + +static void printHeader(TAOS_FIELD* fields, int* width, int num_fields) { + int rowWidth = 0; + for (int col = 0; col < num_fields; col++) { + TAOS_FIELD* field = fields + col; + int padding = (int)(width[col] - strlen(field->name)); + int left = padding / 2; + printf(" %*.s%s%*.s |", left, " ", field->name, padding - left, " "); + rowWidth += width[col] + 3; + } + + putchar('\n'); + for (int i = 0; i < rowWidth; i++) { + putchar('='); + } + putchar('\n'); +} + + +static int horizontalPrintResult(TAOS_RES* result) { + TAOS_ROW row = taos_fetch_row(result); + if (row == NULL) { + return 0; + } + + int num_fields = taos_num_fields(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + int32_t* length = taos_fetch_lengths(result); + int precision = taos_result_precision(result); + + int width[TSDB_MAX_COLUMNS]; + for (int col = 0; col < num_fields; col++) { + width[col] = calcColWidth(fields + col, precision); + } + + printHeader(fields, width, num_fields); + + int numOfRows = 0; + do { + for (int i = 0; i < num_fields; i++) { + putchar(' '); + printField(row[i], fields + i, width[i], length[i], precision); + putchar(' '); + putchar('|'); + } + putchar('\n'); + numOfRows++; + row = taos_fetch_row(result); + } while(row != NULL); + + return numOfRows; +} + + +int shellDumpResult(TAOS *con, char *fname, int *error_no, bool vertical) { + int numOfRows = 0; + + TAOS_RES* result = taos_use_result(con); if (result == NULL) { taos_error(con); return -1; } if (fname != NULL) { - if (wordexp(fname, &full_path, 0) != 0) { - fprintf(stderr, "ERROR: invalid file name: %s\n", fname); - return -1; - } - - fp = fopen(full_path.we_wordv[0], "w"); - if (fp == NULL) { - fprintf(stderr, "ERROR: failed to open file: %s\n", full_path.we_wordv[0]); - wordfree(&full_path); - return -1; - } - - wordfree(&full_path); - } - - TAOS_FIELD *fields = taos_fetch_fields(result); - - row = taos_fetch_row(result); - int32_t* length = taos_fetch_lengths(result); - - char t_str[TSDB_MAX_BYTES_PER_ROW] = "\0"; - int l[TSDB_MAX_COLUMNS] = {0}; - int maxLenColumnName = 0; - - if (row) { - // Print the header indicator - if (fname == NULL) { // print to standard output - if (!printMode) { - for (int col = 0; col < num_fields; col++) { - switch (fields[col].type) { - case TSDB_DATA_TYPE_BOOL: - l[col] = MAX(BOOL_OUTPUT_LENGTH, strlen(fields[col].name)); - break; - case TSDB_DATA_TYPE_TINYINT: - l[col] = MAX(TINYINT_OUTPUT_LENGTH, strlen(fields[col].name)); - break; - case TSDB_DATA_TYPE_SMALLINT: - l[col] = MAX(SMALLINT_OUTPUT_LENGTH, strlen(fields[col].name)); - break; - case TSDB_DATA_TYPE_INT: - l[col] = MAX(INT_OUTPUT_LENGTH, strlen(fields[col].name)); - break; - case TSDB_DATA_TYPE_BIGINT: - l[col] = MAX(BIGINT_OUTPUT_LENGTH, strlen(fields[col].name)); - break; - case TSDB_DATA_TYPE_FLOAT: - l[col] = MAX(FLOAT_OUTPUT_LENGTH, strlen(fields[col].name)); - break; - case TSDB_DATA_TYPE_DOUBLE: - l[col] = MAX(DOUBLE_OUTPUT_LENGTH, strlen(fields[col].name)); - break; - case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: - l[col] = MAX(fields[col].bytes, strlen(fields[col].name)); - /* l[col] = max(BINARY_OUTPUT_LENGTH, strlen(fields[col].name)); */ - break; - case TSDB_DATA_TYPE_TIMESTAMP: { - int32_t defaultWidth = TIMESTAMP_OUTPUT_LENGTH; - if (args.is_raw_time) { - defaultWidth = 14; - } - if (taos_result_precision(result) == TSDB_TIME_PRECISION_MICRO) { - defaultWidth += 3; - } - l[col] = MAX(defaultWidth, strlen(fields[col].name)); - - break; - } - default: - break; - } - - int spaces = (int)(l[col] - strlen(fields[col].name)); - int left_space = spaces / 2; - int right_space = (spaces % 2 ? left_space + 1 : left_space); - printf("%*.s%s%*.s|", left_space, " ", fields[col].name, right_space, " "); - output_bytes += (l[col] + 1); - } - printf("\n"); - for (int k = 0; k < output_bytes; k++) printf("="); - printf("\n"); - } else { - for (int col = 0; col < num_fields; col++) { - if (strlen(fields[col].name) > maxLenColumnName) maxLenColumnName = strlen(fields[col].name); - } - } - - // print the elements - do { - if (!printMode) { - for (int i = 0; i < num_fields; i++) { - if (row[i] == NULL) { - printf("%*s|", l[i], TSDB_DATA_NULL_STR); - continue; - } - - switch (fields[i].type) { - case TSDB_DATA_TYPE_BOOL: - printf("%*s|", l[i], ((((int)(*((char *)row[i]))) == 1) ? "true" : "false")); - break; - case TSDB_DATA_TYPE_TINYINT: - printf("%*d|", l[i], (int)(*((char *)row[i]))); - break; - case TSDB_DATA_TYPE_SMALLINT: - printf("%*d|", l[i], (int)(*((short *)row[i]))); - break; - case TSDB_DATA_TYPE_INT: - printf("%*d|", l[i], *((int *)row[i])); - break; - case TSDB_DATA_TYPE_BIGINT: - printf("%*" PRId64 "|", l[i], *((int64_t *)row[i])); - break; - case TSDB_DATA_TYPE_FLOAT: { - float fv = 0; - fv = GET_FLOAT_VAL(row[i]); - printf("%*.5f|", l[i], fv); - } - break; - case TSDB_DATA_TYPE_DOUBLE: { - double dv = 0; - dv = GET_DOUBLE_VAL(row[i]); - printf("%*.9f|", l[i], dv); - } - break; - case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: - memset(t_str, 0, TSDB_MAX_BYTES_PER_ROW); - memcpy(t_str, row[i], length[i]); - /* printf("%-*s|",max(fields[i].bytes, strlen(fields[i].name)), - * t_str); */ - /* printf("%-*s|", l[i], t_str); */ - shellPrintNChar(t_str, l[i], printMode); - break; - case TSDB_DATA_TYPE_TIMESTAMP: - if (args.is_raw_time) { - printf(" %" PRId64 "|", *(int64_t *)row[i]); - } else { - if (taos_result_precision(result) == TSDB_TIME_PRECISION_MICRO) { - tt = (time_t)((*(int64_t *)row[i]) / 1000000); - } else { - tt = (time_t)((*(int64_t *)row[i]) / 1000); - } - - ptm = localtime(&tt); - strftime(buf, 64, "%y-%m-%d %H:%M:%S", ptm); - - if (taos_result_precision(result) == TSDB_TIME_PRECISION_MICRO) { - printf(" %s.%06d|", buf, (int)(*(int64_t *)row[i] % 1000000)); - } else { - printf(" %s.%03d|", buf, (int)(*(int64_t *)row[i] % 1000)); - } - } - break; - default: - break; - } - } - printf("\n"); - } else { - printf("*************************** %d.row ***************************\n", numOfRows + 1); - for (int i = 0; i < num_fields; i++) { - // 1. print column name - int left_space = (int)(maxLenColumnName - strlen(fields[i].name)); - printf("%*.s%s: ", left_space, " ", fields[i].name); - - // 2. print column value - if (row[i] == NULL) { - printf("%s\n", TSDB_DATA_NULL_STR); - continue; - } - - switch (fields[i].type) { - case TSDB_DATA_TYPE_BOOL: - printf("%s\n", ((((int)(*((char *)row[i]))) == 1) ? "true" : "false")); - break; - case TSDB_DATA_TYPE_TINYINT: - printf("%d\n", (int)(*((char *)row[i]))); - break; - case TSDB_DATA_TYPE_SMALLINT: - printf("%d\n", (int)(*((short *)row[i]))); - break; - case TSDB_DATA_TYPE_INT: - printf("%d\n", *((int *)row[i])); - break; - case TSDB_DATA_TYPE_BIGINT: - printf("%" PRId64 "\n", *((int64_t *)row[i])); - break; - case TSDB_DATA_TYPE_FLOAT: { - float fv = 0; - fv = GET_FLOAT_VAL(row[i]); - printf("%.5f\n", fv); - } - break; - case TSDB_DATA_TYPE_DOUBLE: { - double dv = 0; - dv = GET_DOUBLE_VAL(row[i]); - printf("%.9f\n", dv); - } - break; - case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: - memset(t_str, 0, TSDB_MAX_BYTES_PER_ROW); - memcpy(t_str, row[i], length[i]); - - l[i] = MAX(fields[i].bytes, strlen(fields[i].name)); - shellPrintNChar(t_str, l[i], printMode); - break; - case TSDB_DATA_TYPE_TIMESTAMP: - if (args.is_raw_time) { - printf("%" PRId64 "\n", *(int64_t *)row[i]); - } else { - if (taos_result_precision(result) == TSDB_TIME_PRECISION_MICRO) { - tt = (time_t)((*(int64_t *)row[i]) / 1000000); - } else { - tt = (time_t)((*(int64_t *)row[i]) / 1000); - } - - ptm = localtime(&tt); - strftime(buf, 64, "%y-%m-%d %H:%M:%S", ptm); - - if (taos_result_precision(result) == TSDB_TIME_PRECISION_MICRO) { - printf("%s.%06d\n", buf, (int)(*(int64_t *)row[i] % 1000000)); - } else { - printf("%s.%03d\n", buf, (int)(*(int64_t *)row[i] % 1000)); - } - } - break; - default: - break; - } - } - } - - numOfRows++; - } while ((row = taos_fetch_row(result))); - - } else { // dump to file - // first write column - for (int col = 0; col < num_fields; col++) { - fprintf(fp, "%s", fields[col].name); - if (col < num_fields - 1) { - fprintf(fp, ","); - } else { - fprintf(fp, "\n"); - } - } - - do { - for (int i = 0; i < num_fields; i++) { - if (row[i]) { - switch (fields[i].type) { - case TSDB_DATA_TYPE_BOOL: - fprintf(fp, "%d", ((((int)(*((char *)row[i]))) == 1) ? 1 : 0)); - break; - case TSDB_DATA_TYPE_TINYINT: - fprintf(fp, "%d", (int)(*((char *)row[i]))); - break; - case TSDB_DATA_TYPE_SMALLINT: - fprintf(fp, "%d", (int)(*((short *)row[i]))); - break; - case TSDB_DATA_TYPE_INT: - fprintf(fp, "%d", *((int *)row[i])); - break; - case TSDB_DATA_TYPE_BIGINT: - fprintf(fp, "%" PRId64, *((int64_t *)row[i])); - break; - case TSDB_DATA_TYPE_FLOAT: { - float fv = 0; - fv = GET_FLOAT_VAL(row[i]); - fprintf(fp, "%.5f", fv); - } - break; - case TSDB_DATA_TYPE_DOUBLE: { - double dv = 0; - dv = GET_DOUBLE_VAL(row[i]); - fprintf(fp, "%.9f", dv); - } - break; - case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: - memset(t_str, 0, TSDB_MAX_BYTES_PER_ROW); - memcpy(t_str, row[i], length[i]); - fprintf(fp, "\'%s\'", t_str); - break; - case TSDB_DATA_TYPE_TIMESTAMP: - if (args.is_raw_time) { - fprintf(fp, "%" PRId64, *(int64_t *)row[i]); - } else { - if (taos_result_precision(result) == TSDB_TIME_PRECISION_MICRO) { - tt = (time_t)((*(int64_t *)row[i]) / 1000000); - } else { - tt = (time_t)((*(int64_t *)row[i]) / 1000); - } - - ptm = localtime(&tt); - strftime(buf, 64, "%Y-%m-%d %H:%M:%S", ptm); - - if (taos_result_precision(result) == TSDB_TIME_PRECISION_MICRO) { - fprintf(fp, "\'%s.%06d\'", buf, (int)(*(int64_t *)row[i] % 1000000)); - } else { - fprintf(fp, "\'%s.%03d\'", buf, (int)(*(int64_t *)row[i] % 1000)); - } - } - break; - default: - break; - } - } else { - fprintf(fp, "%s", TSDB_DATA_NULL_STR); - } - if (i < num_fields - 1) { - fprintf(fp, ","); - } else { - fprintf(fp, "\n"); - } - } - - numOfRows++; - } while ((row = taos_fetch_row(result))); - } + numOfRows = dumpResultToFile(fname, result); + } else if(vertical) { + numOfRows = verticalPrintResult(result); + } else { + numOfRows = horizontalPrintResult(result); } *error_no = taos_errno(con); - taos_free_result(result); - result = NULL; - - if (fname != NULL) { - fclose(fp); - } - return numOfRows; } + void read_history() { // Initialize history memset(history.hist, 0, sizeof(char *) * MAX_HISTORY_SIZE); diff --git a/src/kit/shell/src/shellImport.c b/src/kit/shell/src/shellImport.c index 2cbd07db4b..70660254a5 100644 --- a/src/kit/shell/src/shellImport.c +++ b/src/kit/shell/src/shellImport.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#define _GNU_SOURCE #define _XOPEN_SOURCE #define _DEFAULT_SOURCE diff --git a/src/kit/shell/src/shellLinux.c b/src/kit/shell/src/shellLinux.c index da2bd94814..856e011a78 100644 --- a/src/kit/shell/src/shellLinux.c +++ b/src/kit/shell/src/shellLinux.c @@ -329,34 +329,27 @@ void *shellLoopQuery(void *arg) { return NULL; } -void shellPrintNChar(char *str, int width, bool printMode) { - int col_left = width; - wchar_t wc; - while (col_left > 0) { - if (*str == '\0') break; - char *tstr = str; - int byte_width = mbtowc(&wc, tstr, MB_CUR_MAX); - if (byte_width <= 0) break; - int col_width = wcwidth(wc); - if (col_width <= 0) { - str += byte_width; - continue; +void shellPrintNChar(const char *str, int length, int width) { + int pos = 0, cols = 0; + while (pos < length) { + wchar_t wc; + pos += mbtowc(&wc, str + pos, MB_CUR_MAX); + if (pos > length) { + break; + } + + int w = wcwidth(wc); + if (w > 0) { + if (width > 0 && cols + w > width) { + break; + } + printf("%lc", wc); + cols += w; } - if (col_left < col_width) break; - printf("%lc", wc); - str += byte_width; - col_left -= col_width; } - while (col_left > 0) { - printf(" "); - col_left--; - } - - if (!printMode) { - printf("|"); - } else { - printf("\n"); + for (; cols < width; cols++) { + putchar(' '); } } diff --git a/src/kit/shell/src/shellMain.c b/src/kit/shell/src/shellMain.c index f8010b84cd..3485a964d7 100644 --- a/src/kit/shell/src/shellMain.c +++ b/src/kit/shell/src/shellMain.c @@ -20,7 +20,6 @@ TAOS* con; pthread_t pid; -int32_t TIMESTAMP_OUTPUT_LENGTH = 22; // TODO: IMPLEMENT INTERRUPT HANDLER. void interruptHandler(int signum) { diff --git a/src/kit/shell/src/shellWindows.c b/src/kit/shell/src/shellWindows.c index ac04c593fb..c446677276 100644 --- a/src/kit/shell/src/shellWindows.c +++ b/src/kit/shell/src/shellWindows.c @@ -217,32 +217,32 @@ void *shellLoopQuery(void *arg) { return NULL; } -void shellPrintNChar(char *str, int width, bool printMode) { - int col_left = width; - wchar_t wc; - while (col_left > 0) { - if (*str == '\0') break; - char *tstr = str; - int byte_width = mbtowc(&wc, tstr, MB_CUR_MAX); - int col_width = byte_width; - if (col_left < col_width) break; - printf("%lc", wc); - str += byte_width; - col_left -= col_width; +void shellPrintNChar(const char *str, int length, int width) { + int pos = 0, cols = 0; + while (pos < length) { + wchar_t wc; + int bytes = mbtowc(&wc, str + pos, MB_CUR_MAX); + pos += bytes; + if (pos > length) { + break; + } + + int w = bytes; + if (w > 0) { + if (width > 0 && cols + w > width) { + break; + } + printf("%lc", wc); + cols += w; + } } - while (col_left > 0) { - printf(" "); - col_left--; - } - - if (!printMode) { - printf("|"); - } else { - printf("\n"); + for (; cols < width; cols++) { + putchar(' '); } } + void get_history_path(char *history) { sprintf(history, "%s/%s", ".", HISTORY_FILE); } void exitShell() { exit(EXIT_SUCCESS); } diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 3cacafa505..04194c6127 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -362,6 +362,26 @@ int main(int argc, char *argv[]) { time_t tTime = time(NULL); struct tm tm = *localtime(&tTime); + printf("###################################################################\n"); + printf("# Server IP: %s:%hu\n", ip_addr == NULL ? "localhost" : ip_addr, port); + printf("# User: %s\n", user); + printf("# Password: %s\n", pass); + printf("# Use metric: %s\n", use_metric ? "true" : "false"); + printf("# Datatype of Columns: %s\n", dataString); + printf("# Binary Length(If applicable): %d\n", + (strcasestr(dataString, "BINARY") != NULL) ? len_of_binary : -1); + printf("# Number of Columns per record: %d\n", ncols_per_record); + printf("# Number of Connections: %d\n", nconnections); + printf("# Number of Tables: %d\n", ntables); + printf("# Number of Data per Table: %d\n", nrecords_per_table); + printf("# Records/Request: %d\n", nrecords_per_request); + printf("# Database name: %s\n", db_name); + printf("# Table prefix: %s\n", tb_prefix); + printf("# Test time: %d-%02d-%02d %02d:%02d:%02d\n", tm.tm_year + 1900, tm.tm_mon + 1, + tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + printf("###################################################################\n\n"); + printf("Press enter key to continue"); + getchar(); fprintf(fp, "###################################################################\n"); fprintf(fp, "# Server IP: %s:%hu\n", ip_addr == NULL ? "localhost" : ip_addr, port); @@ -858,15 +878,16 @@ void generateData(char *res, char **data_type, int num_of_cols, int64_t timestam pstr += sprintf(pstr, ")"); } +static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567890"; void rand_string(char *str, int size) { - memset(str, 0, size); - const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567890"; - char *sptr = str; - if (size) { + str[0] = 0; + if (size > 0) { --size; - for (size_t n = 0; n < size; n++) { + int n; + for (n = 0; n < size; n++) { int key = rand() % (int)(sizeof charset - 1); - sptr += sprintf(sptr, "%c", charset[key]); + str[n] = charset[key]; } + str[n] = 0; } } diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index adba091136..9886a91f48 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -37,6 +37,8 @@ #define COMMAND_SIZE 65536 #define DEFAULT_DUMP_FILE "taosdump.sql" +#define MAX_DBS 100 + int converStringToReadable(char *str, int size, char *buf, int bufsize); int convertNCharToReadable(char *str, int size, char *buf, int bufsize); void taosDumpCharset(FILE *fp); @@ -359,7 +361,7 @@ int main(int argc, char *argv[]) { void taosFreeDbInfos() { if (dbInfos == NULL) return; - for (int i = 0; i < TSDB_MAX_DBS; i++) tfree(dbInfos[i]); + for (int i = 0; i < MAX_DBS; i++) tfree(dbInfos[i]); tfree(dbInfos); } @@ -437,7 +439,7 @@ int taosDumpOut(SDumpArguments *arguments) { return -1; } - dbInfos = (SDbInfo **)calloc(TSDB_MAX_DBS, sizeof(SDbInfo *)); + dbInfos = (SDbInfo **)calloc(MAX_DBS, sizeof(SDbInfo *)); if (dbInfos == NULL) { fprintf(stderr, "failed to allocate memory\n"); goto _exit_failure; @@ -531,7 +533,7 @@ int taosDumpOut(SDumpArguments *arguments) { } } - taos_free_result(result); + // taos_free_result(result); if (count == 0) { fprintf(stderr, "No databases valid to dump\n"); @@ -720,6 +722,57 @@ void taosDumpCreateMTableClause(STableDef *tableDes, char *metric, int numOfCols count_temp = counter; for (; counter < numOfCols; counter++) { + TAOS_ROW row = NULL; + + sprintf(command, "select %s from %s limit 1", tableDes->cols[counter].field, tableDes->name); + if (taos_query(taos, command) != 0) { + fprintf(stderr, "failed to run command %s\n", command); + return; + } + + result = taos_use_result(taos); + if (result == NULL) { + fprintf(stderr, "failed to use result\n"); + return; + } + + TAOS_FIELD *fields = taos_fetch_fields(result); + + row = taos_fetch_row(result); + switch (fields[0].type) { + case TSDB_DATA_TYPE_BOOL: + sprintf(tableDes->cols[counter].note, "%d", ((((int)(*((char *)row[0]))) == 1) ? 1 : 0)); + break; + case TSDB_DATA_TYPE_TINYINT: + sprintf(tableDes->cols[counter].note, "%d", (int)(*((char *)row[0]))); + break; + case TSDB_DATA_TYPE_SMALLINT: + sprintf(tableDes->cols[counter].note, "%d", (int)(*((short *)row[0]))); + break; + case TSDB_DATA_TYPE_INT: + sprintf(tableDes->cols[counter].note, "%d", *((int *)row[0])); + break; + case TSDB_DATA_TYPE_BIGINT: + sprintf(tableDes->cols[counter].note, "%" PRId64 "", *((int64_t *)row[0])); + break; + case TSDB_DATA_TYPE_FLOAT: + sprintf(tableDes->cols[counter].note, "%f", GET_FLOAT_VAL(row[0])); + break; + case TSDB_DATA_TYPE_DOUBLE: + sprintf(tableDes->cols[counter].note, "%f", GET_DOUBLE_VAL(row[0])); + break; + case TSDB_DATA_TYPE_TIMESTAMP: + sprintf(tableDes->cols[counter].note, "%" PRId64 "", *(int64_t *)row[0]); + break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: + default: + strncpy(tableDes->cols[counter].note, (char *)row[0], fields[0].bytes); + break; + } + + taos_free_result(result); + if (counter != count_temp) { if (strcasecmp(tableDes->cols[counter].type, "binary") == 0 || strcasecmp(tableDes->cols[counter].type, "nchar") == 0) { @@ -941,7 +994,7 @@ int taosDumpTableData(FILE *fp, char *tbname, SDumpArguments *arguments) { pstr += sprintf(pstr, "%d", *((int *)row[col])); break; case TSDB_DATA_TYPE_BIGINT: - pstr += sprintf(pstr, "%" PRId64 "", *((int64_t *)row[col])); + pstr += sprintf(pstr, "%" PRId64, *((int64_t *)row[col])); break; case TSDB_DATA_TYPE_FLOAT: pstr += sprintf(pstr, "%f", GET_FLOAT_VAL(row[col])); @@ -960,7 +1013,7 @@ int taosDumpTableData(FILE *fp, char *tbname, SDumpArguments *arguments) { pstr += sprintf(pstr, "\'%s\'", tbuf); break; case TSDB_DATA_TYPE_TIMESTAMP: - pstr += sprintf(pstr, "%" PRId64 "", *(int64_t *)row[col]); + pstr += sprintf(pstr, "%" PRId64, *(int64_t *)row[col]); break; default: break; diff --git a/src/mnode/inc/mgmtDef.h b/src/mnode/inc/mgmtDef.h index fac342901a..9d3e46205d 100644 --- a/src/mnode/inc/mgmtDef.h +++ b/src/mnode/inc/mgmtDef.h @@ -63,10 +63,8 @@ typedef struct SMnodeObj { int8_t updateEnd[1]; int32_t refCount; int8_t role; - SDnodeObj *pDnode; } SMnodeObj; -// todo use dynamic length string typedef struct { char *tableId; int8_t type; diff --git a/src/mnode/inc/mgmtDnode.h b/src/mnode/inc/mgmtDnode.h index c9e062255b..14960c5701 100644 --- a/src/mnode/inc/mgmtDnode.h +++ b/src/mnode/inc/mgmtDnode.h @@ -34,6 +34,7 @@ char* mgmtGetDnodeStatusStr(int32_t dnodeStatus); void mgmtMonitorDnodeModule(); int32_t mgmtGetDnodesNum(); +int32_t mgmtGetOnlinDnodesNum(); void * mgmtGetNextDnode(void *pIter, SDnodeObj **pDnode); void mgmtIncDnodeRef(SDnodeObj *pDnode); void mgmtDecDnodeRef(SDnodeObj *pDnode); diff --git a/src/mnode/inc/mgmtMnode.h b/src/mnode/inc/mgmtMnode.h index b9a135346d..0973aa6ea6 100644 --- a/src/mnode/inc/mgmtMnode.h +++ b/src/mnode/inc/mgmtMnode.h @@ -44,7 +44,7 @@ void mgmtDecMnodeRef(struct SMnodeObj *pMnode); char * mgmtGetMnodeRoleStr(); void mgmtGetMnodeIpSet(SRpcIpSet *ipSet); void mgmtGetMnodeInfos(void *mnodes); - +void mgmtUpdateMnodeIpSet(); #ifdef __cplusplus } diff --git a/src/mnode/inc/mgmtTable.h b/src/mnode/inc/mgmtTable.h index 84220c9cf8..3ef4c6d453 100644 --- a/src/mnode/inc/mgmtTable.h +++ b/src/mnode/inc/mgmtTable.h @@ -31,6 +31,7 @@ void * mgmtGetNextChildTable(void *pIter, SChildTableObj **pTable); void * mgmtGetNextSuperTable(void *pIter, SSuperTableObj **pTable); void mgmtDropAllChildTables(SDbObj *pDropDb); void mgmtDropAllSuperTables(SDbObj *pDropDb); +void mgmtDropAllChildTablesInVgroups(SVgObj *pVgroup); #ifdef __cplusplus } diff --git a/src/mnode/inc/mgmtVgroup.h b/src/mnode/inc/mgmtVgroup.h index ce4cfed532..ab0345cd20 100644 --- a/src/mnode/inc/mgmtVgroup.h +++ b/src/mnode/inc/mgmtVgroup.h @@ -29,6 +29,7 @@ void mgmtIncVgroupRef(SVgObj *pVgroup); void mgmtDecVgroupRef(SVgObj *pVgroup); void mgmtDropAllDbVgroups(SDbObj *pDropDb, bool sendMsg); void mgmtDropAllDnodeVgroups(SDnodeObj *pDropDnode); +void mgmtUpdateAllDbVgroups(SDbObj *pAlterDb); void * mgmtGetNextVgroup(void *pIter, SVgObj **pVgroup); void mgmtUpdateVgroup(SVgObj *pVgroup); diff --git a/src/mnode/src/mgmtAcct.c b/src/mnode/src/mgmtAcct.c index 27beff8944..a35591382c 100644 --- a/src/mnode/src/mgmtAcct.c +++ b/src/mnode/src/mgmtAcct.c @@ -94,7 +94,7 @@ int32_t mgmtInitAccts() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_ACCOUNT, .tableName = "accounts", - .hashSessions = TSDB_MAX_ACCOUNTS, + .hashSessions = TSDB_DEFAULT_ACCOUNTS_HASH_SIZE, .maxRowSize = tsAcctUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 3ea2e3aa87..df18fe8786 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -96,6 +96,7 @@ static int32_t mgmtDbActionUpdate(SSdbOper *pOper) { memcpy(pSaved, pDb, pOper->rowSize); free(pDb); } + mgmtUpdateAllDbVgroups(pSaved); mgmtDecDbRef(pSaved); return TSDB_CODE_SUCCESS; } @@ -127,7 +128,7 @@ int32_t mgmtInitDbs() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_DB, .tableName = "dbs", - .hashSessions = TSDB_MAX_DBS, + .hashSessions = TSDB_DEFAULT_DBS_HASH_SIZE, .maxRowSize = tsDbUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index c3ae8b5ab1..93c8276b14 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -74,7 +74,6 @@ static int32_t mgmtDnodeActionDelete(SSdbOper *pOper) { SDnodeObj *pDnode = pOper->pObj; #ifndef _SYNC - //TODO: drop dnode local mgmtDropAllDnodeVgroups(pDnode); #endif mgmtDropMnodeLocal(pDnode->dnodeId); @@ -130,7 +129,7 @@ int32_t mgmtInitDnodes() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_DNODE, .tableName = "dnodes", - .hashSessions = TSDB_MAX_DNODES, + .hashSessions = TSDB_DEFAULT_DNODES_HASH_SIZE, .maxRowSize = tsDnodeUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_AUTO, @@ -179,6 +178,23 @@ int32_t mgmtGetDnodesNum() { return sdbGetNumOfRows(tsDnodeSdb); } +int32_t mgmtGetOnlinDnodesNum(char *ep) { + SDnodeObj *pDnode = NULL; + void * pIter = NULL; + int32_t onlineDnodes = 0; + + while (1) { + pIter = mgmtGetNextDnode(pIter, &pDnode); + if (pDnode == NULL) break; + if (pDnode->status != TAOS_DN_STATUS_OFFLINE) onlineDnodes++; + mgmtDecDnodeRef(pDnode); + } + + sdbFreeIter(pIter); + + return onlineDnodes; +} + void *mgmtGetDnode(int32_t dnodeId) { return sdbGetRow(tsDnodeSdb, &dnodeId); } @@ -397,7 +413,6 @@ static int32_t mgmtCreateDnode(char *ep) { return code; } -//TODO drop others tables int32_t mgmtDropDnode(SDnodeObj *pDnode) { SSdbOper oper = { .type = SDB_OPER_GLOBAL, @@ -410,7 +425,7 @@ int32_t mgmtDropDnode(SDnodeObj *pDnode) { code = TSDB_CODE_SDB_ERROR; } - mLPrint("dnode:%d is dropped from cluster, result:%s", pDnode->dnodeId, tstrerror(code)); + mLPrint("dnode:%d, is dropped from cluster, result:%s", pDnode->dnodeId, tstrerror(code)); return code; } diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index d9ddd465f6..6471b7f182 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -36,6 +36,25 @@ static int32_t tsMnodeUpdateSize = 0; static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, void *pConn); +static SRpcIpSet tsMnodeRpcIpSet; +static SDMMnodeInfos tsMnodeInfos; + +#if defined(LINUX) + static pthread_rwlock_t tsMnodeLock; + #define mgmtMnodeWrLock() pthread_rwlock_wrlock(&tsMnodeLock) + #define mgmtMnodeRdLock() pthread_rwlock_rdlock(&tsMnodeLock) + #define mgmtMnodeUnLock() pthread_rwlock_unlock(&tsMnodeLock) + #define mgmtMnodeInitLock() pthread_rwlock_init(&tsMnodeLock, NULL) + #define mgmtMnodeDestroyLock() pthread_rwlock_destroy(&tsMnodeLock) +#else + static pthread_mutex_t tsMnodeLock; + #define mgmtMnodeWrLock() pthread_mutex_lock(&tsMnodeLock) + #define mgmtMnodeRdLock() pthread_mutex_lock(&tsMnodeLock) + #define mgmtMnodeUnLock() pthread_mutex_unlock(&tsMnodeLock) + #define mgmtMnodeInitLock() pthread_mutex_init(&tsMnodeLock, NULL) + #define mgmtMnodeDestroyLock() pthread_mutex_destroy(&tsMnodeLock) +#endif + static int32_t mgmtMnodeActionDestroy(SSdbOper *pOper) { tfree(pOper->pObj); return TSDB_CODE_SUCCESS; @@ -46,7 +65,6 @@ static int32_t mgmtMnodeActionInsert(SSdbOper *pOper) { SDnodeObj *pDnode = mgmtGetDnode(pMnode->mnodeId); if (pDnode == NULL) return TSDB_CODE_DNODE_NOT_EXIST; - pMnode->pDnode = pDnode; pDnode->isMgmt = true; mgmtDecDnodeRef(pDnode); @@ -102,17 +120,22 @@ static int32_t mgmtMnodeActionRestored() { } sdbFreeIter(pIter); } + + mgmtUpdateMnodeIpSet(); + return TSDB_CODE_SUCCESS; } int32_t mgmtInitMnodes() { + mgmtMnodeInitLock(); + SMnodeObj tObj; tsMnodeUpdateSize = (int8_t *)tObj.updateEnd - (int8_t *)&tObj; SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_MNODE, .tableName = "mnodes", - .hashSessions = TSDB_MAX_MNODES, + .hashSessions = TSDB_DEFAULT_MNODES_HASH_SIZE, .maxRowSize = tsMnodeUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_INT, @@ -140,6 +163,7 @@ int32_t mgmtInitMnodes() { void mgmtCleanupMnodes() { sdbCloseTable(tsMnodeSdb); + mgmtMnodeDestroyLock(); } int32_t mgmtGetMnodesNum() { @@ -177,50 +201,65 @@ char *mgmtGetMnodeRoleStr(int32_t role) { } } -void mgmtGetMnodeIpSet(SRpcIpSet *ipSet) { - void *pIter = NULL; - while (1) { - SMnodeObj *pMnode = NULL; - pIter = mgmtGetNextMnode(pIter, &pMnode); - if (pMnode == NULL) break; +void mgmtUpdateMnodeIpSet() { + SRpcIpSet *ipSet = &tsMnodeRpcIpSet; + SDMMnodeInfos *mnodes = &tsMnodeInfos; - strcpy(ipSet->fqdn[ipSet->numOfIps], pMnode->pDnode->dnodeFqdn); - ipSet->port[ipSet->numOfIps] = htons(pMnode->pDnode->dnodePort); + mPrint("update mnodes ipset, numOfIps:%d ", mgmtGetMnodesNum()); - if (pMnode->role == TAOS_SYNC_ROLE_MASTER) { - ipSet->inUse = ipSet->numOfIps; - } + mgmtMnodeWrLock(); - ipSet->numOfIps++; - - mgmtDecMnodeRef(pMnode); - } - sdbFreeIter(pIter); -} + memset(ipSet, 0, sizeof(tsMnodeRpcIpSet)); + memset(mnodes, 0, sizeof(SDMMnodeInfos)); -void mgmtGetMnodeInfos(void *param) { - SDMMnodeInfos *mnodes = param; - mnodes->inUse = 0; - int32_t index = 0; - void *pIter = NULL; + void * pIter = NULL; while (1) { SMnodeObj *pMnode = NULL; pIter = mgmtGetNextMnode(pIter, &pMnode); if (pMnode == NULL) break; - mnodes->nodeInfos[index].nodeId = htonl(pMnode->mnodeId); - strcpy(mnodes->nodeInfos[index].nodeEp, pMnode->pDnode->dnodeEp); - if (pMnode->role == TAOS_SYNC_ROLE_MASTER) { - mnodes->inUse = index; + SDnodeObj *pDnode = mgmtGetDnode(pMnode->mnodeId); + if (pDnode != NULL) { + strcpy(ipSet->fqdn[ipSet->numOfIps], pDnode->dnodeFqdn); + ipSet->port[ipSet->numOfIps] = htons(pDnode->dnodePort); + + mnodes->nodeInfos[index].nodeId = htonl(pMnode->mnodeId); + strcpy(mnodes->nodeInfos[index].nodeEp, pDnode->dnodeEp); + + if (pMnode->role == TAOS_SYNC_ROLE_MASTER) { + ipSet->inUse = ipSet->numOfIps; + mnodes->inUse = index; + } + + mPrint("mnode:%d, ep:%s %s", index, pDnode->dnodeEp, + pMnode->role == TAOS_SYNC_ROLE_MASTER ? "master" : ""); + + ipSet->numOfIps++; + index++; } - index++; + mgmtDecDnodeRef(pDnode); mgmtDecMnodeRef(pMnode); } - sdbFreeIter(pIter); mnodes->nodeNum = index; + + sdbFreeIter(pIter); + + mgmtMnodeUnLock(); +} + +void mgmtGetMnodeIpSet(SRpcIpSet *ipSet) { + mgmtMnodeRdLock(); + *ipSet = tsMnodeRpcIpSet; + mgmtMnodeUnLock(); +} + +void mgmtGetMnodeInfos(void *mnodeInfos) { + mgmtMnodeRdLock(); + *(SDMMnodeInfos *)mnodeInfos = tsMnodeInfos; + mgmtMnodeUnLock(); } int32_t mgmtAddMnode(int32_t dnodeId) { @@ -240,6 +279,8 @@ int32_t mgmtAddMnode(int32_t dnodeId) { code = TSDB_CODE_SDB_ERROR; } + mgmtUpdateMnodeIpSet(); + return code; } @@ -250,6 +291,8 @@ void mgmtDropMnodeLocal(int32_t dnodeId) { sdbDeleteRow(&oper); mgmtDecMnodeRef(pMnode); } + + mgmtUpdateMnodeIpSet(); } int32_t mgmtDropMnode(int32_t dnodeId) { @@ -270,6 +313,9 @@ int32_t mgmtDropMnode(int32_t dnodeId) { } sdbDecRef(tsMnodeSdb, pMnode); + + mgmtUpdateMnodeIpSet(); + return code; } @@ -343,7 +389,15 @@ static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, voi cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pMnode->pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); + + SDnodeObj *pDnode = mgmtGetDnode(pMnode->mnodeId); + if (pDnode != NULL) { + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE); + } else { + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, "invalid ep", pShow->bytes[cols] - VARSTR_HEADER_SIZE); + } + mgmtDecDnodeRef(pDnode); + cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index 47fb71680a..237d2ca499 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -28,6 +28,7 @@ #include "mgmtDef.h" #include "mgmtInt.h" #include "mgmtMnode.h" +#include "mgmtDnode.h" #include "mgmtSdb.h" typedef enum { @@ -196,6 +197,8 @@ void sdbUpdateMnodeRoles() { mgmtDecMnodeRef(pMnode); } } + + mgmtUpdateMnodeIpSet(); } static uint32_t sdbGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size, uint64_t *fversion) { @@ -257,10 +260,15 @@ void sdbUpdateSync() { if (pMnode == NULL) break; syncCfg.nodeInfo[index].nodeId = pMnode->mnodeId; - syncCfg.nodeInfo[index].nodePort = pMnode->pDnode->dnodePort + TSDB_PORT_SYNC; - strcpy(syncCfg.nodeInfo[index].nodeFqdn, pMnode->pDnode->dnodeEp); - index++; + SDnodeObj *pDnode = mgmtGetDnode(pMnode->mnodeId); + if (pDnode != NULL) { + syncCfg.nodeInfo[index].nodePort = pDnode->dnodePort + TSDB_PORT_SYNC; + strcpy(syncCfg.nodeInfo[index].nodeFqdn, pDnode->dnodeEp); + index++; + } + + mgmtDecDnodeRef(pDnode); mgmtDecMnodeRef(pMnode); } sdbFreeIter(pIter); @@ -352,7 +360,7 @@ void sdbIncRef(void *handle, void *pObj) { int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos); atomic_add_fetch_32(pRefCount, 1); if (0 && (pTable->tableId == SDB_TABLE_MNODE || pTable->tableId == SDB_TABLE_DNODE)) { - sdbTrace("table:%s, add ref to record:%s:%d", pTable->tableName, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount); + sdbTrace("add ref to table:%s record:%s:%d", pTable->tableName, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount); } } @@ -363,7 +371,7 @@ void sdbDecRef(void *handle, void *pObj) { int32_t * pRefCount = (int32_t *)(pObj + pTable->refCountPos); int32_t refCount = atomic_sub_fetch_32(pRefCount, 1); if (0 && (pTable->tableId == SDB_TABLE_MNODE || pTable->tableId == SDB_TABLE_DNODE)) { - sdbTrace("table:%s, def ref of record:%s:%d", pTable->tableName, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount); + sdbTrace("def ref of table:%s record:%s:%d", pTable->tableName, sdbGetKeyStrFromObj(pTable, pObj), *pRefCount); } int8_t *updateEnd = pObj + pTable->refCountPos - 1; @@ -442,8 +450,8 @@ static int32_t sdbInsertHash(SSdbTable *pTable, SSdbOper *pOper) { pthread_mutex_unlock(&pTable->mutex); - sdbTrace("table:%s, insert record:%s to hash, numOfRows:%d version:%" PRIu64, pTable->tableName, - sdbGetKeyStrFromObj(pTable, pOper->pObj), pTable->numOfRows, sdbGetVersion()); + sdbTrace("table:%s, insert record:%s to hash, rowSize:%d vnumOfRows:%d version:%" PRIu64, pTable->tableName, + sdbGetKeyStrFromObj(pTable, pOper->pObj), pOper->rowSize, pTable->numOfRows, sdbGetVersion()); (*pTable->insertFp)(pOper); return TSDB_CODE_SUCCESS; diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index d8bcf67242..ccbed350dc 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -119,7 +119,7 @@ static void mgmtDoDealyedAddToShellQueue(void *param, void *tmrId) { void mgmtDealyedAddToShellQueue(SQueuedMsg *queuedMsg) { void *unUsed = NULL; - taosTmrReset(mgmtDoDealyedAddToShellQueue, 1000, queuedMsg, tsMgmtTmr, &unUsed); + taosTmrReset(mgmtDoDealyedAddToShellQueue, 300, queuedMsg, tsMgmtTmr, &unUsed); } void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) { @@ -325,6 +325,8 @@ static void mgmtProcessHeartBeatMsg(SQueuedMsg *pMsg) { return; } + pHBRsp->onlineDnodes = htonl(mgmtGetOnlinDnodesNum()); + pHBRsp->totalDnodes = htonl(mgmtGetDnodesNum()); mgmtGetMnodeIpSet(&pHBRsp->ipList); /* diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 7b010a536a..53fbd64f87 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -340,7 +340,7 @@ static int32_t mgmtInitChildTables() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_CTABLE, .tableName = "ctables", - .hashSessions = tsMaxTables, + .hashSessions = TSDB_DEFAULT_CTABLES_HASH_SIZE, .maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16) + TSDB_TABLE_ID_LEN + TSDB_CQ_SQL_SIZE, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_VAR_STRING, @@ -507,7 +507,7 @@ static int32_t mgmtInitSuperTables() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_STABLE, .tableName = "stables", - .hashSessions = TSDB_MAX_SUPER_TABLES, + .hashSessions = TSDB_DEFAULT_STABLES_HASH_SIZE, .maxRowSize = sizeof(SSuperTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16) + TSDB_TABLE_ID_LEN, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_VAR_STRING, @@ -1139,7 +1139,7 @@ int32_t mgmtRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, v prefixLen = strlen(prefix); SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER; - char stableName[TSDB_TABLE_NAME_LEN] = {0}; + char stableName[TSDB_TABLE_NAME_LEN + 1] = {0}; while (numOfRows < rows) { pShow->pIter = mgmtGetNextSuperTable(pShow->pIter, &pTable); @@ -1305,7 +1305,7 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { if (pDnode == NULL) break; strncpy(pVgroupInfo->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); - pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort); + pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(pDnode->dnodePort); pVgroupInfo->vgroups[vgSize].numOfIps++; } @@ -1334,13 +1334,13 @@ static void mgmtProcessDropSuperTableRsp(SRpcMsg *rpcMsg) { } static void *mgmtBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableObj *pTable) { - char * pTagData = NULL; + STagData * pTagData = NULL; int32_t tagDataLen = 0; int32_t totalCols = 0; int32_t contLen = 0; if (pTable->info.type == TSDB_CHILD_TABLE && pMsg != NULL) { - pTagData = pMsg->schema + TSDB_TABLE_ID_LEN + 1; - tagDataLen = htonl(pMsg->contLen) - sizeof(SCMCreateTableMsg) - TSDB_TABLE_ID_LEN - 1; + pTagData = (STagData*)pMsg->schema; + tagDataLen = ntohl(pTagData->dataLen); totalCols = pTable->superTable->numOfColumns + pTable->superTable->numOfTags; contLen = sizeof(SMDCreateTableMsg) + totalCols * sizeof(SSchema) + tagDataLen + pTable->sqlLen; } else { @@ -1393,7 +1393,7 @@ static void *mgmtBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableOb } if (pTable->info.type == TSDB_CHILD_TABLE && pMsg != NULL) { - memcpy(pCreate->data + totalCols * sizeof(SSchema), pTagData, tagDataLen); + memcpy(pCreate->data + totalCols * sizeof(SSchema), pTagData->data, tagDataLen); memcpy(pCreate->data + totalCols * sizeof(SSchema) + tagDataLen, pTable->sql, pTable->sqlLen); } @@ -1420,10 +1420,10 @@ static SChildTableObj* mgmtDoCreateChildTable(SCMCreateTableMsg *pCreate, SVgObj pTable->vgId = pVgroup->vgId; if (pTable->info.type == TSDB_CHILD_TABLE) { - char *pTagData = (char *) pCreate->schema; // it is a tag key - SSuperTableObj *pSuperTable = mgmtGetSuperTable(pTagData); + STagData *pTagData = (STagData *) pCreate->schema; // it is a tag key + SSuperTableObj *pSuperTable = mgmtGetSuperTable(pTagData->name); if (pSuperTable == NULL) { - mError("table:%s, corresponding super table:%s does not exist", pCreate->tableId, pTagData); + mError("table:%s, corresponding super table:%s does not exist", pCreate->tableId, pTagData->name); free(pTable); terrno = TSDB_CODE_INVALID_TABLE; return NULL; @@ -1538,7 +1538,7 @@ static void mgmtProcessCreateChildTableMsg(SQueuedMsg *pMsg) { SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); SQueuedMsg *newMsg = mgmtCloneQueuedMsg(pMsg); newMsg->ahandle = pMsg->pTable; - newMsg->maxRetry = 5; + newMsg->maxRetry = 10; SRpcMsg rpcMsg = { .handle = newMsg, .pCont = pMDCreate, @@ -1742,7 +1742,9 @@ static int32_t mgmtDoGetChildTableMeta(SQueuedMsg *pMsg, STableMetaMsg *pMeta) { static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) { SCMTableInfoMsg *pInfo = pMsg->pCont; - int32_t contLen = sizeof(SCMCreateTableMsg) + sizeof(STagData); + STagData* pTag = (STagData*)pInfo->tags; + + int32_t contLen = sizeof(SCMCreateTableMsg) + offsetof(STagData, data) + ntohl(pTag->dataLen); SCMCreateTableMsg *pCreateMsg = rpcMallocCont(contLen); if (pCreateMsg == NULL) { mError("table:%s, failed to create table while get meta info, no enough memory", pInfo->tableId); @@ -1756,14 +1758,9 @@ static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) { pCreateMsg->getMeta = 1; pCreateMsg->contLen = htonl(contLen); - contLen = sizeof(STagData); - if (contLen > pMsg->contLen - sizeof(SCMTableInfoMsg)) { - contLen = pMsg->contLen - sizeof(SCMTableInfoMsg); - } - memcpy(pCreateMsg->schema, pInfo->tags, contLen); + memcpy(pCreateMsg->schema, pInfo->tags, contLen - sizeof(SCMCreateTableMsg)); SQueuedMsg *newMsg = mgmtCloneQueuedMsg(pMsg); - pMsg->pCont = newMsg->pCont; newMsg->msgType = TSDB_MSG_TYPE_CM_CREATE_TABLE; newMsg->pCont = pCreateMsg; @@ -1790,6 +1787,34 @@ static void mgmtGetChildTableMeta(SQueuedMsg *pMsg) { rpcSendResponse(&rpcRsp); } +void mgmtDropAllChildTablesInVgroups(SVgObj *pVgroup) { + void * pIter = NULL; + int32_t numOfTables = 0; + SChildTableObj *pTable = NULL; + + mPrint("vgId:%d, all child tables will be dropped from sdb", pVgroup->vgId); + + while (1) { + pIter = mgmtGetNextChildTable(pIter, &pTable); + if (pTable == NULL) break; + + if (pTable->vgId == pVgroup->vgId) { + SSdbOper oper = { + .type = SDB_OPER_LOCAL, + .table = tsChildTableSdb, + .pObj = pTable, + }; + sdbDeleteRow(&oper); + numOfTables++; + } + mgmtDecTableRef(pTable); + } + + sdbFreeIter(pIter); + + mPrint("vgId:%d, all child tables is dropped from sdb", pVgroup->vgId); +} + void mgmtDropAllChildTables(SDbObj *pDropDb) { void * pIter = NULL; int32_t numOfTables = 0; @@ -1999,7 +2024,7 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { SCMMultiTableInfoMsg *pInfo = pMsg->pCont; pInfo->numOfTables = htonl(pInfo->numOfTables); - int32_t totalMallocLen = 4*1024*1024; // first malloc 4 MB, subsequent reallocation as twice + int32_t totalMallocLen = 4 * 1024 * 1024; // first malloc 4 MB, subsequent reallocation as twice SMultiTableMeta *pMultiMeta = rpcMallocCont(totalMallocLen); if (pMultiMeta == NULL) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); @@ -2009,26 +2034,30 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { pMultiMeta->contLen = sizeof(SMultiTableMeta); pMultiMeta->numOfTables = 0; - for (int t = 0; t < pInfo->numOfTables; ++t) { - char *tableId = (char*)(pInfo->tableIds + t * TSDB_TABLE_ID_LEN); + for (int32_t t = 0; t < pInfo->numOfTables; ++t) { + char * tableId = (char *)(pInfo->tableIds + t * TSDB_TABLE_ID_LEN + 1); SChildTableObj *pTable = mgmtGetChildTable(tableId); if (pTable == NULL) continue; if (pMsg->pDb == NULL) pMsg->pDb = mgmtGetDbByTableId(tableId); - if (pMsg->pDb == NULL) continue; + if (pMsg->pDb == NULL) { + mgmtDecTableRef(pTable); + continue; + } int availLen = totalMallocLen - pMultiMeta->contLen; if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)) { - //TODO realloc - //totalMallocLen *= 2; - //pMultiMeta = rpcReMalloc(pMultiMeta, totalMallocLen); - //if (pMultiMeta == NULL) { - /// rpcSendResponse(ahandle, TSDB_CODE_SERV_OUT_OF_MEMORY, NULL, 0); - // return TSDB_CODE_SERV_OUT_OF_MEMORY; - //} else { - // t--; - // continue; - //} + totalMallocLen *= 2; + pMultiMeta = rpcReallocCont(pMultiMeta, totalMallocLen); + if (pMultiMeta == NULL) { + mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); + mgmtDecTableRef(pTable); + return; + } else { + t--; + mgmtDecTableRef(pTable); + continue; + } } STableMetaMsg *pMeta = (STableMetaMsg *)(pMultiMeta->metas + pMultiMeta->contLen); @@ -2037,6 +2066,8 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { pMultiMeta->numOfTables ++; pMultiMeta->contLen += pMeta->contLen; } + + mgmtDecTableRef(pTable); } SRpcMsg rpcRsp = {0}; @@ -2123,7 +2154,7 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, continue; } - char tableName[TSDB_TABLE_NAME_LEN] = {0}; + char tableName[TSDB_TABLE_NAME_LEN + 1] = {0}; // pattern compare for table name mgmtExtractTableName(pTable->info.tableId, tableName); @@ -2201,6 +2232,8 @@ static void mgmtProcessAlterTableMsg(SQueuedMsg *pMsg) { } pAlter->type = htons(pAlter->type); + pAlter->numOfCols = htons(pAlter->numOfCols); + pAlter->tagValLen = htonl(pAlter->tagValLen); if (pAlter->numOfCols > 2) { mError("table:%s, error numOfCols:%d in alter table", pAlter->tableId, pAlter->numOfCols); @@ -2232,7 +2265,8 @@ static void mgmtProcessAlterTableMsg(SQueuedMsg *pMsg) { mTrace("table:%s, start to alter ctable", pAlter->tableId); SChildTableObj *pTable = (SChildTableObj *)pMsg->pTable; if (pAlter->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) { - code = mgmtModifyChildTableTagValue(pTable, pAlter->schema[0].name, pAlter->tagVal); + char *tagVal = (char*)(pAlter->schema + pAlter->numOfCols); + code = mgmtModifyChildTableTagValue(pTable, pAlter->schema[0].name, tagVal); } else if (pAlter->type == TSDB_ALTER_TABLE_ADD_COLUMN) { code = mgmtAddNormalTableColumn(pMsg->pDb, pTable, pAlter->schema, 1); } else if (pAlter->type == TSDB_ALTER_TABLE_DROP_COLUMN) { diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index cc22ed2169..62a98c4170 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -117,7 +117,7 @@ int32_t mgmtInitUsers() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_USER, .tableName = "users", - .hashSessions = TSDB_MAX_USERS, + .hashSessions = TSDB_DEFAULT_USERS_HASH_SIZE, .maxRowSize = tsUserUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index ef5582f395..960863d665 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -121,6 +121,20 @@ static int32_t mgmtVgroupActionDelete(SSdbOper *pOper) { return TSDB_CODE_SUCCESS; } +static void mgmtVgroupUpdateIdPool(SVgObj *pVgroup) { + int32_t oldTables = taosIdPoolMaxSize(pVgroup->idPool); + SDbObj *pDb = pVgroup->pDb; + if (pDb != NULL) { + if (pDb->cfg.maxTables != oldTables) { + mPrint("vgId:%d tables change from %d to %d", pVgroup->vgId, oldTables, pDb->cfg.maxTables); + taosUpdateIdPool(pVgroup->idPool, pDb->cfg.maxTables); + int32_t size = sizeof(SChildTableObj *) * pDb->cfg.maxTables; + pVgroup->tableList = (SChildTableObj **)realloc(pVgroup->tableList, size); + memset(pVgroup->tableList + oldTables, 0, (pDb->cfg.maxTables - oldTables) * sizeof(SChildTableObj **)); + } + } +} + static int32_t mgmtVgroupActionUpdate(SSdbOper *pOper) { SVgObj *pNew = pOper->pObj; SVgObj *pVgroup = mgmtGetVgroup(pNew->vgId); @@ -146,20 +160,11 @@ static int32_t mgmtVgroupActionUpdate(SSdbOper *pOper) { } } - int32_t oldTables = taosIdPoolMaxSize(pVgroup->idPool); - SDbObj *pDb = pVgroup->pDb; - if (pDb != NULL) { - if (pDb->cfg.maxTables != oldTables) { - mPrint("vgId:%d tables change from %d to %d", pVgroup->vgId, oldTables, pDb->cfg.maxTables); - taosUpdateIdPool(pVgroup->idPool, pDb->cfg.maxTables); - int32_t size = sizeof(SChildTableObj *) * pDb->cfg.maxTables; - pVgroup->tableList = (SChildTableObj **)realloc(pVgroup->tableList, size); - } - } + mgmtVgroupUpdateIdPool(pVgroup); mgmtDecVgroupRef(pVgroup); - mTrace("vgId:%d, is updated, numOfVnode:%d tables:%d", pVgroup->vgId, pVgroup->numOfVnodes, pDb == NULL ? 0 : pDb->cfg.maxTables); + mTrace("vgId:%d, is updated, numOfVnode:%d", pVgroup->vgId, pVgroup->numOfVnodes); return TSDB_CODE_SUCCESS; } @@ -196,7 +201,7 @@ int32_t mgmtInitVgroups() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_VGROUP, .tableName = "vgroups", - .hashSessions = TSDB_MAX_VGROUPS, + .hashSessions = TSDB_DEFAULT_VGROUPS_HASH_SIZE, .maxRowSize = tsVgUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_AUTO, @@ -742,11 +747,14 @@ void mgmtDropAllDnodeVgroups(SDnodeObj *pDropDnode) { SVgObj *pVgroup = NULL; int32_t numOfVgroups = 0; + mPrint("dnode:%d, all vgroups will be dropped from sdb", pDropDnode->dnodeId); + while (1) { pIter = mgmtGetNextVgroup(pIter, &pVgroup); if (pVgroup == NULL) break; if (pVgroup->vnodeGid[0].dnodeId == pDropDnode->dnodeId) { + mgmtDropAllChildTablesInVgroups(pVgroup); SSdbOper oper = { .type = SDB_OPER_LOCAL, .table = tsVgroupSdb, @@ -754,12 +762,35 @@ void mgmtDropAllDnodeVgroups(SDnodeObj *pDropDnode) { }; sdbDeleteRow(&oper); numOfVgroups++; - continue; } mgmtDecVgroupRef(pVgroup); } sdbFreeIter(pIter); + + mPrint("dnode:%d, all vgroups is dropped from sdb", pDropDnode->dnodeId); +} + +void mgmtUpdateAllDbVgroups(SDbObj *pAlterDb) { + void * pIter = NULL; + SVgObj *pVgroup = NULL; + + mPrint("db:%s, all vgroups will be update in sdb", pAlterDb->name); + + while (1) { + pIter = mgmtGetNextVgroup(pIter, &pVgroup); + if (pVgroup == NULL) break; + + if (pVgroup->pDb == pAlterDb) { + mgmtVgroupUpdateIdPool(pVgroup); + } + + mgmtDecVgroupRef(pVgroup); + } + + sdbFreeIter(pIter); + + mPrint("db:%s, all vgroups is updated in sdb", pAlterDb->name); } void mgmtDropAllDbVgroups(SDbObj *pDropDb, bool sendMsg) { diff --git a/src/os/linux/src/linuxPlatform.c b/src/os/linux/src/linuxPlatform.c index 73cccd020a..782a508b17 100644 --- a/src/os/linux/src/linuxPlatform.c +++ b/src/os/linux/src/linuxPlatform.c @@ -148,6 +148,10 @@ static void taosDeleteTimer(void *tharg) { timer_delete(*pTimer); } +static pthread_t timerThread; +static timer_t timerId; +static volatile bool stopTimer = false; + void *taosProcessAlarmSignal(void *tharg) { // Block the signal sigset_t sigset; @@ -156,7 +160,6 @@ void *taosProcessAlarmSignal(void *tharg) { sigprocmask(SIG_BLOCK, &sigset, NULL); void (*callback)(int) = tharg; - static timer_t timerId; struct sigevent sevent = {{0}}; #ifdef _ALPINE @@ -187,7 +190,7 @@ void *taosProcessAlarmSignal(void *tharg) { } int signo; - while (1) { + while (!stopTimer) { if (sigwait(&sigset, &signo)) { uError("Failed to wait signal: number %d", signo); continue; @@ -202,7 +205,6 @@ void *taosProcessAlarmSignal(void *tharg) { return NULL; } -static pthread_t timerThread; int taosInitTimer(void (*callback)(int), int ms) { pthread_attr_t tattr; @@ -217,7 +219,7 @@ int taosInitTimer(void (*callback)(int), int ms) { } void taosUninitTimer() { - pthread_cancel(timerThread); + stopTimer = true; pthread_join(timerThread, NULL); } diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 562de72410..2bc6bf54bf 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -3,3 +3,4 @@ PROJECT(TDengine) ADD_SUBDIRECTORY(monitor) ADD_SUBDIRECTORY(http) +ADD_SUBDIRECTORY(mqtt) diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index 11da145463..9a9c659b03 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -267,8 +267,10 @@ static void httpStopThread(HttpThread* pThread) { struct epoll_event event = { .events = EPOLLIN }; eventfd_t fd = eventfd(1, 0); if (fd == -1) { + httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); pthread_cancel(pThread->thread); } else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { + httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); pthread_cancel(pThread->thread); } diff --git a/src/plugins/mqtt/CMakeLists.txt b/src/plugins/mqtt/CMakeLists.txt new file mode 100644 index 0000000000..6224a0cad4 --- /dev/null +++ b/src/plugins/mqtt/CMakeLists.txt @@ -0,0 +1,22 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(TDengine) + +IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/client/inc) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/zlib-1.2.11/inc) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc) + INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc) + INCLUDE_DIRECTORIES(${TD_OS_DIR}/inc) + INCLUDE_DIRECTORIES(inc) + AUX_SOURCE_DIRECTORY(src SRC) + ADD_LIBRARY(mqtt ${SRC}) + TARGET_LINK_LIBRARIES(mqtt taos_static z) + + IF (TD_ADMIN) + TARGET_LINK_LIBRARIES(mqtt admin) + ENDIF () +ENDIF () diff --git a/src/plugins/mqtt/inc/mqttLog.h b/src/plugins/mqtt/inc/mqttLog.h new file mode 100644 index 0000000000..735678a326 --- /dev/null +++ b/src/plugins/mqtt/inc/mqttLog.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_MQTT_LOG_H +#define TDENGINE_MQTT_LOG_H + +#include "tlog.h" + +extern int32_t mqttDebugFlag; + +#define mqttError(...) \ + if (mqttDebugFlag & DEBUG_ERROR) { \ + taosPrintLog("ERROR MQT ", 255, __VA_ARGS__); \ + } +#define mqttWarn(...) \ + if ( mqttDebugFlag & DEBUG_WARN) { \ + taosPrintLog("WARN MQT ", mqttDebugFlag, __VA_ARGS__); \ + } +#define mqttTrace(...) \ + if ( mqttDebugFlag & DEBUG_TRACE) { \ + taosPrintLog("MQT ", mqttDebugFlag, __VA_ARGS__); \ + } +#define mqttDump(...) \ + if ( mqttDebugFlag & DEBUG_TRACE) { \ + taosPrintLongString("MQT ", mqttDebugFlag, __VA_ARGS__); \ + } +#define mqttPrint(...) \ + { taosPrintLog("MQT ", 255, __VA_ARGS__); } + +#endif diff --git a/src/plugins/mqtt/inc/mqttSystem.h b/src/plugins/mqtt/inc/mqttSystem.h new file mode 100644 index 0000000000..c61318806d --- /dev/null +++ b/src/plugins/mqtt/inc/mqttSystem.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_MQTT_SYSTEM_H +#define TDENGINE_MQTT_SYSTEM_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int32_t mqttGetReqCount(); +int32_t mqttInitSystem(); +int32_t mqttStartSystem(); +void mqttStopSystem(); +void mqttCleanUpSystem(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/plugins/mqtt/src/mqttSystem.c b/src/plugins/mqtt/src/mqttSystem.c new file mode 100644 index 0000000000..ccf6cfb3e3 --- /dev/null +++ b/src/plugins/mqtt/src/mqttSystem.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#define _DEFAULT_SOURCE +#include "mqttSystem.h" +#include "mqtt.h" +#include "mqttLog.h" +#include "os.h" +#include "taos.h" +#include "tglobal.h" +#include "tsocket.h" +#include "ttimer.h" + +int32_t mqttGetReqCount() { return 0; } +int mqttInitSystem() { + mqttPrint("mqttInitSystem"); + return 0; +} + +int mqttStartSystem() { + mqttPrint("mqttStartSystem"); + return 0; +} + +void mqttStopSystem() { + mqttPrint("mqttStopSystem"); +} + +void mqttCleanUpSystem() { + mqttPrint("mqttCleanUpSystem"); +} diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index 3f4618bf1c..0996b643d1 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -138,7 +138,7 @@ typedef struct SQuery { SColumnInfo* colList; SColumnInfo* tagColList; int32_t numOfFilterCols; - int64_t* defaultVal; + int64_t* fillVal; uint32_t status; // query status SResultRec rec; int32_t pos; diff --git a/src/query/inc/qfill.h b/src/query/inc/qfill.h index d0ba8941b2..323ff7a812 100644 --- a/src/query/inc/qfill.h +++ b/src/query/inc/qfill.h @@ -28,7 +28,7 @@ typedef struct { STColumn col; // column info int16_t functionId; // sql function id int16_t flag; // column flag: TAG COLUMN|NORMAL COLUMN - union {int64_t i; double d;} defaultVal; + union {int64_t i; double d;} fillVal; } SFillColInfo; typedef struct SFillInfo { @@ -75,15 +75,13 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, tFilePage* pInpu TSKEY taosGetRevisedEndKey(TSKEY ekey, int32_t order, int64_t timeInterval, int8_t slidingTimeUnit, int8_t precision); -int32_t taosGetNumOfResultWithFill(SFillInfo* pFillInfo, int32_t numOfRows, int64_t ekey, int32_t maxNumOfRows); +int64_t taosGetNumOfResultWithFill(SFillInfo* pFillInfo, int32_t numOfRows, int64_t ekey, int32_t maxNumOfRows); int32_t taosNumOfRemainRows(SFillInfo *pFillInfo); -int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numOfRows, int32_t outputRows, char** srcData); - int taosDoLinearInterpolation(int32_t type, SPoint *point1, SPoint *point2, SPoint *point); -void taosGenerateDataBlock(SFillInfo* pFillInfo, tFilePage** output, int64_t* outputRows, int32_t capacity); +int64_t taosGenerateDataBlock(SFillInfo* pFillInfo, tFilePage** output, int32_t capacity); #ifdef __cplusplus } diff --git a/src/query/inc/tsqlfunction.h b/src/query/inc/tsqlfunction.h index a11c03f2c0..6e591b28d2 100644 --- a/src/query/inc/tsqlfunction.h +++ b/src/query/inc/tsqlfunction.h @@ -126,7 +126,6 @@ typedef struct SArithmeticSupport { typedef struct SQLPreAggVal { bool isSet; - int32_t size; SDataStatis statis; } SQLPreAggVal; @@ -174,7 +173,6 @@ typedef struct SQLFunctionCtx { int16_t outputBytes; // size of results, determined by function and input column data type bool hasNull; // null value exist in current block int16_t functionId; // function id - int32_t blockStatus; // Indicate if data is loaded, it is first/last/internal block. Only for file blocks void * aInputElemBuf; char * aOutputBuf; // final result output buffer, point to sdata->data uint8_t currentStage; // record current running step, default: 0 diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index e148bcb58e..47ad633e34 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -110,7 +110,7 @@ static void resetMergeResultBuf(SQuery *pQuery, SQLFunctionCtx *pCtx, SResultInf static bool functionNeedToExecute(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx *pCtx, int32_t functionId); static void getNextTimeWindow(SQuery *pQuery, STimeWindow *pTimeWindow); -static void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void *inputData, TSKEY *tsCol, int32_t size, +static void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void* pData, TSKEY *tsCol, SDataBlockInfo* pBlockInfo, int32_t functionId, SDataStatis *pStatis, bool hasNull, void *param, int32_t scanFlag); static void initCtxOutputBuf(SQueryRuntimeEnv *pRuntimeEnv); static void destroyTableQueryInfo(STableQueryInfo *pTableQueryInfo, int32_t numOfCols); @@ -200,7 +200,7 @@ bool getNeighborPoints(SQInfo *pQInfo, void *pMeterObj, SPointInterpoSupporter * return false; } else { // prev has been located if (pQuery->fileId >= 0) { - pQuery->pos = pQuery->pBlock[pQuery->slot].numOfPoints - 1; + pQuery->pos = pQuery->pBlock[pQuery->slot].numOfRows - 1; getOneRowFromDataBlock(pRuntimeEnv, pPointInterpSupporter->pPrevPoint, pQuery->pos); qTrace("QInfo:%p get prev data point, fileId:%d, slot:%d, pos:%d, pQuery->pos:%d", GET_QINFO_ADDR(pQuery), @@ -210,11 +210,11 @@ bool getNeighborPoints(SQInfo *pQInfo, void *pMeterObj, SPointInterpoSupporter * assert(vnodeIsDatablockLoaded(pRuntimeEnv, pMeterObj, -1, true) == DISK_BLOCK_NO_NEED_TO_LOAD); pBlock = &pRuntimeEnv->cacheBlock; - pQuery->pos = pBlock->numOfPoints - 1; + pQuery->pos = pBlock->numOfRows - 1; getOneRowFromDataBlock(pRuntimeEnv, pPointInterpSupporter->pPrevPoint, pQuery->pos); qTrace("QInfo:%p get prev data point, fileId:%d, slot:%d, pos:%d, pQuery->pos:%d", GET_QINFO_ADDR(pQuery), - pQuery->fileId, pQuery->slot, pBlock->numOfPoints - 1, pQuery->pos); + pQuery->fileId, pQuery->slot, pBlock->numOfRows - 1, pQuery->pos); } } } @@ -376,11 +376,16 @@ bool isSelectivityWithTagsQuery(SQuery *pQuery) { bool isTSCompQuery(SQuery *pQuery) { return pQuery->pSelectExpr[0].base.functionId == TSDB_FUNC_TS_COMP; } -static bool limitResults(SQuery *pQuery) { +static bool limitResults(SQueryRuntimeEnv* pRuntimeEnv) { + SQInfo* pQInfo = GET_QINFO_ADDR(pRuntimeEnv); + SQuery* pQuery = pRuntimeEnv->pQuery; + if ((pQuery->limit.limit > 0) && (pQuery->rec.total + pQuery->rec.rows > pQuery->limit.limit)) { pQuery->rec.rows = pQuery->limit.limit - pQuery->rec.total; - assert(pQuery->rec.rows > 0); - + + qTrace("QInfo:%p discard remain data due to result limitation, limit:%"PRId64", current return:%d, total:%"PRId64, + pQInfo, pQuery->limit.limit, pQuery->rec.rows, pQuery->rec.total + pQuery->rec.rows); + assert(pQuery->rec.rows >= 0); setQueryStatus(pQuery, QUERY_COMPLETED); return true; } @@ -403,23 +408,24 @@ static bool isTopBottomQuery(SQuery *pQuery) { return false; } -static SDataStatis *getStatisInfo(SQuery *pQuery, SDataStatis *pStatis, SDataBlockInfo *pDataBlockInfo, int32_t index) { +static SDataStatis *getStatisInfo(SQuery *pQuery, SDataStatis *pStatis, int32_t numOfCols, int32_t index) { // for a tag column, no corresponding field info - SColIndex *pColIndexEx = &pQuery->pSelectExpr[index].base.colInfo; - if (TSDB_COL_IS_TAG(pColIndexEx->flag)) { + SColIndex *pColIndex = &pQuery->pSelectExpr[index].base.colInfo; + if (TSDB_COL_IS_TAG(pColIndex->flag)) { return NULL; } - + /* * Choose the right column field info by field id, since the file block may be out of date, * which means the newest table schema is not equalled to the schema of this block. + * TODO: speedup by using bsearch */ - for (int32_t i = 0; i < pDataBlockInfo->numOfCols; ++i) { - if (pColIndexEx->colId == pStatis[i].colId) { + for (int32_t i = 0; i < numOfCols; ++i) { + if (pColIndex->colId == pStatis[i].colId) { return &pStatis[i]; } } - + return NULL; } @@ -431,8 +437,7 @@ static SDataStatis *getStatisInfo(SQuery *pQuery, SDataStatis *pStatis, SDataBlo * @param pColStatis * @return */ -static bool hasNullValue(SQuery *pQuery, int32_t col, SDataBlockInfo *pDataBlockInfo, SDataStatis *pStatis, - SDataStatis **pColStatis) { +static bool hasNullValue(SQuery *pQuery, int32_t col, int32_t numOfCols, SDataStatis *pStatis, SDataStatis **pColStatis) { SColIndex *pColIndex = &pQuery->pSelectExpr[col].base.colInfo; if (TSDB_COL_IS_TAG(pColIndex->flag)) { return false; @@ -444,7 +449,7 @@ static bool hasNullValue(SQuery *pQuery, int32_t col, SDataBlockInfo *pDataBlock } if (pStatis != NULL) { - *pColStatis = getStatisInfo(pQuery, pStatis, pDataBlockInfo, col); + *pColStatis = getStatisInfo(pQuery, pStatis, numOfCols, col); } else { *pColStatis = NULL; } @@ -603,9 +608,9 @@ static SWindowStatus *getTimeWindowResStatus(SWindowResInfo *pWindowResInfo, int return &pWindowResInfo->pResult[slot].status; } -static int32_t getForwardStepsInBlock(int32_t numOfPoints, __block_search_fn_t searchFn, TSKEY ekey, int16_t pos, +static int32_t getForwardStepsInBlock(int32_t numOfRows, __block_search_fn_t searchFn, TSKEY ekey, int16_t pos, int16_t order, int64_t *pData) { - int32_t endPos = searchFn((char *)pData, numOfPoints, ekey, order); + int32_t endPos = searchFn((char *)pData, numOfRows, ekey, order); int32_t forwardStep = 0; if (endPos >= 0) { @@ -624,15 +629,17 @@ static int32_t getForwardStepsInBlock(int32_t numOfPoints, __block_search_fn_t s /** * NOTE: the query status only set for the first scan of master scan. */ -static void doCheckQueryCompleted(SQueryRuntimeEnv *pRuntimeEnv, TSKEY lastKey, SWindowResInfo *pWindowResInfo) { +static int32_t doCheckQueryCompleted(SQueryRuntimeEnv *pRuntimeEnv, TSKEY lastKey, SWindowResInfo *pWindowResInfo) { SQuery *pQuery = pRuntimeEnv->pQuery; if (pRuntimeEnv->scanFlag != MASTER_SCAN || (!isIntervalQuery(pQuery))) { - return; + return pWindowResInfo->size; } // no qualified results exist, abort check + int32_t numOfClosed = 0; + if (pWindowResInfo->size == 0) { - return; + return pWindowResInfo->size; } // query completed @@ -646,10 +653,10 @@ static void doCheckQueryCompleted(SQueryRuntimeEnv *pRuntimeEnv, TSKEY lastKey, int32_t i = 0; int64_t skey = TSKEY_INITIAL_VAL; - // TODO opt performance: get the closed time window here for (i = 0; i < pWindowResInfo->size; ++i) { SWindowResult *pResult = &pWindowResInfo->pResult[i]; if (pResult->status.closed) { + numOfClosed += 1; continue; } @@ -672,16 +679,26 @@ static void doCheckQueryCompleted(SQueryRuntimeEnv *pRuntimeEnv, TSKEY lastKey, pWindowResInfo->prevSKey = pWindowResInfo->pResult[pWindowResInfo->curIndex].window.skey; - // the number of completed slots are larger than the threshold, dump to client immediately. - int32_t n = numOfClosedTimeWindow(pWindowResInfo); - if (n > pWindowResInfo->threshold) { + // the number of completed slots are larger than the threshold, return current generated results to client. + if (numOfClosed > pWindowResInfo->threshold) { + qTrace("QInfo:%p total result window:%d closed:%d, reached the output threshold %d, return", + GET_QINFO_ADDR(pRuntimeEnv), pWindowResInfo->size, numOfClosed, pQuery->rec.threshold); + setQueryStatus(pQuery, QUERY_RESBUF_FULL); + } else { + qTrace("QInfo:%p total result window:%d already closed:%d", GET_QINFO_ADDR(pRuntimeEnv), pWindowResInfo->size, + numOfClosed); } - - qTrace("QInfo:%p total window:%d, closed:%d", GET_QINFO_ADDR(pRuntimeEnv), pWindowResInfo->size, n); } - + + // output has reached the limitation, set query completed + if (pQuery->limit.limit > 0 && (pQuery->limit.limit + pQuery->limit.offset) <= numOfClosed && + pRuntimeEnv->scanFlag == MASTER_SCAN) { + setQueryStatus(pQuery, QUERY_COMPLETED); + } + assert(pWindowResInfo->prevSKey != TSKEY_INITIAL_VAL); + return numOfClosed; } static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SDataBlockInfo *pDataBlockInfo, TSKEY *pPrimaryColumn, @@ -733,7 +750,7 @@ static int32_t getNumOfRowsInTimeWindow(SQuery *pQuery, SDataBlockInfo *pDataBlo } static void doBlockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SWindowStatus *pStatus, STimeWindow *pWin, - int32_t startPos, int32_t forwardStep, TSKEY *tsBuf) { + int32_t offset, int32_t forwardStep, TSKEY *tsBuf, int32_t numOfTotal) { SQuery * pQuery = pRuntimeEnv->pQuery; SQLFunctionCtx *pCtx = pRuntimeEnv->pCtx; @@ -743,12 +760,17 @@ static void doBlockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SWindowStat pCtx[k].nStartQueryTimestamp = pWin->skey; pCtx[k].size = forwardStep; - pCtx[k].startOffset = (QUERY_IS_ASC_QUERY(pQuery)) ? startPos : startPos - (forwardStep - 1); + pCtx[k].startOffset = (QUERY_IS_ASC_QUERY(pQuery)) ? offset : offset - (forwardStep - 1); if ((aAggs[functionId].nStatus & TSDB_FUNCSTATE_SELECTIVITY) != 0) { - pCtx[k].ptsList = &tsBuf[pCtx[k].startOffset]; + pCtx[k].ptsList = tsBuf; } + // not a whole block involved in query processing, statistics data can not be used + if (forwardStep != numOfTotal) { + pCtx[k].preAggVals.isSet = false; + } + if (functionNeedToExecute(pRuntimeEnv, &pCtx[k], functionId)) { aAggs[functionId].xFunction(&pCtx[k]); } @@ -890,7 +912,7 @@ static char *getDataBlock(SQueryRuntimeEnv *pRuntimeEnv, SArithmeticSupport *sas } assert(dataBlock != NULL); - sas->data[i] = dataBlock + pCtx->startOffset * pQuery->colList[i].bytes; // start from the offset + sas->data[i] = dataBlock/* + pQuery->colList[i].bytes*/; // start from the offset } } else { // other type of query function @@ -933,14 +955,15 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis * for (int32_t k = 0; k < pQuery->numOfOutput; ++k) { int32_t functionId = pQuery->pSelectExpr[k].base.functionId; + int32_t colId = pQuery->pSelectExpr[k].base.colInfo.colId; SDataStatis *tpField = NULL; - bool hasNull = hasNullValue(pQuery, k, pDataBlockInfo, pStatis, &tpField); + bool hasNull = hasNullValue(pQuery, k, pDataBlockInfo->numOfCols, pStatis, &tpField); char *dataBlock = getDataBlock(pRuntimeEnv, &sasArray[k], k, pDataBlockInfo->rows, pDataBlock); - setExecParams(pQuery, &pCtx[k], dataBlock, primaryKeyCol, pDataBlockInfo->rows, functionId, tpField, hasNull, - &sasArray[k], pRuntimeEnv->scanFlag); + setExecParams(pQuery, &pCtx[k], dataBlock, primaryKeyCol, pDataBlockInfo, functionId, tpField, hasNull, + &sasArray[k], colId); } int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); @@ -958,7 +981,7 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis * getNumOfRowsInTimeWindow(pQuery, pDataBlockInfo, primaryKeyCol, pQuery->pos, ekey, searchFn, true); SWindowStatus *pStatus = getTimeWindowResStatus(pWindowResInfo, curTimeWindow(pWindowResInfo)); - doBlockwiseApplyFunctions(pRuntimeEnv, pStatus, &win, pQuery->pos, forwardStep, primaryKeyCol); + doBlockwiseApplyFunctions(pRuntimeEnv, pStatus, &win, pQuery->pos, forwardStep, primaryKeyCol, pDataBlockInfo->rows); int32_t index = pWindowResInfo->curIndex; STimeWindow nextWin = win; @@ -978,7 +1001,7 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis * forwardStep = getNumOfRowsInTimeWindow(pQuery, pDataBlockInfo, primaryKeyCol, startPos, ekey, searchFn, true); pStatus = getTimeWindowResStatus(pWindowResInfo, curTimeWindow(pWindowResInfo)); - doBlockwiseApplyFunctions(pRuntimeEnv, pStatus, &nextWin, startPos, forwardStep, primaryKeyCol); + doBlockwiseApplyFunctions(pRuntimeEnv, pStatus, &nextWin, startPos, forwardStep, primaryKeyCol, pDataBlockInfo->rows); } pWindowResInfo->curIndex = index; @@ -1154,14 +1177,15 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS for (int32_t k = 0; k < pQuery->numOfOutput; ++k) { int32_t functionId = pQuery->pSelectExpr[k].base.functionId; - + int32_t colId = pQuery->pSelectExpr[k].base.colInfo.colId; + SDataStatis *pColStatis = NULL; - bool hasNull = hasNullValue(pQuery, k, pDataBlockInfo, pStatis, &pColStatis); + bool hasNull = hasNullValue(pQuery, k, pDataBlockInfo->numOfCols, pStatis, &pColStatis); char *dataBlock = getDataBlock(pRuntimeEnv, &sasArray[k], k, pDataBlockInfo->rows, pDataBlock); - setExecParams(pQuery, &pCtx[k], dataBlock, primaryKeyCol, pDataBlockInfo->rows, functionId, pColStatis, hasNull, - &sasArray[k], pRuntimeEnv->scanFlag); + setExecParams(pQuery, &pCtx[k], dataBlock, primaryKeyCol, pDataBlockInfo, functionId, pColStatis, hasNull, + &sasArray[k], colId); } // set the input column data @@ -1214,7 +1238,7 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS } // all startOffset are identical - offset -= pCtx[0].startOffset; +// offset -= pCtx[0].startOffset; SWindowStatus *pStatus = getTimeWindowResStatus(pWindowResInfo, curTimeWindow(pWindowResInfo)); doRowwiseApplyFunctions(pRuntimeEnv, pStatus, &win, offset); @@ -1255,9 +1279,6 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS } } - // all startOffset are identical - offset -= pCtx[0].startOffset; - for (int32_t k = 0; k < pQuery->numOfOutput; ++k) { int32_t functionId = pQuery->pSelectExpr[k].base.functionId; if (functionNeedToExecute(pRuntimeEnv, &pCtx[k], functionId)) { @@ -1305,55 +1326,55 @@ static int32_t tableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBl TSKEY lastKey = QUERY_IS_ASC_QUERY(pQuery) ? pDataBlockInfo->window.ekey : pDataBlockInfo->window.skey; pTableQInfo->lastKey = lastKey + GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); - doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo); // interval query with limit applied - if (isIntervalQuery(pQuery) && pQuery->limit.limit > 0 && - (pQuery->limit.limit + pQuery->limit.offset) <= numOfClosedTimeWindow(pWindowResInfo) && - pRuntimeEnv->scanFlag == MASTER_SCAN) { - setQueryStatus(pQuery, QUERY_COMPLETED); - } + int32_t numOfRes = 0; + + if (isIntervalQuery(pQuery)) { + numOfRes = doCheckQueryCompleted(pRuntimeEnv, lastKey, pWindowResInfo); + } else { + numOfRes = getNumOfResult(pRuntimeEnv); - int32_t numOfRes = getNumOfResult(pRuntimeEnv); + // update the number of output result + if (numOfRes > 0 && pQuery->checkBuffer == 1) { + assert(numOfRes >= pQuery->rec.rows); + pQuery->rec.rows = numOfRes; - // update the number of output result - if (numOfRes > 0 && pQuery->checkBuffer == 1) { - assert(numOfRes >= pQuery->rec.rows); - pQuery->rec.rows = numOfRes; + if (numOfRes >= pQuery->rec.threshold) { + setQueryStatus(pQuery, QUERY_RESBUF_FULL); + } - if (numOfRes >= pQuery->rec.threshold) { - setQueryStatus(pQuery, QUERY_RESBUF_FULL); - } - - if ((pQuery->limit.limit >= 0) && numOfRes >= (pQuery->limit.limit + pQuery->limit.offset)) { - setQueryStatus(pQuery, QUERY_COMPLETED); + if ((pQuery->limit.limit >= 0) && (pQuery->limit.limit + pQuery->limit.offset) <= numOfRes) { + setQueryStatus(pQuery, QUERY_COMPLETED); + } } } return numOfRes; } -void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void *inputData, TSKEY *tsCol, int32_t size, - int32_t functionId, SDataStatis *pStatis, bool hasNull, void *param, int32_t scanFlag) { - pCtx->scanFlag = scanFlag; - +void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void* inputData, TSKEY *tsCol, SDataBlockInfo* pBlockInfo, + int32_t functionId, SDataStatis *pStatis, bool hasNull, void *param, int32_t colId) { + pCtx->hasNull = hasNull; pCtx->aInputElemBuf = inputData; - pCtx->hasNull = hasNull; if (pStatis != NULL) { - pCtx->preAggVals.isSet = true; - pCtx->preAggVals.size = size; + pCtx->preAggVals.isSet = true; pCtx->preAggVals.statis = *pStatis; + if (pCtx->preAggVals.statis.numOfNull == -1) { + pCtx->preAggVals.statis.numOfNull = pBlockInfo->rows; // todo :can not be -1 + } } else { pCtx->preAggVals.isSet = false; } - pCtx->startOffset = QUERY_IS_ASC_QUERY(pQuery) ? pQuery->pos : 0; - pCtx->size = QUERY_IS_ASC_QUERY(pQuery) ? size - pQuery->pos : pQuery->pos + 1; + // limit/offset query will affect this value + pCtx->startOffset = QUERY_IS_ASC_QUERY(pQuery) ? pQuery->pos:0; + pCtx->size = QUERY_IS_ASC_QUERY(pQuery) ? pBlockInfo->rows - pQuery->pos : pQuery->pos + 1; uint32_t status = aAggs[functionId].nStatus; if (((status & (TSDB_FUNCSTATE_SELECTIVITY | TSDB_FUNCSTATE_NEED_TS)) != 0) && (tsCol != NULL)) { - pCtx->ptsList = &tsCol[pCtx->startOffset]; + pCtx->ptsList = tsCol; } if (functionId >= TSDB_FUNC_FIRST_DST && functionId <= TSDB_FUNC_LAST_DST) { @@ -1363,7 +1384,7 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void *inputData, TSKEY } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_TWA || functionId == TSDB_FUNC_DIFF || (functionId >= TSDB_FUNC_RATE && functionId <= TSDB_FUNC_AVG_IRATE)) { /* - * leastsquares function needs two columns of input, currently, the x value of linear equation is set to + * least squares function needs two columns of input, currently, the x value of linear equation is set to * timestamp column, and the y-value is the column specified in pQuery->pSelectExpr[i].colIdxInBuffer * * top/bottom function needs timestamp to indicate when the @@ -1377,6 +1398,12 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void *inputData, TSKEY } else if (functionId == TSDB_FUNC_ARITHM) { pCtx->param[1].pz = param; + } else if (functionId == TSDB_FUNC_SPREAD) { // set the statistics data for primary time stamp column + if (colId == PRIMARYKEY_TIMESTAMP_COL_INDEX) { + pCtx->preAggVals.isSet = true; + pCtx->preAggVals.statis.min = pBlockInfo->window.skey; + pCtx->preAggVals.statis.max = pBlockInfo->window.ekey; + } } #if defined(_DEBUG_VIEW) @@ -2015,10 +2042,10 @@ void pointInterpSupporterSetData(SQInfo *pQInfo, SPointInterpoSupporter *pPointI tVariantCreateFromBinary(&pCtx->param[3], (char *)&count, sizeof(count), TSDB_DATA_TYPE_INT); - if (isNull((char *)&pQuery->defaultVal[i], pCtx->inputType)) { + if (isNull((char *)&pQuery->fillVal[i], pCtx->inputType)) { pCtx->param[1].nType = TSDB_DATA_TYPE_NULL; } else { - tVariantCreateFromBinary(&pCtx->param[1], (char *)&pQuery->defaultVal[i], pCtx->inputBytes, pCtx->inputType); + tVariantCreateFromBinary(&pCtx->param[1], (char *)&pQuery->fillVal[i], pCtx->inputBytes, pCtx->inputType); } pInterpDetail->ts = pQuery->window.skey; @@ -2318,7 +2345,7 @@ SArray *loadDataBlockOnDemand(SQueryRuntimeEnv *pRuntimeEnv, void* pQueryHandle, int32_t binarySearchForKey(char *pValue, int num, TSKEY key, int order) { int32_t midPos = -1; - int32_t numOfPoints; + int32_t numOfRows; if (num <= 0) { return -1; @@ -2337,8 +2364,8 @@ int32_t binarySearchForKey(char *pValue, int num, TSKEY key, int order) { if (key == keyList[firstPos]) return firstPos; if (key < keyList[firstPos]) return firstPos - 1; - numOfPoints = lastPos - firstPos + 1; - midPos = (numOfPoints >> 1) + firstPos; + numOfRows = lastPos - firstPos + 1; + midPos = (numOfRows >> 1) + firstPos; if (key < keyList[midPos]) { lastPos = midPos - 1; @@ -2363,8 +2390,8 @@ int32_t binarySearchForKey(char *pValue, int num, TSKEY key, int order) { return lastPos; } - numOfPoints = lastPos - firstPos + 1; - midPos = (numOfPoints >> 1) + firstPos; + numOfRows = lastPos - firstPos + 1; + midPos = (numOfRows >> 1) + firstPos; if (key < keyList[midPos]) { lastPos = midPos - 1; @@ -2455,13 +2482,13 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) { } SDataStatis *pStatis = NULL; - SArray * pDataBlock = loadDataBlockOnDemand(pRuntimeEnv, pQueryHandle, &blockInfo, &pStatis); - pQuery->pos = QUERY_IS_ASC_QUERY(pQuery) ? 0 : blockInfo.rows - 1; + + SArray *pDataBlock = loadDataBlockOnDemand(pRuntimeEnv, pQueryHandle, &blockInfo, &pStatis); int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, &blockInfo, pStatis, binarySearchForKey, pDataBlock); - qTrace("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", rows:%d, numOfRes:%d", GET_QINFO_ADDR(pRuntimeEnv), - blockInfo.window.skey, blockInfo.window.ekey, blockInfo.rows, numOfRes); + qTrace("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%"PRId64, GET_QINFO_ADDR(pRuntimeEnv), + blockInfo.window.skey, blockInfo.window.ekey, blockInfo.rows, numOfRes, pQuery->current->lastKey); // while the output buffer is full or limit/offset is applied, query may be paused here if (Q_STATUS_EQUAL(pQuery->status, QUERY_RESBUF_FULL | QUERY_COMPLETED)) { @@ -3363,7 +3390,9 @@ static void clearEnvAfterReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatus // during reverse scan pTableQueryInfo->lastKey = pStatus->lastKey; pQuery->status = pStatus->status; + pTableQueryInfo->win = pStatus->w; + pQuery->window = pTableQueryInfo->win; } void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv, TSKEY start) { @@ -3385,6 +3414,7 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv, TSKEY start) { if (pRuntimeEnv->scanFlag == MASTER_SCAN) { qstatus.status = pQuery->status; qstatus.curWindow.ekey = pTableQueryInfo->lastKey - step; + qstatus.lastKey = pTableQueryInfo->lastKey; } if (!needScanDataBlocksAgain(pRuntimeEnv)) { @@ -3412,6 +3442,9 @@ void scanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv, TSKEY start) { setQueryStatus(pQuery, QUERY_NOT_COMPLETED); pRuntimeEnv->scanFlag = REPEAT_SCAN; + + qTrace("QInfo:%p start to repeat scan data blocks due to query func required, qrange:%"PRId64"-%"PRId64, pQInfo, + cond.twindow.skey, cond.twindow.ekey); // check if query is killed or not if (isQueryKilled(pQInfo)) { @@ -3633,12 +3666,14 @@ void setIntervalQueryRange(SQInfo *pQInfo, TSKEY key) { STimeWindow w = {0}; SWindowResInfo *pWindowResInfo = &pTableQueryInfo->windowResInfo; - getAlignQueryTimeWindow(pQuery, win.skey, win.skey, win.ekey, &skey1, &ekey1, &w); + TSKEY sk = MIN(win.skey, win.ekey); + TSKEY ek = MAX(win.skey, win.ekey); + getAlignQueryTimeWindow(pQuery, win.skey, sk, ek, &skey1, &ekey1, &w); pWindowResInfo->startTime = pTableQueryInfo->win.skey; // windowSKey may be 0 in case of 1970 timestamp if (pWindowResInfo->prevSKey == TSKEY_INITIAL_VAL) { if (!QUERY_IS_ASC_QUERY(pQuery)) { - assert(win.ekey == pQuery->window.skey); + assert(win.ekey == pQuery->window.ekey); } pWindowResInfo->prevSKey = w.skey; @@ -3673,10 +3708,6 @@ bool needPrimaryTimestampCol(SQuery *pQuery, SDataBlockInfo *pDataBlockInfo) { return loadPrimaryTS; } -bool onDemandLoadDatablock(SQuery *pQuery, int16_t queryRangeSet) { - return (pQuery->intervalTime == 0) || ((queryRangeSet == 1) && (isIntervalQuery(pQuery))); -} - static int32_t getNumOfSubset(SQInfo *pQInfo) { SQuery *pQuery = pQInfo->runtimeEnv.pQuery; @@ -3698,7 +3729,7 @@ static int32_t doCopyToSData(SQInfo *pQInfo, SWindowResult *result, int32_t orde int32_t startIdx = 0; int32_t step = -1; - qTrace("QInfo:%p start to copy data from windowResInfo to query buf", GET_QINFO_ADDR(pQuery)); + qTrace("QInfo:%p start to copy data from windowResInfo to query buf", pQInfo); int32_t totalSubset = getNumOfSubset(pQInfo); if (orderType == TSDB_ORDER_ASC) { @@ -3827,7 +3858,7 @@ bool queryHasRemainResults(SQueryRuntimeEnv* pRuntimeEnv) { } /* - * There are no results returned to client now. + * While the code reaches here, there are no results returned to client now. * If query is not completed yet, the gaps between two results blocks need to be handled after next data block * is retrieved from TSDB. * @@ -3881,18 +3912,24 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data } int32_t doFillGapsInResults(SQueryRuntimeEnv* pRuntimeEnv, tFilePage **pDst, int32_t numOfRows, int32_t *numOfInterpo) { + SQInfo* pQInfo = GET_QINFO_ADDR(pRuntimeEnv); SQuery *pQuery = pRuntimeEnv->pQuery; + SFillInfo* pFillInfo = pRuntimeEnv->pFillInfo; + while (1) { - taosGenerateDataBlock(pRuntimeEnv->pFillInfo, (tFilePage**) pQuery->sdata, &pQuery->rec.rows, pQuery->rec.capacity); - int32_t ret = pQuery->rec.rows; + int32_t ret = taosGenerateDataBlock(pFillInfo, (tFilePage**) pQuery->sdata, pQuery->rec.capacity); // todo apply limit output function /* reached the start position of according to offset value, return immediately */ if (pQuery->limit.offset == 0) { + qTrace("QInfo:%p initial numOfRows:%d, generate filled result:%d rows", pQInfo, pFillInfo->numOfRows, ret); return ret; } if (pQuery->limit.offset < ret) { + qTrace("QInfo:%p initial numOfRows:%d, generate filled result:%d rows, offset:%d. Discard due to offset, remain:%d, new offset:%d", + pQInfo, pFillInfo->numOfRows, ret, pQuery->limit.offset, ret - pQuery->limit.offset, 0); + ret -= pQuery->limit.offset; // todo !!!!there exactly number of interpo is not valid. // todo refactor move to the beginning of buffer @@ -3900,10 +3937,16 @@ int32_t doFillGapsInResults(SQueryRuntimeEnv* pRuntimeEnv, tFilePage **pDst, int memmove(pDst[i]->data, pDst[i]->data + pQuery->pSelectExpr[i].bytes * pQuery->limit.offset, ret * pQuery->pSelectExpr[i].bytes); } + pQuery->limit.offset = 0; return ret; } else { + qTrace("QInfo:%p initial numOfRows:%d, generate filled result:%d rows, offset:%d. Discard due to offset, " + "remain:%d, new offset:%d", pQInfo, pFillInfo->numOfRows, ret, pQuery->limit.offset, 0, + pQuery->limit.offset - ret); + pQuery->limit.offset -= ret; + pQuery->rec.rows = 0; ret = 0; } @@ -3911,8 +3954,6 @@ int32_t doFillGapsInResults(SQueryRuntimeEnv* pRuntimeEnv, tFilePage **pDst, int return ret; } } - - return 0; } void vnodePrintQueryStatistics(SQInfo *pQInfo) { @@ -3993,8 +4034,8 @@ static void updateOffsetVal(SQueryRuntimeEnv *pRuntimeEnv, SDataBlockInfo *pBloc int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, pBlockInfo, NULL, binarySearchForKey, pDataBlock); - qTrace("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", rows:%d, numOfRes:%d", GET_QINFO_ADDR(pRuntimeEnv), - pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes); + qTrace("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%"PRId64, GET_QINFO_ADDR(pRuntimeEnv), + pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, numOfRes, pQuery->current->lastKey); } void skipBlocks(SQueryRuntimeEnv *pRuntimeEnv) { @@ -4022,7 +4063,7 @@ void skipBlocks(SQueryRuntimeEnv *pRuntimeEnv) { pTableQueryInfo->lastKey = (QUERY_IS_ASC_QUERY(pQuery)) ? blockInfo.window.ekey : blockInfo.window.skey; pTableQueryInfo->lastKey += step; - qTrace("QInfo:%p skip rows:%d, offset:%" PRId64 "", GET_QINFO_ADDR(pRuntimeEnv), blockInfo.rows, + qTrace("QInfo:%p skip rows:%d, offset:%" PRId64, GET_QINFO_ADDR(pRuntimeEnv), blockInfo.rows, pQuery->limit.offset); } else { // find the appropriated start position in current block updateOffsetVal(pRuntimeEnv, &blockInfo); @@ -4111,8 +4152,9 @@ static bool skipTimeInterval(SQueryRuntimeEnv *pRuntimeEnv, TSKEY* start) { int32_t numOfRes = tableApplyFunctionsOnBlock(pRuntimeEnv, &blockInfo, NULL, binarySearchForKey, pDataBlock); pRuntimeEnv->windowResInfo.curIndex = index; // restore the window index - qTrace("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", rows:%d, numOfRes:%d", - GET_QINFO_ADDR(pRuntimeEnv), blockInfo.window.skey, blockInfo.window.ekey, blockInfo.rows, numOfRes); + qTrace("QInfo:%p check data block, brange:%" PRId64 "-%" PRId64 ", numOfRows:%d, numOfRes:%d, lastKey:%"PRId64, + GET_QINFO_ADDR(pRuntimeEnv), blockInfo.window.skey, blockInfo.window.ekey, blockInfo.rows, numOfRes, pQuery->current->lastKey); + return true; } else { // do nothing *start = tw.skey; @@ -4206,7 +4248,7 @@ static SFillColInfo* taosCreateFillColInfo(SQuery* pQuery) { pFillCol[i].col.offset = offset; pFillCol[i].flag = TSDB_COL_NORMAL; // always be ta normal column for table query pFillCol[i].functionId = pExprInfo->base.functionId; - pFillCol[i].defaultVal.i = pQuery->defaultVal[i]; + pFillCol[i].fillVal.i = pQuery->fillVal[i]; offset += pExprInfo->bytes; } @@ -4582,7 +4624,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { skipResults(pRuntimeEnv); // the limitation of output result is reached, set the query completed - if (limitResults(pQuery)) { + if (limitResults(pRuntimeEnv)) { pQInfo->tableIndex = pQInfo->groupInfo.numOfTables; break; } @@ -4837,7 +4879,7 @@ static void tableFixedOutputProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) pQuery->rec.rows = getNumOfResult(pRuntimeEnv); skipResults(pRuntimeEnv); - limitResults(pQuery); + limitResults(pRuntimeEnv); } static void tableMultiOutputProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) { @@ -4885,7 +4927,7 @@ static void tableMultiOutputProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) resetCtxOutputBuf(pRuntimeEnv); } - limitResults(pQuery); + limitResults(pRuntimeEnv); if (Q_STATUS_EQUAL(pQuery->status, QUERY_RESBUF_FULL)) { qTrace("QInfo:%p query paused due to output limitation, next qrange:%" PRId64 "-%" PRId64, pQInfo, pQuery->current->lastKey, pQuery->window.ekey); @@ -4963,7 +5005,7 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) { // the offset is handled at prepare stage if no interpolation involved if (pQuery->fillType == TSDB_FILL_NONE || pQuery->rec.rows == 0) { - limitResults(pQuery); + limitResults(pRuntimeEnv); break; } else { TSKEY ekey = taosGetRevisedEndKey(pQuery->window.ekey, pQuery->order.order, pQuery->slidingTime, @@ -4971,11 +5013,10 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) { taosFillSetStartInfo(pRuntimeEnv->pFillInfo, pQuery->rec.rows, ekey); taosFillCopyInputDataFromFilePage(pRuntimeEnv->pFillInfo, (tFilePage**) pQuery->sdata); numOfInterpo = 0; + pQuery->rec.rows = doFillGapsInResults(pRuntimeEnv, (tFilePage **)pQuery->sdata, pQuery->rec.rows, &numOfInterpo); - - qTrace("QInfo: %p fill results completed, final:%d", pQInfo, pQuery->rec.rows); if (pQuery->rec.rows > 0 || Q_STATUS_EQUAL(pQuery->status, QUERY_COMPLETED)) { - limitResults(pQuery); + limitResults(pRuntimeEnv); break; } @@ -5008,9 +5049,8 @@ static void tableQueryImpl(SQInfo *pQInfo) { int32_t remain = taosNumOfRemainRows(pRuntimeEnv->pFillInfo); pQuery->rec.rows = doFillGapsInResults(pRuntimeEnv, (tFilePage **)pQuery->sdata, remain, &numOfInterpo); - qTrace("QInfo: %p fill results completed, final:%d", pQInfo, pQuery->rec.rows); if (pQuery->rec.rows > 0) { - limitResults(pQuery); + limitResults(pRuntimeEnv); } qTrace("QInfo:%p current:%d returned, total:%d", pQInfo, pQuery->rec.rows, pQuery->rec.total); @@ -5134,7 +5174,7 @@ bool validateExprColumnInfo(SQueryTableMsg *pQueryMsg, SSqlFuncMsg *pExprMsg, SC static bool validateQueryMsg(SQueryTableMsg *pQueryMsg) { if (pQueryMsg->intervalTime < 0) { - qError("qmsg:%p illegal value of interval time %" PRId64 "", pQueryMsg, pQueryMsg->intervalTime); + qError("qmsg:%p illegal value of interval time %" PRId64, pQueryMsg, pQueryMsg->intervalTime); return false; } @@ -5342,7 +5382,7 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList, pQueryMsg->fillType = htons(pQueryMsg->fillType); if (pQueryMsg->fillType != TSDB_FILL_NONE) { - pQueryMsg->defaultVal = (uint64_t)(pMsg); + pQueryMsg->fillVal = (uint64_t)(pMsg); int64_t *v = (int64_t *)pMsg; for (int32_t i = 0; i < pQueryMsg->numOfOutput; ++i) { @@ -5610,18 +5650,18 @@ static void doUpdateExprColumnIndex(SQuery *pQuery) { continue; } - SColIndex *pColIndexEx = &pSqlExprMsg->colInfo; - if (!TSDB_COL_IS_TAG(pColIndexEx->flag)) { + SColIndex *pColIndex = &pSqlExprMsg->colInfo; + if (!TSDB_COL_IS_TAG(pColIndex->flag)) { for (int32_t f = 0; f < pQuery->numOfCols; ++f) { - if (pColIndexEx->colId == pQuery->colList[f].colId) { - pColIndexEx->colIndex = f; + if (pColIndex->colId == pQuery->colList[f].colId) { + pColIndex->colIndex = f; break; } } } else { for (int32_t f = 0; f < pQuery->numOfTags; ++f) { - if (pColIndexEx->colId == pQuery->tagColList[f].colId) { - pColIndexEx->colIndex = f; + if (pColIndex->colId == pQuery->tagColList[f].colId) { + pColIndex->colIndex = f; break; } } @@ -5713,13 +5753,13 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList, } if (pQuery->fillType != TSDB_FILL_NONE) { - pQuery->defaultVal = malloc(sizeof(int64_t) * pQuery->numOfOutput); - if (pQuery->defaultVal == NULL) { + pQuery->fillVal = malloc(sizeof(int64_t) * pQuery->numOfOutput); + if (pQuery->fillVal == NULL) { goto _cleanup; } // the first column is the timestamp - memcpy(pQuery->defaultVal, (char *)pQueryMsg->defaultVal, pQuery->numOfOutput * sizeof(int64_t)); + memcpy(pQuery->fillVal, (char *)pQueryMsg->fillVal, pQuery->numOfOutput * sizeof(int64_t)); } // to make sure third party won't overwrite this structure @@ -5745,7 +5785,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList, SGroupItem item = { .id = id }; // NOTE: compare STableIdInfo with STableId // not a problem at present because we only use their 1st int64_t field - STableIdInfo* pTableId = taosArraySearch( pTableIdList, compareTableIdInfo, &id ); + STableIdInfo* pTableId = taosArraySearch( pTableIdList, &id, compareTableIdInfo); if (pTableId != NULL ) { window.skey = pTableId->key; } else { @@ -5776,7 +5816,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList, return pQInfo; _cleanup: - tfree(pQuery->defaultVal); + tfree(pQuery->fillVal); if (pQuery->sdata != NULL) { for (int16_t col = 0; col < pQuery->numOfOutput; ++col) { @@ -5884,8 +5924,8 @@ static void freeQInfo(SQInfo *pQInfo) { tfree(pQuery->pSelectExpr); } - if (pQuery->defaultVal != NULL) { - tfree(pQuery->defaultVal); + if (pQuery->fillVal != NULL) { + tfree(pQuery->fillVal); } // todo refactor, extract method to destroytableDataInfo @@ -5988,8 +6028,13 @@ static int32_t doDumpQueryResult(SQInfo *pQInfo, char *data) { } pQuery->rec.total += pQuery->rec.rows; - qTrace("QInfo:%p current:%d, total:%d", pQInfo, pQuery->rec.rows, pQuery->rec.total); + qTrace("QInfo:%p current numOfRes rows:%d, total:%d", pQInfo, pQuery->rec.rows, pQuery->rec.total); + if (pQuery->limit.limit > 0 && pQuery->limit.limit == pQuery->rec.total) { + qTrace("QInfo:%p results limitation reached, limitation:%"PRId64, pQInfo, pQuery->limit.limit); + setQueryStatus(pQuery, QUERY_OVER); + } + return TSDB_CODE_SUCCESS; // todo if interpolation exists, the result may be dump to client by several rounds @@ -6041,6 +6086,8 @@ int32_t qCreateQueryInfo(void *tsdb, int32_t vgId, SQueryTableMsg *pQueryMsg, qi isSTableQuery = TSDB_QUERY_HAS_TYPE(pQueryMsg->queryType, TSDB_QUERY_TYPE_MULTITABLE_QUERY); STableIdInfo *id = taosArrayGet(pTableIdList, 0); + qTrace("qmsg:%p query table, uid:%"PRId64", tid:%d", pQueryMsg, id->uid, id->tid); + if ((code = tsdbGetOneTableGroup(tsdb, id->uid, &groupInfo)) != TSDB_CODE_SUCCESS) { goto _over; } diff --git a/src/query/src/qast.c b/src/query/src/qast.c index d784fa4102..f35f4d0184 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -773,9 +773,6 @@ static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, // todo refactor: tstr *name = ((STableIndexElem *)pData)->pTable->name; - // char* name = NULL; -// tsdbGetTableName(pQueryInfo->, pTable, &name); - // todo speed up by using hash if (pQueryInfo->colIndex == TSDB_TBNAME_COLUMN_INDEX) { if (pQueryInfo->optr == TSDB_RELATION_IN) { @@ -1051,7 +1048,7 @@ static void* exception_malloc(size_t size) { return p; } -static char* exception_strdup(const char* str) { +static UNUSED_FUNC char* exception_strdup(const char* str) { char* p = strdup(str); if (p == NULL) { THROW(TSDB_CODE_SERV_OUT_OF_MEMORY); @@ -1154,28 +1151,33 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) { tVariant* pVal = exception_calloc(1, sizeof(tVariant)); right->pVal = pVal; pVal->nType = TSDB_DATA_TYPE_ARRAY; - pVal->arr = taosArrayInit(2, sizeof(char*)); + pVal->arr = taosArrayInit(2, POINTER_BYTES); const char* cond = tbnameCond + QUERY_COND_REL_PREFIX_IN_LEN; for (const char *e = cond; *e != 0; e++) { if (*e == TS_PATH_DELIMITER[0]) { cond = e + 1; } else if (*e == ',') { - size_t len = e - cond + 1; - char* p = exception_malloc( len ); - memcpy(p, cond, len); - p[len - 1] = 0; + size_t len = e - cond + VARSTR_HEADER_SIZE; + char* p = exception_malloc(len); + varDataSetLen(p, len - VARSTR_HEADER_SIZE); + memcpy(varDataVal(p), cond, len); cond += len; taosArrayPush(pVal->arr, &p); } } if (*cond != 0) { - char* p = exception_strdup( cond ); - taosArrayPush(pVal->arr, &p); + size_t len = strlen(cond) + VARSTR_HEADER_SIZE; + + char* p = exception_malloc(len); + varDataSetLen(p, len - VARSTR_HEADER_SIZE); + memcpy(varDataVal(p), cond, len); + + taosArrayPush(pVal->arr, &p); } - taosArraySortString(pVal->arr); + taosArraySortString(pVal->arr, taosArrayCompareString); } CLEANUP_EXECUTE_TO(anchor, false); diff --git a/src/query/src/qfill.c b/src/query/src/qfill.c index 4f69c44940..36ffc433ce 100644 --- a/src/query/src/qfill.c +++ b/src/query/src/qfill.c @@ -34,7 +34,7 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, ch * here we revised the start time of day according to the local time zone, * but in case of DST, the start time of one day need to be dynamically decided. * - * TODO dynamically decide the start time of a day + * TODO dynamically decide the start time of a day, move to common module */ // todo refactor to extract function that is available for Linux/Windows/Mac platform @@ -116,10 +116,9 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey) return; } - pFillInfo->rowIdx = 0; + pFillInfo->rowIdx = 0; + pFillInfo->endKey = endKey; pFillInfo->numOfRows = numOfRows; - - pFillInfo->endKey = endKey; } void taosFillCopyInputDataFromFilePage(SFillInfo* pFillInfo, tFilePage** pInput) { @@ -131,6 +130,8 @@ void taosFillCopyInputDataFromFilePage(SFillInfo* pFillInfo, tFilePage** pInput) void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, tFilePage* pInput) { assert(pFillInfo->numOfRows == pInput->num); + int32_t t = 0; + for(int32_t i = 0; i < pFillInfo->numOfCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; @@ -138,7 +139,7 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, tFilePage* pInpu memcpy(pFillInfo->pData[i], s, pInput->num * pCol->col.bytes); if (pCol->flag == TSDB_COL_TAG) { // copy the tag value - memcpy(pFillInfo->pTags[i], pFillInfo->pData[i], pCol->col.bytes); + memcpy(pFillInfo->pTags[t++], pFillInfo->pData[i], pCol->col.bytes); } } } @@ -170,7 +171,7 @@ static int32_t taosGetTotalNumOfFilledRes(SFillInfo* pFillInfo, const TSKEY* tsA } } -int32_t taosGetNumOfResultWithFill(SFillInfo* pFillInfo, int32_t numOfRows, int64_t ekey, int32_t maxNumOfRows) { +int64_t taosGetNumOfResultWithFill(SFillInfo* pFillInfo, int32_t numOfRows, int64_t ekey, int32_t maxNumOfRows) { int32_t numOfRes = taosGetTotalNumOfFilledRes(pFillInfo, (int64_t*) pFillInfo->pData[0], numOfRows, pFillInfo->slidingTime, ekey); return (numOfRes > maxNumOfRows) ? maxNumOfRows : numOfRes; @@ -193,7 +194,7 @@ static double linearInterpolationImpl(double v1, double v2, double k1, double k2 int taosDoLinearInterpolation(int32_t type, SPoint* point1, SPoint* point2, SPoint* point) { switch (type) { case TSDB_DATA_TYPE_INT: { - *(int32_t*)point->val = linearInterpolationImpl(*(int32_t*)point1->val, *(int32_t*)point2->val, point1->key, + *(int32_t*)point->val = (int32_t) linearInterpolationImpl(*(int32_t*)point1->val, *(int32_t*)point2->val, point1->key, point2->key, point->key); break; } @@ -209,17 +210,17 @@ int taosDoLinearInterpolation(int32_t type, SPoint* point1, SPoint* point2, SPoi }; case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_BIGINT: { - *(int64_t*)point->val = linearInterpolationImpl(*(int64_t*)point1->val, *(int64_t*)point2->val, point1->key, + *(int64_t*)point->val = (int64_t) linearInterpolationImpl(*(int64_t*)point1->val, *(int64_t*)point2->val, point1->key, point2->key, point->key); break; }; case TSDB_DATA_TYPE_SMALLINT: { - *(int16_t*)point->val = linearInterpolationImpl(*(int16_t*)point1->val, *(int16_t*)point2->val, point1->key, + *(int16_t*)point->val = (int16_t) linearInterpolationImpl(*(int16_t*)point1->val, *(int16_t*)point2->val, point1->key, point2->key, point->key); break; }; case TSDB_DATA_TYPE_TINYINT: { - *(int8_t*)point->val = + *(int8_t*) point->val = (int8_t) linearInterpolationImpl(*(int8_t*)point1->val, *(int8_t*)point2->val, point1->key, point2->key, point->key); break; }; @@ -243,8 +244,8 @@ static void setTagsValue(SFillInfo* pColInfo, tFilePage** data, char** pTags, in static void doInterpoResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* num, char** srcData, int64_t ts, char** pTags, bool outOfBound) { - char** prevValues = &pFillInfo->prevValues; - char** nextValues = &pFillInfo->nextValues; + char* prevValues = pFillInfo->prevValues; + char* nextValues = pFillInfo->nextValues; SPoint point1, point2, point; @@ -257,16 +258,21 @@ static void doInterpoResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* // set the other values if (pFillInfo->fillType == TSDB_FILL_PREV) { - char* pInterpolationData = FILL_IS_ASC_FILL(pFillInfo) ? *prevValues : *nextValues; - if (pInterpolationData != NULL) { + char* p = FILL_IS_ASC_FILL(pFillInfo) ? prevValues : nextValues; + + if (p != NULL) { for (int32_t i = 1; i < numOfValCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; char* val1 = elePtrAt(data[i]->data, pCol->col.bytes, *num); - if (isNull(pInterpolationData + pCol->col.offset, pCol->col.type)) { - setNull(val1, pCol->col.type, pCol->col.bytes); + if (isNull(p + pCol->col.offset, pCol->col.type)) { + if (pCol->col.type == TSDB_DATA_TYPE_BINARY || pCol->col.type == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(val1, pCol->col.type); + } else { + setNull(val1, pCol->col.type, pCol->col.bytes); + } } else { - assignVal(val1, pInterpolationData + pCol->col.offset, pCol->col.bytes, pCol->col.type); + assignVal(val1, p + pCol->col.offset, pCol->col.bytes, pCol->col.type); } } } else { // no prev value yet, set the value for NULL @@ -274,14 +280,18 @@ static void doInterpoResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* SFillColInfo* pCol = &pFillInfo->pFillCol[i]; char* val1 = elePtrAt(data[i]->data, pCol->col.bytes, *num); - setNull(val1, pCol->col.type, pCol->col.bytes); + if (pCol->col.type == TSDB_DATA_TYPE_BINARY||pCol->col.type == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(val1, pCol->col.type); + } else { + setNull(val1, pCol->col.type, pCol->col.bytes); + } } } setTagsValue(pFillInfo, data, pTags, numOfValCols, *num); } else if (pFillInfo->fillType == TSDB_FILL_LINEAR) { // TODO : linear interpolation supports NULL value - if (*prevValues != NULL && !outOfBound) { + if (prevValues != NULL && !outOfBound) { for (int32_t i = 1; i < numOfValCols; ++i) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; @@ -289,14 +299,17 @@ static void doInterpoResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* int16_t bytes = pCol->col.bytes; char *val1 = elePtrAt(data[i]->data, pCol->col.bytes, *num); - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BOOL) { + if (type == TSDB_DATA_TYPE_BINARY|| type == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(val1, pCol->col.type); + continue; + } else if (type == TSDB_DATA_TYPE_BOOL) { setNull(val1, pCol->col.type, bytes); continue; } - point1 = (SPoint){.key = *(TSKEY*)(*prevValues), .val = *prevValues + pCol->col.offset}; + point1 = (SPoint){.key = *(TSKEY*)(prevValues), .val = prevValues + pCol->col.offset}; point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->rowIdx * bytes}; - point = (SPoint){.key = pFillInfo->start, .val = val1}; + point = (SPoint){.key = pFillInfo->start, .val = val1}; taosDoLinearInterpolation(type, &point1, &point2, &point); } @@ -307,7 +320,12 @@ static void doInterpoResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* SFillColInfo* pCol = &pFillInfo->pFillCol[i]; char* val1 = elePtrAt(data[i]->data, pCol->col.bytes, *num); - setNull(val1, pCol->col.type, pCol->col.bytes); + + if (pCol->col.type == TSDB_DATA_TYPE_BINARY || pCol->col.type == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(val1, pCol->col.type); + } else { + setNull(val1, pCol->col.type, pCol->col.bytes); + } } setTagsValue(pFillInfo, data, pTags, numOfValCols, *num); @@ -318,7 +336,7 @@ static void doInterpoResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t* SFillColInfo* pCol = &pFillInfo->pFillCol[i]; char* val1 = elePtrAt(data[i]->data, pCol->col.bytes, *num); - assignVal(val1, (char*)&pCol->defaultVal.i, pCol->col.bytes, pCol->col.type); + assignVal(val1, (char*)&pCol->fillVal.i, pCol->col.bytes, pCol->col.type); } setTagsValue(pFillInfo, data, pTags, numOfValCols, *num); @@ -338,11 +356,16 @@ static void initBeforeAfterDataBuf(SFillInfo* pFillInfo, char** nextValues) { *nextValues = calloc(1, pFillInfo->rowSize); for (int i = 1; i < pFillInfo->numOfCols; i++) { SFillColInfo* pCol = &pFillInfo->pFillCol[i]; - setNull(*nextValues + pCol->col.offset, pCol->col.type, pCol->col.bytes); + + if (pCol->col.type == TSDB_DATA_TYPE_BINARY||pCol->col.type == TSDB_DATA_TYPE_NCHAR) { + setVardataNull(*nextValues + pCol->col.offset, pCol->col.type); + } else { + setNull(*nextValues + pCol->col.offset, pCol->col.type, pCol->col.bytes); + } } } -int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numOfRows, int32_t outputRows, char** srcData) { +int32_t generateDataBlockImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t numOfRows, int32_t outputRows, char** srcData) { int32_t num = 0; pFillInfo->numOfCurrent = 0; @@ -356,8 +379,8 @@ int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numO if (numOfRows == 0) { /* - * we need to rebuild whole result set - * NOTE:we need to keep the last saved data, to generated the filled data + * These data are generated according to fill strategy, since the current timestamp is out of time window of + * real result set. Note that we need to keep the direct previous result rows, to generated the filled data. */ while (num < outputRows) { doInterpoResultImpl(pFillInfo, data, &num, srcData, pFillInfo->start, pTags, true); @@ -387,7 +410,7 @@ int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numO while (((pFillInfo->start < ts && FILL_IS_ASC_FILL(pFillInfo)) || (pFillInfo->start > ts && !FILL_IS_ASC_FILL(pFillInfo))) && num < outputRows) { - doInterpoResultImpl(pFillInfo, data, &num, srcData, pFillInfo->start, pTags, false); + doInterpoResultImpl(pFillInfo, data, &num, srcData, ts, pTags, false); } /* output buffer is full, abort */ @@ -420,7 +443,7 @@ int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numO assignVal(val1, src, pCol->col.bytes, pCol->col.type); memcpy(*prevValues + pCol->col.offset, src, pCol->col.bytes); } else { - assignVal(val1, (char*) &pCol->defaultVal.i, pCol->col.bytes, pCol->col.type); + assignVal(val1, (char*) &pCol->fillVal.i, pCol->col.bytes, pCol->col.type); } } } @@ -450,21 +473,12 @@ int32_t taosDoInterpoResult(SFillInfo* pFillInfo, tFilePage** data, int32_t numO } } -void taosGenerateDataBlock(SFillInfo* pFillInfo, tFilePage** output, int64_t* outputRows, int32_t capacity) { +int64_t taosGenerateDataBlock(SFillInfo* pFillInfo, tFilePage** output, int32_t capacity) { int32_t remain = taosNumOfRemainRows(pFillInfo); // todo use iterator? - -// TSKEY ekey = taosGetRevisedEndKey(pQuery->window.ekey, pQuery->order.order, pQuery->slidingTime, -// pQuery->slidingTimeUnit, pQuery->precision); -// if (QUERY_IS_ASC_QUERY(pQuery)) { -// assert(ekey >= pQuery->window.ekey); -// } else { -// assert(ekey <= pQuery->window.ekey); -// } - - int32_t rows = taosGetNumOfResultWithFill(pFillInfo, remain, pFillInfo->endKey, capacity); + int32_t rows = taosGetNumOfResultWithFill(pFillInfo, remain, pFillInfo->endKey, capacity); - int32_t numOfRes = taosDoInterpoResult(pFillInfo, output, remain, rows, pFillInfo->pData); - *outputRows = rows; - + int32_t numOfRes = generateDataBlockImpl(pFillInfo, output, remain, rows, pFillInfo->pData); assert(numOfRes == rows); + + return numOfRes; } diff --git a/src/query/src/tvariant.c b/src/query/src/tvariant.c index 6f8d579936..c89e9dc5f2 100644 --- a/src/query/src/tvariant.c +++ b/src/query/src/tvariant.c @@ -101,11 +101,12 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32 break; } case TSDB_DATA_TYPE_NCHAR: { // here we get the nchar length from raw binary bits length - pVar->nLen = len / TSDB_NCHAR_SIZE; - pVar->wpz = calloc(1, (pVar->nLen + 1) * TSDB_NCHAR_SIZE); + int32_t lenInwchar = len / TSDB_NCHAR_SIZE; + pVar->wpz = calloc(1, (lenInwchar + 1) * TSDB_NCHAR_SIZE); - wcsncpy(pVar->wpz, (wchar_t *)pz, pVar->nLen); - pVar->wpz[pVar->nLen] = 0; + wcsncpy(pVar->wpz, (wchar_t *)pz, lenInwchar); + pVar->wpz[lenInwchar] = 0; + pVar->nLen = len; break; } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 0410281f0d..a8bb2fd65b 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -867,9 +867,8 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) { // underlying UDP layer does not know it is server or client pRecv->connType = pRecv->connType | pRpc->connType; - if (pRecv->ip==0 && pConn) { - rpcProcessBrokenLink(pConn); - rpcFreeMsg(pRecv->msg); + if (pRecv->ip == 0 && pConn) { + rpcProcessBrokenLink(pConn); return NULL; } diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 739b86d7a5..a7312fadf1 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -147,8 +147,10 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) { struct epoll_event event = { .events = EPOLLIN }; eventfd_t fd = eventfd(1, 0); if (fd == -1) { + tError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", pThreadObj->label, strerror(errno)); pthread_cancel(pThreadObj->thread); } else if (epoll_ctl(pThreadObj->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { + tError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", pThreadObj->label, strerror(errno)); pthread_cancel(pThreadObj->thread); } @@ -213,7 +215,6 @@ static void* taosAcceptTcpConnection(void *arg) { continue; } - tTrace("%s TCP connection from ip:%s:%hu", pServerObj->label, inet_ntoa(caddr.sin_addr), caddr.sin_port); taosKeepTcpAlive(connFd); // pick up the thread to handle this connection @@ -227,7 +228,8 @@ static void* taosAcceptTcpConnection(void *arg) { inet_ntoa(caddr.sin_addr), pFdObj->port, pFdObj, pThreadObj->numOfFds); } else { close(connFd); - tError("%s failed to malloc FdObj(%s)", pServerObj->label, strerror(errno)); + tError("%s failed to malloc FdObj(%s) for connection from:%s:%hu", pServerObj->label, strerror(errno), + inet_ntoa(caddr.sin_addr), caddr.sin_port); } // pick up next thread for next connection @@ -339,7 +341,9 @@ static void taosReportBrokenLink(SFdObj *pFdObj) { recvInfo.chandle = NULL; recvInfo.connType = RPC_CONN_TCP; (*(pThreadObj->processData))(&recvInfo); - } + } else { + taosFreeFdObj(pFdObj); + } } #define maxEvents 10 @@ -350,7 +354,7 @@ static void *taosProcessTcpData(void *param) { struct epoll_event events[maxEvents]; SRecvInfo recvInfo; SRpcHead rpcHead; - + while (1) { int fdNum = epoll_wait(pThreadObj->pollFd, events, maxEvents, -1); if (pThreadObj->stop) { @@ -464,7 +468,7 @@ static void taosFreeFdObj(SFdObj *pFdObj) { pFdObj->signature = NULL; epoll_ctl(pThreadObj->pollFd, EPOLL_CTL_DEL, pFdObj->fd, NULL); - close(pFdObj->fd); + taosCloseSocket(pFdObj->fd); pThreadObj->numOfFds--; diff --git a/src/rpc/test/rserver.c b/src/rpc/test/rserver.c index 958d099027..508f04fbc3 100644 --- a/src/rpc/test/rserver.c +++ b/src/rpc/test/rserver.c @@ -127,6 +127,8 @@ int main(int argc, char *argv[]) { SRpcInit rpcInit; char dataName[20] = "server.data"; + taosBlockSIGPIPE(); + memset(&rpcInit, 0, sizeof(rpcInit)); rpcInit.localPort = 7000; rpcInit.label = "SER"; diff --git a/src/tsdb/inc/tsdbMain.h b/src/tsdb/inc/tsdbMain.h index 8a0a9e1208..20a704db49 100644 --- a/src/tsdb/inc/tsdbMain.h +++ b/src/tsdb/inc/tsdbMain.h @@ -74,7 +74,7 @@ void tsdbCloseMetaFile(SMetaFile *mfh); typedef struct { TSKEY keyFirst; TSKEY keyLast; - int32_t numOfPoints; + int32_t numOfRows; void * pData; } SMemTable; @@ -173,7 +173,7 @@ typedef struct { typedef struct { TSKEY keyFirst; TSKEY keyLast; - int64_t numOfPoints; + int64_t numOfRows; SList * list; } SCacheMem; @@ -294,7 +294,7 @@ typedef struct { int64_t last : 1; // If the block in data file or last file int64_t offset : 63; // Offset of data block or sub-block index depending on numOfSubBlocks int32_t algorithm : 8; // Compression algorithm - int32_t numOfPoints : 24; // Number of total points + int32_t numOfRows : 24; // Number of total points int32_t sversion; // Schema version int32_t len; // Data block length or nothing int16_t numOfSubBlocks; // Number of sub-blocks; @@ -495,11 +495,12 @@ void tsdbSetHelperTable(SRWHelper *pHelper, STable *pTable, STsdbRepo *pRepo); int tsdbCloseHelperFile(SRWHelper *pHelper, bool hasError); // --------- For read operations -int tsdbLoadCompIdx(SRWHelper *pHelper, void *target); -int tsdbLoadCompInfo(SRWHelper *pHelper, void *target); -int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target); -int tsdbLoadBlockDataCols(SRWHelper *pHelper, SDataCols *pDataCols, int blkIdx, int16_t *colIds, int numOfColIds); -int tsdbLoadBlockData(SRWHelper *pHelper, SCompBlock *pCompBlock, SDataCols *target); +int tsdbLoadCompIdx(SRWHelper *pHelper, void *target); +int tsdbLoadCompInfo(SRWHelper *pHelper, void *target); +int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target); +int tsdbLoadBlockDataCols(SRWHelper *pHelper, SDataCols *pDataCols, int blkIdx, int16_t *colIds, int numOfColIds); +int tsdbLoadBlockData(SRWHelper *pHelper, SCompBlock *pCompBlock, SDataCols *target); +void tsdbGetDataStatis(SRWHelper *pHelper, SDataStatis *pStatis, int numOfCols); // --------- For write operations int tsdbWriteDataBlock(SRWHelper *pHelper, SDataCols *pDataCols); diff --git a/src/tsdb/src/tsdbCache.c b/src/tsdb/src/tsdbCache.c index 2761ed5e8e..edc8472b34 100644 --- a/src/tsdb/src/tsdbCache.c +++ b/src/tsdb/src/tsdbCache.c @@ -82,7 +82,7 @@ void *tsdbAllocFromCache(STsdbCache *pCache, int bytes, TSKEY key) { memset(ptr, 0, bytes); if (key < pCache->mem->keyFirst) pCache->mem->keyFirst = key; if (key > pCache->mem->keyLast) pCache->mem->keyLast = key; - pCache->mem->numOfPoints++; + pCache->mem->numOfRows++; return ptr; } @@ -127,7 +127,7 @@ static int tsdbAllocBlockFromPool(STsdbCache *pCache) { if (pCache->mem == NULL) return -1; pCache->mem->keyFirst = INT64_MAX; pCache->mem->keyLast = 0; - pCache->mem->numOfPoints = 0; + pCache->mem->numOfRows = 0; pCache->mem->list = tdListNew(sizeof(STsdbCacheBlock *)); } @@ -162,6 +162,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) { pCache->totalCacheBlocks = totalBlocks; tsdbAdjustCacheBlocks(pCache); } + pRepo->config.totalBlocks = totalBlocks; tsdbUnLockRepo((TsdbRepoT *)pRepo); tsdbTrace("vgId:%d, tsdb total cache blocks changed from %d to %d", pRepo->config.tsdbId, oldNumOfBlocks, totalBlocks); diff --git a/src/tsdb/src/tsdbFile.c b/src/tsdb/src/tsdbFile.c index dcea2737ff..bd5c20bd7a 100644 --- a/src/tsdb/src/tsdbFile.c +++ b/src/tsdb/src/tsdbFile.c @@ -233,10 +233,10 @@ SFileGroup *tsdbGetFileGroupNext(SFileGroupIter *pIter) { // SCompBlock *pBlock = pStartBlock; // for (int i = 0; i < numOfBlocks; i++) { // if (tsdbLoadCompCols(pFile, pBlock, (void *)pCompData) < 0) return -1; -// pCols->numOfPoints += (pCompData->cols[0].len / 8); +// pCols->numOfRows += (pCompData->cols[0].len / 8); // for (int iCol = 0; iCol < pBlock->numOfCols; iCol++) { // SCompCol *pCompCol = &(pCompData->cols[iCol]); -// // pCols->numOfPoints += pBlock->numOfPoints; +// // pCols->numOfRows += pBlock->numOfRows; // int k = 0; // for (; k < pCols->numOfCols; k++) { // if (pCompCol->colId == pCols->cols[k].colId) break; diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index cac5279b76..55342ffd38 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -37,7 +37,8 @@ static TSKEY tsdbNextIterKey(SSkipListIterator *pIter); static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minKey, TSKEY maxKey); static void tsdbAlterCompression(STsdbRepo *pRepo, int8_t compression); static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep); -static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables); +static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables); +static int32_t tsdbSaveConfig(STsdbRepo *pRepo); #define TSDB_GET_TABLE_BY_ID(pRepo, sid) (((STSDBRepo *)pRepo)->pTableList)[sid] #define TSDB_GET_TABLE_BY_NAME(pRepo, name) @@ -319,10 +320,25 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg) { ASSERT(pRCfg->maxRowsPerFileBlock == pCfg->maxRowsPerFileBlock); ASSERT(pRCfg->precision == pCfg->precision); - if (pRCfg->compression != pCfg->compression) tsdbAlterCompression(pRepo, pCfg->compression); - if (pRCfg->keep != pCfg->keep) tsdbAlterKeep(pRepo, pCfg->keep); - if (pRCfg->totalBlocks != pCfg->totalBlocks) tsdbAlterCacheTotalBlocks(pRepo, pCfg->totalBlocks); - if (pRCfg->maxTables != pCfg->maxTables) tsdbAlterMaxTables(pRepo, pCfg->maxTables); + bool configChanged = false; + if (pRCfg->compression != pCfg->compression) { + configChanged = true; + tsdbAlterCompression(pRepo, pCfg->compression); + } + if (pRCfg->keep != pCfg->keep) { + configChanged = true; + tsdbAlterKeep(pRepo, pCfg->keep); + } + if (pRCfg->totalBlocks != pCfg->totalBlocks) { + configChanged = true; + tsdbAlterCacheTotalBlocks(pRepo, pCfg->totalBlocks); + } + if (pRCfg->maxTables != pCfg->maxTables) { + configChanged = true; + tsdbAlterMaxTables(pRepo, pCfg->maxTables); + } + + if (configChanged) tsdbSaveConfig(pRepo); return TSDB_CODE_SUCCESS; } @@ -814,7 +830,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable tSkipListNewNodeInfo(pTable->mem->pData, &level, &headSize); TSKEY key = dataRowKey(row); - // printf("insert:%lld, size:%d\n", key, pTable->mem->numOfPoints); + // printf("insert:%lld, size:%d\n", key, pTable->mem->numOfRows); // Copy row into the memory SSkipListNode *pNode = tsdbAllocFromCache(pRepo->tsdbCache, headSize + dataRowLen(row), key); @@ -838,7 +854,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable if (key < pTable->mem->keyFirst) pTable->mem->keyFirst = key; if (key > pTable->lastKey) pTable->lastKey = key; - pTable->mem->numOfPoints = tSkipListGetSize(pTable->mem->pData); + pTable->mem->numOfRows = tSkipListGetSize(pTable->mem->pData); tsdbTrace("vgId:%d, tid:%d, uid:%" PRId64 ", table:%s a row is inserted to table! key:%" PRId64, pRepo->config.tsdbId, pTable->tableId.tid, pTable->tableId.uid, varDataVal(pTable->name), dataRowKey(row)); @@ -1047,7 +1063,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters while (true) { int rowsRead = tsdbReadRowsFromCache(pIter, maxKey, maxRowsToRead, pDataCols); assert(rowsRead >= 0); - if (pDataCols->numOfPoints == 0) break; + if (pDataCols->numOfRows == 0) break; nLoop++; ASSERT(dataColsKeyFirst(pDataCols) >= minKey && dataColsKeyFirst(pDataCols) <= maxKey); @@ -1056,13 +1072,13 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters int rowsWritten = tsdbWriteDataBlock(pHelper, pDataCols); ASSERT(rowsWritten != 0); if (rowsWritten < 0) goto _err; - ASSERT(rowsWritten <= pDataCols->numOfPoints); + ASSERT(rowsWritten <= pDataCols->numOfRows); tdPopDataColsPoints(pDataCols, rowsWritten); - maxRowsToRead = pCfg->maxRowsPerFileBlock * 4 / 5 - pDataCols->numOfPoints; + maxRowsToRead = pCfg->maxRowsPerFileBlock * 4 / 5 - pDataCols->numOfRows; } - ASSERT(pDataCols->numOfPoints == 0); + ASSERT(pDataCols->numOfRows == 0); // Move the last block to the new .l file if neccessary if (tsdbMoveLastBlockIfNeccessary(pHelper) < 0) { @@ -1134,8 +1150,10 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { int maxFiles = keep / pCfg->maxTables + 3; if (pRepo->config.keep > keep) { + pRepo->config.keep = keep; pRepo->tsdbFileH->maxFGroups = maxFiles; } else { + pRepo->config.keep = keep; pRepo->tsdbFileH->fGroup = realloc(pRepo->tsdbFileH->fGroup, sizeof(SFileGroup)); if (pRepo->tsdbFileH->fGroup == NULL) { // TODO: deal with the error @@ -1155,6 +1173,8 @@ static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) { pMeta->maxTables = maxTables; pMeta->tables = realloc(pMeta->tables, maxTables * sizeof(STable *)); + memset(&pMeta->tables[oldMaxTables], 0, sizeof(STable *) * (maxTables-oldMaxTables)); + pRepo->config.maxTables = maxTables; tsdbTrace("vgId:%d, tsdb maxTables is changed from %d to %d!", pRepo->config.tsdbId, oldMaxTables, maxTables); } @@ -1176,7 +1196,7 @@ uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t * // Map index to the file name int fid = (*index) / 3; - if (fid > pFileH->numOfFGroups) { + if (fid >= pFileH->numOfFGroups) { // return meta data file if ((*index) % 3 > 0) { // it is finished tfree(spath); diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index dc21d8ab24..37a10bb069 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -129,7 +129,7 @@ int tsdbRestoreTable(void *pHandle, void *cont, int contLen) { if (pTable->type == TSDB_SUPER_TABLE) { STColumn* pColSchema = schemaColAt(pTable->tagSchema, 0); pTable->pIndex = tSkipListCreate(TSDB_SUPER_TABLE_SL_LEVEL, pColSchema->type, pColSchema->bytes, - 1, 0, 0, getTagIndexKey); + 1, 0, 1, getTagIndexKey); } tsdbAddTableToMeta(pMeta, pTable, false); @@ -292,6 +292,13 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { if (tsdbCheckTableCfg(pCfg) < 0) return -1; + STable *pTable = tsdbGetTableByUid(pMeta, pCfg->tableId.uid); + if (pTable != NULL) { + tsdbError("vgId:%d table %s already exists, tid %d uid %" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name), + pTable->tableId.tid, pTable->tableId.uid); + return TSDB_CODE_TABLE_ALREADY_EXIST; + } + STable *super = NULL; int newSuper = 0; @@ -319,7 +326,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { // index the first tag column STColumn* pColSchema = schemaColAt(super->tagSchema, 0); super->pIndex = tSkipListCreate(TSDB_SUPER_TABLE_SL_LEVEL, pColSchema->type, pColSchema->bytes, - 1, 0, 0, getTagIndexKey); // Allow duplicate key, no lock + 1, 0, 1, getTagIndexKey); // Allow duplicate key, no lock if (super->pIndex == NULL) { tdFreeSchema(super->schema); @@ -443,6 +450,7 @@ static int tsdbFreeTable(STable *pTable) { // Free content if (TSDB_TABLE_IS_SUPER_TABLE(pTable)) { + tdFreeSchema(pTable->tagSchema); tSkipListDestroy(pTable->pIndex); } diff --git a/src/tsdb/src/tsdbRWHelper.c b/src/tsdb/src/tsdbRWHelper.c index c5ef00c233..eebe0b6b46 100644 --- a/src/tsdb/src/tsdbRWHelper.c +++ b/src/tsdb/src/tsdbRWHelper.c @@ -307,7 +307,7 @@ void tsdbSetHelperTable(SRWHelper *pHelper, STable *pTable, STsdbRepo *pRepo) { */ int tsdbWriteDataBlock(SRWHelper *pHelper, SDataCols *pDataCols) { ASSERT(TSDB_HELPER_TYPE(pHelper) == TSDB_WRITE_HELPER); - ASSERT(pDataCols->numOfPoints > 0); + ASSERT(pDataCols->numOfRows > 0); SCompBlock compBlock; int rowsToWrite = 0; @@ -322,7 +322,7 @@ int tsdbWriteDataBlock(SRWHelper *pHelper, SDataCols *pDataCols) { if (pIdx->offset == 0 || (!pIdx->hasLast && keyFirst > pIdx->maxKey)) { // Just append as a super block ASSERT(pHelper->hasOldLastBlock == false); - rowsToWrite = pDataCols->numOfPoints; + rowsToWrite = pDataCols->numOfRows; SFile *pWFile = NULL; bool isLast = false; @@ -380,10 +380,10 @@ int tsdbMoveLastBlockIfNeccessary(SRWHelper *pHelper) { if (pCompBlock->numOfSubBlocks > 1) { if (tsdbLoadBlockData(pHelper, blockAtIdx(pHelper, pIdx->numOfBlocks - 1), NULL) < 0) return -1; - ASSERT(pHelper->pDataCols[0]->numOfPoints > 0 && - pHelper->pDataCols[0]->numOfPoints < pHelper->config.minRowsPerFileBlock); + ASSERT(pHelper->pDataCols[0]->numOfRows > 0 && + pHelper->pDataCols[0]->numOfRows < pHelper->config.minRowsPerFileBlock); if (tsdbWriteBlockToFile(pHelper, &(pHelper->files.nLastF), pHelper->pDataCols[0], - pHelper->pDataCols[0]->numOfPoints, &compBlock, true, true) < 0) + pHelper->pDataCols[0]->numOfRows, &compBlock, true, true) < 0) return -1; if (tsdbUpdateSuperBlock(pHelper, &compBlock, pIdx->numOfBlocks - 1) < 0) return -1; @@ -409,7 +409,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) { if (pIdx->offset > 0) { pIdx->offset = lseek(pHelper->files.nHeadF.fd, 0, SEEK_END); if (pIdx->offset < 0) return -1; - ASSERT(pIdx->offset >= tsizeof(pHelper->pCompIdx)); + ASSERT(pIdx->offset >= TSDB_FILE_HEAD_SIZE); if (tsendfile(pHelper->files.nHeadF.fd, pHelper->files.headF.fd, NULL, pIdx->len) < pIdx->len) return -1; } @@ -489,6 +489,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) { } ASSERT(((char *)ptr - (char *)pHelper->pBuffer) == (pFile->info.len - sizeof(TSCKSUM))); + if (lseek(fd, TSDB_FILE_HEAD_SIZE, SEEK_SET) < 0) return -1; } } @@ -542,6 +543,34 @@ int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target) { return 0; } +void tsdbGetDataStatis(SRWHelper *pHelper, SDataStatis *pStatis, int numOfCols) { + SCompData *pCompData = pHelper->pCompData; + + for (int i = 0, j = 0; i < numOfCols;) { + if (j >= pCompData->numOfCols) { + pStatis[i].numOfNull = -1; + i++; + continue; + } + + if (pStatis[i].colId == pCompData->cols[j].colId) { + pStatis[i].sum = pCompData->cols[j].sum; + pStatis[i].max = pCompData->cols[j].max; + pStatis[i].min = pCompData->cols[j].min; + pStatis[i].maxIndex = pCompData->cols[j].maxIndex; + pStatis[i].minIndex = pCompData->cols[j].minIndex; + pStatis[i].numOfNull = pCompData->cols[j].numOfNull; + i++; + j++; + } else if (pStatis[i].colId < pCompData->cols[j].colId) { + pStatis[i].numOfNull = -1; + i++; + } else { + j++; + } + } +} + static int comparColIdCompCol(const void *arg1, const void *arg2) { return (*(int16_t *)arg1) - ((SCompCol *)arg2)->colId; } @@ -596,13 +625,13 @@ int tsdbLoadBlockDataCols(SRWHelper *pHelper, SDataCols *pDataCols, int blkIdx, for (int i = 1; i < numOfSubBlocks; i++) { pStartBlock++; if (tsdbLoadSingleBlockDataCols(pHelper, pStartBlock, colIds, numOfColIds, pHelper->pDataCols[1]) < 0) return -1; - tdMergeDataCols(pDataCols, pHelper->pDataCols[1], pHelper->pDataCols[1]->numOfPoints); + tdMergeDataCols(pDataCols, pHelper->pDataCols[1], pHelper->pDataCols[1]->numOfRows); } return 0; } -static int tsdbCheckAndDecodeColumnData(SDataCol *pDataCol, char *content, int32_t len, int8_t comp, int numOfPoints, +static int tsdbCheckAndDecodeColumnData(SDataCol *pDataCol, char *content, int32_t len, int8_t comp, int numOfRows, int maxPoints, char *buffer, int bufferSize) { // Verify by checksum if (!taosCheckChecksumWhole((uint8_t *)content, len)) return -1; @@ -611,16 +640,16 @@ static int tsdbCheckAndDecodeColumnData(SDataCol *pDataCol, char *content, int32 if (comp) { // // Need to decompress pDataCol->len = (*(tDataTypeDesc[pDataCol->type].decompFunc))( - content, len - sizeof(TSCKSUM), numOfPoints, pDataCol->pData, pDataCol->spaceSize, comp, buffer, bufferSize); + content, len - sizeof(TSCKSUM), numOfRows, pDataCol->pData, pDataCol->spaceSize, comp, buffer, bufferSize); if (pDataCol->type == TSDB_DATA_TYPE_BINARY || pDataCol->type == TSDB_DATA_TYPE_NCHAR) { - dataColSetOffset(pDataCol, numOfPoints); + dataColSetOffset(pDataCol, numOfRows); } } else { // No need to decompress, just memcpy it pDataCol->len = len - sizeof(TSCKSUM); memcpy(pDataCol->pData, content, pDataCol->len); if (pDataCol->type == TSDB_DATA_TYPE_BINARY || pDataCol->type == TSDB_DATA_TYPE_NCHAR) { - dataColSetOffset(pDataCol, numOfPoints); + dataColSetOffset(pDataCol, numOfRows); } } return 0; @@ -644,7 +673,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa int32_t tsize = sizeof(SCompData) + sizeof(SCompCol) * pCompBlock->numOfCols + sizeof(TSCKSUM); if (!taosCheckChecksumWhole((uint8_t *)pCompData, tsize)) goto _err; - pDataCols->numOfPoints = pCompBlock->numOfPoints; + pDataCols->numOfRows = pCompBlock->numOfRows; // Recover the data int ccol = 0; @@ -653,7 +682,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa SDataCol *pDataCol = &(pDataCols->cols[dcol]); if (ccol >= pCompData->numOfCols) { // Set current column as NULL and forward - dataColSetNEleNull(pDataCol, pCompBlock->numOfPoints, pDataCols->maxPoints); + dataColSetNEleNull(pDataCol, pCompBlock->numOfRows, pDataCols->maxPoints); dcol++; continue; } @@ -662,15 +691,15 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa if (pCompCol->colId == pDataCol->colId) { if (pCompBlock->algorithm == TWO_STAGE_COMP) { - int zsize = pDataCol->bytes * pCompBlock->numOfPoints + COMP_OVERFLOW_BYTES; + int zsize = pDataCol->bytes * pCompBlock->numOfRows + COMP_OVERFLOW_BYTES; if (pCompCol->type == TSDB_DATA_TYPE_BINARY || pCompCol->type == TSDB_DATA_TYPE_NCHAR) { - zsize += (sizeof(VarDataLenT) * pCompBlock->numOfPoints); + zsize += (sizeof(VarDataLenT) * pCompBlock->numOfRows); } pHelper->compBuffer = trealloc(pHelper->compBuffer, zsize); if (pHelper->compBuffer == NULL) goto _err; } if (tsdbCheckAndDecodeColumnData(pDataCol, (char *)pCompData + tsize + pCompCol->offset, pCompCol->len, - pCompBlock->algorithm, pCompBlock->numOfPoints, pDataCols->maxPoints, + pCompBlock->algorithm, pCompBlock->numOfRows, pDataCols->maxPoints, pHelper->compBuffer, tsizeof(pHelper->compBuffer)) < 0) goto _err; dcol++; @@ -679,7 +708,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa ccol++; } else { // Set current column as NULL and forward - dataColSetNEleNull(pDataCol, pCompBlock->numOfPoints, pDataCols->maxPoints); + dataColSetNEleNull(pDataCol, pCompBlock->numOfRows, pDataCols->maxPoints); dcol++; } } @@ -703,7 +732,7 @@ int tsdbLoadBlockData(SRWHelper *pHelper, SCompBlock *pCompBlock, SDataCols *tar tdResetDataCols(pHelper->pDataCols[1]); pCompBlock++; if (tsdbLoadBlockDataImpl(pHelper, pCompBlock, pHelper->pDataCols[1]) < 0) goto _err; - if (tdMergeDataCols(pHelper->pDataCols[0], pHelper->pDataCols[1], pHelper->pDataCols[1]->numOfPoints) < 0) goto _err; + if (tdMergeDataCols(pHelper->pDataCols[0], pHelper->pDataCols[1], pHelper->pDataCols[1]->numOfRows) < 0) goto _err; } // if (target) TODO @@ -724,7 +753,7 @@ static bool tsdbShouldCreateNewLast(SRWHelper *pHelper) { static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDataCols, int rowsToWrite, SCompBlock *pCompBlock, bool isLast, bool isSuperBlock) { - ASSERT(rowsToWrite > 0 && rowsToWrite <= pDataCols->numOfPoints && + ASSERT(rowsToWrite > 0 && rowsToWrite <= pDataCols->numOfRows && rowsToWrite <= pHelper->config.maxRowsPerFileBlock); SCompData *pCompData = (SCompData *)(pHelper->pBuffer); @@ -747,7 +776,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa pCompCol->colId = pDataCol->colId; pCompCol->type = pDataCol->type; - if (tDataTypeDesc[pDataCol->type].getStatisFunc) { + if (tDataTypeDesc[pDataCol->type].getStatisFunc && ncol != 0) { (*tDataTypeDesc[pDataCol->type].getStatisFunc)( (TSKEY *)(pDataCols->cols[0].pData), pDataCol->pData, rowsToWrite, &(pCompCol->min), &(pCompCol->max), &(pCompCol->sum), &(pCompCol->minIndex), &(pCompCol->maxIndex), &(pCompCol->numOfNull)); @@ -811,7 +840,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa pCompBlock->last = isLast; pCompBlock->offset = offset; pCompBlock->algorithm = pHelper->config.compress; - pCompBlock->numOfPoints = rowsToWrite; + pCompBlock->numOfRows = rowsToWrite; pCompBlock->sversion = pHelper->tableInfo.sversion; pCompBlock->len = (int32_t)lsize; pCompBlock->numOfSubBlocks = isSuperBlock ? 1 : 0; @@ -848,7 +877,7 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa int rowsWritten = 0; SCompBlock compBlock = {0}; - ASSERT(pDataCols->numOfPoints > 0); + ASSERT(pDataCols->numOfRows > 0); TSKEY keyFirst = dataColsKeyFirst(pDataCols); SCompIdx *pIdx = pHelper->pCompIdx + pHelper->tableInfo.tid; @@ -860,32 +889,32 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa // ASSERT(compareKeyBlock((void *)&keyFirst, (void *)pCompBlock) == 0); if (keyFirst > blockAtIdx(pHelper, blkIdx)->keyLast) { // Merge with the last block by append - ASSERT(blockAtIdx(pHelper, blkIdx)->numOfPoints < pHelper->config.minRowsPerFileBlock && blkIdx == pIdx->numOfBlocks-1); + ASSERT(blockAtIdx(pHelper, blkIdx)->numOfRows < pHelper->config.minRowsPerFileBlock && blkIdx == pIdx->numOfBlocks-1); int defaultRowsToWrite = pHelper->config.maxRowsPerFileBlock * 4 / 5; // TODO: make a interface - rowsWritten = MIN((defaultRowsToWrite - blockAtIdx(pHelper, blkIdx)->numOfPoints), pDataCols->numOfPoints); + rowsWritten = MIN((defaultRowsToWrite - blockAtIdx(pHelper, blkIdx)->numOfRows), pDataCols->numOfRows); if ((blockAtIdx(pHelper, blkIdx)->numOfSubBlocks < TSDB_MAX_SUBBLOCKS) && - (blockAtIdx(pHelper, blkIdx)->numOfPoints + rowsWritten < pHelper->config.minRowsPerFileBlock) && (pHelper->files.nLastF.fd) > 0) { + (blockAtIdx(pHelper, blkIdx)->numOfRows + rowsWritten < pHelper->config.minRowsPerFileBlock) && (pHelper->files.nLastF.fd) > 0) { if (tsdbWriteBlockToFile(pHelper, &(pHelper->files.lastF), pDataCols, rowsWritten, &compBlock, true, false) < 0) goto _err; if (tsdbAddSubBlock(pHelper, &compBlock, blkIdx, rowsWritten) < 0) goto _err; } else { // Load if (tsdbLoadBlockData(pHelper, blockAtIdx(pHelper, blkIdx), NULL) < 0) goto _err; - ASSERT(pHelper->pDataCols[0]->numOfPoints == blockAtIdx(pHelper, blkIdx)->numOfPoints); + ASSERT(pHelper->pDataCols[0]->numOfRows == blockAtIdx(pHelper, blkIdx)->numOfRows); // Merge if (tdMergeDataCols(pHelper->pDataCols[0], pDataCols, rowsWritten) < 0) goto _err; // Write SFile *pWFile = NULL; bool isLast = false; - if (pHelper->pDataCols[0]->numOfPoints >= pHelper->config.minRowsPerFileBlock) { + if (pHelper->pDataCols[0]->numOfRows >= pHelper->config.minRowsPerFileBlock) { pWFile = &(pHelper->files.dataF); } else { isLast = true; pWFile = (pHelper->files.nLastF.fd > 0) ? &(pHelper->files.nLastF) : &(pHelper->files.lastF); } if (tsdbWriteBlockToFile(pHelper, pWFile, pHelper->pDataCols[0], - pHelper->pDataCols[0]->numOfPoints, &compBlock, isLast, true) < 0) + pHelper->pDataCols[0]->numOfRows, &compBlock, isLast, true) < 0) goto _err; if (tsdbUpdateSuperBlock(pHelper, &compBlock, blkIdx) < 0) goto _err; } @@ -902,7 +931,7 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa // rows1: number of rows must merge in this block int rows1 = tsdbGetRowsInRange(pDataCols, blockAtIdx(pHelper, blkIdx)->keyFirst, blockAtIdx(pHelper, blkIdx)->keyLast); // rows2: max nuber of rows the block can have more - int rows2 = pHelper->config.maxRowsPerFileBlock - blockAtIdx(pHelper, blkIdx)->numOfPoints; + int rows2 = pHelper->config.maxRowsPerFileBlock - blockAtIdx(pHelper, blkIdx)->numOfRows; // rows3: number of rows between this block and the next block int rows3 = tsdbGetRowsInRange(pDataCols, blockAtIdx(pHelper, blkIdx)->keyFirst, keyLimit); @@ -910,7 +939,7 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa if ((rows2 >= rows1) && (( blockAtIdx(pHelper, blkIdx)->last) || - ((rows1 + blockAtIdx(pHelper, blkIdx)->numOfPoints < pHelper->config.minRowsPerFileBlock) && (pHelper->files.nLastF.fd < 0)))) { + ((rows1 + blockAtIdx(pHelper, blkIdx)->numOfRows < pHelper->config.minRowsPerFileBlock) && (pHelper->files.nLastF.fd < 0)))) { rowsWritten = rows1; bool isLast = false; SFile *pFile = NULL; @@ -936,11 +965,11 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa int round = 0; // tdResetDataCols(pHelper->pDataCols[1]); while (true) { - if (iter1 >= pHelper->pDataCols[0]->numOfPoints && iter2 >= rows3) break; + if (iter1 >= pHelper->pDataCols[0]->numOfRows && iter2 >= rows3) break; tdMergeTwoDataCols(pHelper->pDataCols[1], pHelper->pDataCols[0], &iter1, pDataCols, &iter2, pHelper->config.maxRowsPerFileBlock * 4 / 5); - ASSERT(pHelper->pDataCols[1]->numOfPoints > 0); + ASSERT(pHelper->pDataCols[1]->numOfRows > 0); if (tsdbWriteBlockToFile(pHelper, &(pHelper->files.dataF), pHelper->pDataCols[1], - pHelper->pDataCols[1]->numOfPoints, &compBlock, false, true) < 0) + pHelper->pDataCols[1]->numOfRows, &compBlock, false, true) < 0) goto _err; if (round == 0) { tsdbUpdateSuperBlock(pHelper, &compBlock, blkIdx); @@ -951,17 +980,17 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa blkIdx++; // TODO: the blkIdx here is not correct - // if (iter1 >= pHelper->pDataCols[0]->numOfPoints && iter2 >= rows3) { - // if (pHelper->pDataCols[1]->numOfPoints > 0) { + // if (iter1 >= pHelper->pDataCols[0]->numOfRows && iter2 >= rows3) { + // if (pHelper->pDataCols[1]->numOfRows > 0) { // if (tsdbWriteBlockToFile(pHelper, &pHelper->files.dataF, pHelper->pDataCols[1], - // pHelper->pDataCols[1]->numOfPoints, &compBlock, false, true) < 0) + // pHelper->pDataCols[1]->numOfRows, &compBlock, false, true) < 0) // goto _err; // // TODO: the blkIdx here is not correct - // tsdbAddSubBlock(pHelper, &compBlock, blkIdx, pHelper->pDataCols[1]->numOfPoints); + // tsdbAddSubBlock(pHelper, &compBlock, blkIdx, pHelper->pDataCols[1]->numOfRows); // } // } - // TSKEY key1 = iter1 >= pHelper->pDataCols[0]->numOfPoints + // TSKEY key1 = iter1 >= pHelper->pDataCols[0]->numOfRows // ? INT64_MAX // : ((int64_t *)(pHelper->pDataCols[0]->cols[0].pData))[iter1]; // TSKEY key2 = iter2 >= rowsWritten ? INT64_MAX : ((int64_t *)(pDataCols->cols[0].pData))[iter2]; @@ -969,11 +998,11 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa // if (key1 < key2) { // for (int i = 0; i < pDataCols->numOfCols; i++) { // SDataCol *pDataCol = pHelper->pDataCols[1]->cols + i; - // memcpy(((char *)pDataCol->pData + TYPE_BYTES[pDataCol->type] * pHelper->pDataCols[1]->numOfPoints), + // memcpy(((char *)pDataCol->pData + TYPE_BYTES[pDataCol->type] * pHelper->pDataCols[1]->numOfRows), // ((char *)pHelper->pDataCols[0]->cols[i].pData + TYPE_BYTES[pDataCol->type] * iter1), // TYPE_BYTES[pDataCol->type]); // } - // pHelper->pDataCols[1]->numOfPoints++; + // pHelper->pDataCols[1]->numOfRows++; // iter1++; // } else if (key1 == key2) { // // TODO: think about duplicate key cases @@ -981,17 +1010,17 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa // } else { // for (int i = 0; i < pDataCols->numOfCols; i++) { // SDataCol *pDataCol = pHelper->pDataCols[1]->cols + i; - // memcpy(((char *)pDataCol->pData + TYPE_BYTES[pDataCol->type] * pHelper->pDataCols[1]->numOfPoints), + // memcpy(((char *)pDataCol->pData + TYPE_BYTES[pDataCol->type] * pHelper->pDataCols[1]->numOfRows), // ((char *)pDataCols->cols[i].pData + // TYPE_BYTES[pDataCol->type] * iter2), // TYPE_BYTES[pDataCol->type]); // } - // pHelper->pDataCols[1]->numOfPoints++; + // pHelper->pDataCols[1]->numOfRows++; // iter2++; // } - // if (pHelper->pDataCols[0]->numOfPoints >= pHelper->config.maxRowsPerFileBlock * 4 / 5) { - // if (tsdbWriteBlockToFile(pHelper, &pHelper->files.dataF, pHelper->pDataCols[1], pHelper->pDataCols[1]->numOfPoints, &compBlock, false, true) < 0) goto _err; + // if (pHelper->pDataCols[0]->numOfRows >= pHelper->config.maxRowsPerFileBlock * 4 / 5) { + // if (tsdbWriteBlockToFile(pHelper, &pHelper->files.dataF, pHelper->pDataCols[1], pHelper->pDataCols[1]->numOfRows, &compBlock, false, true) < 0) goto _err; // // TODO: blkIdx here is not correct, fix it // tsdbInsertSuperBlock(pHelper, &compBlock, blkIdx); @@ -1104,7 +1133,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId pSCompBlock->numOfSubBlocks++; ASSERT(pSCompBlock->numOfSubBlocks <= TSDB_MAX_SUBBLOCKS); pSCompBlock->len += sizeof(SCompBlock); - pSCompBlock->numOfPoints += rowsAdded; + pSCompBlock->numOfRows += rowsAdded; pSCompBlock->keyFirst = MIN(pSCompBlock->keyFirst, pCompBlock->keyFirst); pSCompBlock->keyLast = MAX(pSCompBlock->keyLast, pCompBlock->keyLast); pIdx->len += sizeof(SCompBlock); @@ -1135,7 +1164,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId ((SCompBlock *)ptr)[1] = *pCompBlock; pSCompBlock->numOfSubBlocks = 2; - pSCompBlock->numOfPoints += rowsAdded; + pSCompBlock->numOfRows += rowsAdded; pSCompBlock->offset = ((char *)ptr) - ((char *)pHelper->pCompInfo); pSCompBlock->len = sizeof(SCompBlock) * 2; pSCompBlock->keyFirst = MIN(((SCompBlock *)ptr)[0].keyFirst, ((SCompBlock *)ptr)[1].keyFirst); @@ -1190,7 +1219,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int // Get the number of rows in range [minKey, maxKey] static int tsdbGetRowsInRange(SDataCols *pDataCols, TSKEY minKey, TSKEY maxKey) { - if (pDataCols->numOfPoints == 0) return 0; + if (pDataCols->numOfRows == 0) return 0; ASSERT(minKey <= maxKey); TSKEY keyFirst = dataColsKeyFirst(pDataCols); @@ -1199,11 +1228,11 @@ static int tsdbGetRowsInRange(SDataCols *pDataCols, TSKEY minKey, TSKEY maxKey) if (minKey > keyLast || maxKey < keyFirst) return 0; - void *ptr1 = taosbsearch((void *)&minKey, (void *)pDataCols->cols[0].pData, pDataCols->numOfPoints, sizeof(TSKEY), + void *ptr1 = taosbsearch((void *)&minKey, (void *)pDataCols->cols[0].pData, pDataCols->numOfRows, sizeof(TSKEY), compTSKEY, TD_GE); ASSERT(ptr1 != NULL); - void *ptr2 = taosbsearch((void *)&maxKey, (void *)pDataCols->cols[0].pData, pDataCols->numOfPoints, sizeof(TSKEY), + void *ptr2 = taosbsearch((void *)&maxKey, (void *)pDataCols->cols[0].pData, pDataCols->numOfRows, sizeof(TSKEY), compTSKEY, TD_LE); ASSERT(ptr2 != NULL); diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 1b09ce74d9..720479130b 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -26,7 +26,7 @@ #include "tsdbMain.h" #define EXTRA_BYTES 2 -#define ASCENDING_ORDER_TRAVERSE(o) (o == TSDB_ORDER_ASC) +#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC) #define QH_GET_NUM_OF_COLS(handle) ((size_t)(taosArrayGetSize((handle)->pColumns))) enum { @@ -40,10 +40,6 @@ enum { TSDB_QUERY_TYPE_EXTERNAL = 3, }; -typedef struct SField { - // todo need the definition -} SField; - typedef struct SQueryFilePos { int32_t fid; int32_t slot; @@ -68,66 +64,56 @@ typedef struct SLoadCompBlockInfo { } SLoadCompBlockInfo; typedef struct STableCheckInfo { - STableId tableId; - TSKEY lastKey; - STable* pTableObj; - int32_t start; - SCompInfo* pCompInfo; - int32_t compSize; - int32_t numOfBlocks; // number of qualified data blocks not the original blocks - SDataCols* pDataCols; - - SSkipListIterator* iter; // skip list iterator - SSkipListIterator* iiter; // imem iterator - - bool hasObtainBuf; // if we should initialize the in-memory skip list iterator + STableId tableId; + TSKEY lastKey; + STable* pTableObj; + SCompInfo* pCompInfo; + int32_t compSize; + int32_t numOfBlocks; // number of qualified data blocks not the original blocks + SDataCols* pDataCols; + bool initBuf; // whether to initialize the in-memory skip list iterator or not + SSkipListIterator* iter; // mem buffer skip list iterator + SSkipListIterator* iiter; // imem buffer skip list iterator } STableCheckInfo; -typedef struct { - SCompBlock* compBlock; - SField* fields; -} SCompBlockFields; - typedef struct STableBlockInfo { - SCompBlockFields pBlock; - STableCheckInfo* pTableCheckInfo; - int32_t blockIndex; - int32_t groupIdx; /* number of group is less than the total number of tables */ + SCompBlock* compBlock; + STableCheckInfo* pTableCheckInfo; +// int32_t blockIndex; +// int32_t groupIdx; /* number of group is less than the total number of tables */ } STableBlockInfo; typedef struct SBlockOrderSupporter { int32_t numOfTables; - STableBlockInfo** pDataBlockInfo; + STableBlockInfo** pDataBlockInfo; int32_t* blockIndexArray; int32_t* numOfBlocksPerTable; } SBlockOrderSupporter; typedef struct STsdbQueryHandle { - STsdbRepo* pTsdb; - SQueryFilePos cur; // current position - - SDataBlockLoadInfo dataBlockLoadInfo; /* record current block load information */ - SLoadCompBlockInfo compBlockLoadInfo; /* record current compblock information in SQuery */ - - int16_t order; - STimeWindow window; // the primary query time window that applies to all queries - SCompBlock* pBlock; - int32_t numOfBlocks; - SField** pFields; - SArray* pColumns; // column list, SColumnInfoData array list - bool locateStart; - int32_t outputCapacity; - int32_t realNumOfRows; - SArray* pTableCheckInfo; //SArray - int32_t activeIndex; - bool checkFiles; // check file stage - void* qinfo; // query info handle, for debug purpose - int32_t type; // query type: retrieve all data blocks, 2. retrieve only last row, 3. retrieve direct prev|next rows - STableBlockInfo* pDataBlockInfo; - + STsdbRepo* pTsdb; + SQueryFilePos cur; // current position + int16_t order; + STimeWindow window; // the primary query time window that applies to all queries + SCompBlock* pBlock; + SDataStatis* statis; // query level statistics, only one table block statistics info exists at any time + int32_t numOfBlocks; + SArray* pColumns; // column list, SColumnInfoData array list + bool locateStart; + int32_t outputCapacity; + int32_t realNumOfRows; + SArray* pTableCheckInfo; //SArray + int32_t activeIndex; + bool checkFiles; // check file stage + void* qinfo; // query info handle, for debug purpose + int32_t type; // query type: retrieve all data blocks, 2. retrieve only last row, 3. retrieve direct prev|next rows SFileGroup* pFileGroup; SFileGroupIter fileIter; SRWHelper rhelper; + STableBlockInfo* pDataBlockInfo; + + SDataBlockLoadInfo dataBlockLoadInfo; /* record current block load information */ + SLoadCompBlockInfo compBlockLoadInfo; /* record current compblock information in SQuery */ } STsdbQueryHandle; static void changeQueryHandleForLastrowQuery(TsdbQueryHandleT pqHandle); @@ -148,23 +134,43 @@ TsdbQueryHandleT* tsdbQueryTables(TsdbRepoT* tsdb, STsdbQueryCond* pCond, STable // todo 2. add the reference count for each table that is involved in query STsdbQueryHandle* pQueryHandle = calloc(1, sizeof(STsdbQueryHandle)); - pQueryHandle->order = pCond->order; - pQueryHandle->window = pCond->twindow; - pQueryHandle->pTsdb = tsdb; - pQueryHandle->type = TSDB_QUERY_TYPE_ALL; + pQueryHandle->order = pCond->order; + pQueryHandle->window = pCond->twindow; + pQueryHandle->pTsdb = tsdb; + pQueryHandle->type = TSDB_QUERY_TYPE_ALL; + pQueryHandle->cur.fid = -1; + pQueryHandle->cur.win = TSWINDOW_INITIALIZER; + pQueryHandle->checkFiles = true;//ASCENDING_TRAVERSE(pQueryHandle->order); + pQueryHandle->activeIndex = 0; // current active table index + pQueryHandle->outputCapacity = ((STsdbRepo*)tsdb)->config.maxRowsPerFileBlock; + tsdbInitReadHelper(&pQueryHandle->rhelper, (STsdbRepo*) tsdb); - pQueryHandle->cur.fid = -1; - pQueryHandle->cur.win = TSWINDOW_INITIALIZER; - size_t sizeOfGroup = taosArrayGetSize(groupList->pGroupList); assert(sizeOfGroup >= 1 && pCond != NULL && pCond->numOfCols > 0); + // allocate buffer in order to load data blocks from file + int32_t numOfCols = pCond->numOfCols; + + pQueryHandle->statis = calloc(numOfCols, sizeof(SDataStatis)); + pQueryHandle->pColumns = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); // todo: use list instead of array? + + for (int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData colInfo = {{0}, 0}; + + colInfo.info = pCond->colList[i]; + colInfo.pData = calloc(1, EXTRA_BYTES + pQueryHandle->outputCapacity * pCond->colList[i].bytes); + taosArrayPush(pQueryHandle->pColumns, &colInfo); + pQueryHandle->statis[i].colId = colInfo.info.colId; + } + pQueryHandle->pTableCheckInfo = taosArrayInit(groupList->numOfTables, sizeof(STableCheckInfo)); + STsdbMeta* pMeta = tsdbGetMeta(tsdb); + assert(pMeta != NULL); for (int32_t i = 0; i < sizeOfGroup; ++i) { SArray* group = *(SArray**) taosArrayGet(groupList->pGroupList, i); - + size_t gsize = taosArrayGetSize(group); assert(gsize > 0); @@ -174,35 +180,18 @@ TsdbQueryHandleT* tsdbQueryTables(TsdbRepoT* tsdb, STsdbQueryCond* pCond, STable STableCheckInfo info = { .lastKey = pQueryHandle->window.skey, .tableId = *id, - .pTableObj = tsdbGetTableByUid(tsdbGetMeta(tsdb), id->uid), + .pTableObj = tsdbGetTableByUid(pMeta, id->uid), }; - + assert(info.pTableObj != NULL && info.pTableObj->tableId.tid == id->tid); taosArrayPush(pQueryHandle->pTableCheckInfo, &info); } } - - uTrace("%p total numOfTable:%d in query", pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo)); - /* - * For ascending timestamp order query, query starts from data files. In contrast, buffer will be checked in the first place - * in case of descending timestamp order query. - */ - pQueryHandle->checkFiles = true;//ASCENDING_ORDER_TRAVERSE(pQueryHandle->order); - pQueryHandle->activeIndex = 0; - - // allocate buffer in order to load data blocks from file - int32_t numOfCols = pCond->numOfCols; - pQueryHandle->outputCapacity = 4096; - - pQueryHandle->pColumns = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); - for (int32_t i = 0; i < pCond->numOfCols; ++i) { - SColumnInfoData colInfo = {{0}, 0}; - - colInfo.info = pCond->colList[i]; - colInfo.pData = calloc(1, EXTRA_BYTES + pQueryHandle->outputCapacity * pCond->colList[i].bytes); - taosArrayPush(pQueryHandle->pColumns, &colInfo); + for(int32_t i = 0; i < numOfCols; ++i) { } + + uTrace("%p total numOfTable:%d in query", pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo)); tsdbInitDataBlockLoadInfo(&pQueryHandle->dataBlockLoadInfo); tsdbInitCompBlockLoadInfo(&pQueryHandle->compBlockLoadInfo); @@ -234,11 +223,11 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh STable* pTable = pCheckInfo->pTableObj; assert(pTable != NULL); - if (pCheckInfo->hasObtainBuf) { + if (pCheckInfo->initBuf) { return true; } - pCheckInfo->hasObtainBuf = true; + pCheckInfo->initBuf = true; int32_t order = pHandle->order; // no data in buffer, abort @@ -335,8 +324,8 @@ static bool hasMoreDataInCache(STsdbQueryHandle* pHandle) { pCheckInfo->tableId.uid, pCheckInfo->tableId.tid, pCheckInfo->lastKey, pHandle->order, pHandle->qinfo); // all data in mem are checked already. - if ((pCheckInfo->lastKey > pHandle->window.ekey && ASCENDING_ORDER_TRAVERSE(pHandle->order)) || - (pCheckInfo->lastKey < pHandle->window.ekey && !ASCENDING_ORDER_TRAVERSE(pHandle->order))) { + if ((pCheckInfo->lastKey > pHandle->window.ekey && ASCENDING_TRAVERSE(pHandle->order)) || + (pCheckInfo->lastKey < pHandle->window.ekey && !ASCENDING_TRAVERSE(pHandle->order))) { return false; } @@ -394,9 +383,10 @@ static int32_t getFileCompInfo(STsdbQueryHandle* pQueryHandle, int32_t* numOfBlo STableCheckInfo* pCheckInfo = taosArrayGet(pQueryHandle->pTableCheckInfo, i); SCompIdx* compIndex = &pQueryHandle->rhelper.pCompIdx[pCheckInfo->tableId.tid]; - if (compIndex->len == 0 || compIndex->numOfBlocks == 0) { // no data block in this file, try next file + if (compIndex->len == 0 || compIndex->numOfBlocks == 0 || + compIndex->uid != pCheckInfo->tableId.uid) { // no data block in this file, try next file pCheckInfo->numOfBlocks = 0; - continue;//no data blocks in the file belongs to pCheckInfo->pTable + continue; // no data blocks in the file belongs to pCheckInfo->pTable } else { if (pCheckInfo->compSize < compIndex->len) { assert(compIndex->len > 0); @@ -446,7 +436,7 @@ static SDataBlockInfo getTrueDataBlockInfo(STableCheckInfo* pCheckInfo, SCompBlo SDataBlockInfo info = { .window = {.skey = pBlock->keyFirst, .ekey = pBlock->keyLast}, .numOfCols = pBlock->numOfCols, - .rows = pBlock->numOfPoints, + .rows = pBlock->numOfRows, .tid = pCheckInfo->tableId.tid, .uid = pCheckInfo->tableId.uid, }; @@ -482,9 +472,11 @@ static SArray* getDefaultLoadColumns(STsdbQueryHandle* pQueryHandle, bool loadTS return pLocalIdList; } -static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo* pCheckInfo, SCompBlock* pBlock, +static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* pCheckInfo, SCompBlock* pBlock, SArray* sa); static int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order); +static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY maxKey, int maxRowsToRead, TSKEY* skey, TSKEY* ekey, + STsdbQueryHandle* pQueryHandle); static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock, STableCheckInfo* pCheckInfo) { STsdbRepo *pRepo = pQueryHandle->pTsdb; @@ -496,8 +488,9 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo bool blockLoaded = false; SArray* sa = getDefaultLoadColumns(pQueryHandle, true); - if (pCheckInfo->pDataCols == NULL) { // todo: why not the real data? - pCheckInfo->pDataCols = tdNewDataCols(pRepo->tsdbMeta->maxRowBytes, pRepo->tsdbMeta->maxCols, pRepo->config.maxRowsPerFileBlock); + if (pCheckInfo->pDataCols == NULL) { + STsdbMeta* pMeta = tsdbGetMeta(pRepo); + pCheckInfo->pDataCols = tdNewDataCols(pMeta->maxRowBytes, pMeta->maxCols, pRepo->config.maxRowsPerFileBlock); } tdInitDataCols(pCheckInfo->pDataCols, tsdbGetTableSchema(tsdbGetMeta(pQueryHandle->pTsdb), pCheckInfo->pTableObj)); @@ -518,11 +511,96 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo return blockLoaded; } +static void handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock, STableCheckInfo* pCheckInfo){ + SQueryFilePos* cur = &pQueryHandle->cur; + SDataBlockInfo binfo = getTrueDataBlockInfo(pCheckInfo, pBlock); + /*bool hasData = */ initTableMemIterator(pQueryHandle, pCheckInfo); + + TSKEY k1 = TSKEY_INITIAL_VAL, k2 = TSKEY_INITIAL_VAL; + if (pCheckInfo->iter != NULL && tSkipListIterGet(pCheckInfo->iter) != NULL) { + SSkipListNode* node = tSkipListIterGet(pCheckInfo->iter); + + SDataRow row = SL_GET_NODE_DATA(node); + k1 = dataRowKey(row); + + if (k1 == binfo.window.skey) { + if (tSkipListIterNext(pCheckInfo->iter)) { + node = tSkipListIterGet(pCheckInfo->iter); + row = SL_GET_NODE_DATA(node); + k1 = dataRowKey(row); + } else { + k1 = TSKEY_INITIAL_VAL; + } + } + } + + if (pCheckInfo->iiter != NULL && tSkipListIterGet(pCheckInfo->iiter) != NULL) { + SSkipListNode* node = tSkipListIterGet(pCheckInfo->iiter); + + SDataRow row = SL_GET_NODE_DATA(node); + k2 = dataRowKey(row); + + if (k2 == binfo.window.skey) { + if (tSkipListIterNext(pCheckInfo->iiter)) { + node = tSkipListIterGet(pCheckInfo->iiter); + row = SL_GET_NODE_DATA(node); + k2 = dataRowKey(row); + } else { + k2 = TSKEY_INITIAL_VAL; + } + } + } + + cur->pos = ASCENDING_TRAVERSE(pQueryHandle->order)? 0:(binfo.rows-1); + + if ((ASCENDING_TRAVERSE(pQueryHandle->order) && + ((k1 != TSKEY_INITIAL_VAL && k1 <= binfo.window.ekey) || (k2 != TSKEY_INITIAL_VAL && k2 <= binfo.window.ekey))) || + (!ASCENDING_TRAVERSE(pQueryHandle->order) && + ((k1 != TSKEY_INITIAL_VAL && k1 >= binfo.window.skey) || (k2 != TSKEY_INITIAL_VAL && k2 >= binfo.window.skey)))) { + + if ((ASCENDING_TRAVERSE(pQueryHandle->order) && + ((k1 != TSKEY_INITIAL_VAL && k1 < binfo.window.skey) || (k2 != TSKEY_INITIAL_VAL && k2 < binfo.window.skey))) || + (!ASCENDING_TRAVERSE(pQueryHandle->order) && + (((k1 != TSKEY_INITIAL_VAL && k1 > binfo.window.skey) || (k2 != TSKEY_INITIAL_VAL && k2 > binfo.window.skey))))) { + // do not load file block into buffer + int32_t step = ASCENDING_TRAVERSE(pQueryHandle->order) ? 1 : -1; + + cur->rows = tsdbReadRowsFromCache(pCheckInfo->iter, pCheckInfo->pTableObj, binfo.window.skey - step, + pQueryHandle->outputCapacity, &cur->win.skey, &cur->win.ekey, pQueryHandle); + pQueryHandle->realNumOfRows = cur->rows; + + // update the last key value + pCheckInfo->lastKey = cur->win.ekey + step; + if (!ASCENDING_TRAVERSE(pQueryHandle->order)) { + SWAP(cur->win.skey, cur->win.ekey, TSKEY); + } + + cur->mixBlock = true; + cur->blockCompleted = false; + return; + } + + SArray* sa = getDefaultLoadColumns(pQueryHandle, true); + doLoadFileDataBlock(pQueryHandle, pBlock, pCheckInfo); + doMergeTwoLevelData(pQueryHandle, pCheckInfo, pBlock, sa); + taosArrayDestroy(sa); + + } else { + pQueryHandle->realNumOfRows = binfo.rows; + + cur->rows = binfo.rows; + cur->win = binfo.window; + cur->mixBlock = false; + cur->blockCompleted = true; + cur->lastKey = binfo.window.ekey + (ASCENDING_TRAVERSE(pQueryHandle->order)? 1:-1); + } +} + static bool loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock, STableCheckInfo* pCheckInfo) { SArray* sa = getDefaultLoadColumns(pQueryHandle, true); SQueryFilePos* cur = &pQueryHandle->cur; - if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (ASCENDING_TRAVERSE(pQueryHandle->order)) { // query ended in current block if (pQueryHandle->window.ekey < pBlock->keyLast || pCheckInfo->lastKey > pBlock->keyFirst) { if (!doLoadFileDataBlock(pQueryHandle, pBlock, pCheckInfo)) { @@ -530,71 +608,20 @@ static bool loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock } SDataCols* pTSCol = pQueryHandle->rhelper.pDataCols[0]; - assert(pTSCol->cols->type == TSDB_DATA_TYPE_TIMESTAMP && pTSCol->numOfPoints == pBlock->numOfPoints); + assert(pTSCol->cols->type == TSDB_DATA_TYPE_TIMESTAMP && pTSCol->numOfRows == pBlock->numOfRows); if (pCheckInfo->lastKey > pBlock->keyFirst) { cur->pos = - binarySearchForKey(pTSCol->cols[0].pData, pBlock->numOfPoints, pCheckInfo->lastKey, pQueryHandle->order); + binarySearchForKey(pTSCol->cols[0].pData, pBlock->numOfRows, pCheckInfo->lastKey, pQueryHandle->order); } else { cur->pos = 0; } - mergeDataInDataBlock(pQueryHandle, pCheckInfo, pBlock, sa); + doMergeTwoLevelData(pQueryHandle, pCheckInfo, pBlock, sa); } else { // the whole block is loaded in to buffer - SDataBlockInfo binfo = getTrueDataBlockInfo(pCheckInfo, pBlock); - /*bool hasData = */ initTableMemIterator(pQueryHandle, pCheckInfo); - - TSKEY k1 = TSKEY_INITIAL_VAL, k2 = TSKEY_INITIAL_VAL; - if (pCheckInfo->iter != NULL && tSkipListIterGet(pCheckInfo->iter) != NULL) { - SSkipListNode* node = tSkipListIterGet(pCheckInfo->iter); - - SDataRow row = SL_GET_NODE_DATA(node); - k1 = dataRowKey(row); - - if (k1 == binfo.window.skey) { - if (tSkipListIterNext(pCheckInfo->iter)) { - node = tSkipListIterGet(pCheckInfo->iter); - row = SL_GET_NODE_DATA(node); - k1 = dataRowKey(row); - } else { - k1 = TSKEY_INITIAL_VAL; - } - } - } - - if (pCheckInfo->iiter != NULL && tSkipListIterGet(pCheckInfo->iiter) != NULL) { - SSkipListNode* node = tSkipListIterGet(pCheckInfo->iiter); - - SDataRow row = SL_GET_NODE_DATA(node); - k2 = dataRowKey(row); - - if (k2 == binfo.window.skey) { - if (tSkipListIterNext(pCheckInfo->iiter)) { - node = tSkipListIterGet(pCheckInfo->iiter); - row = SL_GET_NODE_DATA(node); - k2 = dataRowKey(row); - } else { - k2 = TSKEY_INITIAL_VAL; - } - } - } - - cur->pos = 0; - if ((k1 != TSKEY_INITIAL_VAL && k1 < binfo.window.ekey) || (k2 != TSKEY_INITIAL_VAL && k2 < binfo.window.ekey)) { - doLoadFileDataBlock(pQueryHandle, pBlock, pCheckInfo); - mergeDataInDataBlock(pQueryHandle, pCheckInfo, pBlock, sa); - } else { - pQueryHandle->realNumOfRows = binfo.rows; - - cur->rows = binfo.rows; - cur->win = binfo.window; - cur->mixBlock = false; - cur->blockCompleted = true; - cur->lastKey = binfo.window.ekey + (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)? 1:-1); - } + handleDataMergeIfNeeded(pQueryHandle, pBlock, pCheckInfo); } - } else { //desc order - // query ended in current block + } else { //desc order, query ended in current block if (pQueryHandle->window.ekey > pBlock->keyFirst) { if (!doLoadFileDataBlock(pQueryHandle, pBlock, pCheckInfo)) { return false; @@ -603,60 +630,16 @@ static bool loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock SDataCols* pDataCols = pCheckInfo->pDataCols; if (pCheckInfo->lastKey < pBlock->keyLast) { cur->pos = - binarySearchForKey(pDataCols->cols[0].pData, pBlock->numOfPoints, pCheckInfo->lastKey, pQueryHandle->order); + binarySearchForKey(pDataCols->cols[0].pData, pBlock->numOfRows, pCheckInfo->lastKey, pQueryHandle->order); } else { - cur->pos = pBlock->numOfPoints - 1; + cur->pos = pBlock->numOfRows - 1; } - mergeDataInDataBlock(pQueryHandle, pCheckInfo, pBlock, sa); + doMergeTwoLevelData(pQueryHandle, pCheckInfo, pBlock, sa); } else { - SDataBlockInfo binfo = getTrueDataBlockInfo(pCheckInfo, pBlock); - /*bool hasData = */ initTableMemIterator(pQueryHandle, pCheckInfo); - - TSKEY k1 = TSKEY_INITIAL_VAL, k2 = TSKEY_INITIAL_VAL; - if (pCheckInfo->iter != NULL) { - SSkipListNode* node = tSkipListIterGet(pCheckInfo->iter); - SDataRow row = SL_GET_NODE_DATA(node); - k1 = dataRowKey(row); - - if (k1 == binfo.window.skey) { - if (tSkipListIterNext(pCheckInfo->iter)) { - node = tSkipListIterGet(pCheckInfo->iter); - row = SL_GET_NODE_DATA(node); - k1 = dataRowKey(row); - } else { - k1 = TSKEY_INITIAL_VAL; - } - } - } - - if (pCheckInfo->iiter != NULL) { - SSkipListNode* node = tSkipListIterGet(pCheckInfo->iiter); - SDataRow row = SL_GET_NODE_DATA(node); - k2 = dataRowKey(row); - - if (k2 == binfo.window.skey) { - if (tSkipListIterNext(pCheckInfo->iiter)) { - node = tSkipListIterGet(pCheckInfo->iiter); - row = SL_GET_NODE_DATA(node); - k2 = dataRowKey(row); - } else { - k2 = TSKEY_INITIAL_VAL; - } - } - } - - cur->pos = binfo.rows - 1; - if ((k1 != TSKEY_INITIAL_VAL && k1 > binfo.window.ekey) || (k2 != TSKEY_INITIAL_VAL && k2 > binfo.window.ekey)) { - doLoadFileDataBlock(pQueryHandle, pBlock, pCheckInfo); - mergeDataInDataBlock(pQueryHandle, pCheckInfo, pBlock, sa); - } else { - pQueryHandle->realNumOfRows = binfo.rows; - } - } -// pQueryHandle->realNumOfRows = pBlock->numOfPoints; -// cur->pos = pBlock->numOfPoints - 1; + handleDataMergeIfNeeded(pQueryHandle, pBlock, pCheckInfo); } + } taosArrayDestroy(sa); return pQueryHandle->realNumOfRows > 0; @@ -664,7 +647,7 @@ static bool loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock static int vnodeBinarySearchKey(char* pValue, int num, TSKEY key, int order) { int firstPos, lastPos, midPos = -1; - int numOfPoints; + int numOfRows; TSKEY* keyList; assert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); @@ -682,8 +665,8 @@ static int vnodeBinarySearchKey(char* pValue, int num, TSKEY key, int order) { if (key == keyList[firstPos]) return firstPos; if (key < keyList[firstPos]) return firstPos - 1; - numOfPoints = lastPos - firstPos + 1; - midPos = (numOfPoints >> 1) + firstPos; + numOfRows = lastPos - firstPos + 1; + midPos = (numOfRows >> 1) + firstPos; if (key < keyList[midPos]) { lastPos = midPos - 1; @@ -708,8 +691,8 @@ static int vnodeBinarySearchKey(char* pValue, int num, TSKEY key, int order) { return lastPos; } - numOfPoints = lastPos - firstPos + 1; - midPos = (numOfPoints >> 1) + firstPos; + numOfRows = lastPos - firstPos + 1; + midPos = (numOfRows >> 1) + firstPos; if (key < keyList[midPos]) { lastPos = midPos - 1; @@ -726,20 +709,20 @@ static int vnodeBinarySearchKey(char* pValue, int num, TSKEY key, int order) { static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t capacity, int32_t numOfRows, int32_t start, int32_t end) { char* pData = NULL; - int32_t step = ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)? 1 : -1; + int32_t step = ASCENDING_TRAVERSE(pQueryHandle->order)? 1 : -1; SDataCols* pCols = pQueryHandle->rhelper.pDataCols[0]; TSKEY* tsArray = pCols->cols[0].pData; int32_t num = end - start + 1; - int32_t reqiredNumOfCols = taosArrayGetSize(pQueryHandle->pColumns); + int32_t requiredNumOfCols = taosArrayGetSize(pQueryHandle->pColumns); //data in buffer has greater timestamp, copy data in file block - for (int32_t i = 0; i < reqiredNumOfCols; ++i) { + for (int32_t i = 0; i < requiredNumOfCols; ++i) { SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); int32_t bytes = pColInfo->info.bytes; - if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (ASCENDING_TRAVERSE(pQueryHandle->order)) { pData = pColInfo->pData + numOfRows * pColInfo->info.bytes; } else { pData = pColInfo->pData + (capacity - numOfRows - num) * pColInfo->info.bytes; @@ -783,7 +766,7 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, STableCheckInfo* p for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); - if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (ASCENDING_TRAVERSE(pQueryHandle->order)) { pData = pColInfo->pData + numOfRows * pColInfo->info.bytes; } else { pData = pColInfo->pData + (capacity - numOfRows - 1) * pColInfo->info.bytes; @@ -810,7 +793,7 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, STableCheckInfo* p // only return the qualified data to client in terms of query time window, data rows in the same block but do not // be included in the query time window will be discarded -static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo* pCheckInfo, SCompBlock* pBlock, +static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* pCheckInfo, SCompBlock* pBlock, SArray* sa) { SQueryFilePos* cur = &pQueryHandle->cur; SDataBlockInfo blockInfo = getTrueDataBlockInfo(pCheckInfo, pBlock); @@ -819,15 +802,15 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo SDataCols* pCols = pQueryHandle->rhelper.pDataCols[0]; int32_t endPos = cur->pos; - if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order) && pQueryHandle->window.ekey > blockInfo.window.ekey) { + if (ASCENDING_TRAVERSE(pQueryHandle->order) && pQueryHandle->window.ekey > blockInfo.window.ekey) { endPos = blockInfo.rows - 1; cur->mixBlock = (cur->pos != 0); - } else if (!ASCENDING_ORDER_TRAVERSE(pQueryHandle->order) && pQueryHandle->window.ekey < blockInfo.window.skey) { + } else if (!ASCENDING_TRAVERSE(pQueryHandle->order) && pQueryHandle->window.ekey < blockInfo.window.skey) { endPos = 0; cur->mixBlock = (cur->pos != blockInfo.rows - 1); } else { int32_t order = (pQueryHandle->order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC; - endPos = vnodeBinarySearchKey(pCols->cols[0].pData, pCols->numOfPoints, pQueryHandle->window.ekey, order); + endPos = vnodeBinarySearchKey(pCols->cols[0].pData, pCols->numOfRows, pQueryHandle->window.ekey, order); cur->mixBlock = true; } @@ -839,13 +822,13 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo int32_t numOfRows = 0; pQueryHandle->cur.win = TSWINDOW_INITIALIZER; - int32_t step = ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)? 1:-1; + int32_t step = ASCENDING_TRAVERSE(pQueryHandle->order)? 1:-1; // no data in buffer, load data from file directly if (pCheckInfo->iiter == NULL && pCheckInfo->iter == NULL) { int32_t start = cur->pos; int32_t end = endPos; - if (!ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (!ASCENDING_TRAVERSE(pQueryHandle->order)) { end = cur->pos; start = endPos; } @@ -857,7 +840,7 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo numOfRows = copyDataFromFileBlock(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, start, end); // if the buffer is not full in case of descending order query, move the data in the front of the buffer - if (!ASCENDING_ORDER_TRAVERSE(pQueryHandle->order) && numOfRows < pQueryHandle->outputCapacity) { + if (!ASCENDING_TRAVERSE(pQueryHandle->order) && numOfRows < pQueryHandle->outputCapacity) { int32_t emptySize = pQueryHandle->outputCapacity - numOfRows; int32_t reqNumOfCols = taosArrayGetSize(pQueryHandle->pColumns); @@ -868,8 +851,8 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo } pos += (end - start + 1) * step; - cur->blockCompleted = (((pos >= endPos || cur->lastKey > pQueryHandle->window.ekey) && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - ((pos <= endPos || cur->lastKey < pQueryHandle->window.ekey) && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))); + cur->blockCompleted = (((pos >= endPos || cur->lastKey > pQueryHandle->window.ekey) && ASCENDING_TRAVERSE(pQueryHandle->order)) || + ((pos <= endPos || cur->lastKey < pQueryHandle->window.ekey) && !ASCENDING_TRAVERSE(pQueryHandle->order))); pCheckInfo->lastKey = cur->lastKey; pQueryHandle->realNumOfRows = numOfRows; @@ -889,18 +872,18 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo SDataRow row = SL_GET_NODE_DATA(node); TSKEY key = dataRowKey(row); - if ((key > pQueryHandle->window.ekey && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - (key < pQueryHandle->window.ekey && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))) { + if ((key > pQueryHandle->window.ekey && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (key < pQueryHandle->window.ekey && !ASCENDING_TRAVERSE(pQueryHandle->order))) { break; } - if (((tsArray[pos] > pQueryHandle->window.ekey || pos > endPos) && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - ((tsArray[pos] < pQueryHandle->window.ekey || pos < endPos) && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))) { + if (((tsArray[pos] > pQueryHandle->window.ekey || pos > endPos) && ASCENDING_TRAVERSE(pQueryHandle->order)) || + ((tsArray[pos] < pQueryHandle->window.ekey || pos < endPos) && !ASCENDING_TRAVERSE(pQueryHandle->order))) { break; } - if ((key < tsArray[pos] && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - (key > tsArray[pos] && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))) { + if ((key < tsArray[pos] && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (key > tsArray[pos] && !ASCENDING_TRAVERSE(pQueryHandle->order))) { copyOneRowFromMem(pQueryHandle, pCheckInfo, pQueryHandle->outputCapacity, numOfRows, row, pSchema); numOfRows += 1; if (cur->win.skey == TSKEY_INITIAL_VAL) { @@ -914,20 +897,20 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo tSkipListIterNext(pCheckInfo->iter); } else if (key == tsArray[pos]) { // data in buffer has the same timestamp of data in file block, ignore it tSkipListIterNext(pCheckInfo->iter); - } else if ((key > tsArray[pos] && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - (key < tsArray[pos] && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))) { + } else if ((key > tsArray[pos] && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (key < tsArray[pos] && !ASCENDING_TRAVERSE(pQueryHandle->order))) { if (cur->win.skey == TSKEY_INITIAL_VAL) { cur->win.skey = tsArray[pos]; } - int32_t order = (pQueryHandle->order == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC; - int32_t end = vnodeBinarySearchKey(pCols->cols[0].pData, pCols->numOfPoints, key, order); + int32_t order = ASCENDING_TRAVERSE(pQueryHandle->order) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC; + int32_t end = vnodeBinarySearchKey(pCols->cols[0].pData, pCols->numOfRows, key, order); if (tsArray[end] == key) { // the value of key in cache equals to the end timestamp value, ignore it tSkipListIterNext(pCheckInfo->iter); } int32_t start = -1; - if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (ASCENDING_TRAVERSE(pQueryHandle->order)) { int32_t remain = end - pos + 1; if (remain + numOfRows > pQueryHandle->outputCapacity) { end = (pQueryHandle->outputCapacity - numOfRows) + pos - 1; @@ -950,9 +933,13 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo } while (numOfRows < pQueryHandle->outputCapacity); if (numOfRows < pQueryHandle->outputCapacity) { + /** + * if cache is empty, load remain file block data. In contrast, if there are remain data in cache, do NOT + * copy them all to result buffer, since it may be overlapped with file data block. + */ if (node == NULL || - ((dataRowKey(SL_GET_NODE_DATA(node)) > pQueryHandle->window.ekey) && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - ((dataRowKey(SL_GET_NODE_DATA(node)) < pQueryHandle->window.ekey) && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))) { + ((dataRowKey(SL_GET_NODE_DATA(node)) > pQueryHandle->window.ekey) && ASCENDING_TRAVERSE(pQueryHandle->order)) || + ((dataRowKey(SL_GET_NODE_DATA(node)) < pQueryHandle->window.ekey) && !ASCENDING_TRAVERSE(pQueryHandle->order))) { // no data in cache or data in cache is greater than the ekey of time window, load data from file block if (cur->win.skey == TSKEY_INITIAL_VAL) { cur->win.skey = tsArray[pos]; @@ -962,7 +949,7 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo int32_t end = -1; // all remain data are qualified, but check the remain capacity in the first place. - if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (ASCENDING_TRAVERSE(pQueryHandle->order)) { int32_t remain = endPos - pos + 1; if (remain + numOfRows > pQueryHandle->outputCapacity) { endPos = (pQueryHandle->outputCapacity - numOfRows) + pos - 1; @@ -982,44 +969,22 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo numOfRows = copyDataFromFileBlock(pQueryHandle, pQueryHandle->outputCapacity, numOfRows, start, end); pos += (end - start + 1) * step; - } else { - - while(numOfRows < pQueryHandle->outputCapacity && node != NULL && - (((dataRowKey(SL_GET_NODE_DATA(node)) <= pQueryHandle->window.ekey) && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - ((dataRowKey(SL_GET_NODE_DATA(node)) >= pQueryHandle->window.ekey) && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)))) { - SDataRow row = SL_GET_NODE_DATA(node); - TSKEY key = dataRowKey(row); - - copyOneRowFromMem(pQueryHandle, pCheckInfo, pQueryHandle->outputCapacity, numOfRows, row, pSchema); - numOfRows += 1; - - if (cur->win.skey == TSKEY_INITIAL_VAL) { - cur->win.skey = key; - } - - cur->win.ekey = key; - cur->lastKey = key + step; - cur->mixBlock = true; - - tSkipListIterNext(pCheckInfo->iter); - node = tSkipListIterGet(pCheckInfo->iter); - } } } } - cur->blockCompleted = (((pos >= endPos || cur->lastKey > pQueryHandle->window.ekey) && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - ((pos <= endPos || cur->lastKey < pQueryHandle->window.ekey) && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))); + cur->blockCompleted = (((pos >= endPos || cur->lastKey > pQueryHandle->window.ekey) && ASCENDING_TRAVERSE(pQueryHandle->order)) || + ((pos <= endPos || cur->lastKey < pQueryHandle->window.ekey) && !ASCENDING_TRAVERSE(pQueryHandle->order))); - if (!ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (!ASCENDING_TRAVERSE(pQueryHandle->order)) { SWAP(cur->win.skey, cur->win.ekey, TSKEY); // if the buffer is not full in case of descending order query, move the data in the front of the buffer if (numOfRows < pQueryHandle->outputCapacity) { int32_t emptySize = pQueryHandle->outputCapacity - numOfRows; - int32_t reqiredNumOfCols = taosArrayGetSize(pQueryHandle->pColumns); - for(int32_t i = 0; i < reqiredNumOfCols; ++i) { + int32_t requiredNumOfCols = taosArrayGetSize(pQueryHandle->pColumns); + for(int32_t i = 0; i < requiredNumOfCols; ++i) { SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); memmove(pColInfo->pData, pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes); } @@ -1037,7 +1002,7 @@ static void mergeDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) { int firstPos, lastPos, midPos = -1; - int numOfPoints; + int numOfRows; TSKEY* keyList; if (num <= 0) return -1; @@ -1053,8 +1018,8 @@ int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) { if (key == keyList[firstPos]) return firstPos; if (key < keyList[firstPos]) return firstPos - 1; - numOfPoints = lastPos - firstPos + 1; - midPos = (numOfPoints >> 1) + firstPos; + numOfRows = lastPos - firstPos + 1; + midPos = (numOfRows >> 1) + firstPos; if (key < keyList[midPos]) { lastPos = midPos - 1; @@ -1079,8 +1044,8 @@ int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) { return lastPos; } - numOfPoints = lastPos - firstPos + 1; - midPos = (numOfPoints >> 1) + firstPos; + numOfRows = lastPos - firstPos + 1; + midPos = (numOfRows >> 1) + firstPos; if (key < keyList[midPos]) { lastPos = midPos - 1; @@ -1100,7 +1065,8 @@ static void cleanBlockOrderSupporter(SBlockOrderSupporter* pSupporter, int32_t n tfree(pSupporter->blockIndexArray); for (int32_t i = 0; i < numOfTables; ++i) { - tfree(pSupporter->pDataBlockInfo[i]); + STableBlockInfo* pBlockInfo = pSupporter->pDataBlockInfo[i]; + tfree(pBlockInfo); } tfree(pSupporter->pDataBlockInfo); @@ -1126,14 +1092,14 @@ static int32_t dataBlockOrderCompar(const void* pLeft, const void* pRight, void* STableBlockInfo* pLeftBlockInfoEx = &pSupporter->pDataBlockInfo[leftTableIndex][leftTableBlockIndex]; STableBlockInfo* pRightBlockInfoEx = &pSupporter->pDataBlockInfo[rightTableIndex][rightTableBlockIndex]; - // assert(pLeftBlockInfoEx->pBlock.compBlock->offset != pRightBlockInfoEx->pBlock.compBlock->offset); - if (pLeftBlockInfoEx->pBlock.compBlock->offset == pRightBlockInfoEx->pBlock.compBlock->offset && - pLeftBlockInfoEx->pBlock.compBlock->last == pRightBlockInfoEx->pBlock.compBlock->last) { + // assert(pLeftBlockInfoEx->compBlock->offset != pRightBlockInfoEx->compBlock->offset); + if (pLeftBlockInfoEx->compBlock->offset == pRightBlockInfoEx->compBlock->offset && + pLeftBlockInfoEx->compBlock->last == pRightBlockInfoEx->compBlock->last) { // todo add more information - uError("error in header file, two block with same offset:%p", pLeftBlockInfoEx->pBlock.compBlock->offset); + uError("error in header file, two block with same offset:%p", pLeftBlockInfoEx->compBlock->offset); } - return pLeftBlockInfoEx->pBlock.compBlock->offset > pRightBlockInfoEx->pBlock.compBlock->offset ? 1 : -1; + return pLeftBlockInfoEx->compBlock->offset > pRightBlockInfoEx->compBlock->offset ? 1 : -1; } static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numOfBlocks, int32_t* numOfAllocBlocks) { @@ -1142,7 +1108,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO return TSDB_CODE_SERV_OUT_OF_MEMORY; } - pQueryHandle->pDataBlockInfo = (STableBlockInfo*)tmp; + pQueryHandle->pDataBlockInfo = (STableBlockInfo*) tmp; memset(pQueryHandle->pDataBlockInfo, 0, sizeof(STableBlockInfo) * numOfBlocks); *numOfAllocBlocks = numOfBlocks; @@ -1158,9 +1124,10 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO cleanBlockOrderSupporter(&sup, 0); return TSDB_CODE_SERV_OUT_OF_MEMORY; } - + int32_t cnt = 0; int32_t numOfQualTables = 0; + for (int32_t j = 0; j < numOfTables; ++j) { STableCheckInfo* pTableCheck = (STableCheckInfo*)taosArrayGet(pQueryHandle->pTableCheckInfo, j); if (pTableCheck->numOfBlocks <= 0) { @@ -1179,14 +1146,12 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO sup.pDataBlockInfo[numOfQualTables] = (STableBlockInfo*)buf; for (int32_t k = 0; k < pTableCheck->numOfBlocks; ++k) { - STableBlockInfo* pBlockInfoEx = &sup.pDataBlockInfo[numOfQualTables][k]; + STableBlockInfo* pBlockInfo = &sup.pDataBlockInfo[numOfQualTables][k]; - pBlockInfoEx->pBlock.compBlock = &pBlock[k]; - pBlockInfoEx->pBlock.fields = NULL; - - pBlockInfoEx->pTableCheckInfo = pTableCheck; - // pBlockInfoEx->groupIdx = pTableCheckInfo[j]->groupIdx; // set the group index - // pBlockInfoEx->blockIndex = pTableCheckInfo[j]->start + k; // set the block index in original table + pBlockInfo->compBlock = &pBlock[k]; + pBlockInfo->pTableCheckInfo = pTableCheck; + // pBlockInfo->groupIdx = pTableCheckInfo[j]->groupIdx; // set the group index + // pBlockInfo->blockIndex = pTableCheckInfo[j]->start + k; // set the block index in original table cnt++; } @@ -1211,8 +1176,8 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO int32_t pos = pTree->pNode[0].index; int32_t index = sup.blockIndexArray[pos]++; - STableBlockInfo* pBlocksInfoEx = sup.pDataBlockInfo[pos]; - pQueryHandle->pDataBlockInfo[numOfTotal++] = pBlocksInfoEx[index]; + STableBlockInfo* pBlocksInfo = sup.pDataBlockInfo[pos]; + pQueryHandle->pDataBlockInfo[numOfTotal++] = pBlocksInfo[index]; // set data block index overflow, in order to disable the offset comparator if (sup.blockIndexArray[pos] >= sup.numOfBlocksPerTable[pos]) { @@ -1225,7 +1190,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO /* * available when no import exists * for(int32_t i = 0; i < cnt - 1; ++i) { - * assert((*pDataBlockInfo)[i].pBlock.compBlock->offset < (*pDataBlockInfo)[i+1].pBlock.compBlock->offset); + * assert((*pDataBlockInfo)[i].compBlock->offset < (*pDataBlockInfo)[i+1].compBlock->offset); * } */ @@ -1245,7 +1210,7 @@ static bool getDataBlocksInFilesImpl(STsdbQueryHandle* pQueryHandle) { int32_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); while ((pQueryHandle->pFileGroup = tsdbGetFileGroupNext(&pQueryHandle->fileIter)) != NULL) { - int32_t type = ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)? QUERY_RANGE_GREATER_EQUAL:QUERY_RANGE_LESS_EQUAL; + int32_t type = ASCENDING_TRAVERSE(pQueryHandle->order)? QUERY_RANGE_GREATER_EQUAL:QUERY_RANGE_LESS_EQUAL; if (getFileCompInfo(pQueryHandle, &numOfBlocks, type) != TSDB_CODE_SUCCESS) { break; } @@ -1277,11 +1242,11 @@ static bool getDataBlocksInFilesImpl(STsdbQueryHandle* pQueryHandle) { return false; } - cur->slot = ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)? 0:pQueryHandle->numOfBlocks-1; + cur->slot = ASCENDING_TRAVERSE(pQueryHandle->order)? 0:pQueryHandle->numOfBlocks-1; cur->fid = pQueryHandle->pFileGroup->fileId; STableBlockInfo* pBlockInfo = &pQueryHandle->pDataBlockInfo[cur->slot]; - return loadFileDataBlock(pQueryHandle, pBlockInfo->pBlock.compBlock, pBlockInfo->pTableCheckInfo); + return loadFileDataBlock(pQueryHandle, pBlockInfo->compBlock, pBlockInfo->pTableCheckInfo); } static bool getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle) { @@ -1304,24 +1269,24 @@ static bool getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle) { // current block is done, try next if (!cur->mixBlock || cur->blockCompleted) { - if ((cur->slot == pQueryHandle->numOfBlocks - 1 && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - (cur->slot == 0 && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))) { + if ((cur->slot == pQueryHandle->numOfBlocks - 1 && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (cur->slot == 0 && !ASCENDING_TRAVERSE(pQueryHandle->order))) { // all data blocks in current file has been checked already, try next file if exists return getDataBlocksInFilesImpl(pQueryHandle); - } else { // next block of the same file - int32_t step = ASCENDING_ORDER_TRAVERSE(pQueryHandle->order) ? 1 : -1; + } else { + // next block of the same file + int32_t step = ASCENDING_TRAVERSE(pQueryHandle->order) ? 1 : -1; cur->slot += step; cur->mixBlock = false; cur->blockCompleted = false; STableBlockInfo* pNext = &pQueryHandle->pDataBlockInfo[cur->slot]; - return loadFileDataBlock(pQueryHandle, pNext->pBlock.compBlock, pNext->pTableCheckInfo); + return loadFileDataBlock(pQueryHandle, pNext->compBlock, pNext->pTableCheckInfo); } } else { - SArray* sa = getDefaultLoadColumns(pQueryHandle, true); - mergeDataInDataBlock(pQueryHandle, pCheckInfo, pBlockInfo->pBlock.compBlock, sa); - return true; + handleDataMergeIfNeeded(pQueryHandle, pBlockInfo->compBlock, pCheckInfo); + return pQueryHandle->realNumOfRows > 0; } } } @@ -1364,7 +1329,7 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pqHandle) { void changeQueryHandleForLastrowQuery(TsdbQueryHandleT pqHandle) { STsdbQueryHandle* pQueryHandle = (STsdbQueryHandle*) pqHandle; - assert(!ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)); + assert(!ASCENDING_TRAVERSE(pQueryHandle->order)); // starts from the buffer in case of descending timestamp order check data blocks @@ -1432,8 +1397,8 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY SDataRow row = SL_GET_NODE_DATA(node); TSKEY key = dataRowKey(row); - if ((key > maxKey && ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) || - (key < maxKey && !ASCENDING_ORDER_TRAVERSE(pQueryHandle->order))) { + if ((key > maxKey && ASCENDING_TRAVERSE(pQueryHandle->order)) || + (key < maxKey && !ASCENDING_TRAVERSE(pQueryHandle->order))) { uTrace("%p key:%"PRIu64" beyond qrange:%"PRId64" - %"PRId64", no more data in buffer", pQueryHandle, key, pQueryHandle->window.skey, pQueryHandle->window.ekey); @@ -1456,7 +1421,7 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); - if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order)) { + if (ASCENDING_TRAVERSE(pQueryHandle->order)) { pData = pColInfo->pData + numOfRows * pColInfo->info.bytes; } else { pData = pColInfo->pData + (maxRowsToRead - numOfRows - 1) * pColInfo->info.bytes; @@ -1489,7 +1454,7 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY assert(numOfRows <= maxRowsToRead); // if the buffer is not full in case of descending order query, move the data in the front of the buffer - if (!ASCENDING_ORDER_TRAVERSE(pQueryHandle->order) && numOfRows < maxRowsToRead) { + if (!ASCENDING_TRAVERSE(pQueryHandle->order) && numOfRows < maxRowsToRead) { int32_t emptySize = maxRowsToRead - numOfRows; for(int32_t i = 0; i < numOfCols; ++i) { @@ -1505,65 +1470,94 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY SDataBlockInfo tsdbRetrieveDataBlockInfo(TsdbQueryHandleT* pQueryHandle) { STsdbQueryHandle* pHandle = (STsdbQueryHandle*)pQueryHandle; - STable* pTable = NULL; - int32_t rows = 0; - - int32_t step = ASCENDING_ORDER_TRAVERSE(pHandle->order)? 1:-1; + int32_t step = ASCENDING_TRAVERSE(pHandle->order)? 1:-1; // there are data in file if (pHandle->cur.fid >= 0) { STableBlockInfo* pBlockInfo = &pHandle->pDataBlockInfo[pHandle->cur.slot]; - STableCheckInfo* pCheckInfo = pBlockInfo->pTableCheckInfo; + STable* pTable = pBlockInfo->pTableCheckInfo->pTableObj; - pTable = pCheckInfo->pTableObj; + SDataBlockInfo blockInfo = { + .uid = pTable->tableId.uid, + .tid = pTable->tableId.tid, + .rows = pHandle->cur.rows, + .window = pHandle->cur.win, + .numOfCols = QH_GET_NUM_OF_COLS(pHandle), + }; - if (pHandle->cur.mixBlock) { - SDataBlockInfo blockInfo = { - .uid = pTable->tableId.uid, - .tid = pTable->tableId.tid, - .rows = pHandle->cur.rows, - .window = pHandle->cur.win, - }; - - return blockInfo; - } else { - SDataBlockInfo binfo = getTrueDataBlockInfo(pCheckInfo, pBlockInfo->pBlock.compBlock); - return binfo; - } + return blockInfo; } else { STableCheckInfo* pCheckInfo = taosArrayGet(pHandle->pTableCheckInfo, pHandle->activeIndex); - pTable = pCheckInfo->pTableObj; - - if (pTable->mem != NULL) { - // create mem table iterator if it is not created yet + SQueryFilePos* cur = &pHandle->cur; + + STable* pTable = pCheckInfo->pTableObj; + if (pTable->mem != NULL) { // create mem table iterator if it is not created yet assert(pCheckInfo->iter != NULL); - STimeWindow* win = &pHandle->cur.win; + STimeWindow* win = &cur->win; - rows = tsdbReadRowsFromCache(pCheckInfo->iter, pCheckInfo->pTableObj, pHandle->window.ekey, + pHandle->cur.rows = tsdbReadRowsFromCache(pCheckInfo->iter, pCheckInfo->pTableObj, pHandle->window.ekey, pHandle->outputCapacity, &win->skey, &win->ekey, pHandle); // todo refactor API // update the last key value pCheckInfo->lastKey = win->ekey + step; + cur->lastKey = win->ekey + step; + cur->mixBlock = true; } - if (!ASCENDING_ORDER_TRAVERSE(pHandle->order)) { + if (!ASCENDING_TRAVERSE(pHandle->order)) { SWAP(pHandle->cur.win.skey, pHandle->cur.win.ekey, TSKEY); } SDataBlockInfo blockInfo = { .uid = pTable->tableId.uid, .tid = pTable->tableId.tid, - .rows = rows, + .rows = pHandle->cur.rows, .window = pHandle->cur.win, + .numOfCols = QH_GET_NUM_OF_COLS(pHandle), }; return blockInfo; } } -// return null for data block in cache +/* + * return null for mixed data block, if not a complete file data block, the statistics value will always return NULL + */ int32_t tsdbRetrieveDataBlockStatisInfo(TsdbQueryHandleT* pQueryHandle, SDataStatis** pBlockStatis) { - *pBlockStatis = NULL; + STsdbQueryHandle* pHandle = (STsdbQueryHandle*) pQueryHandle; + + SQueryFilePos* cur = &pHandle->cur; + if (cur->mixBlock) { + *pBlockStatis = NULL; + return TSDB_CODE_SUCCESS; + } + + assert((cur->slot >= 0 && cur->slot < pHandle->numOfBlocks) || + ((cur->slot == pHandle->numOfBlocks) && (cur->slot == 0))); + + STableBlockInfo* pBlockInfo = &pHandle->pDataBlockInfo[cur->slot]; + tsdbLoadCompData(&pHandle->rhelper, pBlockInfo->compBlock, NULL); + + size_t numOfCols = QH_GET_NUM_OF_COLS(pHandle); + for(int32_t i = 0; i < numOfCols; ++i) { + SDataStatis* st = &pHandle->statis[i]; + int32_t colId = st->colId; + + memset(st, 0, sizeof(SDataStatis)); + st->colId = colId; + } + + tsdbGetDataStatis(&pHandle->rhelper, pHandle->statis, numOfCols); + + *pBlockStatis = pHandle->statis; + + //update the number of NULL data rows + for(int32_t i = 0; i < numOfCols; ++i) { + if (pHandle->statis[i].numOfNull == -1) { // set the column data are all NULL + pHandle->statis[i].numOfNull = pBlockInfo->compBlock->numOfRows; + } + } + return TSDB_CODE_SUCCESS; } @@ -1577,13 +1571,13 @@ SArray* tsdbRetrieveDataBlock(TsdbQueryHandleT* pQueryHandle, SArray* pIdList) { if (pHandle->cur.fid < 0) { return pHandle->pColumns; } else { - STableBlockInfo* pBlockInfoEx = &pHandle->pDataBlockInfo[pHandle->cur.slot]; - STableCheckInfo* pCheckInfo = pBlockInfoEx->pTableCheckInfo; + STableBlockInfo* pBlockInfo = &pHandle->pDataBlockInfo[pHandle->cur.slot]; + STableCheckInfo* pCheckInfo = pBlockInfo->pTableCheckInfo; if (pHandle->cur.mixBlock) { return pHandle->pColumns; } else { - SDataBlockInfo binfo = getTrueDataBlockInfo(pCheckInfo, pBlockInfoEx->pBlock.compBlock); + SDataBlockInfo binfo = getTrueDataBlockInfo(pCheckInfo, pBlockInfo->compBlock); assert(pHandle->realNumOfRows <= binfo.rows); // data block has been loaded, todo extract method @@ -1593,14 +1587,14 @@ SArray* tsdbRetrieveDataBlock(TsdbQueryHandleT* pQueryHandle, SArray* pIdList) { pBlockLoadInfo->tid == pCheckInfo->pTableObj->tableId.tid) { return pHandle->pColumns; } else { // only load the file block - SCompBlock* pBlock = pBlockInfoEx->pBlock.compBlock; + SCompBlock* pBlock = pBlockInfo->compBlock; doLoadFileDataBlock(pHandle, pBlock, pCheckInfo); // todo refactor - int32_t numOfRows = copyDataFromFileBlock(pHandle, pHandle->outputCapacity, 0, 0, pBlock->numOfPoints - 1); + int32_t numOfRows = copyDataFromFileBlock(pHandle, pHandle->outputCapacity, 0, 0, pBlock->numOfRows - 1); // if the buffer is not full in case of descending order query, move the data in the front of the buffer - if (!ASCENDING_ORDER_TRAVERSE(pHandle->order) && numOfRows < pHandle->outputCapacity) { + if (!ASCENDING_TRAVERSE(pHandle->order) && numOfRows < pHandle->outputCapacity) { int32_t emptySize = pHandle->outputCapacity - numOfRows; int32_t reqNumOfCols = taosArrayGetSize(pHandle->pColumns); @@ -1700,7 +1694,7 @@ void filterPrepare(void* expr, void* param) { tVariant* pCond = pExpr->_node.pRight->pVal; SSchema* pSchema = pExpr->_node.pLeft->pSchema; - // todo : if current super table does not change schema yet, this function may failed, add test case + // todo : if current super table does not change schema yet, this function may fail to get correct schema, test case int32_t index = getTagColumnIndex(pTSSchema, pSchema); assert((index >= 0 && i < TSDB_MAX_TAGS) || (index == TSDB_TBNAME_COLUMN_INDEX)); @@ -2039,8 +2033,9 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) { } taosArrayDestroy(pQueryHandle->pColumns); - tfree(pQueryHandle->pDataBlockInfo); + tfree(pQueryHandle->statis); + tsdbDestroyHelper(&pQueryHandle->rhelper); tfree(pQueryHandle); diff --git a/src/util/inc/tarray.h b/src/util/inc/tarray.h index 866bde0938..4d44e82b1b 100644 --- a/src/util/inc/tarray.h +++ b/src/util/inc/tarray.h @@ -129,7 +129,7 @@ void taosArraySort(SArray* pArray, int (*compar)(const void*, const void*)); * sort string array * @param pArray */ -void taosArraySortString(SArray* pArray); +void taosArraySortString(SArray* pArray, __compar_fn_t comparFn); /** * search the array @@ -137,14 +137,14 @@ void taosArraySortString(SArray* pArray); * @param compar * @param key */ -void* taosArraySearch(const SArray* pArray, int (*compar)(const void*, const void*), const void* key); +void* taosArraySearch(const SArray* pArray, const void* key, __compar_fn_t comparFn); /** * search the array * @param pArray * @param key */ -char* taosArraySearchString(const SArray* pArray, const char* key); +char* taosArraySearchString(const SArray* pArray, const char* key, __compar_fn_t comparFn); #ifdef __cplusplus } diff --git a/src/util/inc/tcompare.h b/src/util/inc/tcompare.h index 8aaa39e483..5e951923c1 100644 --- a/src/util/inc/tcompare.h +++ b/src/util/inc/tcompare.h @@ -34,16 +34,18 @@ typedef struct SPatternCompareInfo { char matchOne; // symbol for match one wildcard, default: '_' } SPatternCompareInfo; -int patternMatch(const char *zPattern, const char *zString, size_t size, const SPatternCompareInfo *pInfo); +int patternMatch(const char *pattern, const char *str, size_t size, const SPatternCompareInfo *pInfo); -int WCSPatternMatch(const wchar_t *zPattern, const wchar_t *zString, size_t size, const SPatternCompareInfo *pInfo); +int WCSPatternMatch(const wchar_t *pattern, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo); -int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size); +int32_t doCompare(const char* a, const char* b, int32_t type, size_t size); __compar_fn_t getKeyComparFunc(int32_t keyType); __compar_fn_t getComparFunc(int32_t type, int32_t optr); +int32_t taosArrayCompareString(const void* a, const void* b); + #ifdef __cplusplus } #endif diff --git a/src/util/inc/tsocket.h b/src/util/inc/tsocket.h index 309aa80ef6..97abc16333 100644 --- a/src/util/inc/tsocket.h +++ b/src/util/inc/tsocket.h @@ -31,7 +31,6 @@ int taosOpenUdpSocket(uint32_t localIp, uint16_t localPort); int taosOpenTcpClientSocket(uint32_t ip, uint16_t port, uint32_t localIp); int taosOpenTcpServerSocket(uint32_t ip, uint16_t port); int taosKeepTcpAlive(int sockFd); -void taosCloseTcpSocket(int sockFd); int taosGetFqdn(char *); uint32_t taosGetIpFromFqdn(const char *); diff --git a/src/util/src/tarray.c b/src/util/src/tarray.c index 5198597ff7..8908dc2e65 100755 --- a/src/util/src/tarray.c +++ b/src/util/src/tarray.c @@ -197,30 +197,23 @@ void taosArraySort(SArray* pArray, int (*compar)(const void*, const void*)) { qsort(pArray->pData, pArray->size, pArray->elemSize, compar); } -void* taosArraySearch(const SArray* pArray, int (*compar)(const void*, const void*), const void* key) { - assert(pArray != NULL); - assert(compar != NULL); +void* taosArraySearch(const SArray* pArray, const void* key, __compar_fn_t comparFn) { + assert(pArray != NULL && comparFn != NULL); assert(key != NULL); - return bsearch(key, pArray->pData, pArray->size, pArray->elemSize, compar); + return bsearch(key, pArray->pData, pArray->size, pArray->elemSize, comparFn); } -static int taosArrayCompareString(const void* a, const void* b) { - const char* x = *(const char**)a; - const char* y = *(const char**)b; - return strcmp(x, y); -} - -void taosArraySortString(SArray* pArray) { +void taosArraySortString(SArray* pArray, __compar_fn_t comparFn) { assert(pArray != NULL); - qsort(pArray->pData, pArray->size, pArray->elemSize, taosArrayCompareString); + qsort(pArray->pData, pArray->size, pArray->elemSize, comparFn); } -char* taosArraySearchString(const SArray* pArray, const char* key) { +char* taosArraySearchString(const SArray* pArray, const char* key, __compar_fn_t comparFn) { assert(pArray != NULL); assert(key != NULL); - void* p = bsearch(&key, pArray->pData, pArray->size, pArray->elemSize, taosArrayCompareString); + void* p = bsearch(&key, pArray->pData, pArray->size, pArray->elemSize, comparFn); if (p == NULL) { return NULL; } diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 4bac669dc0..cb9f339f6a 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -216,30 +216,37 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH; } -static UNUSED_FUNC int32_t compareStrPatternComp(const void* pLeft, const void* pRight) { +static int32_t compareStrPatternComp(const void* pLeft, const void* pRight) { SPatternCompareInfo pInfo = {'%', '_'}; - const char* pattern = pRight; - const char* str = pLeft; - - int32_t ret = patternMatch(pattern, str, strlen(str), &pInfo); + char pattern[128] = {0}; + memcpy(pattern, varDataVal(pRight), varDataLen(pRight)); + assert(varDataLen(pRight) < 128); + int32_t ret = patternMatch(pattern, varDataVal(pLeft), varDataLen(pLeft), &pInfo); return (ret == TSDB_PATTERN_MATCH) ? 0 : 1; } +int32_t taosArrayCompareString(const void* a, const void* b) { + const char* x = *(const char**)a; + const char* y = *(const char**)b; + + return compareLenPrefixedStr(x, y); +} + static int32_t compareFindStrInArray(const void* pLeft, const void* pRight) { const SArray* arr = (const SArray*) pRight; - return taosArraySearchString(arr, pLeft) == NULL ? 0 : 1; + return taosArraySearchString(arr, pLeft, taosArrayCompareString) == NULL ? 0 : 1; } -static UNUSED_FUNC int32_t compareWStrPatternComp(const void* pLeft, const void* pRight) { +static int32_t compareWStrPatternComp(const void* pLeft, const void* pRight) { SPatternCompareInfo pInfo = {'%', '_'}; - const wchar_t* pattern = pRight; - const wchar_t* str = pLeft; - - int32_t ret = WCSPatternMatch(pattern, str, wcslen(str), &pInfo); + wchar_t pattern[128] = {0}; + memcpy(pattern, varDataVal(pRight), varDataLen(pRight)/TSDB_NCHAR_SIZE); + assert(varDataLen(pRight) < 128); + int32_t ret = WCSPatternMatch(pattern, varDataVal(pLeft), varDataLen(pLeft)/TSDB_NCHAR_SIZE, &pInfo); return (ret == TSDB_PATTERN_MATCH) ? 0 : 1; } @@ -248,25 +255,25 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { switch (type) { case TSDB_DATA_TYPE_SMALLINT: { - comparFn = compareInt16Val; break; + comparFn = compareInt16Val; break; } case TSDB_DATA_TYPE_INT: { - comparFn = compareInt32Val; break; + comparFn = compareInt32Val; break; } case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_TIMESTAMP: { - comparFn = compareInt64Val; break; + comparFn = compareInt64Val; break; } case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT:{ - comparFn = compareInt8Val; break; + comparFn = compareInt8Val; break; } case TSDB_DATA_TYPE_FLOAT: { - comparFn = compareFloatVal; break; + comparFn = compareFloatVal; break; } case TSDB_DATA_TYPE_DOUBLE: { diff --git a/src/util/src/tqueue.c b/src/util/src/tqueue.c index 1e248c9e45..475941dbdb 100644 --- a/src/util/src/tqueue.c +++ b/src/util/src/tqueue.c @@ -65,6 +65,7 @@ taos_queue taosOpenQueue() { } void taosCloseQueue(taos_queue param) { + if (param == NULL) return; STaosQueue *queue = (STaosQueue *)param; STaosQnode *pTemp; STaosQnode *pNode = queue->head; @@ -224,6 +225,7 @@ taos_qset taosOpenQset() { } void taosCloseQset(taos_qset param) { + if (param == NULL) return; STaosQset *qset = (STaosQset *)param; pthread_mutex_destroy(&qset->mutex); tsem_destroy(&qset->sem); diff --git a/src/util/src/tsocket.c b/src/util/src/tsocket.c index efdf752960..d92228a089 100644 --- a/src/util/src/tsocket.c +++ b/src/util/src/tsocket.c @@ -305,20 +305,11 @@ int taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t clientI sockFd = -1; } + // taosKeepTcpAlive(sockFd); + return sockFd; } -void taosCloseTcpSocket(int sockFd) { - struct linger linger; - linger.l_onoff = 1; - linger.l_linger = 0; - if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_LINGER, (void *)&linger, sizeof(linger)) < 0) { - uError("setsockopt SO_LINGER failed: %d (%s)", errno, strerror(errno)); - } - - taosCloseSocket(sockFd); -} - int taosKeepTcpAlive(int sockFd) { int alive = 1; if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_KEEPALIVE, (void *)&alive, sizeof(alive)) < 0) { @@ -355,6 +346,15 @@ int taosKeepTcpAlive(int sockFd) { return -1; } + struct linger linger = {0}; + linger.l_onoff = 1; + //linger.l_linger = 0; + if (taosSetSockOpt(sockFd, SOL_SOCKET, SO_LINGER, (void *)&linger, sizeof(linger)) < 0) { + uError("setsockopt SO_LINGER failed: %d (%s)", errno, strerror(errno)); + close(sockFd); + return -1; + } + return 0; } diff --git a/src/util/src/ttime.c b/src/util/src/ttime.c index d34bf0e6ce..8355ed9dc1 100644 --- a/src/util/src/ttime.c +++ b/src/util/src/ttime.c @@ -13,6 +13,7 @@ * along with this program. If not, see . */ +#define _BSD_SOURCE #define _XOPEN_SOURCE #define _DEFAULT_SOURCE diff --git a/src/util/src/ttimer.c b/src/util/src/ttimer.c index 42fd13b2cd..e6ef73ef57 100644 --- a/src/util/src/ttimer.c +++ b/src/util/src/ttimer.c @@ -405,19 +405,19 @@ static bool doStopTimer(tmr_obj_t* timer, uint8_t state) { tmrTrace(fmt, timer->ctrl->label, timer->id, timer->fp, timer->param); return reusable; } - + if (state != TIMER_STATE_EXPIRED) { // timer already stopped or cancelled, has nothing to do in this case return false; } - + if (timer->executedBy == taosGetPthreadId()) { // taosTmrReset is called in the timer callback, should do nothing in this // case to avoid dead lock. note taosTmrReset must be the last statement // of the callback funtion, will be a bug otherwise. return false; } - + // timer callback is executing in another thread, we SHOULD wait it to stop, // BUT this may result in dead lock if current thread are holding a lock which // the timer callback need to acquire. so, we HAVE TO return directly. @@ -501,6 +501,7 @@ static void taosTmrModuleInit(void) { tmr_ctrl_t* ctrl = tmrCtrls + i; ctrl->next = ctrl + 1; } + (tmrCtrls + taosMaxTmrCtrl - 1)->next = NULL; unusedTmrCtrl = tmrCtrls; pthread_mutex_init(&tmrCtrlMutex, NULL); @@ -574,12 +575,12 @@ void taosTmrCleanUp(void* handle) { if (numOfTmrCtrl <=0) { taosUninitTimer(); - + taosCleanUpScheduler(tmrQhandle); for (int i = 0; i < tListLen(wheels); i++) { time_wheel_t* wheel = wheels + i; - pthread_mutex_destroy(&wheel->mutex); + pthread_mutex_destroy(&wheel->mutex); free(wheel->slots); } diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 4514d80a54..b8bc29550e 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -35,7 +35,7 @@ static void vnodeCleanUp(SVnodeObj *pVnode); static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg); static int32_t vnodeReadCfg(SVnodeObj *pVnode); static int32_t vnodeSaveVersion(SVnodeObj *pVnode); -static bool vnodeReadVersion(SVnodeObj *pVnode); +static int32_t vnodeReadVersion(SVnodeObj *pVnode); static int vnodeProcessTsdbStatus(void *arg, int status); static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size, uint64_t *fversion); static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index); @@ -46,9 +46,9 @@ static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT; #ifndef _SYNC tsync_h syncStart(const SSyncInfo *info) { return NULL; } -int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype) { return 0; } +int32_t syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle, int qtype) { return 0; } void syncStop(tsync_h shandle) {} -int syncReconfig(tsync_h shandle, const SSyncCfg * cfg) { return 0; } +int32_t syncReconfig(tsync_h shandle, const SSyncCfg * cfg) { return 0; } int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; } void syncConfirmForward(tsync_h shandle, uint64_t version, int32_t code) {} #endif @@ -73,13 +73,18 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { return TSDB_CODE_SUCCESS; } + mkdir(tsVnodeDir, 0755); + char rootDir[TSDB_FILENAME_LEN] = {0}; sprintf(rootDir, "%s/vnode%d", tsVnodeDir, pVnodeCfg->cfg.vgId); if (mkdir(rootDir, 0755) != 0) { + vPrint("vgId:%d, failed to create vnode, reason:%s dir:%s", pVnodeCfg->cfg.vgId, strerror(errno), rootDir); if (errno == EACCES) { return TSDB_CODE_NO_DISK_PERMISSIONS; } else if (errno == ENOSPC) { return TSDB_CODE_SERV_NO_DISKSPACE; + } else if (errno == ENOENT) { + return TSDB_CODE_NOT_SUCH_FILE_OR_DIR; } else if (errno == EEXIST) { } else { return TSDB_CODE_VG_INIT_FAILED; @@ -143,35 +148,20 @@ int32_t vnodeAlter(void *param, SMDCreateVnodeMsg *pVnodeCfg) { pVnode->status = TAOS_VN_STATUS_UPDATING; int32_t code = vnodeSaveCfg(pVnodeCfg); - if (code != TSDB_CODE_SUCCESS) { - vError("vgId:%d, failed to save vnode cfg, reason:%s", pVnodeCfg->cfg.vgId, tstrerror(code)); - return code; - } + if (code != TSDB_CODE_SUCCESS) return code; code = vnodeReadCfg(pVnode); - if (code != TSDB_CODE_SUCCESS) { - vError("vgId:%d, failed to read cfg file", pVnode->vgId); - taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t)); - return code; - } + if (code != TSDB_CODE_SUCCESS) return code; code = syncReconfig(pVnode->sync, &pVnode->syncCfg); - if (code != TSDB_CODE_SUCCESS) { - vTrace("vgId:%d, failed to alter vnode, canot reconfig sync, result:%s", pVnode->vgId, - tstrerror(code)); - return code; - } + if (code != TSDB_CODE_SUCCESS) return code; code = tsdbConfigRepo(pVnode->tsdb, &pVnode->tsdbCfg); - if (code != TSDB_CODE_SUCCESS) { - vTrace("vgId:%d, failed to alter vnode, canot reconfig tsdb, result:%s", pVnode->vgId, - tstrerror(code)); - return code; - } + if (code != TSDB_CODE_SUCCESS) return code; pVnode->status = TAOS_VN_STATUS_READY; - vTrace("vgId:%d, vnode is altered", pVnode->vgId); + return TSDB_CODE_SUCCESS; } @@ -180,26 +170,40 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { pthread_once(&vnodeModuleInit, vnodeInit); SVnodeObj *pVnode = calloc(sizeof(SVnodeObj), 1); + if (pVnode == NULL) { + vError("vgId:%d, failed to open vnode since no enough memory", vnode); + return TAOS_SYSTEM_ERROR(errno); + } + + atomic_add_fetch_32(&tsOpennedVnodes, 1); + atomic_add_fetch_32(&pVnode->refCount, 1); + pVnode->vgId = vnode; pVnode->status = TAOS_VN_STATUS_INIT; - pVnode->refCount = 1; pVnode->version = 0; pVnode->tsdbCfg.tsdbId = pVnode->vgId; pVnode->rootDir = strdup(rootDir); - taosHashPut(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t), (char *)(&pVnode), sizeof(SVnodeObj *)); int32_t code = vnodeReadCfg(pVnode); if (code != TSDB_CODE_SUCCESS) { - vError("vgId:%d, failed to read cfg file", pVnode->vgId); - taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t)); + vnodeCleanUp(pVnode); + return code; + } + + code = vnodeReadVersion(pVnode); + if (code != TSDB_CODE_SUCCESS) { + vnodeCleanUp(pVnode); return code; } - vnodeReadVersion(pVnode); pVnode->fversion = pVnode->version; pVnode->wqueue = dnodeAllocateWqueue(pVnode); pVnode->rqueue = dnodeAllocateRqueue(pVnode); + if (pVnode->wqueue == NULL || pVnode->rqueue == NULL) { + vnodeCleanUp(pVnode); + return terrno; + } SCqCfg cqCfg = {0}; sprintf(cqCfg.user, "root"); @@ -207,22 +211,29 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { cqCfg.vgId = vnode; cqCfg.cqWrite = vnodeWriteToQueue; pVnode->cq = cqOpen(pVnode, &cqCfg); + if (pVnode->cq == NULL) { + vnodeCleanUp(pVnode); + return terrno; + } STsdbAppH appH = {0}; appH.appH = (void *)pVnode; appH.notifyStatus = vnodeProcessTsdbStatus; appH.cqH = pVnode->cq; - sprintf(temp, "%s/tsdb", rootDir); pVnode->tsdb = tsdbOpenRepo(temp, &appH); if (pVnode->tsdb == NULL) { - vError("vgId:%d, failed to open tsdb at %s(%s)", pVnode->vgId, temp, tstrerror(terrno)); - taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t)); + vnodeCleanUp(pVnode); return terrno; } sprintf(temp, "%s/wal", rootDir); pVnode->wal = walOpen(temp, &pVnode->walCfg); + if (pVnode->wal == NULL) { + vnodeCleanUp(pVnode); + return terrno; + } + walRestore(pVnode->wal, pVnode, vnodeWriteToQueue); SSyncInfo syncInfo; @@ -239,16 +250,25 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { syncInfo.notifyFileSynced = vnodeNotifyFileSynced; pVnode->sync = syncStart(&syncInfo); +#ifndef _SYNC + pVnode->role = TAOS_SYNC_ROLE_MASTER; +#else + if (pVnode->sync == NULL) { + vnodeCleanUp(pVnode); + return terrno; + } +#endif + // start continuous query if (pVnode->role == TAOS_SYNC_ROLE_MASTER) cqStart(pVnode->cq); pVnode->events = NULL; - pVnode->status = TAOS_VN_STATUS_READY; vTrace("vgId:%d, vnode is opened in %s, pVnode:%p", pVnode->vgId, rootDir, pVnode); - atomic_add_fetch_32(&tsOpennedVnodes, 1); + taosHashPut(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t), (char *)(&pVnode), sizeof(SVnodeObj *)); + return TSDB_CODE_SUCCESS; } @@ -277,13 +297,6 @@ void vnodeRelease(void *pVnodeRaw) { } tfree(pVnode->rootDir); - // remove read queue - dnodeFreeRqueue(pVnode->rqueue); - pVnode->rqueue = NULL; - - // remove write queue - dnodeFreeWqueue(pVnode->wqueue); - pVnode->wqueue = NULL; if (pVnode->status == TAOS_VN_STATUS_DELETING) { char rootDir[TSDB_FILENAME_LEN] = {0}; @@ -378,15 +391,26 @@ static void vnodeCleanUp(SVnodeObj *pVnode) { pVnode->sync = NULL; } - cqClose(pVnode->cq); - pVnode->cq = NULL; - - tsdbCloseRepo(pVnode->tsdb, 1); - pVnode->tsdb = NULL; - - walClose(pVnode->wal); + if (pVnode->wal) + walClose(pVnode->wal); pVnode->wal = NULL; + if (pVnode->tsdb) + tsdbCloseRepo(pVnode->tsdb, 1); + pVnode->tsdb = NULL; + + if (pVnode->cq) + cqClose(pVnode->cq); + pVnode->cq = NULL; + + if (pVnode->wqueue) + dnodeFreeWqueue(pVnode->wqueue); + pVnode->wqueue = NULL; + + if (pVnode->rqueue) + dnodeFreeRqueue(pVnode->rqueue); + pVnode->rqueue = NULL; + vnodeRelease(pVnode); } @@ -429,7 +453,7 @@ static void vnodeNotifyRole(void *ahandle, int8_t role) { static void vnodeNotifyFileSynced(void *ahandle, uint64_t fversion) { SVnodeObj *pVnode = ahandle; - vTrace("vgId:%d, data file is synced, fversion:%" PRId64 "", pVnode->vgId, fversion); + vTrace("vgId:%d, data file is synced, fversion:%" PRId64, pVnode->vgId, fversion); pVnode->fversion = fversion; pVnode->version = fversion; @@ -453,7 +477,8 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { if (!fp) { vError("vgId:%d, failed to open vnode cfg file for write, file:%s error:%s", pVnodeCfg->cfg.vgId, cfgFile, strerror(errno)); - return errno; + terrno = TAOS_SYSTEM_ERROR(errno); + return terrno; } int32_t len = 0; @@ -503,27 +528,30 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { } static int32_t vnodeReadCfg(SVnodeObj *pVnode) { - char cfgFile[TSDB_FILENAME_LEN + 30] = {0}; + cJSON *root = NULL; + char *content = NULL; + char cfgFile[TSDB_FILENAME_LEN + 30] = {0}; + int maxLen = 1000; + + terrno = TSDB_CODE_OTHERS; sprintf(cfgFile, "%s/vnode%d/config.json", tsVnodeDir, pVnode->vgId); FILE *fp = fopen(cfgFile, "r"); if (!fp) { - vError("vgId:%d, failed to open vnode cfg file for read, file:%s, error:%s", pVnode->vgId, + vError("vgId:%d, failed to open vnode cfg file:%s to read, error:%s", pVnode->vgId, cfgFile, strerror(errno)); + terrno = TAOS_SYSTEM_ERROR(errno); + goto PARSE_OVER; + } + + content = calloc(1, maxLen + 1); + if (content == NULL) goto PARSE_OVER; + int len = fread(content, 1, maxLen, fp); + if (len <= 0) { + vError("vgId:%d, failed to read vnode cfg, content is null", pVnode->vgId); return errno; } - int ret = TSDB_CODE_OTHERS; - int maxLen = 1000; - char *content = calloc(1, maxLen + 1); - int len = fread(content, 1, maxLen, fp); - if (len <= 0) { - free(content); - fclose(fp); - vError("vgId:%d, failed to read vnode cfg, content is null", pVnode->vgId); - return false; - } - - cJSON *root = cJSON_Parse(content); + root = cJSON_Parse(content); if (root == NULL) { vError("vgId:%d, failed to read vnode cfg, invalid json format", pVnode->vgId); goto PARSE_OVER; @@ -682,19 +710,19 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { pVnode->syncCfg.nodeInfo[i].nodePort += TSDB_PORT_SYNC; } - ret = 0; + terrno = TSDB_CODE_SUCCESS; - vPrint("vgId:%d, read vnode cfg successed, replcia:%d", pVnode->vgId, pVnode->syncCfg.replica); + vPrint("vgId:%d, read vnode cfg successfully, replcia:%d", pVnode->vgId, pVnode->syncCfg.replica); for (int32_t i = 0; i < pVnode->syncCfg.replica; i++) { vPrint("vgId:%d, dnode:%d, %s:%d", pVnode->vgId, pVnode->syncCfg.nodeInfo[i].nodeId, pVnode->syncCfg.nodeInfo[i].nodeFqdn, pVnode->syncCfg.nodeInfo[i].nodePort); } PARSE_OVER: - free(content); + tfree(content); cJSON_Delete(root); - fclose(fp); - return ret; + if (fp) fclose(fp); + return terrno; } static int32_t vnodeSaveVersion(SVnodeObj *pVnode) { @@ -704,7 +732,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) { if (!fp) { vError("vgId:%d, failed to open vnode version file for write, file:%s error:%s", pVnode->vgId, versionFile, strerror(errno)); - return errno; + return TAOS_SYSTEM_ERROR(errno); } int32_t len = 0; @@ -724,29 +752,33 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) { return 0; } -static bool vnodeReadVersion(SVnodeObj *pVnode) { - char versionFile[TSDB_FILENAME_LEN + 30] = {0}; +static int32_t vnodeReadVersion(SVnodeObj *pVnode) { + char versionFile[TSDB_FILENAME_LEN + 30] = {0}; + char *content = NULL; + cJSON *root = NULL; + int maxLen = 100; + + terrno = TSDB_CODE_OTHERS; sprintf(versionFile, "%s/vnode%d/version.json", tsVnodeDir, pVnode->vgId); FILE *fp = fopen(versionFile, "r"); if (!fp) { if (errno != ENOENT) { vError("vgId:%d, failed to open version file:%s error:%s", pVnode->vgId, versionFile, strerror(errno)); + terrno = TAOS_SYSTEM_ERROR(errno); + } else { + terrno = TSDB_CODE_SUCCESS; } - return false; + goto PARSE_OVER; } - bool ret = false; - int maxLen = 100; - char *content = calloc(1, maxLen + 1); + content = calloc(1, maxLen + 1); int len = fread(content, 1, maxLen, fp); if (len <= 0) { - free(content); - fclose(fp); - vPrint("vgId:%d, failed to read vnode version, content is null", pVnode->vgId); - return false; + vError("vgId:%d, failed to read vnode version, content is null", pVnode->vgId); + goto PARSE_OVER; } - cJSON *root = cJSON_Parse(content); + root = cJSON_Parse(content); if (root == NULL) { vError("vgId:%d, failed to read vnode version, invalid json format", pVnode->vgId); goto PARSE_OVER; @@ -759,13 +791,12 @@ static bool vnodeReadVersion(SVnodeObj *pVnode) { } pVnode->version = version->valueint; - ret = true; - - vPrint("vgId:%d, read vnode version succeed, version:%" PRId64, pVnode->vgId, pVnode->version); + terrno = TSDB_CODE_SUCCESS; + vPrint("vgId:%d, read vnode version successfully, version:%" PRId64, pVnode->vgId, pVnode->version); PARSE_OVER: - free(content); + tfree(content); cJSON_Delete(root); - fclose(fp); - return ret; + if(fp) fclose(fp); + return terrno; } diff --git a/src/wal/src/walMain.c b/src/wal/src/walMain.c index 8d92fac926..ebfc9d98bb 100644 --- a/src/wal/src/walMain.c +++ b/src/wal/src/walMain.c @@ -25,6 +25,7 @@ #include "tlog.h" #include "tchecksum.h" #include "tutil.h" +#include "taoserror.h" #include "twal.h" #include "tqueue.h" @@ -56,7 +57,10 @@ static int walRemoveWalFiles(const char *path); void *walOpen(const char *path, const SWalCfg *pCfg) { SWal *pWal = calloc(sizeof(SWal), 1); - if (pWal == NULL) return NULL; + if (pWal == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return NULL; + } pWal->fd = -1; pWal->max = pCfg->wals; @@ -75,6 +79,7 @@ void *walOpen(const char *path, const SWalCfg *pCfg) { walRenew(pWal); if (pWal->fd <0) { + terrno = TAOS_SYSTEM_ERROR(errno); wError("wal:%s, failed to open", path); pthread_mutex_destroy(&pWal->mutex); free(pWal); @@ -112,9 +117,10 @@ void walClose(void *handle) { } int walRenew(void *handle) { + if (handle == NULL) return 0; SWal *pWal = handle; int code = 0; - + pthread_mutex_lock(&pWal->mutex); if (pWal->fd >=0) { @@ -156,6 +162,7 @@ int walRenew(void *handle) { int walWrite(void *handle, SWalHead *pHead) { SWal *pWal = handle; int code = 0; + if (pWal == NULL) return -1; // no wal if (pWal->level == TAOS_WAL_NOLOG) return 0; @@ -178,6 +185,7 @@ int walWrite(void *handle, SWalHead *pHead) { void walFsync(void *handle) { SWal *pWal = handle; + if (pWal == NULL) return; if (pWal->level == TAOS_WAL_FSYNC && pWal->fd >=0) { if (fsync(pWal->fd) < 0) { diff --git a/tests/pytest/account/account_create.py b/tests/pytest/account/account_create.py index 24bcc8df2f..85adfff199 100644 --- a/tests/pytest/account/account_create.py +++ b/tests/pytest/account/account_create.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): try: diff --git a/tests/pytest/account/account_del.py b/tests/pytest/account/account_del.py index 43690c6e37..7f05a39765 100644 --- a/tests/pytest/account/account_del.py +++ b/tests/pytest/account/account_del.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): print("==========step1") diff --git a/tests/pytest/alter/alter_stable.py b/tests/pytest/alter/alter_stable.py index 5772edcf7f..6852f4ef4a 100644 --- a/tests/pytest/alter/alter_stable.py +++ b/tests/pytest/alter/alter_stable.py @@ -9,9 +9,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) self.types = [ "int", "bigint", diff --git a/tests/pytest/alter/alter_table.py b/tests/pytest/alter/alter_table.py index 6e0c591da6..6d4f72556b 100644 --- a/tests/pytest/alter/alter_table.py +++ b/tests/pytest/alter/alter_table.py @@ -9,9 +9,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) self.types = [ "int", "bigint", diff --git a/tests/pytest/alter/file_corrupt.py b/tests/pytest/alter/file_corrupt.py index 51ea882270..28d50cdd38 100644 --- a/tests/pytest/alter/file_corrupt.py +++ b/tests/pytest/alter/file_corrupt.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/dbmgmt/database-name-boundary.py b/tests/pytest/dbmgmt/database-name-boundary.py index ff6dce22ae..df3b027ba7 100644 --- a/tests/pytest/dbmgmt/database-name-boundary.py +++ b/tests/pytest/dbmgmt/database-name-boundary.py @@ -23,9 +23,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): diff --git a/tests/pytest/dbmgmt/dropDB_memory_test.py b/tests/pytest/dbmgmt/dropDB_memory_test.py index b029945be2..0f0925c268 100644 --- a/tests/pytest/dbmgmt/dropDB_memory_test.py +++ b/tests/pytest/dbmgmt/dropDB_memory_test.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index ab5db30051..cceb17b0de 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -1,127 +1,134 @@ #!/bin/bash -python3 ./test.py $1 -f insert/basic.py -python3 ./test.py $1 -f insert/int.py -python3 ./test.py $1 -f insert/float.py -python3 ./test.py $1 -f insert/bigint.py -python3 ./test.py $1 -f insert/bool.py -python3 ./test.py $1 -f insert/double.py -python3 ./test.py $1 -f insert/smallint.py -python3 ./test.py $1 -f insert/tinyint.py -python3 ./test.py $1 -f insert/date.py -python3 ./test.py $1 -f insert/binary.py -python3 ./test.py $1 -f insert/nchar.py -python3 ./test.py $1 -f insert/nchar-boundary.py -python3 ./test.py $1 -f insert/nchar-unicode.py -python3 ./test.py $1 -f insert/multi.py +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 $1 -f table/column_name.py -python3 ./test.py $1 -f table/column_num.py -python3 ./test.py $1 -f table/db_table.py -python3 ./test.py $1 -f table/tablename-boundary.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 $1 -f tag_lite/filter.py -python3 ./test.py $1 -f tag_lite/create-tags-boundary.py -python3 ./test.py $1 -f tag_lite/3.py -python3 ./test.py $1 -f tag_lite/4.py -python3 ./test.py $1 -f tag_lite/5.py -python3 ./test.py $1 -f tag_lite/6.py -python3 ./test.py $1 -f tag_lite/add.py -python3 ./test.py $1 -f tag_lite/bigint.py -python3 ./test.py $1 -f tag_lite/binary_binary.py -python3 ./test.py $1 -f tag_lite/binary.py -python3 ./test.py $1 -f tag_lite/bool_binary.py -python3 ./test.py $1 -f tag_lite/bool_int.py -python3 ./test.py $1 -f tag_lite/bool.py -python3 ./test.py $1 -f tag_lite/change.py -python3 ./test.py $1 -f tag_lite/column.py -python3 ./test.py $1 -f tag_lite/commit.py -python3 ./test.py $1 -f tag_lite/create.py -python3 ./test.py $1 -f tag_lite/datatype.py -python3 ./test.py $1 -f tag_lite/datatype-without-alter.py -python3 ./test.py $1 -f tag_lite/delete.py -python3 ./test.py $1 -f tag_lite/double.py -python3 ./test.py $1 -f tag_lite/float.py -python3 ./test.py $1 -f tag_lite/int_binary.py -python3 ./test.py $1 -f tag_lite/int_float.py -python3 ./test.py $1 -f tag_lite/int.py -python3 ./test.py $1 -f tag_lite/set.py -python3 ./test.py $1 -f tag_lite/smallint.py -python3 ./test.py $1 -f tag_lite/tinyint.py +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 $1 -f dbmgmt/database-name-boundary.py +python3 ./test.py -f dbmgmt/database-name-boundary.py -python3 ./test.py $1 -f import_merge/importBlock1HO.py -python3 ./test.py $1 -f import_merge/importBlock1HPO.py -python3 ./test.py $1 -f import_merge/importBlock1H.py -python3 ./test.py $1 -f import_merge/importBlock1S.py -python3 ./test.py $1 -f import_merge/importBlock1Sub.py -python3 ./test.py $1 -f import_merge/importBlock1TO.py -python3 ./test.py $1 -f import_merge/importBlock1TPO.py -python3 ./test.py $1 -f import_merge/importBlock1T.py -python3 ./test.py $1 -f import_merge/importBlock2HO.py -python3 ./test.py $1 -f import_merge/importBlock2HPO.py -python3 ./test.py $1 -f import_merge/importBlock2H.py -python3 ./test.py $1 -f import_merge/importBlock2S.py -python3 ./test.py $1 -f import_merge/importBlock2Sub.py -python3 ./test.py $1 -f import_merge/importBlock2TO.py -python3 ./test.py $1 -f import_merge/importBlock2TPO.py -python3 ./test.py $1 -f import_merge/importBlock2T.py -python3 ./test.py $1 -f import_merge/importBlockbetween.py -python3 ./test.py $1 -f import_merge/importCacheFileHO.py -python3 ./test.py $1 -f import_merge/importCacheFileHPO.py -python3 ./test.py $1 -f import_merge/importCacheFileH.py -python3 ./test.py $1 -f import_merge/importCacheFileS.py -python3 ./test.py $1 -f import_merge/importCacheFileSub.py -python3 ./test.py $1 -f import_merge/importCacheFileTO.py -python3 ./test.py $1 -f import_merge/importCacheFileTPO.py -python3 ./test.py $1 -f import_merge/importCacheFileT.py -python3 ./test.py $1 -f import_merge/importDataH2.py -python3 ./test.py $1 -f import_merge/importDataHO2.py -python3 ./test.py $1 -f import_merge/importDataHO.py -python3 ./test.py $1 -f import_merge/importDataHPO.py -python3 ./test.py $1 -f import_merge/importDataLastHO.py -python3 ./test.py $1 -f import_merge/importDataLastHPO.py -python3 ./test.py $1 -f import_merge/importDataLastH.py -python3 ./test.py $1 -f import_merge/importDataLastS.py -python3 ./test.py $1 -f import_merge/importDataLastSub.py -python3 ./test.py $1 -f import_merge/importDataLastTO.py -python3 ./test.py $1 -f import_merge/importDataLastTPO.py -python3 ./test.py $1 -f import_merge/importDataLastT.py -python3 ./test.py $1 -f import_merge/importDataS.py -python3 ./test.py $1 -f import_merge/importDataSub.py -python3 ./test.py $1 -f import_merge/importDataTO.py -python3 ./test.py $1 -f import_merge/importDataTPO.py -python3 ./test.py $1 -f import_merge/importDataT.py -python3 ./test.py $1 -f import_merge/importHeadOverlap.py -python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py -python3 ./test.py $1 -f import_merge/importHead.py -python3 ./test.py $1 -f import_merge/importHORestart.py -python3 ./test.py $1 -f import_merge/importHPORestart.py -python3 ./test.py $1 -f import_merge/importHRestart.py -python3 ./test.py $1 -f import_merge/importLastHO.py -python3 ./test.py $1 -f import_merge/importLastHPO.py -python3 ./test.py $1 -f import_merge/importLastH.py -python3 ./test.py $1 -f import_merge/importLastS.py -python3 ./test.py $1 -f import_merge/importLastSub.py -python3 ./test.py $1 -f import_merge/importLastTO.py -python3 ./test.py $1 -f import_merge/importLastTPO.py -python3 ./test.py $1 -f import_merge/importLastT.py -python3 ./test.py $1 -f import_merge/importSpan.py -python3 ./test.py $1 -f import_merge/importSRestart.py -python3 ./test.py $1 -f import_merge/importSubRestart.py -python3 ./test.py $1 -f import_merge/importTailOverlap.py -python3 ./test.py $1 -f import_merge/importTailPartOverlap.py -python3 ./test.py $1 -f import_merge/importTail.py -python3 ./test.py $1 -f import_merge/importToCommit.py -python3 ./test.py $1 -f import_merge/importTORestart.py -python3 ./test.py $1 -f import_merge/importTPORestart.py -python3 ./test.py $1 -f import_merge/importTRestart.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 $1 -f user/user_create.py -python3 ./test.py $1 -f user/pass_len.py +python3 ./test.py -f user/user_create.py +python3 ./test.py -f user/pass_len.py # table -#python3 ./test.py $1 -f table/del_stable.py +#python3 ./test.py -f table/del_stable.py +#query +python3 ./test.py -f query/filter.py +python3 ./test.py $1 -f query/filterCombo.py +python3 ./test.py $1 -f query/queryNormal.py +python3 ./test.py $1 -f query/queryError.py diff --git a/tests/pytest/import_merge/importBlock1H.py b/tests/pytest/import_merge/importBlock1H.py index aef29444d6..fca37ff1b1 100644 --- a/tests/pytest/import_merge/importBlock1H.py +++ b/tests/pytest/import_merge/importBlock1H.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1HO.py b/tests/pytest/import_merge/importBlock1HO.py index ad4bcf1288..c853d3a6af 100644 --- a/tests/pytest/import_merge/importBlock1HO.py +++ b/tests/pytest/import_merge/importBlock1HO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1HPO.py b/tests/pytest/import_merge/importBlock1HPO.py index 6aabc035ec..968f21f50f 100644 --- a/tests/pytest/import_merge/importBlock1HPO.py +++ b/tests/pytest/import_merge/importBlock1HPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1S.py b/tests/pytest/import_merge/importBlock1S.py index 4b2adfb961..6a0ce18edf 100644 --- a/tests/pytest/import_merge/importBlock1S.py +++ b/tests/pytest/import_merge/importBlock1S.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1Sub.py b/tests/pytest/import_merge/importBlock1Sub.py index 343b87c757..2eaf5fc26e 100644 --- a/tests/pytest/import_merge/importBlock1Sub.py +++ b/tests/pytest/import_merge/importBlock1Sub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1T.py b/tests/pytest/import_merge/importBlock1T.py index 40f4bbfdec..ffac67a7e1 100644 --- a/tests/pytest/import_merge/importBlock1T.py +++ b/tests/pytest/import_merge/importBlock1T.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1TO.py b/tests/pytest/import_merge/importBlock1TO.py index db8b036d6f..5d6c6624d9 100644 --- a/tests/pytest/import_merge/importBlock1TO.py +++ b/tests/pytest/import_merge/importBlock1TO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock1TPO.py b/tests/pytest/import_merge/importBlock1TPO.py index f2361712e7..e7807e892a 100644 --- a/tests/pytest/import_merge/importBlock1TPO.py +++ b/tests/pytest/import_merge/importBlock1TPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2H.py b/tests/pytest/import_merge/importBlock2H.py index 62552980bd..eea1e4bcf8 100644 --- a/tests/pytest/import_merge/importBlock2H.py +++ b/tests/pytest/import_merge/importBlock2H.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2HO.py b/tests/pytest/import_merge/importBlock2HO.py index 0f53210f4a..99a9662f1c 100644 --- a/tests/pytest/import_merge/importBlock2HO.py +++ b/tests/pytest/import_merge/importBlock2HO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2HPO.py b/tests/pytest/import_merge/importBlock2HPO.py index 3b7ffbbe44..54afef6c06 100644 --- a/tests/pytest/import_merge/importBlock2HPO.py +++ b/tests/pytest/import_merge/importBlock2HPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2S.py b/tests/pytest/import_merge/importBlock2S.py index 69b0291839..9d4757709a 100644 --- a/tests/pytest/import_merge/importBlock2S.py +++ b/tests/pytest/import_merge/importBlock2S.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2Sub.py b/tests/pytest/import_merge/importBlock2Sub.py index 5b93750584..db43a492bc 100644 --- a/tests/pytest/import_merge/importBlock2Sub.py +++ b/tests/pytest/import_merge/importBlock2Sub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2T.py b/tests/pytest/import_merge/importBlock2T.py index 0d9b70299d..c0d85fa3b0 100644 --- a/tests/pytest/import_merge/importBlock2T.py +++ b/tests/pytest/import_merge/importBlock2T.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2TO.py b/tests/pytest/import_merge/importBlock2TO.py index fe57308c42..05692c336d 100644 --- a/tests/pytest/import_merge/importBlock2TO.py +++ b/tests/pytest/import_merge/importBlock2TO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlock2TPO.py b/tests/pytest/import_merge/importBlock2TPO.py index 4da52bd3f4..817d2db382 100644 --- a/tests/pytest/import_merge/importBlock2TPO.py +++ b/tests/pytest/import_merge/importBlock2TPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importBlockbetween.py b/tests/pytest/import_merge/importBlockbetween.py index eea7f7ea7c..2e4ac8a737 100644 --- a/tests/pytest/import_merge/importBlockbetween.py +++ b/tests/pytest/import_merge/importBlockbetween.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileH.py b/tests/pytest/import_merge/importCacheFileH.py index cd2b3a73f1..3398f7bdad 100644 --- a/tests/pytest/import_merge/importCacheFileH.py +++ b/tests/pytest/import_merge/importCacheFileH.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileHO.py b/tests/pytest/import_merge/importCacheFileHO.py index 2e65c337b7..19520dc3d0 100644 --- a/tests/pytest/import_merge/importCacheFileHO.py +++ b/tests/pytest/import_merge/importCacheFileHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileHPO.py b/tests/pytest/import_merge/importCacheFileHPO.py index f01ebd0d60..9e0a57fb46 100644 --- a/tests/pytest/import_merge/importCacheFileHPO.py +++ b/tests/pytest/import_merge/importCacheFileHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileS.py b/tests/pytest/import_merge/importCacheFileS.py index 0bb9107562..2f0af569e5 100644 --- a/tests/pytest/import_merge/importCacheFileS.py +++ b/tests/pytest/import_merge/importCacheFileS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileSub.py b/tests/pytest/import_merge/importCacheFileSub.py index cd5d250968..300bb6e8d0 100644 --- a/tests/pytest/import_merge/importCacheFileSub.py +++ b/tests/pytest/import_merge/importCacheFileSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileT.py b/tests/pytest/import_merge/importCacheFileT.py index be79e26bc7..ab33cf6a93 100644 --- a/tests/pytest/import_merge/importCacheFileT.py +++ b/tests/pytest/import_merge/importCacheFileT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileTO.py b/tests/pytest/import_merge/importCacheFileTO.py index dd17de3adf..00e22da976 100644 --- a/tests/pytest/import_merge/importCacheFileTO.py +++ b/tests/pytest/import_merge/importCacheFileTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importCacheFileTPO.py b/tests/pytest/import_merge/importCacheFileTPO.py index 948b99ed21..c6089e1d68 100644 --- a/tests/pytest/import_merge/importCacheFileTPO.py +++ b/tests/pytest/import_merge/importCacheFileTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataH2.py b/tests/pytest/import_merge/importDataH2.py index b5e53d862e..a21f0c47be 100644 --- a/tests/pytest/import_merge/importDataH2.py +++ b/tests/pytest/import_merge/importDataH2.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataHO.py b/tests/pytest/import_merge/importDataHO.py index f6d65a5c53..fdcaedd83c 100644 --- a/tests/pytest/import_merge/importDataHO.py +++ b/tests/pytest/import_merge/importDataHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataHO2.py b/tests/pytest/import_merge/importDataHO2.py index 6246b55b32..b094701132 100644 --- a/tests/pytest/import_merge/importDataHO2.py +++ b/tests/pytest/import_merge/importDataHO2.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataHPO.py b/tests/pytest/import_merge/importDataHPO.py index c749dbd113..9d74c0c352 100644 --- a/tests/pytest/import_merge/importDataHPO.py +++ b/tests/pytest/import_merge/importDataHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastH.py b/tests/pytest/import_merge/importDataLastH.py index 830711a420..c8e5f62423 100644 --- a/tests/pytest/import_merge/importDataLastH.py +++ b/tests/pytest/import_merge/importDataLastH.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastHO.py b/tests/pytest/import_merge/importDataLastHO.py index 037c81f087..33215997a4 100644 --- a/tests/pytest/import_merge/importDataLastHO.py +++ b/tests/pytest/import_merge/importDataLastHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastHPO.py b/tests/pytest/import_merge/importDataLastHPO.py index 46a7e5909d..fa8542f35b 100644 --- a/tests/pytest/import_merge/importDataLastHPO.py +++ b/tests/pytest/import_merge/importDataLastHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastS.py b/tests/pytest/import_merge/importDataLastS.py index 2dd7cdb744..2f595fef54 100644 --- a/tests/pytest/import_merge/importDataLastS.py +++ b/tests/pytest/import_merge/importDataLastS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastSub.py b/tests/pytest/import_merge/importDataLastSub.py index bb9953057e..5c2069c90f 100644 --- a/tests/pytest/import_merge/importDataLastSub.py +++ b/tests/pytest/import_merge/importDataLastSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastT.py b/tests/pytest/import_merge/importDataLastT.py index 29f0afaf1a..08e944eb68 100644 --- a/tests/pytest/import_merge/importDataLastT.py +++ b/tests/pytest/import_merge/importDataLastT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastTO.py b/tests/pytest/import_merge/importDataLastTO.py index 47639130b5..a82c054141 100644 --- a/tests/pytest/import_merge/importDataLastTO.py +++ b/tests/pytest/import_merge/importDataLastTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataLastTPO.py b/tests/pytest/import_merge/importDataLastTPO.py index 4190836505..ff75a1b2ae 100644 --- a/tests/pytest/import_merge/importDataLastTPO.py +++ b/tests/pytest/import_merge/importDataLastTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataS.py b/tests/pytest/import_merge/importDataS.py index daa4b2e025..37627e8d6b 100644 --- a/tests/pytest/import_merge/importDataS.py +++ b/tests/pytest/import_merge/importDataS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataSub.py b/tests/pytest/import_merge/importDataSub.py index e946a254c2..17e2b141b7 100644 --- a/tests/pytest/import_merge/importDataSub.py +++ b/tests/pytest/import_merge/importDataSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataT.py b/tests/pytest/import_merge/importDataT.py index abb5e312ef..b0b7b82b79 100644 --- a/tests/pytest/import_merge/importDataT.py +++ b/tests/pytest/import_merge/importDataT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataTO.py b/tests/pytest/import_merge/importDataTO.py index 2a6d9e272b..c0b57136af 100644 --- a/tests/pytest/import_merge/importDataTO.py +++ b/tests/pytest/import_merge/importDataTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importDataTPO.py b/tests/pytest/import_merge/importDataTPO.py index 06d5cf3c1a..8a1c9264b4 100644 --- a/tests/pytest/import_merge/importDataTPO.py +++ b/tests/pytest/import_merge/importDataTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHORestart.py b/tests/pytest/import_merge/importHORestart.py index cfbfa61c90..f74c4c76d6 100644 --- a/tests/pytest/import_merge/importHORestart.py +++ b/tests/pytest/import_merge/importHORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHPORestart.py b/tests/pytest/import_merge/importHPORestart.py index 7e96d44a1a..e5f79fbe6c 100644 --- a/tests/pytest/import_merge/importHPORestart.py +++ b/tests/pytest/import_merge/importHPORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHRestart.py b/tests/pytest/import_merge/importHRestart.py index aa1783977e..be67039789 100644 --- a/tests/pytest/import_merge/importHRestart.py +++ b/tests/pytest/import_merge/importHRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHead.py b/tests/pytest/import_merge/importHead.py index 6971986ebc..80e6d92c69 100644 --- a/tests/pytest/import_merge/importHead.py +++ b/tests/pytest/import_merge/importHead.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHeadOverlap.py b/tests/pytest/import_merge/importHeadOverlap.py index df5f07b5a2..535c0c2859 100644 --- a/tests/pytest/import_merge/importHeadOverlap.py +++ b/tests/pytest/import_merge/importHeadOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importHeadPartOverlap.py b/tests/pytest/import_merge/importHeadPartOverlap.py index 8c9885e22f..85ddd64f0a 100644 --- a/tests/pytest/import_merge/importHeadPartOverlap.py +++ b/tests/pytest/import_merge/importHeadPartOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importInsertThenImport.py b/tests/pytest/import_merge/importInsertThenImport.py new file mode 100644 index 0000000000..292fae8c47 --- /dev/null +++ b/tests/pytest/import_merge/importInsertThenImport.py @@ -0,0 +1,85 @@ +################################################################### +# 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 taos +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdSql.prepare() + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("insert 100 sequential data") + startTime = self.startTime + for rid in range(1, 101): + tdSql.execute( + 'insert into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(100) + + tdLog.info("================= step4") + tdLog.info("import 100 sequential data") + startTime = self.startTime + for rid in range(1, 101): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, 100 + rid)) + + tdSql.query('select * from tb1') + tdSql.checkRows(100) + tdSql.checkData(0, 1, 1) + + tdLog.info("================= step5") + tdDnodes.stop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdLog.info("import 100 sequential data again") + startTime = self.startTime + for rid in range(1, 101): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, 100 + rid)) + + tdLog.info("================= step7") + tdSql.query('select * from tb1') + tdSql.checkRows(100) + tdSql.checkData(0, 1, 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastH.py b/tests/pytest/import_merge/importLastH.py index a6f9fa087c..17fa233e37 100644 --- a/tests/pytest/import_merge/importLastH.py +++ b/tests/pytest/import_merge/importLastH.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastHO.py b/tests/pytest/import_merge/importLastHO.py index e6468b243e..adb44fc0ea 100644 --- a/tests/pytest/import_merge/importLastHO.py +++ b/tests/pytest/import_merge/importLastHO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastHPO.py b/tests/pytest/import_merge/importLastHPO.py index 4a299ed823..d8ed2d9ef1 100644 --- a/tests/pytest/import_merge/importLastHPO.py +++ b/tests/pytest/import_merge/importLastHPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastS.py b/tests/pytest/import_merge/importLastS.py index 2a5de46eb2..bf222a0d5f 100644 --- a/tests/pytest/import_merge/importLastS.py +++ b/tests/pytest/import_merge/importLastS.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastSub.py b/tests/pytest/import_merge/importLastSub.py index fa1b2387f3..5a6b9f4150 100644 --- a/tests/pytest/import_merge/importLastSub.py +++ b/tests/pytest/import_merge/importLastSub.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastT.py b/tests/pytest/import_merge/importLastT.py index b7a1e58bc5..2b1be1fe2b 100644 --- a/tests/pytest/import_merge/importLastT.py +++ b/tests/pytest/import_merge/importLastT.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastTO.py b/tests/pytest/import_merge/importLastTO.py index 541cbd29ca..ce189f6371 100644 --- a/tests/pytest/import_merge/importLastTO.py +++ b/tests/pytest/import_merge/importLastTO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importLastTPO.py b/tests/pytest/import_merge/importLastTPO.py index 6ec21d0c79..627d090855 100644 --- a/tests/pytest/import_merge/importLastTPO.py +++ b/tests/pytest/import_merge/importLastTPO.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importSRestart.py b/tests/pytest/import_merge/importSRestart.py index 0771b8bf9c..29f5a19b54 100644 --- a/tests/pytest/import_merge/importSRestart.py +++ b/tests/pytest/import_merge/importSRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importSpan.py b/tests/pytest/import_merge/importSpan.py index 736c4bad64..4e20e9754f 100644 --- a/tests/pytest/import_merge/importSpan.py +++ b/tests/pytest/import_merge/importSpan.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importSubRestart.py b/tests/pytest/import_merge/importSubRestart.py index f7f33d32c1..b1a6f30c43 100644 --- a/tests/pytest/import_merge/importSubRestart.py +++ b/tests/pytest/import_merge/importSubRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTORestart.py b/tests/pytest/import_merge/importTORestart.py index 194756cd12..07eb6c28cb 100644 --- a/tests/pytest/import_merge/importTORestart.py +++ b/tests/pytest/import_merge/importTORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTPORestart.py b/tests/pytest/import_merge/importTPORestart.py index 36d4b64390..10bbf3efce 100644 --- a/tests/pytest/import_merge/importTPORestart.py +++ b/tests/pytest/import_merge/importTPORestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTRestart.py b/tests/pytest/import_merge/importTRestart.py index 9308518d8c..63a9368eca 100644 --- a/tests/pytest/import_merge/importTRestart.py +++ b/tests/pytest/import_merge/importTRestart.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTail.py b/tests/pytest/import_merge/importTail.py index a80db730a0..a552edb244 100644 --- a/tests/pytest/import_merge/importTail.py +++ b/tests/pytest/import_merge/importTail.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTailOverlap.py b/tests/pytest/import_merge/importTailOverlap.py index 98596d2f77..78e51f93f9 100644 --- a/tests/pytest/import_merge/importTailOverlap.py +++ b/tests/pytest/import_merge/importTailOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importTailPartOverlap.py b/tests/pytest/import_merge/importTailPartOverlap.py index 0263114a25..e433cb66f3 100644 --- a/tests/pytest/import_merge/importTailPartOverlap.py +++ b/tests/pytest/import_merge/importTailPartOverlap.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 diff --git a/tests/pytest/import_merge/importToCommit.py b/tests/pytest/import_merge/importToCommit.py index b1a0065d47..dd2c27918a 100644 --- a/tests/pytest/import_merge/importToCommit.py +++ b/tests/pytest/import_merge/importToCommit.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 1 @@ -45,7 +45,8 @@ class TDTestCase: tdLog.info("================= step2") tdLog.info('insert data until the first commit') dnodesDir = tdDnodes.getDnodesRootDir() - dataDir = dnodesDir + '/dnode1/data/data' + dataDir = dnodesDir + '/dnode1/data/vnode' + tdLog.info('CBD: dataDir=%s' % dataDir) startTime = self.startTime rid0 = 1 while (True): diff --git a/tests/pytest/insert/basic.py b/tests/pytest/insert/basic.py index 35f830d951..dcb5834d55 100644 --- a/tests/pytest/insert/basic.py +++ b/tests/pytest/insert/basic.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/bigint.py b/tests/pytest/insert/bigint.py index 214200900a..7c7d2d0f95 100644 --- a/tests/pytest/insert/bigint.py +++ b/tests/pytest/insert/bigint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/binary-boundary.py b/tests/pytest/insert/binary-boundary.py index 583217a732..bb86ddf61c 100644 --- a/tests/pytest/insert/binary-boundary.py +++ b/tests/pytest/insert/binary-boundary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/binary.py b/tests/pytest/insert/binary.py index 677ae4bf29..0d583aa2cc 100644 --- a/tests/pytest/insert/binary.py +++ b/tests/pytest/insert/binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/bool.py b/tests/pytest/insert/bool.py index c175afd8b5..1412567cd7 100644 --- a/tests/pytest/insert/bool.py +++ b/tests/pytest/insert/bool.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/date.py b/tests/pytest/insert/date.py index fb7f1816c4..6e22e5b72e 100644 --- a/tests/pytest/insert/date.py +++ b/tests/pytest/insert/date.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/double.py b/tests/pytest/insert/double.py index 19be9653c0..1b66ed1c44 100644 --- a/tests/pytest/insert/double.py +++ b/tests/pytest/insert/double.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/float.py b/tests/pytest/insert/float.py index 414833877e..8b6277d436 100644 --- a/tests/pytest/insert/float.py +++ b/tests/pytest/insert/float.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/int.py b/tests/pytest/insert/int.py index 350426a5bd..4a94a331d6 100644 --- a/tests/pytest/insert/int.py +++ b/tests/pytest/insert/int.py @@ -20,9 +20,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/multi.py b/tests/pytest/insert/multi.py index c14d7dc2e0..5f81f12fdb 100644 --- a/tests/pytest/insert/multi.py +++ b/tests/pytest/insert/multi.py @@ -20,9 +20,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/nchar-boundary.py b/tests/pytest/insert/nchar-boundary.py index 255cc5b79a..05a66f6066 100644 --- a/tests/pytest/insert/nchar-boundary.py +++ b/tests/pytest/insert/nchar-boundary.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/nchar-unicode.py b/tests/pytest/insert/nchar-unicode.py index 12eef379d3..152a09723e 100644 --- a/tests/pytest/insert/nchar-unicode.py +++ b/tests/pytest/insert/nchar-unicode.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/nchar.py b/tests/pytest/insert/nchar.py index d61a44844d..b8e365f143 100644 --- a/tests/pytest/insert/nchar.py +++ b/tests/pytest/insert/nchar.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/randomNullCommit.py b/tests/pytest/insert/randomNullCommit.py new file mode 100644 index 0000000000..ecacd20daf --- /dev/null +++ b/tests/pytest/insert/randomNullCommit.py @@ -0,0 +1,66 @@ +################################################################### +# 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 random + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdLog.info("=============== step1") + tdSql.execute( + 'create table tb (ts timestamp, speed int, temp float, note binary(5), flag bool)') + + numOfRecords = 0 + randomList = [10, 50, 100, 500, 1000, 5000] + for i in range(0, 10): + num = random.choice(randomList) + tdLog.info("will insert %d records" % num) + for x in range(0, num): + tdLog.info( + 'insert into tb values (now + %da, NULL, NULL, NULL, TRUE)' % + x) + tdSql.execute( + 'insert into tb values (now + %da, NULL, NULL, NULL, TRUE)' % + x) + + numOfRecords = numOfRecords + num + + tdSql.query("select * from tb") + tdSql.checkRows(numOfRecords) + tdSql.checkData(numOfRecords - num, 1, None) + tdSql.checkData(numOfRecords - 1, 2, None) + + tdLog.info("stop dnode to commit data to disk") + tdDnodes.stop(1) + tdDnodes.start(1) + tdLog.sleep(5) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/smallint.py b/tests/pytest/insert/smallint.py index 0d85e45cfa..16322e9aeb 100644 --- a/tests/pytest/insert/smallint.py +++ b/tests/pytest/insert/smallint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/insert/sparseData.py b/tests/pytest/insert/sparseData.py new file mode 100644 index 0000000000..38b04b339e --- /dev/null +++ b/tests/pytest/insert/sparseData.py @@ -0,0 +1,67 @@ +################################################################### +# 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 + +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdLog.info("=============== step1") + tdSql.execute( + 'create table tb (ts timestamp, speed int, temp float, note binary(4000), flag bool)') + + numOfRecords = 1000000 + dividend = 1000 + tdLog.info("will insert %d records" % numOfRecords) + + ts = 1500000000000 + for i in range(0, numOfRecords): + + if (i % dividend): + print(".", end="") + tdSql.execute( + 'insert into tb values (%d + %da, NULL, NULL, NULL, TRUE)' % + (ts, i)) + else: + print("a", end="") + tdSql.execute( + 'insert into tb values (%d + %da, NULL, NULL, "a", FALSE)' % + (ts, i)) + + tdSql.query("select * from tb") + tdSql.checkRows(numOfRecords) + tdSql.checkData(numOfRecords - dividend, 3, 'a') + tdSql.checkData(numOfRecords - dividend - 1, 3, None) + + tdLog.info("stop dnode to commit data to disk") + tdDnodes.stop(1) + tdLog.info("dnodes:%d size is %d" % (1, tdDnodes.getDataSize(1))) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/tinyint.py b/tests/pytest/insert/tinyint.py index 6d7178054e..a10c999e8c 100644 --- a/tests/pytest/insert/tinyint.py +++ b/tests/pytest/insert/tinyint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/query/filter.py b/tests/pytest/query/filter.py new file mode 100644 index 0000000000..43c8e5bf0a --- /dev/null +++ b/tests/pytest/query/filter.py @@ -0,0 +1,114 @@ +################################################################### +# 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 taos +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, tagtype int, name nchar(16)) tags(dev nchar(50))") + tdSql.execute( + 'CREATE TABLE if not exists dev_001 using st tags("dev_01")') + tdSql.execute( + 'CREATE TABLE if not exists dev_002 using st tags("dev_02")') + + print("==============step2") + + tdSql.execute( + """INSERT INTO dev_001(ts, tagtype, name) VALUES('2020-05-13 10:00:00.000', 1, 'first'),('2020-05-13 10:00:00.001', 2, 'second'), + ('2020-05-13 10:00:00.002', 3, 'third') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first'), ('2020-05-13 10:00:00.004', 2, 'second'), + ('2020-05-13 10:00:00.005', 3, 'third')""") + + # > for timestamp type + tdSql.query("select * from db.st where ts > '2020-05-13 10:00:00.002'") + tdSql.checkRows(3) + + # > for numeric type + tdSql.query("select * from db.st where tagtype > 2") + tdSql.checkRows(2) + + # < for timestamp type + tdSql.query("select * from db.st where ts < '2020-05-13 10:00:00.002'") + tdSql.checkRows(2) + + # < for numeric type + tdSql.query("select * from db.st where tagtype < 2") + tdSql.checkRows(2) + + # >= for timestamp type + tdSql.query("select * from db.st where ts >= '2020-05-13 10:00:00.002'") + tdSql.checkRows(4) + + # >= for numeric type + tdSql.query("select * from db.st where tagtype >= 2") + tdSql.checkRows(4) + + # <= for timestamp type + tdSql.query("select * from db.st where ts <= '2020-05-13 10:00:00.002'") + tdSql.checkRows(3) + + # <= for numeric type + tdSql.query("select * from db.st where tagtype <= 2") + tdSql.checkRows(4) + + # = for timestamp type + tdSql.query("select * from db.st where ts = '2020-05-13 10:00:00.002'") + tdSql.checkRows(1) + + # = for numeric type + tdSql.query("select * from db.st where tagtype = 2") + tdSql.checkRows(2) + + # = for nchar type + tdSql.query("select * from db.st where name = 'first'") + tdSql.checkRows(2) + + # <> for timestamp type + tdSql.query("select * from db.st where ts <> '2020-05-13 10:00:00.002'") + #tdSql.checkRows(4) + + # <> for numeric type + tdSql.query("select * from db.st where tagtype <> 2") + tdSql.checkRows(4) + + # <> for nchar type + tdSql.query("select * from db.st where name <> 'first'") + tdSql.checkRows(4) + + # % for nchar type + tdSql.query("select * from db.st where name like 'fi%'") + tdSql.checkRows(2) + + # - for nchar type + tdSql.query("select * from db.st where name like '_econd'") + tdSql.checkRows(2) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/filterCombo.py b/tests/pytest/query/filterCombo.py new file mode 100644 index 0000000000..c25b6156b8 --- /dev/null +++ b/tests/pytest/query/filterCombo.py @@ -0,0 +1,60 @@ +################################################################### +# 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 taos +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, tagtype int, name nchar(16)) tags(dev nchar(50))") + tdSql.execute( + 'CREATE TABLE if not exists dev_001 using st tags("dev_01")') + tdSql.execute( + 'CREATE TABLE if not exists dev_002 using st tags("dev_02")') + + print("==============step2") + + tdSql.execute( + """INSERT INTO dev_001(ts, tagtype, name) VALUES('2020-05-13 10:00:00.000', 1, 'first'),('2020-05-13 10:00:00.001', 2, 'second'), + ('2020-05-13 10:00:00.002', 3, 'third') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first'), ('2020-05-13 10:00:00.004', 2, 'second'), + ('2020-05-13 10:00:00.005', 3, 'third')""") + + # query with filter condition A OR condition B + tdSql.query("select * from db.st where ts > '2020-05-13 10:00:00.002' AND tagtype < 2") + tdSql.checkRows(1) + + # query with filter condition A OR condition B, error expected + tdSql.error("select * from db.st where ts > '2020-05-13 10:00:00.002' OR tagtype < 2") + + # illegal condition + tdSql.error("select * from db.st where ts != '2020-05-13 10:00:00.002' OR tagtype < 2") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/query.py b/tests/pytest/query/query.py index 68b8baab64..da0ef96d0e 100644 --- a/tests/pytest/query/query.py +++ b/tests/pytest/query/query.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/query/queryError.py b/tests/pytest/query/queryError.py new file mode 100644 index 0000000000..d0515ef34d --- /dev/null +++ b/tests/pytest/query/queryError.py @@ -0,0 +1,67 @@ +################################################################### +# 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 taos +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, tagtype int, name nchar(16)) tags(dev nchar(50))") + tdSql.execute( + 'CREATE TABLE if not exists dev_001 using st tags("dev_01")') + tdSql.execute( + 'CREATE TABLE if not exists dev_002 using st tags("dev_02")') + + print("==============step2") + + tdSql.execute( + """INSERT INTO dev_001(ts, tagtype, name) VALUES('2020-05-13 10:00:00.000', 1, 'first'),('2020-05-13 10:00:00.001', 2, 'second'), + ('2020-05-13 10:00:00.002', 3, 'third') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first'), ('2020-05-13 10:00:00.004', 2, 'second'), + ('2020-05-13 10:00:00.005', 3, 'third')""") + + """Error expected here, but no errors + # query first .. as .. + tdSql.error("select first(*) as one from st") + + # query last .. as .. + tdSql.error("select last(*) as latest from st") + """ + + # query last row .. as .. + tdSql.error("select last_row as latest from st") + + # query distinct on normal colnum + tdSql.error("select distinct tagtype from st") + + # query .. order by non-time field + tdSql.error("select * from st order by name") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/queryNormal.py b/tests/pytest/query/queryNormal.py new file mode 100644 index 0000000000..3ca9c1d135 --- /dev/null +++ b/tests/pytest/query/queryNormal.py @@ -0,0 +1,84 @@ +################################################################### +# 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 taos +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + print("==============step1") + + tdSql.execute("create table stb1 (ts timestamp, c1 int, c2 float) tags(t1 int, t2 binary(10), t3 nchar(10))") + tdSql.execute("insert into tb1 using stb1 tags(1,'tb1', '表1') values ('2020-04-18 15:00:00.000', 1, 0.1), ('2020-04-18 15:00:01.000', 2, 0.1)") + tdSql.execute("insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)") + + # join 2 tables -- bug exists + # tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts") + # tdSql.checkRows(1) + + # join 3 tables -- bug exists + # tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id") + + # query count + tdSql.query("select count(*) from stb1") + tdSql.checkData(0, 0, 4) + + # query first + tdSql.query("select first(*) from stb1") + tdSql.checkData(0, 1, 1) + + # query last + tdSql.query("select last(*) from stb1") + tdSql.checkData(0, 1, 4) + + # query as + tdSql.query("select t2 as number from stb1") + tdSql.checkRows(2) + + # query first ... as + tdSql.query("select first(*) as begin from stb1") + tdSql.checkData(0, 1, 1) + + # query last ... as + tdSql.query("select last(*) as end from stb1") + tdSql.checkData(0, 1, 4) + + # query group .. by + tdSql.query("select sum(c1), t2 from stb1 group by t2") + tdSql.checkRows(2) + + # query ... limit + tdSql.query("select * from stb1 limit 2") + tdSql.checkRows(2) + + # query ... limit offset + tdSql.query("select * from stb1 limit 2 offset 3") + tdSql.checkRows(1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/tbname.py b/tests/pytest/query/tbname.py index 5ea89fff82..08416ba3ed 100644 --- a/tests/pytest/query/tbname.py +++ b/tests/pytest/query/tbname.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/random-test/random-test.py b/tests/pytest/random-test/random-test.py index a3f4c00ea5..596f33264f 100644 --- a/tests/pytest/random-test/random-test.py +++ b/tests/pytest/random-test/random-test.py @@ -108,11 +108,24 @@ class Test: tdDnodes.start(1) tdSql.prepare() + def delete_datafiles(self): + tdLog.info("delete data files") + dnodesDir = tdDnodes.getDnodesRootDir() + dataDir = dnodesDir + '/dnode1/*' + deleteCmd = 'rm -rf %s' % dataDir + os.system(deleteCmd) + + self.current_tb = "" + self.last_tb = "" + self.written = 0 + tdDnodes.start(1) + tdSql.prepare() + class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -129,10 +142,11 @@ class TDTestCase: 7: test.drop_table, 8: test.reset_query_cache, 9: test.reset_database, + 10: test.delete_datafiles, } for x in range(1, 100): - r = random.randint(1, 9) + r = random.randint(1, 10) tdLog.notice("iteration %d run func %d" % (x, r)) switch.get(r, lambda: "ERROR")() diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh index 5f48789d45..57a9a67936 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -46,7 +46,20 @@ python3 ./test.py $1 -f import_merge/importTail.py python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importTRestart.py python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importInsertThenImport.py +python3 ./test.py $1 -s && sleep 1 #tag python3 ./test.py $1 -f tag_lite/filter.py python3 ./test.py $1 -s && sleep 1 + +#query +python3 ./test.py $1 -f query/filter.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f query/filterCombo.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f query/queryNormal.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f query/queryError.py +python3 ./test.py $1 -s && sleep 1 + diff --git a/tests/pytest/stable/insert.py b/tests/pytest/stable/insert.py index 9f9e7c6e06..3d37e6726c 100644 --- a/tests/pytest/stable/insert.py +++ b/tests/pytest/stable/insert.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/alter_column.py b/tests/pytest/table/alter_column.py index 15bc9f7aa7..73fdbe1ae9 100644 --- a/tests/pytest/table/alter_column.py +++ b/tests/pytest/table/alter_column.py @@ -20,9 +20,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/boundary.py b/tests/pytest/table/boundary.py index faa222231b..bb5e187f0d 100644 --- a/tests/pytest/table/boundary.py +++ b/tests/pytest/table/boundary.py @@ -10,140 +10,162 @@ from util.sql import * class TDTestCase: - def init( self, conn ): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) - - def getLimitFromSourceCode( self, name ): + def getLimitFromSourceCode(self, name): cmd = "grep -w '#define %s' ../../src/inc/taosdef.h|awk '{print $3}'" % name return int(subprocess.check_output(cmd, shell=True)) - - def generateString( self, length ): + def generateString(self, length): chars = string.ascii_uppercase + string.ascii_lowercase v = "" - for i in range( length ): - v += random.choice( chars ) + for i in range(length): + v += random.choice(chars) return v - - def checkTagBoundaries( self ): - tdLog.debug( "checking tag boundaries" ) + def checkTagBoundaries(self): + tdLog.debug("checking tag boundaries") tdSql.prepare() - maxTags = self.getLimitFromSourceCode( 'TSDB_MAX_TAGS' ) - totalTagsLen = self.getLimitFromSourceCode( 'TSDB_MAX_TAGS_LEN' ) - tdLog.notice( "max tags is %d" % maxTags ) - tdLog.notice( "max total tag length is %d" % totalTagsLen ) + maxTags = self.getLimitFromSourceCode('TSDB_MAX_TAGS') + totalTagsLen = self.getLimitFromSourceCode('TSDB_MAX_TAGS_LEN') + tdLog.notice("max tags is %d" % maxTags) + tdLog.notice("max total tag length is %d" % totalTagsLen) # for binary tags, 2 bytes are used for length tagLen = (totalTagsLen - maxTags * 2) // maxTags firstTagLen = totalTagsLen - 2 * maxTags - tagLen * (maxTags - 1) sql = "create table cars(ts timestamp, f int) tags(t0 binary(%d)" % firstTagLen - for i in range( 1, maxTags ): + for i in range(1, maxTags): sql += ", t%d binary(%d)" % (i, tagLen) sql += ");" - tdLog.debug( "creating super table: " + sql ) - tdSql.execute( sql ) - tdSql.query( 'show stables' ) - tdSql.checkRows( 1 ) + tdLog.debug("creating super table: " + sql) + tdSql.execute(sql) + tdSql.query('show stables') + tdSql.checkRows(1) - for i in range( 10 ): + for i in range(10): sql = "create table car%d using cars tags('%d'" % (i, i) sql += ", '0'" * (maxTags - 1) + ");" - tdLog.debug( "creating table: " + sql ) - tdSql.execute( sql ) + tdLog.debug("creating table: " + sql) + tdSql.execute(sql) sql = "insert into car%d values(now, 0);" % i - tdLog.debug( "inserting data: " + sql ) - tdSql.execute( sql ) + tdLog.debug("inserting data: " + sql) + tdSql.execute(sql) - tdSql.query( 'show tables' ) - tdLog.info( 'tdSql.checkRow(10)' ) - tdSql.checkRows( 10 ) + tdSql.query('show tables') + tdLog.info('tdSql.checkRow(10)') + tdSql.checkRows(10) - tdSql.query( 'select * from cars;' ) - tdSql.checkRows( 10 ) + tdSql.query('select * from cars;') + tdSql.checkRows(10) - - def checkColumnBoundaries( self ): - tdLog.debug( "checking column boundaries" ) + def checkColumnBoundaries(self): + tdLog.debug("checking column boundaries") tdSql.prepare() # one column is for timestamp - maxCols = self.getLimitFromSourceCode( 'TSDB_MAX_COLUMNS' ) - 1 + maxCols = self.getLimitFromSourceCode('TSDB_MAX_COLUMNS') - 1 sql = "create table cars (ts timestamp" - for i in range( maxCols ): + for i in range(maxCols): sql += ", c%d int" % i sql += ");" - tdSql.execute( sql ) - tdSql.query( 'show tables' ) - tdSql.checkRows( 1 ) + tdSql.execute(sql) + tdSql.query('show tables') + tdSql.checkRows(1) sql = "insert into cars values (now" - for i in range( maxCols ): + for i in range(maxCols): sql += ", %d" % i sql += ");" - tdSql.execute( sql ) - tdSql.query( 'select * from cars' ) - tdSql.checkRows( 1 ) + tdSql.execute(sql) + tdSql.query('select * from cars') + tdSql.checkRows(1) - - def checkTableNameBoundaries( self ): - tdLog.debug( "checking table name boundaries" ) + def checkTableNameBoundaries(self): + tdLog.debug("checking table name boundaries") tdSql.prepare() - maxTableNameLen = self.getLimitFromSourceCode( 'TSDB_TABLE_NAME_LEN' ) - tdLog.notice( "table name max length is %d" % maxTableNameLen ) + maxTableNameLen = self.getLimitFromSourceCode('TSDB_TABLE_NAME_LEN') + tdLog.notice("table name max length is %d" % maxTableNameLen) - name = self.generateString( maxTableNameLen - 1) - tdLog.info( "table name is '%s'" % name ) + # create a super table with name exceed max length + sname = self.generateString(maxTableNameLen + 1) + tdLog.info("create a super table with length %d" % len(sname)) + tdSql.error( + "create table %s (ts timestamp, value int) tags(id int)" % + sname) - tdSql.execute( "create table %s (ts timestamp, value int)" % name ) - tdSql.execute( "insert into %s values(now, 0)" % name ) + # create a super table with name of max length + sname = self.generateString(maxTableNameLen) + tdLog.info("create a super table with length %d" % len(sname)) + tdSql.execute( + "create table %s (ts timestamp, value int) tags(id int)" % + sname) + tdLog.info("check table count, should be one") + tdSql.query('show stables') + tdSql.checkRows(1) - tdSql.query( 'show tables' ) - tdSql.checkRows( 1 ) + # create a child table with name exceed max length + name = self.generateString(maxTableNameLen + 1) + tdLog.info("create a child table with length %d" % len(name)) + tdSql.error("create table %s using %s tags(0)" % (name, sname)) - tdSql.query( 'select * from %s' % name ) - tdSql.checkRows( 1 ) + # create a child table with name of max length + name = self.generateString(maxTableNameLen) + tdLog.info("create a child table with length %d" % len(name)) + tdSql.execute("create table %s using %s tags(0)" % (name, sname)) + tdSql.query('show tables') + tdSql.checkRows(1) + # insert one row + tdLog.info("insert one row of data") + tdSql.execute("insert into %s values(now, 0)" % name) + tdSql.query("select * from " + name) + tdSql.checkRows(1) + tdSql.query("select * from " + sname) + tdSql.checkRows(1) - def checkRowBoundaries( self ): - tdLog.debug( "checking row boundaries" ) + name = name[:len(name) - 1] + tdSql.error("select * from " + name) + tdSql.checkRows(0) + + def checkRowBoundaries(self): + tdLog.debug("checking row boundaries") tdSql.prepare() # 8 bytes for timestamp maxRowSize = 65536 - 8 - maxCols = self.getLimitFromSourceCode( 'TSDB_MAX_COLUMNS' ) - 1 + maxCols = self.getLimitFromSourceCode('TSDB_MAX_COLUMNS') - 1 # for binary cols, 2 bytes are used for length colLen = (maxRowSize - maxCols * 2) // maxCols firstColLen = maxRowSize - 2 * maxCols - colLen * (maxCols - 1) sql = "create table cars (ts timestamp, c0 binary(%d)" % firstColLen - for i in range( 1, maxCols ): + for i in range(1, maxCols): sql += ", c%d binary(%d)" % (i, colLen) sql += ");" - tdSql.execute( sql ) - tdSql.query( 'show tables' ) - tdSql.checkRows( 1 ) + tdSql.execute(sql) + tdSql.query('show tables') + tdSql.checkRows(1) - col = self.generateString( firstColLen ) + col = self.generateString(firstColLen) sql = "insert into cars values (now, '%s'" % col - col = self.generateString( colLen ) - for i in range( 1, maxCols ): - sql += ", '%s'" % col + col = self.generateString(colLen) + for i in range(1, maxCols): + sql += ", '%s'" % col sql += ");" - tdLog.info( sql ); - tdSql.execute( sql ) - tdSql.query( "select * from cars" ) - tdSql.checkRows( 1 ) - + tdLog.info(sql) + tdSql.execute(sql) + tdSql.query("select * from cars") + tdSql.checkRows(1) def run(self): self.checkTagBoundaries() @@ -151,7 +173,6 @@ class TDTestCase: self.checkTableNameBoundaries() self.checkRowBoundaries() - def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/pytest/table/column_name.py b/tests/pytest/table/column_name.py index aa958fd60c..a180d3f752 100644 --- a/tests/pytest/table/column_name.py +++ b/tests/pytest/table/column_name.py @@ -10,9 +10,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/column_num.py b/tests/pytest/table/column_num.py index 877f0409dc..3abedb083c 100644 --- a/tests/pytest/table/column_num.py +++ b/tests/pytest/table/column_num.py @@ -8,9 +8,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/create-a-lot.py b/tests/pytest/table/create-a-lot.py new file mode 100644 index 0000000000..7db4a8eaca --- /dev/null +++ b/tests/pytest/table/create-a-lot.py @@ -0,0 +1,45 @@ +################################################################### +# 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 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): + tdSql.prepare() + + print("==============step1") + print("prepare data") + + for x in range(0, 1000000): + tb_name = "tb%d" % x + tdLog.info("create table %s (ts timestamp, i int)" % tb_name) + tdSql.execute("create table %s (ts timestamp, i int)" % tb_name) + tdLog.info("insert into %s values(now, 1)" % tb_name) + tdSql.execute("insert into %s values(now, 1)" % tb_name) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/table/create.py b/tests/pytest/table/create.py index b456b444f4..8fedd4e920 100644 --- a/tests/pytest/table/create.py +++ b/tests/pytest/table/create.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/db_table.py b/tests/pytest/table/db_table.py index d4a8568375..5ead829e26 100644 --- a/tests/pytest/table/db_table.py +++ b/tests/pytest/table/db_table.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/del_stable.py b/tests/pytest/table/del_stable.py index 3932f32536..e7fd0f1fb1 100644 --- a/tests/pytest/table/del_stable.py +++ b/tests/pytest/table/del_stable.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/table/tablename-boundary.py b/tests/pytest/table/tablename-boundary.py index 335073065c..ce843c3fe7 100644 --- a/tests/pytest/table/tablename-boundary.py +++ b/tests/pytest/table/tablename-boundary.py @@ -10,9 +10,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/3.py b/tests/pytest/tag_lite/3.py index e5b5ba05e0..373db1c70f 100644 --- a/tests/pytest/tag_lite/3.py +++ b/tests/pytest/tag_lite/3.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -69,9 +69,9 @@ class TDTestCase: "insert into %s values (now + %s, %d)" % (tb, ms, x)) x = x + 1 - #TSIM: endw + # TSIM: endw i = i + 1 - #TSIM: endw + # TSIM: endw while (i < 10): tb = "%s%d" % (tbPrefix, i) # TSIM: sql create table $tb using %s tags( 1, 1, 1 ) @@ -89,9 +89,9 @@ class TDTestCase: "insert into %s values (now + %s, %d)" % (tb, ms, x)) x = x + 1 - #TSIM: endw + # TSIM: endw i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -102,7 +102,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(%d)' % totalNum) tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from %s where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % mt) @@ -111,7 +111,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % mt) tdSql.query('select * from %s where ts > now + 4m' % mt) @@ -119,7 +119,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % mt) tdSql.query('select * from %s where ts = now + 4m' % mt) @@ -127,7 +127,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -138,7 +138,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -149,14 +149,14 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> 0 tdLog.info('select * from %s where tgcol1 <> 0' % mt) tdSql.query('select * from %s where tgcol1 <> 0' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 = 1 tdLog.info('select * from %s where tgcol1 = 1' % mt) tdSql.query('select * from %s where tgcol1 = 1' % mt) @@ -164,35 +164,35 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> 1 tdLog.info('select * from %s where tgcol1 <> 1' % mt) tdSql.query('select * from %s where tgcol1 <> 1' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 = true tdLog.info('select * from %s where tgcol1 = true' % mt) tdSql.query('select * from %s where tgcol1 = true' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> true tdLog.info('select * from %s where tgcol1 <> true' % mt) tdSql.query('select * from %s where tgcol1 <> true' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 = false tdLog.info('select * from %s where tgcol1 = false' % mt) tdSql.query('select * from %s where tgcol1 = false' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> false tdLog.info('select * from %s where tgcol1 <> false' % mt) tdSql.query('select * from %s where tgcol1 <> false' % mt) @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -210,28 +210,28 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol2 <> 0 tdLog.info('select * from %s where tgcol2 <> 0' % mt) tdSql.query('select * from %s where tgcol2 <> 0' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol2 = 1 tdLog.info('select * from %s where tgcol2 = 1' % mt) tdSql.query('select * from %s where tgcol2 = 1' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol2 <> 1 tdLog.info('select * from %s where tgcol2 <> 1' % mt) tdSql.query('select * from %s where tgcol2 <> 1' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -242,28 +242,28 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol3 <> 0 tdLog.info('select * from %s where tgcol3 <> 0' % mt) tdSql.query('select * from %s where tgcol3 <> 0' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol3 = 1 tdLog.info('select * from %s where tgcol3 = 1' % mt) tdSql.query('select * from %s where tgcol3 = 1' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol3 <> 1 tdLog.info('select * from %s where tgcol3 <> 1' % mt) tdSql.query('select * from %s where tgcol3 <> 1' % mt) tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -277,7 +277,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> true tdLog.info( 'select * from %s where ts > now + 4m and tgcol1 <> true' % @@ -288,7 +288,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = false tdLog.info( 'select * from %s where ts < now + 4m and tgcol1 = false' % @@ -299,7 +299,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> false tdLog.info( 'select * from %s where ts < now + 4m and tgcol1 <> false' % @@ -310,7 +310,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol1 = false' % @@ -321,7 +321,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol1 <> false' % @@ -332,7 +332,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol1 <> false tdLog.info( @@ -344,7 +344,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> false # and ts < now + 5m tdLog.info( @@ -357,7 +357,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -368,7 +368,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 tdLog.info('select * from %s where ts > now + 4m and tgcol2 <> 1' % mt) tdSql.query( @@ -378,7 +378,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) tdSql.query('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) @@ -386,7 +386,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 tdLog.info('select * from %s where ts < now + 4m and tgcol2 <> 0' % mt) tdSql.query( @@ -396,7 +396,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 tdLog.info('select * from %s where ts <= now + 4m and tgcol2 = 0' % mt) tdSql.query( @@ -406,7 +406,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % @@ -418,7 +418,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 tdLog.info( @@ -431,7 +431,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts # < now + 5m tdLog.info( @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -455,7 +455,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 tdLog.info('select * from %s where ts > now + 4m and tgcol3 <> 1' % mt) tdSql.query( @@ -465,7 +465,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) tdSql.query('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) @@ -473,7 +473,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 tdLog.info('select * from %s where ts < now + 4m and tgcol3 <> 0' % mt) tdSql.query( @@ -483,7 +483,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 tdLog.info('select * from %s where ts <= now + 4m and tgcol3 = 0' % mt) tdSql.query( @@ -493,7 +493,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % @@ -505,7 +505,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 tdLog.info( @@ -518,7 +518,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts # < now + 5m tdLog.info( @@ -531,7 +531,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -547,7 +547,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 and # tgcol1 <> true tdLog.info( @@ -560,7 +560,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 and # tgcol1 = false tdLog.info( @@ -573,7 +573,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 and # tgcol1 <> false tdLog.info( @@ -586,7 +586,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 and # tgcol1 = false tdLog.info( @@ -599,7 +599,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 and # tgcol1 <> false tdLog.info( @@ -612,7 +612,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 and tgcol1 <> false tdLog.info( @@ -625,7 +625,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol1 <> false tdLog.info( @@ -638,7 +638,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -654,7 +654,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and # tgcol1 <> true tdLog.info( @@ -667,7 +667,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and # tgcol1 = false tdLog.info( @@ -680,7 +680,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and # tgcol1 <> false tdLog.info( @@ -693,7 +693,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and # tgcol1 = false tdLog.info( @@ -706,7 +706,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and # tgcol1 <> false tdLog.info( @@ -719,7 +719,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol1 <> false tdLog.info( @@ -732,7 +732,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol1 <> false tdLog.info( @@ -745,7 +745,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -761,7 +761,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( @@ -774,7 +774,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -787,7 +787,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -800,7 +800,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -813,7 +813,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -826,7 +826,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( @@ -839,7 +839,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol2 <> 0 tdLog.info( @@ -852,7 +852,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -868,7 +868,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( @@ -881,7 +881,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -894,7 +894,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -907,7 +907,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -920,7 +920,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -933,7 +933,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -946,7 +946,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -959,7 +959,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -977,7 +977,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -995,7 +995,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and @@ -1012,7 +1012,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and @@ -1029,7 +1029,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') @@ -1047,7 +1047,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1064,7 +1064,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1081,7 +1081,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1096,7 +1096,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') @@ -1114,7 +1114,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2 @@ -1130,7 +1130,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3 @@ -1146,7 +1146,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') @@ -1165,7 +1165,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and @@ -1182,7 +1182,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and @@ -1199,7 +1199,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step18 tdLog.info('=============== step18') @@ -1218,7 +1218,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1235,7 +1235,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1250,7 +1250,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1263,7 +1263,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step19 tdLog.info('=============== step19') @@ -1278,7 +1278,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and @@ -1291,7 +1291,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = true and @@ -1304,7 +1304,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -1318,7 +1318,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/4.py b/tests/pytest/tag_lite/4.py index 2b5b69a965..aae930ecdf 100644 --- a/tests/pytest/tag_lite/4.py +++ b/tests/pytest/tag_lite/4.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -73,9 +73,9 @@ class TDTestCase: "insert into %s values (now + %s, %d)" % (tb, ms, x)) x = x + 1 - #TSIM: endw + # TSIM: endw i = i + 1 - #TSIM: endw + # TSIM: endw while (i < 10): tb = "%s%d" % (tbPrefix, i) # TSIM: sql create table $tb using %s tags( 1, 1, 1, 1 ) @@ -96,9 +96,9 @@ class TDTestCase: "insert into %s values (now + %s, %d)" % (tb, ms, x)) x = x + 1 - #TSIM: endw + # TSIM: endw i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -109,7 +109,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from %s where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % mt) @@ -118,7 +118,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % mt) tdSql.query('select * from %s where ts > now + 4m' % mt) @@ -126,7 +126,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % mt) tdSql.query('select * from %s where ts = now + 4m' % mt) @@ -134,7 +134,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -146,7 +146,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -157,7 +157,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> 0 tdLog.info('select * from %s where tgcol1 <> 0' % mt) tdSql.query('select * from %s where tgcol1 <> 0' % mt) @@ -165,7 +165,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 = 1 tdLog.info('select * from %s where tgcol1 = 1' % mt) tdSql.query('select * from %s where tgcol1 = 1' % mt) @@ -173,7 +173,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> 1 tdLog.info('select * from %s where tgcol1 <> 1' % mt) tdSql.query('select * from %s where tgcol1 <> 1' % mt) @@ -181,7 +181,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 = 1 tdLog.info('select * from %s where tgcol1 = 1' % mt) tdSql.query('select * from %s where tgcol1 = 1' % mt) @@ -189,7 +189,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> 1 tdLog.info('select * from %s where tgcol1 <> 1' % mt) tdSql.query('select * from %s where tgcol1 <> 1' % mt) @@ -197,7 +197,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 = 0 tdLog.info('select * from %s where tgcol1 = 0' % mt) tdSql.query('select * from %s where tgcol1 = 0' % mt) @@ -205,7 +205,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol1 <> 0 tdLog.info('select * from %s where tgcol1 <> 0' % mt) tdSql.query('select * from %s where tgcol1 <> 0' % mt) @@ -213,7 +213,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -224,7 +224,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol2 <> 0 tdLog.info('select * from %s where tgcol2 <> 0' % mt) tdSql.query('select * from %s where tgcol2 <> 0' % mt) @@ -232,7 +232,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol2 = 1 tdLog.info('select * from %s where tgcol2 = 1' % mt) tdSql.query('select * from %s where tgcol2 = 1' % mt) @@ -240,7 +240,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol2 <> 1 tdLog.info('select * from %s where tgcol2 <> 1' % mt) tdSql.query('select * from %s where tgcol2 <> 1' % mt) @@ -248,7 +248,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -259,7 +259,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol3 <> 0 tdLog.info('select * from %s where tgcol3 <> 0' % mt) tdSql.query('select * from %s where tgcol3 <> 0' % mt) @@ -267,7 +267,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol3 = 1 tdLog.info('select * from %s where tgcol3 = 1' % mt) tdSql.query('select * from %s where tgcol3 = 1' % mt) @@ -275,7 +275,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol3 <> 1 tdLog.info('select * from %s where tgcol3 <> 1' % mt) tdSql.query('select * from %s where tgcol3 <> 1' % mt) @@ -283,7 +283,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -294,7 +294,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol4 <> 0 tdLog.info('select * from %s where tgcol4 <> 0' % mt) tdSql.query('select * from %s where tgcol4 <> 0' % mt) @@ -302,7 +302,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol4 = 1 tdLog.info('select * from %s where tgcol4 = 1' % mt) tdSql.query('select * from %s where tgcol4 = 1' % mt) @@ -310,7 +310,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where tgcol4 <> 1 tdLog.info('select * from %s where tgcol4 <> 1' % mt) tdSql.query('select * from %s where tgcol4 <> 1' % mt) @@ -318,7 +318,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -329,7 +329,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 tdLog.info('select * from %s where ts > now + 4m and tgcol1 <> 1' % mt) tdSql.query( @@ -339,7 +339,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol1 = 0' % mt) tdSql.query('select * from %s where ts < now + 4m and tgcol1 = 0' % mt) @@ -347,7 +347,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 tdLog.info('select * from %s where ts < now + 4m and tgcol1 <> 0' % mt) tdSql.query( @@ -357,7 +357,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 tdLog.info('select * from %s where ts <= now + 4m and tgcol1 = 0' % mt) tdSql.query( @@ -367,7 +367,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % @@ -379,7 +379,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol1 <> 0 tdLog.info( @@ -392,7 +392,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts # < now + 5m tdLog.info( @@ -405,7 +405,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -416,7 +416,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 tdLog.info('select * from %s where ts > now + 4m and tgcol2 <> 1' % mt) tdSql.query( @@ -426,7 +426,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) tdSql.query('select * from %s where ts < now + 4m and tgcol2 = 0' % mt) @@ -434,7 +434,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 tdLog.info('select * from %s where ts < now + 4m and tgcol2 <> 0' % mt) tdSql.query( @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 tdLog.info('select * from %s where ts <= now + 4m and tgcol2 = 0' % mt) tdSql.query( @@ -454,7 +454,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % @@ -466,7 +466,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 tdLog.info( @@ -479,7 +479,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts # < now + 5m tdLog.info( @@ -492,7 +492,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -503,7 +503,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 tdLog.info('select * from %s where ts > now + 4m and tgcol3 <> 1' % mt) tdSql.query( @@ -513,7 +513,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) tdSql.query('select * from %s where ts < now + 4m and tgcol3 = 0' % mt) @@ -521,7 +521,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 tdLog.info('select * from %s where ts < now + 4m and tgcol3 <> 0' % mt) tdSql.query( @@ -531,7 +531,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 tdLog.info('select * from %s where ts <= now + 4m and tgcol3 = 0' % mt) tdSql.query( @@ -541,7 +541,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % @@ -553,7 +553,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 tdLog.info( @@ -566,7 +566,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts # < now + 5m tdLog.info( @@ -579,7 +579,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -590,7 +590,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 tdLog.info('select * from %s where ts > now + 4m and tgcol4 <> 1' % mt) tdSql.query( @@ -600,7 +600,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol4 = 0' % mt) tdSql.query('select * from %s where ts < now + 4m and tgcol4 = 0' % mt) @@ -608,7 +608,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 tdLog.info('select * from %s where ts < now + 4m and tgcol4 <> 0' % mt) tdSql.query( @@ -618,7 +618,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 tdLog.info('select * from %s where ts <= now + 4m and tgcol4 = 0' % mt) tdSql.query( @@ -628,7 +628,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % @@ -640,7 +640,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 tdLog.info( @@ -653,7 +653,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts # < now + 5m tdLog.info( @@ -666,7 +666,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -682,7 +682,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 1 and # tgcol1 <> 1 tdLog.info( @@ -695,7 +695,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( @@ -708,7 +708,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -721,7 +721,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( @@ -734,7 +734,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -747,7 +747,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 and tgcol1 <> 0 tdLog.info( @@ -760,7 +760,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol2 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol1 <> 0 tdLog.info( @@ -773,7 +773,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -789,7 +789,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and # tgcol1 <> 1 tdLog.info( @@ -802,7 +802,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and # tgcol1 = 0 tdLog.info( @@ -815,7 +815,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -828,7 +828,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and # tgcol1 = 0 tdLog.info( @@ -841,7 +841,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -854,7 +854,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -867,7 +867,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol1 <> 0 tdLog.info( @@ -880,7 +880,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -896,7 +896,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( @@ -909,7 +909,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -922,7 +922,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -935,7 +935,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -948,7 +948,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -961,7 +961,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( @@ -974,7 +974,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol2 <> 0 tdLog.info( @@ -987,7 +987,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -1003,7 +1003,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 1 and # tgcol4 <> 1 tdLog.info( @@ -1016,7 +1016,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( @@ -1029,7 +1029,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1042,7 +1042,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( @@ -1055,7 +1055,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1068,7 +1068,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol4 <> 0 tdLog.info( @@ -1081,7 +1081,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol3 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol4 <> 0 tdLog.info( @@ -1094,7 +1094,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') @@ -1110,7 +1110,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( @@ -1123,7 +1123,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1136,7 +1136,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1149,7 +1149,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1162,7 +1162,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1175,7 +1175,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1188,7 +1188,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol1 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1201,7 +1201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') @@ -1217,7 +1217,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( @@ -1230,7 +1230,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1243,7 +1243,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1256,7 +1256,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1269,7 +1269,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1282,7 +1282,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1295,7 +1295,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1308,7 +1308,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') @@ -1324,7 +1324,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 tdLog.info( @@ -1337,7 +1337,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( @@ -1350,7 +1350,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1363,7 +1363,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( @@ -1376,7 +1376,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1389,7 +1389,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1402,7 +1402,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from %s where ts > now + 4m and tgcol4 <> 0 and ts # < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 @@ -1416,7 +1416,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step18 tdLog.info('=============== step18') @@ -1434,7 +1434,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step19 tdLog.info('=============== step19') @@ -1452,7 +1452,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1469,7 +1469,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1486,7 +1486,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1503,7 +1503,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step20 tdLog.info('=============== step20') @@ -1521,7 +1521,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1538,7 +1538,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1555,7 +1555,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1572,7 +1572,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1585,7 +1585,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step21 tdLog.info('=============== step21') @@ -1603,7 +1603,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol2 @@ -1619,7 +1619,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol3 @@ -1635,7 +1635,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s group by tgcol4 @@ -1651,7 +1651,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step22 tdLog.info('=============== step22') @@ -1670,7 +1670,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1687,7 +1687,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1704,7 +1704,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1717,7 +1717,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step23 tdLog.info('=============== step23') @@ -1736,7 +1736,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1753,7 +1753,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1768,7 +1768,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1781,7 +1781,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m and @@ -1795,7 +1795,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step24 tdLog.info('=============== step24') @@ -1810,7 +1810,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1823,7 +1823,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1836,7 +1836,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from %s where tgcol1 = 1 and @@ -1849,7 +1849,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -1863,7 +1863,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/5.py b/tests/pytest/tag_lite/5.py index 66fc4b721c..b3608bebee 100644 --- a/tests/pytest/tag_lite/5.py +++ b/tests/pytest/tag_lite/5.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -86,10 +86,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): tb = "%s%d" % (tbPrefix, i) @@ -115,10 +115,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -129,7 +129,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -138,7 +138,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -146,7 +146,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -154,7 +154,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -166,7 +166,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -177,7 +177,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 0 tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) @@ -185,7 +185,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 = 1 tdLog.info('select * from %s where tgcol1 = 1' % (mt)) tdSql.query('select * from %s where tgcol1 = 1' % (mt)) @@ -193,7 +193,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 1 tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) @@ -201,7 +201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 = 1 tdLog.info('select * from %s where tgcol1 = 1' % (mt)) tdSql.query('select * from %s where tgcol1 = 1' % (mt)) @@ -209,7 +209,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 1 tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) @@ -217,7 +217,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 = 0 tdLog.info('select * from %s where tgcol1 = 0' % (mt)) tdSql.query('select * from %s where tgcol1 = 0' % (mt)) @@ -225,7 +225,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 0 tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) @@ -233,7 +233,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -244,7 +244,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 0 tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) @@ -252,7 +252,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 1 tdLog.info('select * from %s where tgcol2 = 1' % (mt)) tdSql.query('select * from %s where tgcol2 = 1' % (mt)) @@ -260,7 +260,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 1 tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) @@ -268,7 +268,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -279,7 +279,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 <> 0 tdLog.info('select * from %s where tgcol3 <> 0' % (mt)) tdSql.query('select * from %s where tgcol3 <> 0' % (mt)) @@ -287,7 +287,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 = 1 tdLog.info('select * from %s where tgcol3 = 1' % (mt)) tdSql.query('select * from %s where tgcol3 = 1' % (mt)) @@ -295,7 +295,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 <> 1 tdLog.info('select * from %s where tgcol3 <> 1' % (mt)) tdSql.query('select * from %s where tgcol3 <> 1' % (mt)) @@ -303,7 +303,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -314,7 +314,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol4 <> 0 tdLog.info('select * from %s where tgcol4 <> 0' % (mt)) tdSql.query('select * from %s where tgcol4 <> 0' % (mt)) @@ -322,7 +322,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol4 = 1 tdLog.info('select * from %s where tgcol4 = 1' % (mt)) tdSql.query('select * from %s where tgcol4 = 1' % (mt)) @@ -330,7 +330,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol4 <> 1 tdLog.info('select * from %s where tgcol4 <> 1' % (mt)) tdSql.query('select * from %s where tgcol4 <> 1' % (mt)) @@ -338,7 +338,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -349,7 +349,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol5 <> 0 tdLog.info('select * from %s where tgcol5 <> 0' % (mt)) tdSql.query('select * from %s where tgcol5 <> 0' % (mt)) @@ -357,7 +357,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol5 = 1 tdLog.info('select * from %s where tgcol5 = 1' % (mt)) tdSql.query('select * from %s where tgcol5 = 1' % (mt)) @@ -365,7 +365,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol5 <> 1 tdLog.info('select * from %s where tgcol5 <> 1' % (mt)) tdSql.query('select * from %s where tgcol5 <> 1' % (mt)) @@ -373,7 +373,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -388,7 +388,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol1 <> 1' % @@ -400,7 +400,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol1 = 0' % @@ -412,7 +412,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol1 <> 0' % @@ -424,7 +424,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol1 = 0' % @@ -436,7 +436,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % @@ -448,7 +448,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol1 <> 0 tdLog.info( @@ -461,7 +461,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and # ts < now + 5m tdLog.info( @@ -474,7 +474,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -489,7 +489,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol2 <> 1' % @@ -501,7 +501,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 = 0' % @@ -513,7 +513,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 <> 0' % @@ -525,7 +525,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 = 0' % @@ -537,7 +537,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % @@ -549,7 +549,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 tdLog.info( @@ -562,7 +562,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m tdLog.info( @@ -575,7 +575,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -590,7 +590,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol3 <> 1' % @@ -602,7 +602,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol3 = 0' % @@ -614,7 +614,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol3 <> 0' % @@ -626,7 +626,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol3 = 0' % @@ -638,7 +638,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % @@ -650,7 +650,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 tdLog.info( @@ -663,7 +663,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and # ts < now + 5m tdLog.info( @@ -676,7 +676,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -691,7 +691,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol4 <> 1' % @@ -703,7 +703,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol4 = 0' % @@ -715,7 +715,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol4 <> 0' % @@ -727,7 +727,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol4 = 0' % @@ -739,7 +739,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % @@ -751,7 +751,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 tdLog.info( @@ -764,7 +764,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m tdLog.info( @@ -777,7 +777,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -792,7 +792,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol5 <> 1' % @@ -804,7 +804,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol5 = 0' % @@ -816,7 +816,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol5 <> 0' % @@ -828,7 +828,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol5 = 0' % @@ -840,7 +840,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % @@ -852,7 +852,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol5 <> 0 tdLog.info( @@ -865,7 +865,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and # ts < now + 5m tdLog.info( @@ -878,7 +878,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -894,7 +894,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and # tgcol1 <> 1 tdLog.info( @@ -907,7 +907,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( @@ -920,7 +920,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -933,7 +933,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( @@ -946,7 +946,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -959,7 +959,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 and tgcol1 <> 0 tdLog.info( @@ -972,7 +972,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol1 <> 0 tdLog.info( @@ -985,7 +985,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -1001,7 +1001,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( @@ -1014,7 +1014,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -1027,7 +1027,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -1040,7 +1040,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -1053,7 +1053,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -1066,7 +1066,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( @@ -1079,7 +1079,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 tdLog.info( @@ -1092,7 +1092,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') @@ -1108,7 +1108,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and # tgcol4 <> 1 tdLog.info( @@ -1121,7 +1121,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( @@ -1134,7 +1134,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1147,7 +1147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( @@ -1160,7 +1160,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1173,7 +1173,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol4 <> 0 tdLog.info( @@ -1186,7 +1186,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 tdLog.info( @@ -1199,7 +1199,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') @@ -1215,7 +1215,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and # tgcol4 <> 1 tdLog.info( @@ -1228,7 +1228,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( @@ -1241,7 +1241,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1254,7 +1254,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( @@ -1267,7 +1267,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1280,7 +1280,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol5 <> 0 and tgcol4 <> 0 tdLog.info( @@ -1293,7 +1293,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 tdLog.info( @@ -1306,7 +1306,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') @@ -1322,7 +1322,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( @@ -1335,7 +1335,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1348,7 +1348,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1361,7 +1361,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1374,7 +1374,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1387,7 +1387,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1400,7 +1400,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1413,7 +1413,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step18 tdLog.info('=============== step18') @@ -1429,7 +1429,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( @@ -1442,7 +1442,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1455,7 +1455,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1468,7 +1468,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1481,7 +1481,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1494,7 +1494,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1507,7 +1507,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1520,7 +1520,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step19 tdLog.info('=============== step19') @@ -1536,7 +1536,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 tdLog.info( @@ -1549,7 +1549,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( @@ -1562,7 +1562,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1575,7 +1575,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( @@ -1588,7 +1588,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1601,7 +1601,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1614,7 +1614,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 @@ -1628,7 +1628,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step20 tdLog.info('=============== step20') @@ -1644,7 +1644,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 tdLog.info( @@ -1657,7 +1657,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( @@ -1670,7 +1670,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( @@ -1683,7 +1683,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( @@ -1696,7 +1696,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( @@ -1709,7 +1709,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and # tgcol5 <> 0 @@ -1723,7 +1723,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 and tgcol5 <> 0 @@ -1737,7 +1737,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step21 tdLog.info('=============== step21') @@ -1755,7 +1755,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step22 tdLog.info('=============== step22') @@ -1773,7 +1773,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -1790,7 +1790,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -1807,7 +1807,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -1824,7 +1824,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -1839,7 +1839,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step23 tdLog.info('=============== step23') @@ -1857,7 +1857,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -1874,7 +1874,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -1891,7 +1891,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -1908,7 +1908,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -1923,7 +1923,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -1937,7 +1937,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step24 tdLog.info('=============== step24') @@ -1955,7 +1955,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 @@ -1971,7 +1971,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 @@ -1987,7 +1987,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 @@ -2003,7 +2003,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 @@ -2019,7 +2019,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step25 tdLog.info('=============== step25') @@ -2038,7 +2038,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2055,7 +2055,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2072,7 +2072,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2087,7 +2087,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2101,7 +2101,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step26 tdLog.info('=============== step26') @@ -2120,7 +2120,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2137,7 +2137,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2154,7 +2154,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2169,7 +2169,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2183,7 +2183,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2197,7 +2197,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step27 @@ -2217,7 +2217,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2234,7 +2234,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2251,7 +2251,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2264,7 +2264,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2278,7 +2278,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -2292,7 +2292,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/6.py b/tests/pytest/tag_lite/6.py index ca1058d51b..b789e41794 100644 --- a/tests/pytest/tag_lite/6.py +++ b/tests/pytest/tag_lite/6.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -89,10 +89,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -120,10 +120,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -134,7 +134,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -143,7 +143,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -151,7 +151,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -159,7 +159,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -171,7 +171,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -182,7 +182,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 0 tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) @@ -190,7 +190,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 = 1 tdLog.info('select * from %s where tgcol1 = 1' % (mt)) tdSql.query('select * from %s where tgcol1 = 1' % (mt)) @@ -198,7 +198,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 1 tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) @@ -206,7 +206,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 = 1 tdLog.info('select * from %s where tgcol1 = 1' % (mt)) tdSql.query('select * from %s where tgcol1 = 1' % (mt)) @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 1 tdLog.info('select * from %s where tgcol1 <> 1' % (mt)) tdSql.query('select * from %s where tgcol1 <> 1' % (mt)) @@ -222,7 +222,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 = 0 tdLog.info('select * from %s where tgcol1 = 0' % (mt)) tdSql.query('select * from %s where tgcol1 = 0' % (mt)) @@ -230,7 +230,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol1 <> 0 tdLog.info('select * from %s where tgcol1 <> 0' % (mt)) tdSql.query('select * from %s where tgcol1 <> 0' % (mt)) @@ -238,7 +238,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -249,7 +249,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 0 tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) @@ -257,7 +257,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 1 tdLog.info('select * from %s where tgcol2 = 1' % (mt)) tdSql.query('select * from %s where tgcol2 = 1' % (mt)) @@ -265,7 +265,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 1 tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -284,7 +284,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 <> 0 tdLog.info('select * from %s where tgcol3 <> 0' % (mt)) tdSql.query('select * from %s where tgcol3 <> 0' % (mt)) @@ -292,7 +292,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 = 1 tdLog.info('select * from %s where tgcol3 = 1' % (mt)) tdSql.query('select * from %s where tgcol3 = 1' % (mt)) @@ -300,7 +300,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 <> 1 tdLog.info('select * from %s where tgcol3 <> 1' % (mt)) tdSql.query('select * from %s where tgcol3 <> 1' % (mt)) @@ -308,7 +308,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -319,7 +319,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol4 <> 0 tdLog.info('select * from %s where tgcol4 <> 0' % (mt)) tdSql.query('select * from %s where tgcol4 <> 0' % (mt)) @@ -327,7 +327,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol4 = 1 tdLog.info('select * from %s where tgcol4 = 1' % (mt)) tdSql.query('select * from %s where tgcol4 = 1' % (mt)) @@ -335,7 +335,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol4 <> 1 tdLog.info('select * from %s where tgcol4 <> 1' % (mt)) tdSql.query('select * from %s where tgcol4 <> 1' % (mt)) @@ -343,7 +343,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol5 <> 0 tdLog.info('select * from %s where tgcol5 <> 0' % (mt)) tdSql.query('select * from %s where tgcol5 <> 0' % (mt)) @@ -362,7 +362,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol5 = 1 tdLog.info('select * from %s where tgcol5 = 1' % (mt)) tdSql.query('select * from %s where tgcol5 = 1' % (mt)) @@ -370,7 +370,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol5 <> 1 tdLog.info('select * from %s where tgcol5 <> 1' % (mt)) tdSql.query('select * from %s where tgcol5 <> 1' % (mt)) @@ -378,7 +378,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -389,7 +389,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol6 <> 0 tdLog.info('select * from %s where tgcol6 <> 0' % (mt)) tdSql.query('select * from %s where tgcol6 <> 0' % (mt)) @@ -397,7 +397,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol6 = 1 tdLog.info('select * from %s where tgcol6 = 1' % (mt)) tdSql.query('select * from %s where tgcol6 = 1' % (mt)) @@ -405,7 +405,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol6 <> 1 tdLog.info('select * from %s where tgcol6 <> 1' % (mt)) tdSql.query('select * from %s where tgcol6 <> 1' % (mt)) @@ -413,7 +413,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -428,7 +428,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol1 <> 1' % @@ -440,7 +440,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol1 = 0' % @@ -452,7 +452,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol1 <> 0' % @@ -464,7 +464,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol1 = 0' % @@ -476,7 +476,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol1 <> 0' % @@ -488,7 +488,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol1 <> 0 tdLog.info( @@ -501,7 +501,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and # ts < now + 5m tdLog.info( @@ -514,7 +514,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -529,7 +529,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol2 <> 1' % @@ -541,7 +541,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 = 0' % @@ -553,7 +553,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 <> 0' % @@ -565,7 +565,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 = 0' % @@ -577,7 +577,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % @@ -589,7 +589,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 tdLog.info( @@ -602,7 +602,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m tdLog.info( @@ -615,7 +615,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -630,7 +630,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol3 <> 1' % @@ -642,7 +642,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol3 = 0' % @@ -654,7 +654,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol3 <> 0' % @@ -666,7 +666,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol3 = 0' % @@ -678,7 +678,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol3 <> 0' % @@ -690,7 +690,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 tdLog.info( @@ -703,7 +703,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and # ts < now + 5m tdLog.info( @@ -716,7 +716,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -731,7 +731,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol4 <> 1' % @@ -743,7 +743,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol4 = 0' % @@ -755,7 +755,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol4 <> 0' % @@ -767,7 +767,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol4 = 0' % @@ -779,7 +779,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol4 <> 0' % @@ -791,7 +791,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 tdLog.info( @@ -804,7 +804,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m tdLog.info( @@ -817,7 +817,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -832,7 +832,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol5 <> 1' % @@ -844,7 +844,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol5 = 0' % @@ -856,7 +856,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol5 <> 0' % @@ -868,7 +868,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol5 = 0' % @@ -880,7 +880,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol5 <> 0' % @@ -892,7 +892,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol5 <> 0 tdLog.info( @@ -905,7 +905,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and # ts < now + 5m tdLog.info( @@ -918,7 +918,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -933,7 +933,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol6 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol6 <> 1' % @@ -945,7 +945,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol6 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol6 = 0' % @@ -957,7 +957,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol6 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol6 <> 0' % @@ -969,7 +969,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol6 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol6 = 0' % @@ -981,7 +981,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol6 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol6 <> 0' % @@ -993,7 +993,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol6 <> 0 tdLog.info( @@ -1006,7 +1006,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol6 <> 0 and # ts < now + 5m tdLog.info( @@ -1019,7 +1019,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') @@ -1035,7 +1035,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and # tgcol1 <> 1 tdLog.info( @@ -1048,7 +1048,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( @@ -1061,7 +1061,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -1074,7 +1074,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and # tgcol1 = 0 tdLog.info( @@ -1087,7 +1087,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and # tgcol1 <> 0 tdLog.info( @@ -1100,7 +1100,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1113,7 +1113,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol1 <> 0 tdLog.info( @@ -1126,7 +1126,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') @@ -1142,7 +1142,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and # tgcol2 <> 1 tdLog.info( @@ -1155,7 +1155,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -1168,7 +1168,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -1181,7 +1181,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and # tgcol2 = 0 tdLog.info( @@ -1194,7 +1194,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and # tgcol2 <> 0 tdLog.info( @@ -1207,7 +1207,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol2 <> 0 tdLog.info( @@ -1220,7 +1220,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 tdLog.info( @@ -1233,7 +1233,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') @@ -1249,7 +1249,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 1 and # tgcol4 <> 1 tdLog.info( @@ -1262,7 +1262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( @@ -1275,7 +1275,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1288,7 +1288,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 = 0 and # tgcol4 = 0 tdLog.info( @@ -1301,7 +1301,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol3 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1314,7 +1314,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol3 <> 0 and tgcol4 <> 0 tdLog.info( @@ -1327,7 +1327,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol3 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 tdLog.info( @@ -1340,7 +1340,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step18 tdLog.info('=============== step18') @@ -1356,7 +1356,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and # tgcol4 <> 1 tdLog.info( @@ -1369,7 +1369,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( @@ -1382,7 +1382,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1395,7 +1395,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and # tgcol4 = 0 tdLog.info( @@ -1408,7 +1408,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and # tgcol4 <> 0 tdLog.info( @@ -1421,7 +1421,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol5 <> 0 and tgcol4 <> 0 tdLog.info( @@ -1434,7 +1434,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol4 <> 0 tdLog.info( @@ -1447,7 +1447,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step19 tdLog.info('=============== step19') @@ -1463,7 +1463,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 1 and # tgcol6 <> 1 tdLog.info( @@ -1476,7 +1476,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 = 0 and # tgcol6 = 0 tdLog.info( @@ -1489,7 +1489,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol5 <> 0 and # tgcol6 <> 0 tdLog.info( @@ -1502,7 +1502,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 = 0 and # tgcol6 = 0 tdLog.info( @@ -1515,7 +1515,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol5 <> 0 and # tgcol6 <> 0 tdLog.info( @@ -1528,7 +1528,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol5 <> 0 and tgcol6 <> 0 tdLog.info( @@ -1541,7 +1541,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol5 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol6 <> 0 tdLog.info( @@ -1554,7 +1554,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step20 tdLog.info('=============== step20') @@ -1570,7 +1570,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( @@ -1583,7 +1583,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1596,7 +1596,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1609,7 +1609,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1622,7 +1622,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol1 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1635,7 +1635,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol1 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1648,7 +1648,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol1 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1661,7 +1661,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step21 tdLog.info('=============== step21') @@ -1677,7 +1677,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 tdLog.info( @@ -1690,7 +1690,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1703,7 +1703,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1716,7 +1716,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 tdLog.info( @@ -1729,7 +1729,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1742,7 +1742,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1755,7 +1755,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 tdLog.info( @@ -1768,7 +1768,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step22 tdLog.info('=============== step22') @@ -1784,7 +1784,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 tdLog.info( @@ -1797,7 +1797,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( @@ -1810,7 +1810,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1823,7 +1823,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 tdLog.info( @@ -1836,7 +1836,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1849,7 +1849,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 tdLog.info( @@ -1862,7 +1862,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 @@ -1876,7 +1876,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step23 tdLog.info('=============== step23') @@ -1892,7 +1892,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 tdLog.info( @@ -1905,7 +1905,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( @@ -1918,7 +1918,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( @@ -1931,7 +1931,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 tdLog.info( @@ -1944,7 +1944,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 tdLog.info( @@ -1957,7 +1957,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and # tgcol5 <> 0 @@ -1971,7 +1971,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 and tgcol5 <> 0 @@ -1985,7 +1985,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step24 tdLog.info('=============== step24') @@ -2002,7 +2002,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 1 and # tgcol2 <> 1 and tgcol3 <> 1 and tgcol1 <> 1 and tgcol5 <> 1 and # tgcol6 <> 1 @@ -2016,7 +2016,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = # 0 @@ -2030,7 +2030,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and # tgcol6 <> 0 @@ -2044,7 +2044,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 = 0 and # tgcol2 = 0 and tgcol3 = 0 and tgcol1 = 0 and tgcol5 = 0 and tgcol6 = # 0 @@ -2058,7 +2058,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol4 <> 0 and # tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and tgcol5 <> 0 and # tgcol6 <> 0 @@ -2072,7 +2072,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol4 <> 0 and tgcol2 <> 0 and tgcol3 <> 0 and tgcol1 <> 0 and # tgcol5 <> 0 and tgcol6 <> 0 @@ -2086,7 +2086,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol4 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol2 <> 0 and tgcol3 <> 0 and # tgcol1 <> 0 and tgcol5 <> 0 and tgcol6 <> 0 @@ -2100,7 +2100,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step25 tdLog.info('=============== step25') @@ -2118,7 +2118,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step26 tdLog.info('=============== step26') @@ -2136,7 +2136,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2153,7 +2153,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2170,7 +2170,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2187,7 +2187,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2202,7 +2202,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2216,7 +2216,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step27 tdLog.info('=============== step27') @@ -2234,7 +2234,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2251,7 +2251,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2268,7 +2268,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2285,7 +2285,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2300,7 +2300,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2314,7 +2314,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2328,7 +2328,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step28 tdLog.info('=============== step28') @@ -2346,7 +2346,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol2 @@ -2362,7 +2362,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol3 @@ -2378,7 +2378,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol4 @@ -2394,7 +2394,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol5 @@ -2410,7 +2410,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt group by tgcol6 @@ -2426,7 +2426,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step29 tdLog.info('=============== step29') @@ -2445,7 +2445,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2462,7 +2462,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2479,7 +2479,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2494,7 +2494,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2508,7 +2508,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2522,7 +2522,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step30 tdLog.info('=============== step30') @@ -2541,7 +2541,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2558,7 +2558,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2575,7 +2575,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2590,7 +2590,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2604,7 +2604,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2618,7 +2618,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m @@ -2632,7 +2632,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step31 tdLog.info('=============== step31') @@ -2651,7 +2651,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2668,7 +2668,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2685,7 +2685,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2698,7 +2698,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2712,7 +2712,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol1 = 1 and @@ -2726,7 +2726,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -2740,7 +2740,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/add.py b/tests/pytest/tag_lite/add.py index e9bc01afd2..1a45237cb0 100644 --- a/tests/pytest/tag_lite/add.py +++ b/tests/pytest/tag_lite/add.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -77,22 +77,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -119,22 +119,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step2 tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt)) @@ -171,22 +171,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -213,22 +213,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step3 tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt)) @@ -265,22 +265,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql describe $tb tdLog.info('describe %s' % (tb)) @@ -289,22 +289,22 @@ class TDTestCase: tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")') tdSql.checkDataType(2, 1, "BIGINT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data31 != FLOAT then tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")') tdSql.checkDataType(3, 1, "FLOAT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data23 != 1 then tdLog.info('tdSql.checkData(2, 3, 1)') tdSql.checkData(2, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data33 != 2.000000 then tdLog.info('tdSql.checkData(3, 3, 2.000000)') tdSql.checkData(3, 3, 2.000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -331,22 +331,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4.00000 then tdLog.info('tdSql.checkData(0, 3, 4.00000)') tdSql.checkData(0, 3, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step4 tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt)) @@ -383,22 +383,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -425,22 +425,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = '1' -x step5 tdLog.info('select * from %s where tgcol3 = "1" -x step5' % (mt)) @@ -477,27 +477,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -540,27 +540,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol6 = '6' tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) @@ -571,27 +571,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 1 tdLog.info('select * from %s where tgcol4 = 1' % (mt)) @@ -600,7 +600,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 = 1 -x step52 tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) tdSql.error('select * from %s where tgcol3 = 12' % (mt)) @@ -636,27 +636,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -699,27 +699,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4 then tdLog.info('tdSql.checkData(0, 2, 4)') tdSql.checkData(0, 2, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) @@ -761,27 +761,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -825,27 +825,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4 then tdLog.info('tdSql.checkData(0, 2, 4)') tdSql.checkData(0, 2, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 1 then tdLog.info('tdSql.checkData(0, 4, 1)') tdSql.checkData(0, 4, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) @@ -887,27 +887,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -950,27 +950,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4.000000000 then tdLog.info('tdSql.checkData(0, 2, 4.000000000)') tdSql.checkData(0, 2, 4.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 1 then tdLog.info('tdSql.checkData(0, 3, 1)') tdSql.checkData(0, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6.00000 then tdLog.info('tdSql.checkData(0, 4, 6.00000)') tdSql.checkData(0, 4, 6.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) @@ -1016,32 +1016,32 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103 tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt)) @@ -1090,32 +1090,32 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 0 then tdLog.info('tdSql.checkData(0, 4, 0)') tdSql.checkData(0, 4, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') tdSql.checkData(0, 5, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) @@ -1161,37 +1161,37 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4.00000 then tdLog.info('tdSql.checkData(0, 5, 4.00000)') tdSql.checkData(0, 5, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5 then tdLog.info('tdSql.checkData(0, 6, 5)') tdSql.checkData(0, 6, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114 tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt)) @@ -1261,42 +1261,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 5 then tdLog.info('tdSql.checkData(0, 4, 5)') tdSql.checkData(0, 4, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 6 then tdLog.info('tdSql.checkData(0, 5, 6)') tdSql.checkData(0, 5, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 7 then tdLog.info('tdSql.checkData(0, 6, 7)') tdSql.checkData(0, 6, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 8 then tdLog.info('tdSql.checkData(0, 7, 8)') tdSql.checkData(0, 7, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) @@ -1348,42 +1348,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3.00000 then tdLog.info('tdSql.checkData(0, 4, 3.00000)') tdSql.checkData(0, 4, 3.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4.000000000 then tdLog.info('tdSql.checkData(0, 5, 4.000000000)') tdSql.checkData(0, 5, 4.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5 then tdLog.info('tdSql.checkData(0, 6, 5)') tdSql.checkData(0, 6, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -1447,42 +1447,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 1 then tdLog.info('tdSql.checkData(0, 3, 1)') tdSql.checkData(0, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 5 then tdLog.info('tdSql.checkData(0, 4, 5)') tdSql.checkData(0, 4, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 3 then tdLog.info('tdSql.checkData(0, 6, 3)') tdSql.checkData(0, 6, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 2 then tdLog.info('tdSql.checkData(0, 7, 2)') tdSql.checkData(0, 7, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = '5' tdLog.info('select * from %s where tgcol2 = "5"' % (mt)) @@ -1491,7 +1491,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 4 tdLog.info('select * from %s where tgcol3 = 4' % (mt)) @@ -1500,7 +1500,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol5 = 2 tdLog.info('select * from %s where tgcol5 = 2' % (mt)) @@ -1509,7 +1509,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol6 = '1' tdLog.info('select * from %s where tgcol6 = "1"' % (mt)) @@ -1518,7 +1518,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -1554,42 +1554,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5.000000000 then tdLog.info('tdSql.checkData(0, 6, 5.000000000)') tdSql.checkData(0, 6, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -1647,42 +1647,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 9 then tdLog.info('tdSql.checkData(0, 3, 9)') tdSql.checkData(0, 3, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 11.000000000 then tdLog.info('tdSql.checkData(0, 4, 11.000000000)') tdSql.checkData(0, 4, 11.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 8 then tdLog.info('tdSql.checkData(0, 5, 8)') tdSql.checkData(0, 5, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 10 then tdLog.info('tdSql.checkData(0, 6, 10)') tdSql.checkData(0, 6, 10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 12 then tdLog.info('tdSql.checkData(0, 7, 12)') tdSql.checkData(0, 7, 12) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -1753,7 +1753,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/bigint.py b/tests/pytest/tag_lite/bigint.py index 875633901c..ecc6fad44d 100644 --- a/tests/pytest/tag_lite/bigint.py +++ b/tests/pytest/tag_lite/bigint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -123,7 +123,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -155,7 +155,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -167,7 +167,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -179,7 +179,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > 100000 and ts < 100000 tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdSql.query( @@ -189,7 +189,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -201,7 +201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -225,7 +225,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -234,7 +234,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -242,7 +242,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -250,7 +250,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -262,7 +262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -281,7 +281,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -289,7 +289,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -297,7 +297,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -305,7 +305,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -313,7 +313,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -321,7 +321,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -329,7 +329,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -342,7 +342,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -364,7 +364,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -376,7 +376,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -388,7 +388,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -400,7 +400,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -413,7 +413,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -426,7 +426,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -462,7 +462,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -480,7 +480,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -498,7 +498,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -517,7 +517,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -536,7 +536,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -556,7 +556,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -570,7 +570,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/binary.py b/tests/pytest/tag_lite/binary.py index 476d9e4062..a5757dc5cd 100644 --- a/tests/pytest/tag_lite/binary.py +++ b/tests/pytest/tag_lite/binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -123,7 +123,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -155,7 +155,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -167,7 +167,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -179,7 +179,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > 100000 and ts < 100000 tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdSql.query( @@ -189,7 +189,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -201,7 +201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -225,7 +225,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -234,7 +234,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -242,7 +242,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -250,7 +250,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -262,7 +262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '0' tdLog.info('select * from %s where tgcol <> "0"' % (mt)) tdSql.query('select * from %s where tgcol <> "0"' % (mt)) @@ -281,7 +281,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = '1' tdLog.info('select * from %s where tgcol = "1"' % (mt)) tdSql.query('select * from %s where tgcol = "1"' % (mt)) @@ -289,7 +289,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '1' tdLog.info('select * from %s where tgcol <> "1"' % (mt)) tdSql.query('select * from %s where tgcol <> "1"' % (mt)) @@ -297,7 +297,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = '1' tdLog.info('select * from %s where tgcol = "1"' % (mt)) tdSql.query('select * from %s where tgcol = "1"' % (mt)) @@ -305,7 +305,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '1' tdLog.info('select * from %s where tgcol <> "1"' % (mt)) tdSql.query('select * from %s where tgcol <> "1"' % (mt)) @@ -313,7 +313,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = '0' tdLog.info('select * from %s where tgcol = "0"' % (mt)) tdSql.query('select * from %s where tgcol = "0"' % (mt)) @@ -321,7 +321,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '0' tdLog.info('select * from %s where tgcol <> "0"' % (mt)) tdSql.query('select * from %s where tgcol <> "0"' % (mt)) @@ -329,7 +329,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -344,7 +344,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '1' tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> "1"' % @@ -356,7 +356,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol = "0"' % @@ -368,7 +368,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> "0"' % @@ -380,7 +380,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = "0"' % @@ -392,7 +392,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> "0"' % @@ -404,7 +404,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> '0' tdLog.info( @@ -417,7 +417,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '0' and # ts < now + 5m tdLog.info( @@ -430,7 +430,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -448,7 +448,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -466,7 +466,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -484,7 +484,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -502,7 +502,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -521,7 +521,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -540,7 +540,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -560,7 +560,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -574,7 +574,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/binary_binary.py b/tests/pytest/tag_lite/binary_binary.py index e05f7e3d0e..9c789eafd6 100644 --- a/tests/pytest/tag_lite/binary_binary.py +++ b/tests/pytest/tag_lite/binary_binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -84,10 +84,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -112,10 +112,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -126,7 +126,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -135,7 +135,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -143,7 +143,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -151,7 +151,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -163,7 +163,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -174,7 +174,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '0' tdLog.info('select * from %s where tgcol <> "0"' % (mt)) tdSql.query('select * from %s where tgcol <> "0"' % (mt)) @@ -182,7 +182,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = '1' tdLog.info('select * from %s where tgcol = "1"' % (mt)) tdSql.query('select * from %s where tgcol = "1"' % (mt)) @@ -190,7 +190,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '1' tdLog.info('select * from %s where tgcol <> "1"' % (mt)) tdSql.query('select * from %s where tgcol <> "1"' % (mt)) @@ -198,7 +198,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = '1' tdLog.info('select * from %s where tgcol = "1"' % (mt)) tdSql.query('select * from %s where tgcol = "1"' % (mt)) @@ -206,7 +206,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '1' tdLog.info('select * from %s where tgcol <> "1"' % (mt)) tdSql.query('select * from %s where tgcol <> "1"' % (mt)) @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = '0' tdLog.info('select * from %s where tgcol = "0"' % (mt)) tdSql.query('select * from %s where tgcol = "0"' % (mt)) @@ -222,7 +222,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> '0' tdLog.info('select * from %s where tgcol <> "0"' % (mt)) tdSql.query('select * from %s where tgcol <> "0"' % (mt)) @@ -230,7 +230,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -241,7 +241,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> '0' tdLog.info('select * from %s where tgcol2 <> "0"' % (mt)) tdSql.query('select * from %s where tgcol2 <> "0"' % (mt)) @@ -249,7 +249,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = '1' tdLog.info('select * from %s where tgcol2 = "1"' % (mt)) tdSql.query('select * from %s where tgcol2 = "1"' % (mt)) @@ -257,7 +257,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> '1' tdLog.info('select * from %s where tgcol2 <> "1"' % (mt)) tdSql.query('select * from %s where tgcol2 <> "1"' % (mt)) @@ -265,7 +265,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -280,7 +280,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '1' tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> "1"' % @@ -292,7 +292,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol = "0"' % @@ -304,7 +304,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> "0"' % @@ -316,7 +316,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = "0"' % @@ -328,7 +328,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> "0"' % @@ -340,7 +340,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> '0' tdLog.info( @@ -353,7 +353,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> '0' and # ts < now + 5m tdLog.info( @@ -366,7 +366,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -381,7 +381,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' tdLog.info( 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % @@ -393,7 +393,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 = "0"' % @@ -405,7 +405,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % @@ -417,7 +417,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % @@ -429,7 +429,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % @@ -441,7 +441,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> '0' tdLog.info( @@ -454,7 +454,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and # ts < now + 5m tdLog.info( @@ -467,7 +467,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -483,7 +483,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and # tgcol <> '1' tdLog.info( @@ -496,7 +496,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and # tgcol = '0' tdLog.info( @@ -509,7 +509,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and # tgcol <> '0' tdLog.info( @@ -522,7 +522,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and # tgcol = '0' tdLog.info( @@ -535,7 +535,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' # and tgcol <> '0' tdLog.info( @@ -548,7 +548,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> '0' and tgcol <> '0' tdLog.info( @@ -561,7 +561,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and # ts < now + 5m and ts < now + 5m and tgcol <> '0' tdLog.info( @@ -574,7 +574,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -592,7 +592,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -610,7 +610,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' @@ -626,7 +626,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and @@ -643,7 +643,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -661,7 +661,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -679,7 +679,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -698,7 +698,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' @@ -715,7 +715,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = '1' and @@ -732,7 +732,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step13 @@ -752,7 +752,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -771,7 +771,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -785,7 +785,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/bool.py b/tests/pytest/tag_lite/bool.py index e8b00ce4d9..6f2afd2625 100644 --- a/tests/pytest/tag_lite/bool.py +++ b/tests/pytest/tag_lite/bool.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -81,10 +81,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -107,10 +107,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -122,7 +122,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -130,7 +130,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -138,7 +138,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -146,7 +146,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -154,7 +154,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -166,7 +166,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -178,7 +178,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -190,7 +190,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -203,7 +203,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -223,7 +223,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -231,7 +231,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -239,7 +239,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -251,7 +251,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -262,7 +262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -270,7 +270,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -280,7 +280,7 @@ class TDTestCase: # TSIM: print expect 100, actual:$rows tdLog.info('expect 100, actual:$rows') # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -288,7 +288,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = true tdLog.info('select * from %s where tgcol = true' % (mt)) tdSql.query('select * from %s where tgcol = true' % (mt)) @@ -296,7 +296,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> true tdLog.info('select * from %s where tgcol <> true' % (mt)) tdSql.query('select * from %s where tgcol <> true' % (mt)) @@ -304,7 +304,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = false tdLog.info('select * from %s where tgcol = false' % (mt)) tdSql.query('select * from %s where tgcol = false' % (mt)) @@ -312,7 +312,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> false tdLog.info('select * from %s where tgcol <> false' % (mt)) tdSql.query('select * from %s where tgcol <> false' % (mt)) @@ -320,7 +320,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -335,7 +335,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> true' % @@ -347,7 +347,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = false tdLog.info( 'select * from %s where ts < now + 4m and tgcol = false' % @@ -359,7 +359,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> false' % @@ -371,7 +371,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = false' % @@ -383,7 +383,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> false' % @@ -395,7 +395,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> false tdLog.info( @@ -408,7 +408,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false # and ts < now + 5m tdLog.info( @@ -421,7 +421,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -439,7 +439,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -457,7 +457,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -475,7 +475,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -493,7 +493,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -512,7 +512,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -531,7 +531,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -555,7 +555,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -569,7 +569,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/bool_binary.py b/tests/pytest/tag_lite/bool_binary.py index 7df7ba8c03..bfc496e8e4 100644 --- a/tests/pytest/tag_lite/bool_binary.py +++ b/tests/pytest/tag_lite/bool_binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -81,10 +81,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): tb = "%s%d" % (tbPrefix, i) @@ -106,10 +106,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -120,7 +120,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -129,7 +129,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -137,7 +137,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -145,7 +145,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -157,7 +157,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -168,7 +168,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -176,7 +176,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -184,7 +184,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -192,7 +192,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = true tdLog.info('select * from %s where tgcol = true' % (mt)) tdSql.query('select * from %s where tgcol = true' % (mt)) @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> true tdLog.info('select * from %s where tgcol <> true' % (mt)) tdSql.query('select * from %s where tgcol <> true' % (mt)) @@ -208,7 +208,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = false tdLog.info('select * from %s where tgcol = false' % (mt)) tdSql.query('select * from %s where tgcol = false' % (mt)) @@ -216,7 +216,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> false tdLog.info('select * from %s where tgcol <> false' % (mt)) tdSql.query('select * from %s where tgcol <> false' % (mt)) @@ -224,7 +224,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -235,7 +235,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> '0' tdLog.info('select * from %s where tgcol2 <> "0"' % (mt)) tdSql.query('select * from %s where tgcol2 <> "0"' % (mt)) @@ -243,7 +243,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = '1' tdLog.info('select * from %s where tgcol2 = "1"' % (mt)) tdSql.query('select * from %s where tgcol2 = "1"' % (mt)) @@ -251,7 +251,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> "1" tdLog.info('select * from %s where tgcol2 <> "1"' % (mt)) tdSql.query('select * from %s where tgcol2 <> "1"' % (mt)) @@ -259,7 +259,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -274,7 +274,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> true' % @@ -286,7 +286,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = false tdLog.info( 'select * from %s where ts < now + 4m and tgcol = false' % @@ -298,7 +298,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> false' % @@ -310,7 +310,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = false' % @@ -322,7 +322,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> false' % @@ -334,7 +334,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> false tdLog.info( @@ -347,7 +347,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false # and ts < now + 5m tdLog.info( @@ -360,7 +360,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -375,7 +375,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' tdLog.info( 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % @@ -387,7 +387,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 = "0"' % @@ -399,7 +399,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % @@ -411,7 +411,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % @@ -423,7 +423,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % @@ -435,7 +435,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> '0' tdLog.info( @@ -448,7 +448,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and # ts < now + 5m tdLog.info( @@ -461,7 +461,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -477,7 +477,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and # tgcol <> true tdLog.info( @@ -490,7 +490,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and # tgcol = false tdLog.info( @@ -503,7 +503,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and # tgcol <> false tdLog.info( @@ -516,7 +516,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and # tgcol = false tdLog.info( @@ -529,7 +529,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' # and tgcol <> false tdLog.info( @@ -542,7 +542,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> '0' and tgcol <> false tdLog.info( @@ -555,7 +555,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and # ts < now + 5m and ts < now + 5m and tgcol <> false tdLog.info( @@ -568,7 +568,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -586,7 +586,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -604,7 +604,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' @@ -620,7 +620,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and @@ -637,7 +637,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -655,7 +655,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -673,7 +673,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -692,7 +692,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' @@ -709,7 +709,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and @@ -726,7 +726,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step13 @@ -746,7 +746,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -765,7 +765,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -779,7 +779,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/bool_int.py b/tests/pytest/tag_lite/bool_int.py index 9706cca945..f7bfc7acef 100644 --- a/tests/pytest/tag_lite/bool_int.py +++ b/tests/pytest/tag_lite/bool_int.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -81,10 +81,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): tb = "%s%d" % (tbPrefix, i) @@ -106,10 +106,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -120,7 +120,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -129,7 +129,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -137,7 +137,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -145,7 +145,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -157,7 +157,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -168,7 +168,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -176,7 +176,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -184,7 +184,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -192,7 +192,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = true tdLog.info('select * from %s where tgcol = true' % (mt)) tdSql.query('select * from %s where tgcol = true' % (mt)) @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> true tdLog.info('select * from %s where tgcol <> true' % (mt)) tdSql.query('select * from %s where tgcol <> true' % (mt)) @@ -208,7 +208,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = false tdLog.info('select * from %s where tgcol = false' % (mt)) tdSql.query('select * from %s where tgcol = false' % (mt)) @@ -216,7 +216,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> false tdLog.info('select * from %s where tgcol <> false' % (mt)) tdSql.query('select * from %s where tgcol <> false' % (mt)) @@ -224,7 +224,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -235,7 +235,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 0 tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) @@ -243,7 +243,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 1 tdLog.info('select * from %s where tgcol2 = 1' % (mt)) tdSql.query('select * from %s where tgcol2 = 1' % (mt)) @@ -251,7 +251,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 1 tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) @@ -259,7 +259,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = true tdLog.info('select * from %s where tgcol2 = true' % (mt)) tdSql.query('select * from %s where tgcol2 = true' % (mt)) @@ -267,7 +267,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> true tdLog.info('select * from %s where tgcol2 <> true' % (mt)) tdSql.query('select * from %s where tgcol2 <> true' % (mt)) @@ -275,7 +275,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = false tdLog.info('select * from %s where tgcol2 = false' % (mt)) tdSql.query('select * from %s where tgcol2 = false' % (mt)) @@ -283,7 +283,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> false tdLog.info('select * from %s where tgcol2 <> false' % (mt)) tdSql.query('select * from %s where tgcol2 <> false' % (mt)) @@ -291,7 +291,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -306,7 +306,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> true tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> true' % @@ -318,7 +318,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = false tdLog.info( 'select * from %s where ts < now + 4m and tgcol = false' % @@ -330,7 +330,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> false tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> false' % @@ -342,7 +342,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = false' % @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> false tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> false' % @@ -366,7 +366,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> false tdLog.info( @@ -379,7 +379,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> false # and ts < now + 5m tdLog.info( @@ -392,7 +392,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -407,7 +407,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol2 <> 1' % @@ -419,7 +419,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 = 0' % @@ -431,7 +431,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 <> 0' % @@ -443,7 +443,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 = 0' % @@ -455,7 +455,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % @@ -467,7 +467,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 tdLog.info( @@ -480,7 +480,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m tdLog.info( @@ -493,7 +493,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -509,7 +509,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and # tgcol <> true tdLog.info( @@ -522,7 +522,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and # tgcol = false tdLog.info( @@ -535,7 +535,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and # tgcol <> false tdLog.info( @@ -548,7 +548,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and # tgcol = false tdLog.info( @@ -561,7 +561,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and # tgcol <> false tdLog.info( @@ -574,7 +574,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 and tgcol <> false tdLog.info( @@ -587,7 +587,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol <> false tdLog.info( @@ -600,7 +600,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -618,7 +618,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -636,7 +636,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 @@ -652,7 +652,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and @@ -669,7 +669,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -687,7 +687,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -705,7 +705,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -724,7 +724,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group @@ -741,7 +741,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = true and @@ -758,7 +758,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step13 @@ -778,7 +778,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -797,7 +797,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -811,7 +811,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/change.py b/tests/pytest/tag_lite/change.py index ab2c80485b..910d11ca7c 100644 --- a/tests/pytest/tag_lite/change.py +++ b/tests/pytest/tag_lite/change.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -66,22 +66,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tagcx tgcol3 -x step21 # TSIM: return -1 @@ -123,22 +123,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 # TSIM: sql alter table $mt change tag tgcol2 tgcol4 @@ -167,22 +167,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 # TSIM: sql alter table $mt change tag tgcol2 tgcol4 @@ -211,22 +211,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 # TSIM: sql alter table $mt change tag tgcol2 tgcol4 @@ -255,42 +255,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5.000000000 then tdLog.info('tdSql.checkData(0, 6, 5.000000000)') tdSql.checkData(0, 6, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol3 # TSIM: sql reset query cache @@ -331,22 +331,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 2 tdLog.info('select * from $mt where tgcol4 = 2') @@ -357,22 +357,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -400,22 +400,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 2 tdLog.info('select * from $mt where tgcol4 = 2') @@ -426,22 +426,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -469,22 +469,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 2 tdLog.info('select * from $mt where tgcol4 = 2') @@ -495,22 +495,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -538,22 +538,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = '2' tdLog.info('select * from $mt where tgcol4 = '2'') @@ -564,22 +564,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -627,42 +627,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 4 then tdLog.info('tdSql.checkData(0, 4, 4)') tdSql.checkData(0, 4, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 5.000000000 then tdLog.info('tdSql.checkData(0, 5, 5.000000000)') tdSql.checkData(0, 5, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 6 then tdLog.info('tdSql.checkData(0, 6, 6)') tdSql.checkData(0, 6, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol8 = 2 tdLog.info('select * from $mt where tgcol8 = 2') @@ -673,42 +673,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 4 then tdLog.info('tdSql.checkData(0, 4, 4)') tdSql.checkData(0, 4, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 5.000000000 then tdLog.info('tdSql.checkData(0, 5, 5.000000000)') tdSql.checkData(0, 5, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 6 then tdLog.info('tdSql.checkData(0, 6, 6)') tdSql.checkData(0, 6, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol9 = '4' tdLog.info('select * from $mt where tgcol9 = '4'') @@ -719,42 +719,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 4 then tdLog.info('tdSql.checkData(0, 4, 4)') tdSql.checkData(0, 4, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 5.000000000 then tdLog.info('tdSql.checkData(0, 5, 5.000000000)') tdSql.checkData(0, 5, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 6 then tdLog.info('tdSql.checkData(0, 6, 6)') tdSql.checkData(0, 6, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol10 = 5 tdLog.info('select * from $mt where tgcol10 = 5') @@ -765,42 +765,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 4 then tdLog.info('tdSql.checkData(0, 4, 4)') tdSql.checkData(0, 4, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 5.000000000 then tdLog.info('tdSql.checkData(0, 5, 5.000000000)') tdSql.checkData(0, 5, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 6 then tdLog.info('tdSql.checkData(0, 6, 6)') tdSql.checkData(0, 6, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol11 = '6' tdLog.info('select * from $mt where tgcol11 = '6'') @@ -811,42 +811,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 4 then tdLog.info('tdSql.checkData(0, 4, 4)') tdSql.checkData(0, 4, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 5.000000000 then tdLog.info('tdSql.checkData(0, 5, 5.000000000)') tdSql.checkData(0, 5, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 6 then tdLog.info('tdSql.checkData(0, 6, 6)') tdSql.checkData(0, 6, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -860,7 +860,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/column.py b/tests/pytest/tag_lite/column.py index 6b2285794d..f82f83c356 100644 --- a/tests/pytest/tag_lite/column.py +++ b/tests/pytest/tag_lite/column.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -103,7 +103,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(4)') tdSql.checkRows(4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -149,7 +149,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -160,7 +160,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(4)') tdSql.checkRows(4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) @@ -169,7 +169,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -183,7 +183,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/commit.py b/tests/pytest/tag_lite/commit.py index 4070ebd368..478520a586 100644 --- a/tests/pytest/tag_lite/commit.py +++ b/tests/pytest/tag_lite/commit.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -77,22 +77,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -119,22 +119,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step2 tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt)) @@ -171,22 +171,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -213,22 +213,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step3 tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt)) @@ -265,22 +265,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql describe $tb tdLog.info('describe %s' % (tb)) @@ -289,22 +289,22 @@ class TDTestCase: tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")') tdSql.checkDataType(2, 1, "BIGINT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data31 != FLOAT then tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")') tdSql.checkDataType(3, 1, "FLOAT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data23 != 1 then tdLog.info('tdSql.checkData(2, 3, 1)') tdSql.checkData(2, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data33 != 2.000000 then tdLog.info('tdSql.checkData(3, 3, 2.000000)') tdSql.checkData(3, 3, 2.000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -331,22 +331,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4.00000 then tdLog.info('tdSql.checkData(0, 3, 4.00000)') tdSql.checkData(0, 3, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step4 tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt)) @@ -383,22 +383,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -425,22 +425,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = '1' -x step5 tdLog.info('select * from %s where tgcol3 = "1" -x step5' % (mt)) @@ -477,27 +477,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -540,27 +540,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol6 = '6' tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) @@ -571,27 +571,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 1 tdLog.info('select * from %s where tgcol4 = 1' % (mt)) @@ -600,7 +600,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 = 1 -x step52 tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt)) tdSql.error('select * from %s where tgcol3 = 12' % (mt)) @@ -636,27 +636,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -699,27 +699,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4 then tdLog.info('tdSql.checkData(0, 2, 4)') tdSql.checkData(0, 2, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) @@ -761,27 +761,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -823,27 +823,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4 then tdLog.info('tdSql.checkData(0, 2, 4)') tdSql.checkData(0, 2, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 1 then tdLog.info('tdSql.checkData(0, 4, 1)') tdSql.checkData(0, 4, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) @@ -885,27 +885,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt)) @@ -948,27 +948,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4.000000000 then tdLog.info('tdSql.checkData(0, 2, 4.000000000)') tdSql.checkData(0, 2, 4.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 1 then tdLog.info('tdSql.checkData(0, 3, 1)') tdSql.checkData(0, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6.00000 then tdLog.info('tdSql.checkData(0, 4, 6.00000)') tdSql.checkData(0, 4, 6.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) @@ -1014,32 +1014,32 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103 tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt)) @@ -1088,32 +1088,32 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 0 then tdLog.info('tdSql.checkData(0, 4, 0)') tdSql.checkData(0, 4, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') tdSql.checkData(0, 5, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) @@ -1159,37 +1159,37 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4.00000 then tdLog.info('tdSql.checkData(0, 5, 4.00000)') tdSql.checkData(0, 5, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5 then tdLog.info('tdSql.checkData(0, 6, 5)') tdSql.checkData(0, 6, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114 tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt)) @@ -1259,42 +1259,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 5 then tdLog.info('tdSql.checkData(0, 4, 5)') tdSql.checkData(0, 4, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 6 then tdLog.info('tdSql.checkData(0, 5, 6)') tdSql.checkData(0, 5, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 7 then tdLog.info('tdSql.checkData(0, 6, 7)') tdSql.checkData(0, 6, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 8 then tdLog.info('tdSql.checkData(0, 7, 8)') tdSql.checkData(0, 7, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) @@ -1346,42 +1346,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3.00000 then tdLog.info('tdSql.checkData(0, 4, 3.00000)') tdSql.checkData(0, 4, 3.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4.000000000 then tdLog.info('tdSql.checkData(0, 5, 4.000000000)') tdSql.checkData(0, 5, 4.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5 then tdLog.info('tdSql.checkData(0, 6, 5)') tdSql.checkData(0, 6, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -1445,42 +1445,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 1 then tdLog.info('tdSql.checkData(0, 3, 1)') tdSql.checkData(0, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 5 then tdLog.info('tdSql.checkData(0, 4, 5)') tdSql.checkData(0, 4, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 3 then tdLog.info('tdSql.checkData(0, 6, 3)') tdSql.checkData(0, 6, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 2 then tdLog.info('tdSql.checkData(0, 7, 2)') tdSql.checkData(0, 7, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = '5' tdLog.info('select * from %s where tgcol2 = "5"' % (mt)) @@ -1489,7 +1489,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 4 tdLog.info('select * from %s where tgcol3 = 4' % (mt)) @@ -1498,7 +1498,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol5 = 2 tdLog.info('select * from %s where tgcol5 = 2' % (mt)) @@ -1507,7 +1507,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol6 = '1' tdLog.info('select * from %s where tgcol6 = "1"' % (mt)) @@ -1516,7 +1516,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -1552,42 +1552,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5.000000000 then tdLog.info('tdSql.checkData(0, 6, 5.000000000)') tdSql.checkData(0, 6, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -1645,42 +1645,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 9 then tdLog.info('tdSql.checkData(0, 3, 9)') tdSql.checkData(0, 3, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 11.000000000 then tdLog.info('tdSql.checkData(0, 4, 11.000000000)') tdSql.checkData(0, 4, 11.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 8 then tdLog.info('tdSql.checkData(0, 5, 8)') tdSql.checkData(0, 5, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 10 then tdLog.info('tdSql.checkData(0, 6, 10)') tdSql.checkData(0, 6, 10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 12 then tdLog.info('tdSql.checkData(0, 7, 12)') tdSql.checkData(0, 7, 12) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # TSIM: sleep 5000 @@ -1713,22 +1713,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -1748,22 +1748,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -1783,22 +1783,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4.00000 then tdLog.info('tdSql.checkData(0, 3, 4.00000)') tdSql.checkData(0, 3, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step5 @@ -1819,22 +1819,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step6 @@ -1855,27 +1855,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol6 = '6' tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) @@ -1886,27 +1886,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 1 tdLog.info('select * from %s where tgcol4 = 1' % (mt)) @@ -1915,7 +1915,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -1935,27 +1935,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4 then tdLog.info('tdSql.checkData(0, 2, 4)') tdSql.checkData(0, 2, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6 then tdLog.info('tdSql.checkData(0, 4, 6)') tdSql.checkData(0, 4, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step8 @@ -1976,27 +1976,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4 then tdLog.info('tdSql.checkData(0, 2, 4)') tdSql.checkData(0, 2, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 5 then tdLog.info('tdSql.checkData(0, 3, 5)') tdSql.checkData(0, 3, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 1 then tdLog.info('tdSql.checkData(0, 4, 1)') tdSql.checkData(0, 4, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step9 @@ -2017,27 +2017,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 4.000000000 then tdLog.info('tdSql.checkData(0, 2, 4.000000000)') tdSql.checkData(0, 2, 4.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 1 then tdLog.info('tdSql.checkData(0, 3, 1)') tdSql.checkData(0, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 6.00000 then tdLog.info('tdSql.checkData(0, 4, 6.00000)') tdSql.checkData(0, 4, 6.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step10 @@ -2058,32 +2058,32 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 0 then tdLog.info('tdSql.checkData(0, 4, 0)') tdSql.checkData(0, 4, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') tdSql.checkData(0, 5, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -2103,42 +2103,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 5 then tdLog.info('tdSql.checkData(0, 4, 5)') tdSql.checkData(0, 4, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 6 then tdLog.info('tdSql.checkData(0, 5, 6)') tdSql.checkData(0, 5, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 7 then tdLog.info('tdSql.checkData(0, 6, 7)') tdSql.checkData(0, 6, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 8 then tdLog.info('tdSql.checkData(0, 7, 8)') tdSql.checkData(0, 7, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -2159,42 +2159,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 1 then tdLog.info('tdSql.checkData(0, 3, 1)') tdSql.checkData(0, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 5 then tdLog.info('tdSql.checkData(0, 4, 5)') tdSql.checkData(0, 4, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 3 then tdLog.info('tdSql.checkData(0, 6, 3)') tdSql.checkData(0, 6, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 2 then tdLog.info('tdSql.checkData(0, 7, 2)') tdSql.checkData(0, 7, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = '5' tdLog.info('select * from %s where tgcol2 = "5"' % (mt)) @@ -2203,7 +2203,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 4 tdLog.info('select * from %s where tgcol3 = 4' % (mt)) @@ -2212,7 +2212,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol5 = 2 tdLog.info('select * from %s where tgcol5 = 2' % (mt)) @@ -2221,7 +2221,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol6 = '1' tdLog.info('select * from %s where tgcol6 = "1"' % (mt)) @@ -2230,7 +2230,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -2250,42 +2250,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 9 then tdLog.info('tdSql.checkData(0, 3, 9)') tdSql.checkData(0, 3, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 11.000000000 then tdLog.info('tdSql.checkData(0, 4, 11.000000000)') tdSql.checkData(0, 4, 11.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 8 then tdLog.info('tdSql.checkData(0, 5, 8)') tdSql.checkData(0, 5, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 10 then tdLog.info('tdSql.checkData(0, 6, 10)') tdSql.checkData(0, 6, 10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 12 then tdLog.info('tdSql.checkData(0, 7, 12)') tdSql.checkData(0, 7, 12) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -2299,7 +2299,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/create-tags-boundary.py b/tests/pytest/tag_lite/create-tags-boundary.py index e80f458f0c..b98ae627c2 100644 --- a/tests/pytest/tag_lite/create-tags-boundary.py +++ b/tests/pytest/tag_lite/create-tags-boundary.py @@ -19,9 +19,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() diff --git a/tests/pytest/tag_lite/create.py b/tests/pytest/tag_lite/create.py index 446f8fd38e..83a1450143 100644 --- a/tests/pytest/tag_lite/create.py +++ b/tests/pytest/tag_lite/create.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -76,12 +76,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -89,7 +89,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -120,12 +120,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -133,7 +133,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -164,12 +164,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -177,7 +177,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -207,12 +207,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -220,7 +220,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -251,12 +251,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -264,7 +264,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -295,12 +295,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -310,7 +310,7 @@ class TDTestCase: # TSIM: print expect 0, actual: $rows tdLog.info('expect 0, actual: $rows') # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -341,12 +341,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -385,12 +385,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = '0' tdLog.info('select * from %s where tgcol = "0"' % (mt)) tdSql.query('select * from %s where tgcol = "0"' % (mt)) @@ -398,7 +398,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -431,12 +431,12 @@ class TDTestCase: # TSIM: print expect 1, actual: $rows tdLog.info('expect 1, actual: $rows') # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -475,12 +475,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -488,7 +488,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -519,12 +519,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -532,7 +532,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step13 tdLog.info('=============== step13') @@ -563,12 +563,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -576,7 +576,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -607,12 +607,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) @@ -621,7 +621,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: print =============== step15 tdLog.info('=============== step15') # TSIM: $i = 15 @@ -651,12 +651,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -664,7 +664,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step16 tdLog.info('=============== step16') @@ -695,12 +695,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -708,7 +708,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step17 tdLog.info('=============== step17') @@ -739,12 +739,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -752,7 +752,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step18 tdLog.info('=============== step18') @@ -783,12 +783,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -796,7 +796,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step19 tdLog.info('=============== step19') @@ -827,12 +827,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -840,7 +840,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step20 tdLog.info('=============== step20') @@ -871,12 +871,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -884,7 +884,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step21 tdLog.info('=============== step21') @@ -915,12 +915,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -928,7 +928,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step22 tdLog.info('=============== step22') @@ -959,12 +959,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -972,7 +972,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step23 tdLog.info('=============== step23') @@ -1003,12 +1003,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -1016,7 +1016,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step24 tdLog.info('=============== step24') @@ -1052,12 +1052,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 2 tdLog.info('select * from %s where tgcol2 = 2' % (mt)) tdSql.query('select * from %s where tgcol2 = 2' % (mt)) @@ -1065,12 +1065,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 = 3 tdLog.info('select * from %s where tgcol3 = 3' % (mt)) tdSql.query('select * from %s where tgcol3 = 3' % (mt)) @@ -1078,12 +1078,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol4 = 4 tdLog.info('select * from %s where tgcol4 = 4' % (mt)) tdSql.query('select * from %s where tgcol4 = 4' % (mt)) @@ -1091,12 +1091,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol5 = 5 tdLog.info('select * from %s where tgcol5 = 5' % (mt)) tdSql.query('select * from %s where tgcol5 = 5' % (mt)) @@ -1104,12 +1104,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol6 = '6' tdLog.info('select * from %s where tgcol6 = "6"' % (mt)) tdSql.query('select * from %s where tgcol6 = "6"' % (mt)) @@ -1117,12 +1117,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol6 = '0' tdLog.info('select * from %s where tgcol6 = "0"' % (mt)) tdSql.query('select * from %s where tgcol6 = "0"' % (mt)) @@ -1130,7 +1130,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step25 tdLog.info('=============== step25') @@ -1166,12 +1166,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol6 = '0' tdLog.info('select * from %s where tgcol6 = "0"' % (mt)) tdSql.query('select * from %s where tgcol6 = "0"' % (mt)) @@ -1179,7 +1179,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step26 tdLog.info('=============== step26') @@ -1216,12 +1216,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol3 = '0' tdLog.info('select * from %s where tgcol3 = "0"' % (mt)) tdSql.query('select * from %s where tgcol3 = "0"' % (mt)) @@ -1229,7 +1229,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step27 tdLog.info('=============== step27') @@ -1280,12 +1280,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step29 tdLog.info('=============== step29') @@ -1316,12 +1316,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step30 tdLog.info('=============== step30') @@ -1376,7 +1376,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print $data00 $data01 $data02 tdLog.info('$data00 $data01 $data02') @@ -1384,7 +1384,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 2, "12345")') tdSql.checkData(0, 2, "12345") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/datatype-without-alter.py b/tests/pytest/tag_lite/datatype-without-alter.py index 1a8d05d648..42bc42bdbf 100644 --- a/tests/pytest/tag_lite/datatype-without-alter.py +++ b/tests/pytest/tag_lite/datatype-without-alter.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 10 diff --git a/tests/pytest/tag_lite/datatype.py b/tests/pytest/tag_lite/datatype.py index 1fcf7ce19e..bc99cf74b0 100644 --- a/tests/pytest/tag_lite/datatype.py +++ b/tests/pytest/tag_lite/datatype.py @@ -20,9 +20,9 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): self.ntables = 10 diff --git a/tests/pytest/tag_lite/delete.py b/tests/pytest/tag_lite/delete.py index 34fe6e6f51..88615e0406 100644 --- a/tests/pytest/tag_lite/delete.py +++ b/tests/pytest/tag_lite/delete.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -77,22 +77,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -127,22 +127,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -177,22 +177,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql describe $tb tdLog.info('describe %s' % (tb)) @@ -201,17 +201,17 @@ class TDTestCase: tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")') tdSql.checkDataType(2, 1, "BIGINT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data31 != FLOAT then tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")') tdSql.checkDataType(3, 1, "FLOAT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data23 != 1 then tdLog.info('tdSql.checkData(2, 3, 1)') tdSql.checkData(2, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol1 -x step40 tdLog.info('alter table %s drop tag tgcol1 -x step40' % (mt)) @@ -251,22 +251,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol1 -x step50 tdLog.info('alter table %s drop tag tgcol1 -x step50' % (mt)) @@ -306,27 +306,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -364,27 +364,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql describe $tb tdLog.info('describe %s' % (tb)) @@ -393,47 +393,47 @@ class TDTestCase: tdLog.info('tdSql.checkDataType(2, 1, "SMALLINT")') tdSql.checkDataType(2, 1, "SMALLINT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data31 != TINYINT then tdLog.info('tdSql.checkDataType(3, 1, "TINYINT")') tdSql.checkDataType(3, 1, "TINYINT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data41 != BINARY then tdLog.info('tdSql.checkDataType(4, 1, "BINARY")') tdSql.checkDataType(4, 1, "BINARY") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data22 != 2 then tdLog.info('tdSql.checkData(2, 2, 2)') tdSql.checkData(2, 2, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data32 != 1 then tdLog.info('tdSql.checkData(3, 2, 1)') tdSql.checkData(3, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data42 != 10 then tdLog.info('tdSql.checkData(4, 2, 10)') tdSql.checkData(4, 2, 10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data23 != 1 then tdLog.info('tdSql.checkData(2, 3, 1)') tdSql.checkData(2, 3, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data33 != 2 then tdLog.info('tdSql.checkData(3, 3, 2)') tdSql.checkData(3, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data43 != 3 then tdLog.info('tdSql.checkData(4, 3, 3)') tdSql.checkData(4, 3, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -471,27 +471,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -531,27 +531,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol3 tdLog.info('alter table %s drop tag tgcol3' % (mt)) @@ -593,32 +593,32 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol3 tdLog.info('alter table %s drop tag tgcol3' % (mt)) @@ -663,37 +663,37 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4.00000 then tdLog.info('tdSql.checkData(0, 5, 4.00000)') tdSql.checkData(0, 5, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5 then tdLog.info('tdSql.checkData(0, 6, 5)') tdSql.checkData(0, 6, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -739,42 +739,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3.00000 then tdLog.info('tdSql.checkData(0, 4, 3.00000)') tdSql.checkData(0, 4, 3.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4.000000000 then tdLog.info('tdSql.checkData(0, 5, 4.000000000)') tdSql.checkData(0, 5, 4.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5 then tdLog.info('tdSql.checkData(0, 6, 5)') tdSql.checkData(0, 6, 5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol2 tdLog.info('alter table %s drop tag tgcol2' % (mt)) @@ -823,42 +823,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5.000000000 then tdLog.info('tdSql.checkData(0, 6, 5.000000000)') tdSql.checkData(0, 6, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol3 tdLog.info('alter table %s drop tag tgcol3' % (mt)) @@ -890,22 +890,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step2 tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt)) @@ -931,22 +931,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step3 tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt)) @@ -972,22 +972,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step4 tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt)) @@ -1013,22 +1013,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = '1' -x step5 tdLog.info('select * from %s where tgcol2 = "1" -x step5' % (mt)) @@ -1054,27 +1054,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != NULL then tdLog.info('tdSql.checkData(0, 4, NULL)') tdSql.checkData(0, 4, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step51 tdLog.info('select * from %s where tgcol2 = 1 -x step51' % (mt)) @@ -1105,27 +1105,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != NULL then tdLog.info('tdSql.checkData(0, 4, NULL)') tdSql.checkData(0, 4, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step71 tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt)) @@ -1156,27 +1156,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != NULL then tdLog.info('tdSql.checkData(0, 4, NULL)') tdSql.checkData(0, 4, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step81 tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt)) @@ -1207,27 +1207,27 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != NULL then tdLog.info('tdSql.checkData(0, 4, NULL)') tdSql.checkData(0, 4, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step91 tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt)) @@ -1258,32 +1258,32 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != NULL then tdLog.info('tdSql.checkData(0, 3, NULL)') tdSql.checkData(0, 3, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != NULL then tdLog.info('tdSql.checkData(0, 4, NULL)') tdSql.checkData(0, 4, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') tdSql.checkData(0, 5, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step101 tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt)) @@ -1319,37 +1319,37 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4.00000 then tdLog.info('tdSql.checkData(0, 3, 4.00000)') tdSql.checkData(0, 3, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != NULL then tdLog.info('tdSql.checkData(0, 4, NULL)') tdSql.checkData(0, 4, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') tdSql.checkData(0, 5, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != NULL then tdLog.info('tdSql.checkData(0, 6, NULL)') tdSql.checkData(0, 6, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step111 tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt)) @@ -1385,42 +1385,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4.000000000 then tdLog.info('tdSql.checkData(0, 3, 4.000000000)') tdSql.checkData(0, 3, 4.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != NULL then tdLog.info('tdSql.checkData(0, 4, NULL)') tdSql.checkData(0, 4, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') tdSql.checkData(0, 5, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != NULL then tdLog.info('tdSql.checkData(0, 6, NULL)') tdSql.checkData(0, 6, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 1 -x step120 tdLog.info('select * from %s where tgcol2 = 1 -x step120' % (mt)) @@ -1464,42 +1464,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 5.000000000 then tdLog.info('tdSql.checkData(0, 4, 5.000000000)') tdSql.checkData(0, 4, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != NULL then tdLog.info('tdSql.checkData(0, 5, NULL)') tdSql.checkData(0, 5, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != NULL then tdLog.info('tdSql.checkData(0, 6, NULL)') tdSql.checkData(0, 6, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol3 = 1 -x step130 tdLog.info('select * from %s where tgcol3 = 1 -x step130' % (mt)) @@ -1583,7 +1583,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/double.py b/tests/pytest/tag_lite/double.py index 92e7d23677..b1f29f592e 100644 --- a/tests/pytest/tag_lite/double.py +++ b/tests/pytest/tag_lite/double.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -123,7 +123,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -155,7 +155,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -167,7 +167,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -179,7 +179,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > 100000 and ts < 100000 tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdSql.query( @@ -189,7 +189,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -201,7 +201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -225,7 +225,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -234,7 +234,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -242,7 +242,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -250,7 +250,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -262,7 +262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -281,7 +281,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -289,7 +289,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -297,7 +297,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -305,7 +305,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -313,7 +313,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -321,7 +321,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -329,7 +329,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -342,7 +342,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -364,7 +364,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -376,7 +376,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -388,7 +388,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -400,7 +400,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -413,7 +413,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -426,7 +426,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -462,7 +462,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -480,7 +480,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -498,7 +498,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -517,7 +517,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -536,7 +536,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -556,7 +556,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -570,7 +570,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/filter.py b/tests/pytest/tag_lite/filter.py index b726e7646e..aeb13a1715 100644 --- a/tests/pytest/tag_lite/filter.py +++ b/tests/pytest/tag_lite/filter.py @@ -18,9 +18,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -120,7 +120,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tg = '1' -x @@ -162,12 +162,12 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data00 != 10 then tdLog.info('tdSql.checkData(0, 0, 10)') tdSql.checkData(0, 0, 10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -194,7 +194,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -263,7 +263,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -293,7 +293,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -313,7 +313,7 @@ class TDTestCase: # TSIM: print expect 100, actual $data00 tdLog.info('expect 100, actual $data00') # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step15 tdLog.info('=============== step15') @@ -344,7 +344,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -358,7 +358,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/float.py b/tests/pytest/tag_lite/float.py index 19140abe13..7b93cb0ac9 100644 --- a/tests/pytest/tag_lite/float.py +++ b/tests/pytest/tag_lite/float.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -123,7 +123,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -155,7 +155,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -167,7 +167,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -179,7 +179,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > 100000 and ts < 100000 tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdSql.query( @@ -189,7 +189,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -201,7 +201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -225,7 +225,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -234,7 +234,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -242,7 +242,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -250,7 +250,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -262,7 +262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -281,7 +281,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -289,7 +289,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -297,7 +297,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -305,7 +305,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -313,7 +313,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -321,7 +321,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -329,7 +329,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -342,7 +342,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -364,7 +364,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -376,7 +376,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -388,7 +388,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -400,7 +400,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -413,7 +413,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -426,7 +426,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -462,7 +462,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -480,7 +480,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -498,7 +498,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -517,7 +517,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -536,7 +536,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -556,7 +556,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -570,7 +570,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/int.py b/tests/pytest/tag_lite/int.py index 769e6009c8..99d4a69624 100644 --- a/tests/pytest/tag_lite/int.py +++ b/tests/pytest/tag_lite/int.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -81,10 +81,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -107,10 +107,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -122,7 +122,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -130,7 +130,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -138,7 +138,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -146,7 +146,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -154,7 +154,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -166,7 +166,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -178,7 +178,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > 100000 and ts < 100000 tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdSql.query( @@ -188,7 +188,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -213,7 +213,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -224,7 +224,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -233,7 +233,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -241,7 +241,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -249,7 +249,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -261,7 +261,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -272,7 +272,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -280,7 +280,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -288,7 +288,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -296,7 +296,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -304,7 +304,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -312,7 +312,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -320,7 +320,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -328,7 +328,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -341,7 +341,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -353,7 +353,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -363,7 +363,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -375,7 +375,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -387,7 +387,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -399,7 +399,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -412,7 +412,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -425,7 +425,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -443,7 +443,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -461,7 +461,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -479,7 +479,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -497,7 +497,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -516,7 +516,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -535,7 +535,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -555,7 +555,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -569,7 +569,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/int_binary.py b/tests/pytest/tag_lite/int_binary.py index 2f3f818cd2..7760814f66 100644 --- a/tests/pytest/tag_lite/int_binary.py +++ b/tests/pytest/tag_lite/int_binary.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -122,7 +122,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -159,7 +159,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -170,7 +170,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -178,7 +178,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -186,7 +186,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -194,7 +194,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -202,7 +202,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -210,7 +210,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -218,7 +218,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -226,7 +226,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -237,7 +237,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> '0' tdLog.info('select * from %s where tgcol2 <> "0"' % (mt)) tdSql.query('select * from %s where tgcol2 <> "0"' % (mt)) @@ -245,7 +245,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = '1' tdLog.info('select * from %s where tgcol2 = "1"' % (mt)) tdSql.query('select * from %s where tgcol2 = "1"' % (mt)) @@ -253,7 +253,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> '1' tdLog.info('select * from %s where tgcol2 <> "1"' % (mt)) tdSql.query('select * from %s where tgcol2 <> "1"' % (mt)) @@ -261,7 +261,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -274,7 +274,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -286,7 +286,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -296,7 +296,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -308,7 +308,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -320,7 +320,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -332,7 +332,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -345,7 +345,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -358,7 +358,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -373,7 +373,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' tdLog.info( 'select * from %s where ts > now + 4m and tgcol2 <> "1"' % @@ -385,7 +385,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 = "0"' % @@ -397,7 +397,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 <> "0"' % @@ -409,7 +409,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 = "0"' % @@ -421,7 +421,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> "0"' % @@ -433,7 +433,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> '0' tdLog.info( @@ -446,7 +446,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and # ts < now + 5m tdLog.info( @@ -459,7 +459,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -475,7 +475,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '1' and # tgcol <> 1 tdLog.info( @@ -488,7 +488,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = '0' and # tgcol = 0 tdLog.info( @@ -501,7 +501,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> '0' and # tgcol <> 0 tdLog.info( @@ -514,7 +514,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = '0' and # tgcol = 0 tdLog.info( @@ -527,7 +527,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> '0' # and tgcol <> 0 tdLog.info( @@ -540,7 +540,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> '0' and tgcol <> 0 tdLog.info( @@ -553,7 +553,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> '0' and # ts < now + 5m and ts < now + 5m and tgcol <> 0 tdLog.info( @@ -566,7 +566,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -584,7 +584,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -602,7 +602,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' @@ -618,7 +618,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and @@ -635,7 +635,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -653,7 +653,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -671,7 +671,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -690,7 +690,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = '1' @@ -707,7 +707,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and @@ -724,7 +724,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step13 @@ -744,7 +744,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -763,7 +763,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -777,7 +777,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/int_float.py b/tests/pytest/tag_lite/int_float.py index 4171085ad7..31c94130ab 100644 --- a/tests/pytest/tag_lite/int_float.py +++ b/tests/pytest/tag_lite/int_float.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -122,7 +122,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -159,7 +159,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -170,7 +170,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -178,7 +178,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -186,7 +186,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -194,7 +194,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -202,7 +202,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -210,7 +210,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -218,7 +218,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -226,7 +226,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -237,7 +237,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 < 0.5 tdLog.info('select * from %s where tgcol2 < 0.5' % (mt)) tdSql.query('select * from %s where tgcol2 < 0.5' % (mt)) @@ -245,7 +245,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 > 0.5 and tgcol2 < 1.5 tdLog.info( 'select * from %s where tgcol2 > 0.5 and tgcol2 < 1.5' % @@ -257,7 +257,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 1 tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) @@ -265,7 +265,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 1 tdLog.info('select * from %s where tgcol2 = 1' % (mt)) tdSql.query('select * from %s where tgcol2 = 1' % (mt)) @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 1 tdLog.info('select * from %s where tgcol2 <> 1' % (mt)) tdSql.query('select * from %s where tgcol2 <> 1' % (mt)) @@ -281,7 +281,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 = 0 tdLog.info('select * from %s where tgcol2 = 0' % (mt)) tdSql.query('select * from %s where tgcol2 = 0' % (mt)) @@ -289,7 +289,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol2 <> 0 tdLog.info('select * from %s where tgcol2 <> 0' % (mt)) tdSql.query('select * from %s where tgcol2 <> 0' % (mt)) @@ -297,7 +297,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -310,7 +310,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -322,7 +322,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -332,7 +332,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -344,7 +344,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -356,7 +356,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -368,7 +368,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -381,7 +381,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -394,7 +394,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -409,7 +409,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol2 <> 1' % @@ -421,7 +421,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 = 0' % @@ -433,7 +433,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol2 <> 0' % @@ -445,7 +445,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 = 0' % @@ -457,7 +457,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol2 <> 0' % @@ -469,7 +469,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 tdLog.info( @@ -482,7 +482,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m tdLog.info( @@ -495,7 +495,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -511,7 +511,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 1 and # tgcol <> 1 tdLog.info( @@ -524,7 +524,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 = 0 and # tgcol = 0 tdLog.info( @@ -537,7 +537,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol2 <> 0 and # tgcol <> 0 tdLog.info( @@ -550,7 +550,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 = 0 and # tgcol = 0 tdLog.info( @@ -563,7 +563,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol2 <> 0 and # tgcol <> 0 tdLog.info( @@ -576,7 +576,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol2 <> 0 and tgcol <> 0 tdLog.info( @@ -589,7 +589,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol2 <> 0 and # ts < now + 5m and ts < now + 5m and tgcol <> 0 tdLog.info( @@ -602,7 +602,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -620,7 +620,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -638,7 +638,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 @@ -654,7 +654,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and @@ -671,7 +671,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -689,7 +689,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -707,7 +707,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step12 tdLog.info('=============== step12') @@ -726,7 +726,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol2 = 1 group @@ -743,7 +743,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), # max(tbcol), first(tbcol), last(tbcol) from $mt where tgcol = 1 and @@ -760,7 +760,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step13 @@ -780,7 +780,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step14 tdLog.info('=============== step14') @@ -799,7 +799,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -813,7 +813,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/set.py b/tests/pytest/tag_lite/set.py index 6e1a5aed9d..2573600dc4 100644 --- a/tests/pytest/tag_lite/set.py +++ b/tests/pytest/tag_lite/set.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -77,22 +77,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $tb set tag tagcx 1 -x step21 tdLog.info('alter table %s set tag tagcx 1 -x step21' % (tb)) @@ -119,22 +119,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 4 tdLog.info('select * from %s where tgcol2 = 4' % (mt)) @@ -145,22 +145,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 0 then tdLog.info('tdSql.checkData(0, 2, 0)') tdSql.checkData(0, 2, 0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql describe $tb tdLog.info('describe %s' % (tb)) @@ -171,22 +171,22 @@ class TDTestCase: tdLog.info('tdSql.checkDataType(2, 1, "BOOL")') tdSql.checkDataType(2, 1, "BOOL") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data31 != INT then tdLog.info('tdSql.checkDataType(3, 1, "INT")') tdSql.checkDataType(3, 1, "INT") # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data23 != false then tdLog.info('tdSql.checkData(2, 3, false)') tdSql.checkData(2, 3, false) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data33 != 4 then tdLog.info('tdSql.checkData(3, 3, 4)') tdSql.checkData(3, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -217,22 +217,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $tb set tag tgcol1=3 tdLog.info('alter table %s set tag tgcol1=3' % (tb)) @@ -254,22 +254,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 3 then tdLog.info('tdSql.checkData(0, 2, 3)') tdSql.checkData(0, 2, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 4 tdLog.info('select * from %s where tgcol2 = 4' % (mt)) @@ -280,22 +280,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 3 then tdLog.info('tdSql.checkData(0, 2, 3)') tdSql.checkData(0, 2, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 2 tdLog.info('select * from %s where tgcol2 = 2' % (mt)) @@ -304,7 +304,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step4 @@ -336,22 +336,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2.00000 then tdLog.info('tdSql.checkData(0, 3, 2.00000)') tdSql.checkData(0, 3, 2.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $tb set tag tgcol1=3 tdLog.info('alter table %s set tag tgcol1=3' % (tb)) @@ -373,22 +373,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 3 then tdLog.info('tdSql.checkData(0, 2, 3)') tdSql.checkData(0, 2, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4.00000 then tdLog.info('tdSql.checkData(0, 3, 4.00000)') tdSql.checkData(0, 3, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 4 tdLog.info('select * from %s where tgcol2 = 4' % (mt)) @@ -399,22 +399,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 3 then tdLog.info('tdSql.checkData(0, 2, 3)') tdSql.checkData(0, 2, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4.00000 then tdLog.info('tdSql.checkData(0, 3, 4.00000)') tdSql.checkData(0, 3, 4.00000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step5 @@ -446,22 +446,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1.000000000 then tdLog.info('tdSql.checkData(0, 2, 1.000000000)') tdSql.checkData(0, 2, 1.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $tb set tag tgcol1=3 tdLog.info('alter table %s set tag tgcol1=3' % (tb)) @@ -483,22 +483,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 3.000000000 then tdLog.info('tdSql.checkData(0, 2, 3.000000000)') tdSql.checkData(0, 2, 3.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = '4' tdLog.info('select * from %s where tgcol2 = "4"' % (mt)) @@ -509,22 +509,22 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 3.000000000 then tdLog.info('tdSql.checkData(0, 2, 3.000000000)') tdSql.checkData(0, 2, 3.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 4 then tdLog.info('tdSql.checkData(0, 3, 4)') tdSql.checkData(0, 3, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -560,42 +560,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 1 then tdLog.info('tdSql.checkData(0, 2, 1)') tdSql.checkData(0, 2, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') tdSql.checkData(0, 3, 2) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 3 then tdLog.info('tdSql.checkData(0, 4, 3)') tdSql.checkData(0, 4, 3) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') tdSql.checkData(0, 5, 4) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 5.000000000 then tdLog.info('tdSql.checkData(0, 6, 5.000000000)') tdSql.checkData(0, 6, 5.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') tdSql.checkData(0, 7, 6) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol3 tdLog.info('alter table %s drop tag tgcol3' % (mt)) @@ -629,42 +629,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 8 then tdLog.info('tdSql.checkData(0, 3, 8)') tdSql.checkData(0, 3, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 9 then tdLog.info('tdSql.checkData(0, 4, 9)') tdSql.checkData(0, 4, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 10.000000000 then tdLog.info('tdSql.checkData(0, 5, 10.000000000)') tdSql.checkData(0, 5, 10.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 11 then tdLog.info('tdSql.checkData(0, 6, 11)') tdSql.checkData(0, 6, 11) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol2 = 8 tdLog.info('select * from %s where tgcol2 = 8' % (mt)) @@ -675,42 +675,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 8 then tdLog.info('tdSql.checkData(0, 3, 8)') tdSql.checkData(0, 3, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 9 then tdLog.info('tdSql.checkData(0, 4, 9)') tdSql.checkData(0, 4, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 10.000000000 then tdLog.info('tdSql.checkData(0, 5, 10.000000000)') tdSql.checkData(0, 5, 10.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 11 then tdLog.info('tdSql.checkData(0, 6, 11)') tdSql.checkData(0, 6, 11) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = '9' tdLog.info('select * from %s where tgcol4 = "9"' % (mt)) @@ -721,42 +721,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 8 then tdLog.info('tdSql.checkData(0, 3, 8)') tdSql.checkData(0, 3, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 9 then tdLog.info('tdSql.checkData(0, 4, 9)') tdSql.checkData(0, 4, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 10.000000000 then tdLog.info('tdSql.checkData(0, 5, 10.000000000)') tdSql.checkData(0, 5, 10.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 11 then tdLog.info('tdSql.checkData(0, 6, 11)') tdSql.checkData(0, 6, 11) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol5 = 10 tdLog.info('select * from %s where tgcol5 = 10' % (mt)) @@ -767,42 +767,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 8 then tdLog.info('tdSql.checkData(0, 3, 8)') tdSql.checkData(0, 3, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 9 then tdLog.info('tdSql.checkData(0, 4, 9)') tdSql.checkData(0, 4, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 10.000000000 then tdLog.info('tdSql.checkData(0, 5, 10.000000000)') tdSql.checkData(0, 5, 10.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 11 then tdLog.info('tdSql.checkData(0, 6, 11)') tdSql.checkData(0, 6, 11) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol6 = '11' tdLog.info('select * from %s where tgcol6 = "11"' % (mt)) @@ -813,42 +813,42 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data01 != 1 then tdLog.info('tdSql.checkData(0, 1, 1)') tdSql.checkData(0, 1, 1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data02 != 7 then tdLog.info('tdSql.checkData(0, 2, 7)') tdSql.checkData(0, 2, 7) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data03 != 8 then tdLog.info('tdSql.checkData(0, 3, 8)') tdSql.checkData(0, 3, 8) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data04 != 9 then tdLog.info('tdSql.checkData(0, 4, 9)') tdSql.checkData(0, 4, 9) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data05 != 10.000000000 then tdLog.info('tdSql.checkData(0, 5, 10.000000000)') tdSql.checkData(0, 5, 10.000000000) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data06 != 11 then tdLog.info('tdSql.checkData(0, 6, 11)') tdSql.checkData(0, 6, 11) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') tdSql.checkData(0, 7, None) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -862,7 +862,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/smallint.py b/tests/pytest/tag_lite/smallint.py index 324deb3632..089af55a34 100644 --- a/tests/pytest/tag_lite/smallint.py +++ b/tests/pytest/tag_lite/smallint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -123,7 +123,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -155,7 +155,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -167,7 +167,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -179,7 +179,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > 100000 and ts < 100000 tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdSql.query( @@ -189,7 +189,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -201,7 +201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -225,7 +225,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -234,7 +234,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -242,7 +242,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -250,7 +250,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -262,7 +262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -281,7 +281,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -289,7 +289,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -297,7 +297,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -305,7 +305,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -313,7 +313,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -321,7 +321,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -329,7 +329,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -342,7 +342,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -364,7 +364,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -376,7 +376,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -388,7 +388,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -400,7 +400,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -413,7 +413,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -426,7 +426,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -462,7 +462,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -480,7 +480,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -498,7 +498,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -517,7 +517,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -536,7 +536,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -556,7 +556,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -570,7 +570,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/tag_lite/tinyint.py b/tests/pytest/tag_lite/tinyint.py index 9406f0b6c7..55e33d013b 100644 --- a/tests/pytest/tag_lite/tinyint.py +++ b/tests/pytest/tag_lite/tinyint.py @@ -7,9 +7,9 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): tdSql.prepare() @@ -82,10 +82,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: while $i < 10 while (i < 10): # TSIM: $tb = $tbPrefix . $i @@ -108,10 +108,10 @@ class TDTestCase: (tb, ms, x)) # TSIM: $x = $x + 1 x = x + 1 - #TSIM: endw + # TSIM: endw # TSIM: $i = $i + 1 i = i + 1 - #TSIM: endw + # TSIM: endw # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -123,7 +123,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($rowNum)') tdSql.checkRows(rowNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (tb)) tdSql.query('select * from %s where ts < now + 4m' % (tb)) @@ -131,7 +131,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts <= now + 4m tdLog.info('select * from %s where ts <= now + 4m' % (tb)) tdSql.query('select * from %s where ts <= now + 4m' % (tb)) @@ -139,7 +139,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (tb)) tdSql.query('select * from %s where ts > now + 4m' % (tb)) @@ -147,7 +147,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts >= now + 4m tdLog.info('select * from %s where ts >= now + 4m' % (tb)) tdSql.query('select * from %s where ts >= now + 4m' % (tb)) @@ -155,7 +155,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(15)') tdSql.checkRows(15) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -167,7 +167,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m tdLog.info( 'select * from %s where ts < now + 4m and ts > now + 5m' % @@ -179,7 +179,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > 100000 and ts < 100000 tdLog.info('select * from %s where ts > 100000 and ts < 100000' % (tb)) tdSql.query( @@ -189,7 +189,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 3m' % @@ -201,7 +201,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and # ts < now + 6m tdLog.info( @@ -214,7 +214,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(1)') tdSql.checkRows(1) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step3 tdLog.info('=============== step3') @@ -225,7 +225,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow($totalNum)') tdSql.checkRows(totalNum) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: sql select * from $mt where ts < now + 4m tdLog.info('select * from %s where ts < now + 4m' % (mt)) @@ -234,7 +234,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(50)') tdSql.checkRows(50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m tdLog.info('select * from %s where ts > now + 4m' % (mt)) tdSql.query('select * from %s where ts > now + 4m' % (mt)) @@ -242,7 +242,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(150)') tdSql.checkRows(150) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts = now + 4m tdLog.info('select * from %s where ts = now + 4m' % (mt)) tdSql.query('select * from %s where ts = now + 4m' % (mt)) @@ -250,7 +250,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m tdLog.info( 'select * from %s where ts > now + 4m and ts < now + 5m' % @@ -262,7 +262,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(10)') tdSql.checkRows(10) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -273,7 +273,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -281,7 +281,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -289,7 +289,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -297,7 +297,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 1 tdLog.info('select * from %s where tgcol = 1' % (mt)) tdSql.query('select * from %s where tgcol = 1' % (mt)) @@ -305,7 +305,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 1 tdLog.info('select * from %s where tgcol <> 1' % (mt)) tdSql.query('select * from %s where tgcol <> 1' % (mt)) @@ -313,7 +313,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol = 0 tdLog.info('select * from %s where tgcol = 0' % (mt)) tdSql.query('select * from %s where tgcol = 0' % (mt)) @@ -321,7 +321,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where tgcol <> 0 tdLog.info('select * from %s where tgcol <> 0' % (mt)) tdSql.query('select * from %s where tgcol <> 0' % (mt)) @@ -329,7 +329,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(100)') tdSql.checkRows(100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -342,7 +342,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1 tdLog.info( 'select * from %s where ts > now + 4m and tgcol <> 1' % @@ -354,7 +354,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(75)') tdSql.checkRows(75) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0 tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt)) tdSql.query( @@ -364,7 +364,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts < now + 4m and tgcol <> 0' % @@ -376,7 +376,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol = 0' % @@ -388,7 +388,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0 tdLog.info( 'select * from %s where ts <= now + 4m and tgcol <> 0' % @@ -400,7 +400,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(25)') tdSql.checkRows(25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and # tgcol <> 0 tdLog.info( @@ -413,7 +413,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts # < now + 5m tdLog.info( @@ -426,7 +426,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(5)') tdSql.checkRows(5) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -444,7 +444,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 200)') tdSql.checkData(0, 0, 200) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step7 tdLog.info('=============== step7') @@ -462,7 +462,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step8 tdLog.info('=============== step8') @@ -480,7 +480,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 50)') tdSql.checkData(0, 0, 50) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step9 tdLog.info('=============== step9') @@ -498,7 +498,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step10 tdLog.info('=============== step10') @@ -517,7 +517,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 100)') tdSql.checkData(0, 0, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== step11 tdLog.info('=============== step11') @@ -536,7 +536,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 0, 25)') tdSql.checkData(0, 0, 25) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: # TSIM: print =============== step12 @@ -556,7 +556,7 @@ class TDTestCase: tdLog.info('tdSql.checkData(0, 1, 100)') tdSql.checkData(0, 1, 100) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: print =============== clear tdLog.info('=============== clear') @@ -570,7 +570,7 @@ class TDTestCase: tdLog.info('tdSql.checkRow(0)') tdSql.checkRows(0) # TSIM: return -1 - #TSIM: endi + # TSIM: endi # TSIM: # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT # convert end diff --git a/tests/pytest/test.py b/tests/pytest/test.py index 86417ea931..5b35563e1b 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -31,9 +31,10 @@ if __name__ == "__main__": masterIp = "" testCluster = False valgrind = 0 + logSql = True stop = 0 - opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:scgh', [ - 'file=', 'path=', 'master', 'stop', 'cluster', 'valgrind', 'help']) + opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scgh', [ + 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help']) for key, value in opts: if key in ['-h', '--help']: tdLog.printNoPrefix( @@ -41,8 +42,10 @@ if __name__ == "__main__": tdLog.printNoPrefix('-f Name of test case file written by Python') tdLog.printNoPrefix('-p Deploy Path for Simulator') tdLog.printNoPrefix('-m Master Ip for Simulator') - tdLog.printNoPrefix('-c Test Cluster Flag') + tdLog.printNoPrefix('-l logSql Flag') tdLog.printNoPrefix('-s stop All dnodes') + tdLog.printNoPrefix('-c Test Cluster Flag') + tdLog.printNoPrefix('-g valgrind Test Flag') sys.exit(0) if key in ['-f', '--file']: @@ -54,6 +57,15 @@ if __name__ == "__main__": if key in ['-m', '--master']: masterIp = value + if key in ['-l', '--logSql']: + if (value.upper() == "TRUE"): + logSql = True + elif (value.upper() == "FALSE"): + logSql = False + else: + tdLog.printNoPrefix("logSql value %s is invalid" % logSql) + sys.exit(0) + if key in ['-c', '--cluster']: testCluster = True @@ -100,6 +112,8 @@ if __name__ == "__main__": tdLog.info("Procedures for tdengine deployed in %s" % (host)) + tdCases.logSql(logSql) + if testCluster: tdLog.info("Procedures for testing cluster") if fileName == "all": diff --git a/tests/pytest/user/pass_len.py b/tests/pytest/user/pass_len.py index 40bd1ca5fc..346b8424fe 100644 --- a/tests/pytest/user/pass_len.py +++ b/tests/pytest/user/pass_len.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): print("==============step1") diff --git a/tests/pytest/user/user_create.py b/tests/pytest/user/user_create.py index f8ac5c6799..a00f670a36 100644 --- a/tests/pytest/user/user_create.py +++ b/tests/pytest/user/user_create.py @@ -19,9 +19,9 @@ from util.sql import tdSql class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) def run(self): print("==============step1") diff --git a/tests/pytest/util/cases.py b/tests/pytest/util/cases.py index f65b0dfde3..2fc1ac8515 100644 --- a/tests/pytest/util/cases.py +++ b/tests/pytest/util/cases.py @@ -24,6 +24,7 @@ class TDCase: def __init__(self, name, case): self.name = name self.case = case + self._logSql = True class TDCases: @@ -36,6 +37,9 @@ class TDCases: moduleName = fileName.replace(".py", "").replace("/", ".") return importlib.import_module(moduleName, package='..') + def logSql(self, logSql): + self._logSql = logSql + def addWindows(self, name, case): self.windowsCases.append(TDCase(name, case)) @@ -66,7 +70,7 @@ class TDCases: for tmp in self.linuxCases: if tmp.name.find(fileName) != -1: case = testModule.TDTestCase() - case.init(conn) + case.init(conn, self._logSql) try: case.run() except Exception as e: diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index ea178baf93..e9f0dad076 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -99,6 +99,19 @@ class TDDnode: def setValgrind(self, value): self.valgrind = value + def getDataSize(self): + totalSize = 0 + + if (self.deployed == 1): + for dirpath, dirnames, filenames in os.walk(self.dataDir): + for f in filenames: + fp = os.path.join(dirpath, f) + + if not os.path.islink(fp): + totalSize = totalSize + os.path.getsize(fp) + + return totalSize + def deploy(self): self.logDir = "%s/pysim/dnode%d/log" % (self.path, self.index) self.dataDir = "%s/pysim/dnode%d/data" % (self.path, self.index) @@ -384,6 +397,10 @@ class TDDnodes: self.check(index) self.dnodes[index - 1].stop() + def getDataSize(self, index): + self.check(index) + return self.dnodes[index - 1].getDataSize() + def forcestop(self, index): self.check(index) self.dnodes[index - 1].forcestop() diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index eb53129722..ec7ac117c0 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -25,9 +25,15 @@ class TDSql: self.queryCols = 0 self.affectedRows = 0 - def init(self, cursor): + def init(self, cursor, log=True): self.cursor = cursor + if (log): + frame = inspect.stack()[1] + callerModule = inspect.getmodule(frame[0]) + callerFilename = callerModule.__file__ + self.cursor.log(callerFilename + ".sql") + def close(self): self.cursor.close() @@ -52,6 +58,9 @@ class TDSql: "%s failed: sql:%s, expect error not occured" % (callerFilename, sql)) else: + self.queryRows = 0 + self.queryCols = 0 + self.queryResult = None tdLog.info("sql:%s, expect error occured" % (sql)) def query(self, sql): @@ -101,7 +110,6 @@ class TDSql: return self.cursor.istype(col, dataType) - def checkData(self, row, col, data): frame = inspect.stack()[1] callerModule = inspect.getmodule(frame[0]) diff --git a/tests/script/general/db/alter_tables_d2.sim b/tests/script/general/db/alter_tables_d2.sim new file mode 100644 index 0000000000..1fd24f9cec --- /dev/null +++ b/tests/script/general/db/alter_tables_d2.sim @@ -0,0 +1,468 @@ +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 numOfTotalVnodes -v 2 + +system sh/deploy.sh -n dnode2 -i 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 2 + +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start + +sleep 3000 +sql connect +sql create dnode $hostname2 +sleep 1000 + +print ============================ step1 + +sql create database db maxTables 5 +sql create table db.st (ts timestamp, i int) tags(t int) +sql create table db.t000 using db.st tags(0) +sql create table db.t001 using db.st tags(1) +sql create table db.t002 using db.st tags(2) +sql create table db.t003 using db.st tags(3) +sql create table db.t004 using db.st tags(4) +sql create table db.t005 using db.st tags(5) +sql create table db.t006 using db.st tags(6) +sql create table db.t007 using db.st tags(7) +sql create table db.t008 using db.st tags(8) +sql create table db.t009 using db.st tags(9) +sql create table db.t010 using db.st tags(0) +sql create table db.t011 using db.st tags(1) +sql create table db.t012 using db.st tags(2) +sql create table db.t013 using db.st tags(3) +sql create table db.t014 using db.st tags(4) +sql create table db.t015 using db.st tags(5) +sql create table db.t016 using db.st tags(6) +sql create table db.t017 using db.st tags(7) +sql create table db.t018 using db.st tags(8) +sql create table db.t019 using db.st tags(9) + +sql show db.tables +if $rows != 20 then + return -1 +endi + +sql insert into db.t000 values(now, 1) +sql insert into db.t001 values(now, 1) +sql insert into db.t002 values(now, 1) +sql insert into db.t003 values(now, 1) +sql insert into db.t004 values(now, 1) +sql insert into db.t005 values(now, 1) +sql insert into db.t006 values(now, 1) +sql insert into db.t007 values(now, 1) +sql insert into db.t008 values(now, 1) +sql insert into db.t009 values(now, 1) +sql insert into db.t010 values(now, 1) +sql insert into db.t011 values(now, 1) +sql insert into db.t012 values(now, 1) +sql insert into db.t013 values(now, 1) +sql insert into db.t014 values(now, 1) +sql insert into db.t015 values(now, 1) +sql insert into db.t016 values(now, 1) +sql insert into db.t017 values(now, 1) +sql insert into db.t018 values(now, 1) +sql insert into db.t019 values(now, 1) + +print ============================ step2 +sql_error create table db.t100 using db.st tags(10) +sql show db.tables +if $rows != 20 then + return -1 +endi + +print ============================ step3 + +sql alter database db maxTables 10 +sleep 1000 + +sql create table db.t100 using db.st tags(0) +sql create table db.t101 using db.st tags(1) +sql create table db.t102 using db.st tags(2) +sql create table db.t103 using db.st tags(3) +sql create table db.t104 using db.st tags(4) +sql create table db.t105 using db.st tags(5) +sql create table db.t106 using db.st tags(6) +sql create table db.t107 using db.st tags(7) +sql create table db.t108 using db.st tags(8) +sql create table db.t109 using db.st tags(9) +sql create table db.t110 using db.st tags(0) +sql create table db.t111 using db.st tags(1) +sql create table db.t112 using db.st tags(2) +sql create table db.t113 using db.st tags(3) +sql create table db.t114 using db.st tags(4) +sql create table db.t115 using db.st tags(5) +sql create table db.t116 using db.st tags(6) +sql create table db.t117 using db.st tags(7) +sql create table db.t118 using db.st tags(8) +sql create table db.t119 using db.st tags(9) +sql show db.tables +if $rows != 40 then + return -1 +endi + + +sql insert into db.t100 values(now, 1) +sql insert into db.t101 values(now, 1) +sql insert into db.t102 values(now, 1) +sql insert into db.t103 values(now, 1) +sql insert into db.t104 values(now, 1) +sql insert into db.t105 values(now, 1) +sql insert into db.t106 values(now, 1) +sql insert into db.t107 values(now, 1) +sql insert into db.t108 values(now, 1) +sql insert into db.t109 values(now, 1) +sql insert into db.t110 values(now, 1) +sql insert into db.t111 values(now, 1) +sql insert into db.t112 values(now, 1) +sql insert into db.t113 values(now, 1) +sql insert into db.t114 values(now, 1) +sql insert into db.t115 values(now, 1) +sql insert into db.t116 values(now, 1) +sql insert into db.t117 values(now, 1) +sql insert into db.t118 values(now, 1) +sql insert into db.t119 values(now, 1) + +print ============================ step4 +sql_error create table db.t200 using db.st tags(10) +sql show db.tables +if $rows != 40 then + return -1 +endi + +print ============================ step5 + +sql alter database db maxTables 15 +sleep 1000 + +sql create table db.t200 using db.st tags(0) +sql create table db.t201 using db.st tags(1) +sql create table db.t202 using db.st tags(2) +sql create table db.t203 using db.st tags(3) +sql create table db.t204 using db.st tags(4) +sql create table db.t205 using db.st tags(5) +sql create table db.t206 using db.st tags(6) +sql create table db.t207 using db.st tags(7) +sql create table db.t208 using db.st tags(8) +sql create table db.t209 using db.st tags(9) +sql create table db.t210 using db.st tags(0) +sql create table db.t211 using db.st tags(1) +sql create table db.t212 using db.st tags(2) +sql create table db.t213 using db.st tags(3) +sql create table db.t214 using db.st tags(4) +sql create table db.t215 using db.st tags(5) +sql create table db.t216 using db.st tags(6) +sql create table db.t217 using db.st tags(7) +sql create table db.t218 using db.st tags(8) +sql create table db.t219 using db.st tags(9) +sql show db.tables +if $rows != 60 then + return -1 +endi + +sql insert into db.t200 values(now, 1) +sql insert into db.t201 values(now, 1) +sql insert into db.t202 values(now, 1) +sql insert into db.t203 values(now, 1) +sql insert into db.t204 values(now, 1) +sql insert into db.t205 values(now, 1) +sql insert into db.t206 values(now, 1) +sql insert into db.t207 values(now, 1) +sql insert into db.t208 values(now, 1) +sql insert into db.t209 values(now, 1) +sql insert into db.t210 values(now, 1) +sql insert into db.t211 values(now, 1) +sql insert into db.t212 values(now, 1) +sql insert into db.t213 values(now, 1) +sql insert into db.t214 values(now, 1) +sql insert into db.t215 values(now, 1) +sql insert into db.t216 values(now, 1) +sql insert into db.t217 values(now, 1) +sql insert into db.t218 values(now, 1) +sql insert into db.t219 values(now, 1) + +print ============================ step6 + +sql reset query cache +sleep 1000 + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 60 then + return -1 +endi + +print ============================ step7 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +sleep 1000 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +sleep 3000 + +sql reset query cache +sleep 1000 + +sql show db.tables +if $rows != 60 then + return -1 +endi + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 60 then + return -1 +endi + +print ============================ step8 +sql_error create table db.t300 using db.st tags(10) +sql show db.tables +if $rows != 60 then + return -1 +endi + +print ============================ step9 + +sql alter database db maxTables 20 +sleep 1000 + +sql create table db.t300 using db.st tags(0) +sql create table db.t301 using db.st tags(1) +sql create table db.t302 using db.st tags(2) +sql create table db.t303 using db.st tags(3) +sql create table db.t304 using db.st tags(4) +sql create table db.t305 using db.st tags(5) +sql create table db.t306 using db.st tags(6) +sql create table db.t307 using db.st tags(7) +sql create table db.t308 using db.st tags(8) +sql create table db.t309 using db.st tags(9) +sql create table db.t310 using db.st tags(0) +sql create table db.t311 using db.st tags(1) +sql create table db.t312 using db.st tags(2) +sql create table db.t313 using db.st tags(3) +sql create table db.t314 using db.st tags(4) +sql create table db.t315 using db.st tags(5) +sql create table db.t316 using db.st tags(6) +sql create table db.t317 using db.st tags(7) +sql create table db.t318 using db.st tags(8) +sql create table db.t319 using db.st tags(9) + +sql insert into db.t300 values(now, 1) +sql insert into db.t301 values(now, 1) +sql insert into db.t302 values(now, 1) +sql insert into db.t303 values(now, 1) +sql insert into db.t304 values(now, 1) +sql insert into db.t305 values(now, 1) +sql insert into db.t306 values(now, 1) +sql insert into db.t307 values(now, 1) +sql insert into db.t308 values(now, 1) +sql insert into db.t309 values(now, 1) +sql insert into db.t310 values(now, 1) +sql insert into db.t311 values(now, 1) +sql insert into db.t312 values(now, 1) +sql insert into db.t313 values(now, 1) +sql insert into db.t314 values(now, 1) +sql insert into db.t315 values(now, 1) +sql insert into db.t316 values(now, 1) +sql insert into db.t317 values(now, 1) +sql insert into db.t318 values(now, 1) +sql insert into db.t319 values(now, 1) + +sql show db.tables +if $rows != 80 then + return -1 +endi + +sql reset query cache +sleep 1000 + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.t300 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 80 then + return -1 +endi + +print ============================ step10 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +sleep 1000 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +sleep 3000 + +sql reset query cache +sleep 1000 + +sql show db.tables +if $rows != 80 then + return -1 +endi + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.t300 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 80 then + return -1 +endi + +print ============================ step11 +sql_error create table db.t400 using db.st tags(10) +sql show db.tables +if $rows != 80 then + return -1 +endi + +print ============================ step9 + +sql alter database db maxTables 25 +sleep 1000 + +sql create table db.t400 using db.st tags(0) +sql create table db.t401 using db.st tags(1) +sql create table db.t402 using db.st tags(2) +sql create table db.t403 using db.st tags(3) +sql create table db.t404 using db.st tags(4) +sql create table db.t405 using db.st tags(5) +sql create table db.t406 using db.st tags(6) +sql create table db.t407 using db.st tags(7) +sql create table db.t408 using db.st tags(8) +sql create table db.t409 using db.st tags(9) +sql create table db.t410 using db.st tags(0) +sql create table db.t411 using db.st tags(1) +sql create table db.t412 using db.st tags(2) +sql create table db.t413 using db.st tags(3) +sql create table db.t414 using db.st tags(4) +sql create table db.t415 using db.st tags(5) +sql create table db.t416 using db.st tags(6) +sql create table db.t417 using db.st tags(7) +sql create table db.t418 using db.st tags(8) +sql create table db.t419 using db.st tags(9) + +sql insert into db.t400 values(now, 1) +sql insert into db.t401 values(now, 1) +sql insert into db.t402 values(now, 1) +sql insert into db.t403 values(now, 1) +sql insert into db.t404 values(now, 1) +sql insert into db.t405 values(now, 1) +sql insert into db.t406 values(now, 1) +sql insert into db.t407 values(now, 1) +sql insert into db.t408 values(now, 1) +sql insert into db.t409 values(now, 1) +sql insert into db.t410 values(now, 1) +sql insert into db.t411 values(now, 1) +sql insert into db.t412 values(now, 1) +sql insert into db.t413 values(now, 1) +sql insert into db.t414 values(now, 1) +sql insert into db.t415 values(now, 1) +sql insert into db.t416 values(now, 1) +sql insert into db.t417 values(now, 1) +sql insert into db.t418 values(now, 1) +sql insert into db.t419 values(now, 1) + +sql show db.tables +if $rows != 100 then + return -1 +endi + +sql reset query cache +sleep 1000 + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.t300 +if $rows != 1 then + return -1 +endi + +sql select * from db.t400 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 100 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/alter_tables_v1.sim b/tests/script/general/db/alter_tables_v1.sim new file mode 100644 index 0000000000..17aa746ce3 --- /dev/null +++ b/tests/script/general/db/alter_tables_v1.sim @@ -0,0 +1,352 @@ +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 numOfTotalVnodes -v 1 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 + +system sh/exec.sh -n dnode1 -s start + +sleep 3000 +sql connect + +print ============================ step1 + +sql create database db maxTables 10 +sql create table db.st (ts timestamp, i int) tags(t int) +sql create table db.t0 using db.st tags(0) +sql create table db.t1 using db.st tags(1) +sql create table db.t2 using db.st tags(2) +sql create table db.t3 using db.st tags(3) +sql create table db.t4 using db.st tags(4) +sql create table db.t5 using db.st tags(5) +sql create table db.t6 using db.st tags(6) +sql create table db.t7 using db.st tags(7) +sql create table db.t8 using db.st tags(8) +sql create table db.t9 using db.st tags(9) + +sql show db.tables +if $rows != 10 then + return -1 +endi + +sql insert into db.t0 values(now, 1) +sql insert into db.t1 values(now, 1) +sql insert into db.t2 values(now, 1) +sql insert into db.t3 values(now, 1) +sql insert into db.t4 values(now, 1) +sql insert into db.t5 values(now, 1) +sql insert into db.t6 values(now, 1) +sql insert into db.t7 values(now, 1) +sql insert into db.t8 values(now, 1) +sql insert into db.t9 values(now, 1) + +print ============================ step2 +sql_error create table db.t10 using db.st tags(10) +sql show db.tables +if $rows != 10 then + return -1 +endi + +print ============================ step3 + +sql alter database db maxTables 20 +sleep 1000 + +sql create table db.t10 using db.st tags(0) +sql create table db.t11 using db.st tags(1) +sql create table db.t12 using db.st tags(2) +sql create table db.t13 using db.st tags(3) +sql create table db.t14 using db.st tags(4) +sql create table db.t15 using db.st tags(5) +sql create table db.t16 using db.st tags(6) +sql create table db.t17 using db.st tags(7) +sql create table db.t18 using db.st tags(8) +sql create table db.t19 using db.st tags(9) +sql show db.tables +if $rows != 20 then + return -1 +endi + +sql insert into db.t10 values(now, 1) +sql insert into db.t11 values(now, 1) +sql insert into db.t12 values(now, 1) +sql insert into db.t13 values(now, 1) +sql insert into db.t14 values(now, 1) +sql insert into db.t15 values(now, 1) +sql insert into db.t16 values(now, 1) +sql insert into db.t17 values(now, 1) +sql insert into db.t18 values(now, 1) +sql insert into db.t19 values(now, 1) + +print ============================ step4 +sql_error create table db.t20 using db.st tags(10) +sql show db.tables +if $rows != 20 then + return -1 +endi + +print ============================ step5 + +sql alter database db maxTables 30 +sleep 1000 + +sql create table db.t20 using db.st tags(0) +sql create table db.t21 using db.st tags(1) +sql create table db.t22 using db.st tags(2) +sql create table db.t23 using db.st tags(3) +sql create table db.t24 using db.st tags(4) +sql create table db.t25 using db.st tags(5) +sql create table db.t26 using db.st tags(6) +sql create table db.t27 using db.st tags(7) +sql create table db.t28 using db.st tags(8) +sql create table db.t29 using db.st tags(9) +sql show db.tables +if $rows != 30 then + return -1 +endi + +sql insert into db.t20 values(now, 1) +sql insert into db.t21 values(now, 1) +sql insert into db.t22 values(now, 1) +sql insert into db.t23 values(now, 1) +sql insert into db.t24 values(now, 1) +sql insert into db.t25 values(now, 1) +sql insert into db.t26 values(now, 1) +sql insert into db.t27 values(now, 1) +sql insert into db.t28 values(now, 1) +sql insert into db.t29 values(now, 1) + +print ============================ step6 + +sql reset query cache +sleep 1000 + +sql select * from db.t0 +if $rows != 1 then + return -1 +endi + +sql select * from db.t10 +if $rows != 1 then + return -1 +endi + +sql select * from db.t20 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 30 then + return -1 +endi + +print ============================ step7 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 1000 +system sh/exec.sh -n dnode1 -s start +sleep 3000 + +sql reset query cache +sleep 1000 + +sql show db.tables +if $rows != 30 then + return -1 +endi + +sql select * from db.t0 +if $rows != 1 then + return -1 +endi + +sql select * from db.t10 +if $rows != 1 then + return -1 +endi + +sql select * from db.t20 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 30 then + return -1 +endi + +print ============================ step8 +sql_error create table db.t30 using db.st tags(10) +sql show db.tables +if $rows != 30 then + return -1 +endi + +print ============================ step9 + +sql alter database db maxTables 40 +sleep 1000 + +sql create table db.t30 using db.st tags(0) +sql create table db.t31 using db.st tags(1) +sql create table db.t32 using db.st tags(2) +sql create table db.t33 using db.st tags(3) +sql create table db.t34 using db.st tags(4) +sql create table db.t35 using db.st tags(5) +sql create table db.t36 using db.st tags(6) +sql create table db.t37 using db.st tags(7) +sql create table db.t38 using db.st tags(8) +sql create table db.t39 using db.st tags(9) + +sql insert into db.t30 values(now, 1) +sql insert into db.t31 values(now, 1) +sql insert into db.t32 values(now, 1) +sql insert into db.t33 values(now, 1) +sql insert into db.t34 values(now, 1) +sql insert into db.t35 values(now, 1) +sql insert into db.t36 values(now, 1) +sql insert into db.t37 values(now, 1) +sql insert into db.t38 values(now, 1) +sql insert into db.t39 values(now, 1) + +sql show db.tables +if $rows != 40 then + return -1 +endi + +sql reset query cache +sleep 1000 + +sql select * from db.t0 +if $rows != 1 then + return -1 +endi + +sql select * from db.t10 +if $rows != 1 then + return -1 +endi + +sql select * from db.t20 +if $rows != 1 then + return -1 +endi + +sql select * from db.t30 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 40 then + return -1 +endi + + +print ============================ step10 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 1000 +system sh/exec.sh -n dnode1 -s start +sleep 3000 + +sql reset query cache +sleep 1000 + +sql show db.tables +if $rows != 40 then + return -1 +endi + +sql select * from db.t0 +if $rows != 1 then + return -1 +endi + +sql select * from db.t10 +if $rows != 1 then + return -1 +endi + +sql select * from db.t20 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 40 then + return -1 +endi + +print ============================ step11 +sql_error create table db.t40 using db.st tags(10) +sql show db.tables +if $rows != 40 then + return -1 +endi + +print ============================ step12 + +sql alter database db maxTables 50 +sleep 1000 + +sql create table db.t40 using db.st tags(0) +sql create table db.t41 using db.st tags(1) +sql create table db.t42 using db.st tags(2) +sql create table db.t43 using db.st tags(3) +sql create table db.t44 using db.st tags(4) +sql create table db.t45 using db.st tags(5) +sql create table db.t46 using db.st tags(6) +sql create table db.t47 using db.st tags(7) +sql create table db.t48 using db.st tags(8) +sql create table db.t49 using db.st tags(9) + +sql insert into db.t40 values(now, 1) +sql insert into db.t41 values(now, 1) +sql insert into db.t42 values(now, 1) +sql insert into db.t43 values(now, 1) +sql insert into db.t44 values(now, 1) +sql insert into db.t45 values(now, 1) +sql insert into db.t46 values(now, 1) +sql insert into db.t47 values(now, 1) +sql insert into db.t48 values(now, 1) +sql insert into db.t49 values(now, 1) + +sql show db.tables +if $rows != 50 then + return -1 +endi + +sql reset query cache +sleep 1000 + +sql select * from db.t0 +if $rows != 1 then + return -1 +endi + +sql select * from db.t10 +if $rows != 1 then + return -1 +endi + +sql select * from db.t20 +if $rows != 1 then + return -1 +endi + +sql select * from db.t30 +if $rows != 1 then + return -1 +endi + +sql select * from db.t40 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 50 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/alter_tables_v4.sim b/tests/script/general/db/alter_tables_v4.sim new file mode 100644 index 0000000000..db00219ed0 --- /dev/null +++ b/tests/script/general/db/alter_tables_v4.sim @@ -0,0 +1,457 @@ +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 numOfTotalVnodes -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 + +system sh/exec.sh -n dnode1 -s start + +sleep 3000 +sql connect + +print ============================ step1 + +sql create database db maxTables 5 +sql create table db.st (ts timestamp, i int) tags(t int) +sql create table db.t000 using db.st tags(0) +sql create table db.t001 using db.st tags(1) +sql create table db.t002 using db.st tags(2) +sql create table db.t003 using db.st tags(3) +sql create table db.t004 using db.st tags(4) +sql create table db.t005 using db.st tags(5) +sql create table db.t006 using db.st tags(6) +sql create table db.t007 using db.st tags(7) +sql create table db.t008 using db.st tags(8) +sql create table db.t009 using db.st tags(9) +sql create table db.t010 using db.st tags(0) +sql create table db.t011 using db.st tags(1) +sql create table db.t012 using db.st tags(2) +sql create table db.t013 using db.st tags(3) +sql create table db.t014 using db.st tags(4) +sql create table db.t015 using db.st tags(5) +sql create table db.t016 using db.st tags(6) +sql create table db.t017 using db.st tags(7) +sql create table db.t018 using db.st tags(8) +sql create table db.t019 using db.st tags(9) + +sql show db.tables +if $rows != 20 then + return -1 +endi + +sql insert into db.t000 values(now, 1) +sql insert into db.t001 values(now, 1) +sql insert into db.t002 values(now, 1) +sql insert into db.t003 values(now, 1) +sql insert into db.t004 values(now, 1) +sql insert into db.t005 values(now, 1) +sql insert into db.t006 values(now, 1) +sql insert into db.t007 values(now, 1) +sql insert into db.t008 values(now, 1) +sql insert into db.t009 values(now, 1) +sql insert into db.t010 values(now, 1) +sql insert into db.t011 values(now, 1) +sql insert into db.t012 values(now, 1) +sql insert into db.t013 values(now, 1) +sql insert into db.t014 values(now, 1) +sql insert into db.t015 values(now, 1) +sql insert into db.t016 values(now, 1) +sql insert into db.t017 values(now, 1) +sql insert into db.t018 values(now, 1) +sql insert into db.t019 values(now, 1) + +print ============================ step2 +sql_error create table db.t100 using db.st tags(10) +sql show db.tables +if $rows != 20 then + return -1 +endi + +print ============================ step3 + +sql alter database db maxTables 10 +sleep 1000 + +sql create table db.t100 using db.st tags(0) +sql create table db.t101 using db.st tags(1) +sql create table db.t102 using db.st tags(2) +sql create table db.t103 using db.st tags(3) +sql create table db.t104 using db.st tags(4) +sql create table db.t105 using db.st tags(5) +sql create table db.t106 using db.st tags(6) +sql create table db.t107 using db.st tags(7) +sql create table db.t108 using db.st tags(8) +sql create table db.t109 using db.st tags(9) +sql create table db.t110 using db.st tags(0) +sql create table db.t111 using db.st tags(1) +sql create table db.t112 using db.st tags(2) +sql create table db.t113 using db.st tags(3) +sql create table db.t114 using db.st tags(4) +sql create table db.t115 using db.st tags(5) +sql create table db.t116 using db.st tags(6) +sql create table db.t117 using db.st tags(7) +sql create table db.t118 using db.st tags(8) +sql create table db.t119 using db.st tags(9) +sql show db.tables +if $rows != 40 then + return -1 +endi + + +sql insert into db.t100 values(now, 1) +sql insert into db.t101 values(now, 1) +sql insert into db.t102 values(now, 1) +sql insert into db.t103 values(now, 1) +sql insert into db.t104 values(now, 1) +sql insert into db.t105 values(now, 1) +sql insert into db.t106 values(now, 1) +sql insert into db.t107 values(now, 1) +sql insert into db.t108 values(now, 1) +sql insert into db.t109 values(now, 1) +sql insert into db.t110 values(now, 1) +sql insert into db.t111 values(now, 1) +sql insert into db.t112 values(now, 1) +sql insert into db.t113 values(now, 1) +sql insert into db.t114 values(now, 1) +sql insert into db.t115 values(now, 1) +sql insert into db.t116 values(now, 1) +sql insert into db.t117 values(now, 1) +sql insert into db.t118 values(now, 1) +sql insert into db.t119 values(now, 1) + +print ============================ step4 +sql_error create table db.t200 using db.st tags(10) +sql show db.tables +if $rows != 40 then + return -1 +endi + +print ============================ step5 + +sql alter database db maxTables 15 +sleep 1000 + +sql create table db.t200 using db.st tags(0) +sql create table db.t201 using db.st tags(1) +sql create table db.t202 using db.st tags(2) +sql create table db.t203 using db.st tags(3) +sql create table db.t204 using db.st tags(4) +sql create table db.t205 using db.st tags(5) +sql create table db.t206 using db.st tags(6) +sql create table db.t207 using db.st tags(7) +sql create table db.t208 using db.st tags(8) +sql create table db.t209 using db.st tags(9) +sql create table db.t210 using db.st tags(0) +sql create table db.t211 using db.st tags(1) +sql create table db.t212 using db.st tags(2) +sql create table db.t213 using db.st tags(3) +sql create table db.t214 using db.st tags(4) +sql create table db.t215 using db.st tags(5) +sql create table db.t216 using db.st tags(6) +sql create table db.t217 using db.st tags(7) +sql create table db.t218 using db.st tags(8) +sql create table db.t219 using db.st tags(9) +sql show db.tables +if $rows != 60 then + return -1 +endi + +sql insert into db.t200 values(now, 1) +sql insert into db.t201 values(now, 1) +sql insert into db.t202 values(now, 1) +sql insert into db.t203 values(now, 1) +sql insert into db.t204 values(now, 1) +sql insert into db.t205 values(now, 1) +sql insert into db.t206 values(now, 1) +sql insert into db.t207 values(now, 1) +sql insert into db.t208 values(now, 1) +sql insert into db.t209 values(now, 1) +sql insert into db.t210 values(now, 1) +sql insert into db.t211 values(now, 1) +sql insert into db.t212 values(now, 1) +sql insert into db.t213 values(now, 1) +sql insert into db.t214 values(now, 1) +sql insert into db.t215 values(now, 1) +sql insert into db.t216 values(now, 1) +sql insert into db.t217 values(now, 1) +sql insert into db.t218 values(now, 1) +sql insert into db.t219 values(now, 1) + +print ============================ step6 + +sql reset query cache +sleep 1000 + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 60 then + return -1 +endi + +print ============================ step7 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 1000 +system sh/exec.sh -n dnode1 -s start +sleep 3000 + +sql reset query cache +sleep 1000 + +sql show db.tables +if $rows != 60 then + return -1 +endi + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 60 then + return -1 +endi + +print ============================ step8 +sql_error create table db.t300 using db.st tags(10) +sql show db.tables +if $rows != 60 then + return -1 +endi + +print ============================ step9 + +sql alter database db maxTables 20 +sleep 1000 + +sql create table db.t300 using db.st tags(0) +sql create table db.t301 using db.st tags(1) +sql create table db.t302 using db.st tags(2) +sql create table db.t303 using db.st tags(3) +sql create table db.t304 using db.st tags(4) +sql create table db.t305 using db.st tags(5) +sql create table db.t306 using db.st tags(6) +sql create table db.t307 using db.st tags(7) +sql create table db.t308 using db.st tags(8) +sql create table db.t309 using db.st tags(9) +sql create table db.t310 using db.st tags(0) +sql create table db.t311 using db.st tags(1) +sql create table db.t312 using db.st tags(2) +sql create table db.t313 using db.st tags(3) +sql create table db.t314 using db.st tags(4) +sql create table db.t315 using db.st tags(5) +sql create table db.t316 using db.st tags(6) +sql create table db.t317 using db.st tags(7) +sql create table db.t318 using db.st tags(8) +sql create table db.t319 using db.st tags(9) + +sql insert into db.t300 values(now, 1) +sql insert into db.t301 values(now, 1) +sql insert into db.t302 values(now, 1) +sql insert into db.t303 values(now, 1) +sql insert into db.t304 values(now, 1) +sql insert into db.t305 values(now, 1) +sql insert into db.t306 values(now, 1) +sql insert into db.t307 values(now, 1) +sql insert into db.t308 values(now, 1) +sql insert into db.t309 values(now, 1) +sql insert into db.t310 values(now, 1) +sql insert into db.t311 values(now, 1) +sql insert into db.t312 values(now, 1) +sql insert into db.t313 values(now, 1) +sql insert into db.t314 values(now, 1) +sql insert into db.t315 values(now, 1) +sql insert into db.t316 values(now, 1) +sql insert into db.t317 values(now, 1) +sql insert into db.t318 values(now, 1) +sql insert into db.t319 values(now, 1) + +sql show db.tables +if $rows != 80 then + return -1 +endi + +sql reset query cache +sleep 1000 + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.t300 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 80 then + return -1 +endi + +print ============================ step10 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 1000 +system sh/exec.sh -n dnode1 -s start +sleep 3000 + +sql reset query cache +sleep 1000 + +sql show db.tables +if $rows != 80 then + return -1 +endi + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.t300 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 80 then + return -1 +endi + +print ============================ step11 +sql_error create table db.t400 using db.st tags(10) +sql show db.tables +if $rows != 80 then + return -1 +endi + +print ============================ step12 + +sql alter database db maxTables 25 +sleep 1000 + +sql create table db.t400 using db.st tags(0) +sql create table db.t401 using db.st tags(1) +sql create table db.t402 using db.st tags(2) +sql create table db.t403 using db.st tags(3) +sql create table db.t404 using db.st tags(4) +sql create table db.t405 using db.st tags(5) +sql create table db.t406 using db.st tags(6) +sql create table db.t407 using db.st tags(7) +sql create table db.t408 using db.st tags(8) +sql create table db.t409 using db.st tags(9) +sql create table db.t410 using db.st tags(0) +sql create table db.t411 using db.st tags(1) +sql create table db.t412 using db.st tags(2) +sql create table db.t413 using db.st tags(3) +sql create table db.t414 using db.st tags(4) +sql create table db.t415 using db.st tags(5) +sql create table db.t416 using db.st tags(6) +sql create table db.t417 using db.st tags(7) +sql create table db.t418 using db.st tags(8) +sql create table db.t419 using db.st tags(9) + +sql insert into db.t400 values(now, 1) +sql insert into db.t401 values(now, 1) +sql insert into db.t402 values(now, 1) +sql insert into db.t403 values(now, 1) +sql insert into db.t404 values(now, 1) +sql insert into db.t405 values(now, 1) +sql insert into db.t406 values(now, 1) +sql insert into db.t407 values(now, 1) +sql insert into db.t408 values(now, 1) +sql insert into db.t409 values(now, 1) +sql insert into db.t410 values(now, 1) +sql insert into db.t411 values(now, 1) +sql insert into db.t412 values(now, 1) +sql insert into db.t413 values(now, 1) +sql insert into db.t414 values(now, 1) +sql insert into db.t415 values(now, 1) +sql insert into db.t416 values(now, 1) +sql insert into db.t417 values(now, 1) +sql insert into db.t418 values(now, 1) +sql insert into db.t419 values(now, 1) + +sql show db.tables +if $rows != 100 then + return -1 +endi + +sql reset query cache +sleep 1000 + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.t300 +if $rows != 1 then + return -1 +endi + +sql select * from db.t400 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 100 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/alter_vgroups.sim b/tests/script/general/db/alter_vgroups.sim new file mode 100644 index 0000000000..1aae7b9383 --- /dev/null +++ b/tests/script/general/db/alter_vgroups.sim @@ -0,0 +1,210 @@ +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 numOfTotalVnodes -v 1 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 + +system sh/exec.sh -n dnode1 -s start + +sleep 3000 +sql connect + +print ============================ step1 + +sql create database db maxTables 20 +sql create table db.st (ts timestamp, i int) tags(t int) +sql create table db.t000 using db.st tags(0) +sql create table db.t001 using db.st tags(1) +sql create table db.t002 using db.st tags(2) +sql create table db.t003 using db.st tags(3) +sql create table db.t004 using db.st tags(4) +sql create table db.t005 using db.st tags(5) +sql create table db.t006 using db.st tags(6) +sql create table db.t007 using db.st tags(7) +sql create table db.t008 using db.st tags(8) +sql create table db.t009 using db.st tags(9) +sql create table db.t010 using db.st tags(0) +sql create table db.t011 using db.st tags(1) +sql create table db.t012 using db.st tags(2) +sql create table db.t013 using db.st tags(3) +sql create table db.t014 using db.st tags(4) +sql create table db.t015 using db.st tags(5) +sql create table db.t016 using db.st tags(6) +sql create table db.t017 using db.st tags(7) +sql create table db.t018 using db.st tags(8) +sql create table db.t019 using db.st tags(9) + +sql show db.tables +if $rows != 20 then + return -1 +endi + +sql insert into db.t000 values(now, 1) +sql insert into db.t001 values(now, 1) +sql insert into db.t002 values(now, 1) +sql insert into db.t003 values(now, 1) +sql insert into db.t004 values(now, 1) +sql insert into db.t005 values(now, 1) +sql insert into db.t006 values(now, 1) +sql insert into db.t007 values(now, 1) +sql insert into db.t008 values(now, 1) +sql insert into db.t009 values(now, 1) +sql insert into db.t010 values(now, 1) +sql insert into db.t011 values(now, 1) +sql insert into db.t012 values(now, 1) +sql insert into db.t013 values(now, 1) +sql insert into db.t014 values(now, 1) +sql insert into db.t015 values(now, 1) +sql insert into db.t016 values(now, 1) +sql insert into db.t017 values(now, 1) +sql insert into db.t018 values(now, 1) +sql insert into db.t019 values(now, 1) + +print ============================ step2 +sql_error create table db.t100 using db.st tags(10) +sql show db.tables +if $rows != 20 then + return -1 +endi + +print ============================ step3 +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 2 +sleep 1000 +system sh/exec.sh -n dnode1 -s start +sleep 3000 + +sql create table db.t100 using db.st tags(0) +sql create table db.t101 using db.st tags(1) +sql create table db.t102 using db.st tags(2) +sql create table db.t103 using db.st tags(3) +sql create table db.t104 using db.st tags(4) +sql create table db.t105 using db.st tags(5) +sql create table db.t106 using db.st tags(6) +sql create table db.t107 using db.st tags(7) +sql create table db.t108 using db.st tags(8) +sql create table db.t109 using db.st tags(9) +sql create table db.t110 using db.st tags(0) +sql create table db.t111 using db.st tags(1) +sql create table db.t112 using db.st tags(2) +sql create table db.t113 using db.st tags(3) +sql create table db.t114 using db.st tags(4) +sql create table db.t115 using db.st tags(5) +sql create table db.t116 using db.st tags(6) +sql create table db.t117 using db.st tags(7) +sql create table db.t118 using db.st tags(8) +sql create table db.t119 using db.st tags(9) +sql show db.tables +if $rows != 40 then + return -1 +endi + + +sql insert into db.t100 values(now, 1) +sql insert into db.t101 values(now, 1) +sql insert into db.t102 values(now, 1) +sql insert into db.t103 values(now, 1) +sql insert into db.t104 values(now, 1) +sql insert into db.t105 values(now, 1) +sql insert into db.t106 values(now, 1) +sql insert into db.t107 values(now, 1) +sql insert into db.t108 values(now, 1) +sql insert into db.t109 values(now, 1) +sql insert into db.t110 values(now, 1) +sql insert into db.t111 values(now, 1) +sql insert into db.t112 values(now, 1) +sql insert into db.t113 values(now, 1) +sql insert into db.t114 values(now, 1) +sql insert into db.t115 values(now, 1) +sql insert into db.t116 values(now, 1) +sql insert into db.t117 values(now, 1) +sql insert into db.t118 values(now, 1) +sql insert into db.t119 values(now, 1) + +print ============================ step4 +sql_error create table db.t200 using db.st tags(10) +sql show db.tables +if $rows != 40 then + return -1 +endi + +print ============================ step5 + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 3 +sleep 1000 +system sh/exec.sh -n dnode1 -s start +sleep 3000 + +sql create table db.t200 using db.st tags(0) +sql create table db.t201 using db.st tags(1) +sql create table db.t202 using db.st tags(2) +sql create table db.t203 using db.st tags(3) +sql create table db.t204 using db.st tags(4) +sql create table db.t205 using db.st tags(5) +sql create table db.t206 using db.st tags(6) +sql create table db.t207 using db.st tags(7) +sql create table db.t208 using db.st tags(8) +sql create table db.t209 using db.st tags(9) +sql create table db.t210 using db.st tags(0) +sql create table db.t211 using db.st tags(1) +sql create table db.t212 using db.st tags(2) +sql create table db.t213 using db.st tags(3) +sql create table db.t214 using db.st tags(4) +sql create table db.t215 using db.st tags(5) +sql create table db.t216 using db.st tags(6) +sql create table db.t217 using db.st tags(7) +sql create table db.t218 using db.st tags(8) +sql create table db.t219 using db.st tags(9) +sql show db.tables +if $rows != 60 then + return -1 +endi + +sql insert into db.t200 values(now, 1) +sql insert into db.t201 values(now, 1) +sql insert into db.t202 values(now, 1) +sql insert into db.t203 values(now, 1) +sql insert into db.t204 values(now, 1) +sql insert into db.t205 values(now, 1) +sql insert into db.t206 values(now, 1) +sql insert into db.t207 values(now, 1) +sql insert into db.t208 values(now, 1) +sql insert into db.t209 values(now, 1) +sql insert into db.t210 values(now, 1) +sql insert into db.t211 values(now, 1) +sql insert into db.t212 values(now, 1) +sql insert into db.t213 values(now, 1) +sql insert into db.t214 values(now, 1) +sql insert into db.t215 values(now, 1) +sql insert into db.t216 values(now, 1) +sql insert into db.t217 values(now, 1) +sql insert into db.t218 values(now, 1) +sql insert into db.t219 values(now, 1) + +print ============================ step6 + +sql reset query cache +sleep 1000 + +sql select * from db.t000 +if $rows != 1 then + return -1 +endi + +sql select * from db.t100 +if $rows != 1 then + return -1 +endi + +sql select * from db.t200 +if $rows != 1 then + return -1 +endi + +sql select * from db.st +if $rows != 60 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/dropdnodes.sim b/tests/script/general/db/dropdnodes.sim new file mode 100644 index 0000000000..7ba5e7b66e --- /dev/null +++ b/tests/script/general/db/dropdnodes.sim @@ -0,0 +1,104 @@ +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/deploy.sh -n dnode2 -i 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 + +print ========== prepare data +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start + +sleep 3000 +sql connect + +sql create dnode $hostname2 +sleep 2000 + +sql create database db maxTables 4 +sql use db + +print ========== step1 +sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) +sql create table db.t1 using db.mt tags(1) +sql create table db.t2 using db.mt tags(2) +sql create table db.t3 using db.mt tags(3) +sql create table db.t4 using db.mt tags(4) +sql create table db.t5 using db.mt tags(5) +sql create table db.t6 using db.mt tags(6) +sql create table db.t7 using db.mt tags(7) +sql create table db.t8 using db.mt tags(8) +sql create table db.t9 using db.mt tags(9) +sql create table db.t10 using db.mt tags(10) +sql create table db.t11 using db.mt tags(11) +sql create table db.t12 using db.mt tags(12) +sql create table db.t13 using db.mt tags(13) +sql create table db.t14 using db.mt tags(14) +sql create table db.t15 using db.mt tags(15) +sql create table db.t16 using db.mt tags(16) + +sql insert into db.t1 values(now, 1) +sql insert into db.t2 values(now, 1) +sql insert into db.t3 values(now, 1) +sql insert into db.t4 values(now, 1) +sql insert into db.t5 values(now, 1) +sql insert into db.t6 values(now, 1) +sql insert into db.t7 values(now, 1) +sql insert into db.t8 values(now, 1) +sql insert into db.t9 values(now, 1) +sql insert into db.t10 values(now, 1) +sql insert into db.t11 values(now, 1) +sql insert into db.t12 values(now, 1) +sql insert into db.t13 values(now, 1) +sql insert into db.t14 values(now, 1) +sql insert into db.t15 values(now, 1) +sql insert into db.t16 values(now, 1) + +print ========== step2 +sql show tables +print $rows +if $rows != 16 then + return -1 +endi + +sql select * from mt +print $rows +if $rows != 16 then + return -1 +endi + +print ========== step3 + +system sh/exec.sh -n dnode2 -s stop -x SIGINT +sleep 500 +sql drop dnode $hostname2 +sleep 2000 + +print ========== step3 + +sql show tables +print $rows +if $rows != 8 then + return -1 +endi + +sql select * from mt +print $rows +if $rows != 8 then + return -1 +endi + +sql select * from db.t5 +if $rows != 1 then + return -1 +endi + +sql select * from db.t13 +if $rows != 1 then + return -1 +endi + +sql_error select * from db.t1 +sql_error select * from db.t9 + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful_insert.sim b/tests/script/general/http/restful_insert.sim index 7b1e88a25f..b36a92c003 100644 --- a/tests/script/general/http/restful_insert.sim +++ b/tests/script/general/http/restful_insert.sim @@ -37,7 +37,7 @@ endi print =============== step3 - query data -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql diff --git a/tests/script/general/import/replica1.sim b/tests/script/general/import/replica1.sim index ad5a3faed5..61f563ba8e 100644 --- a/tests/script/general/import/replica1.sim +++ b/tests/script/general/import/replica1.sim @@ -32,10 +32,10 @@ sql connect sql create database ir1db days 7 sql use ir1db -sql create table tb(ts timestamp, i int) +sql create table tb(ts timestamp, i bigint) print ================= step1 -sql import into tb values(1520000010000, 10000) +sql import into tb values(1520000010000, 1520000010000) sql select * from tb; print $rows if $rows != 1 then @@ -43,7 +43,7 @@ if $rows != 1 then endi print ================= step2 -sql insert into tb values(1520000008000, 8000) +sql insert into tb values(1520000008000, 1520000008000) print $rows sql select * from tb; if $rows != 2 then @@ -51,7 +51,7 @@ if $rows != 2 then endi print ================= step3 -sql insert into tb values(1520000020000, 20000) +sql insert into tb values(1520000020000, 1520000020000) sql select * from tb; print $rows if $rows != 3 then @@ -59,9 +59,9 @@ if $rows != 3 then endi print ================= step4 -sql import into tb values(1520000009000, 9000) -sql import into tb values(1520000015000, 15000) -sql import into tb values(1520000030000, 30000) +sql import into tb values(1520000009000, 1520000009000) +sql import into tb values(1520000015000, 1520000015000) +sql import into tb values(1520000030000, 1520000030000) sql select * from tb; print $rows if $rows != 6 then @@ -69,10 +69,10 @@ if $rows != 6 then endi print ================= step5 -sql insert into tb values(1520000008000, 8000) -sql insert into tb values(1520000014000, 14000) -sql insert into tb values(1520000025000, 25000) -sql insert into tb values(1520000040000, 40000) +sql insert into tb values(1520000008000, 1520000008000) +sql insert into tb values(1520000014000, 1520000014000) +sql insert into tb values(1520000025000, 1520000025000) +sql insert into tb values(1520000040000, 1520000040000) sql select * from tb; print $rows if $rows != 9 then @@ -80,11 +80,11 @@ if $rows != 9 then endi print ================= step6 -sql import into tb values(1520000007000, 7000) -sql import into tb values(1520000012000, 12000) -sql import into tb values(1520000023000, 23000) -sql import into tb values(1520000034000, 34000) -sql import into tb values(1520000050000, 50000) +sql import into tb values(1520000007000, 1520000007000) +sql import into tb values(1520000012000, 1520000012000) +sql import into tb values(1520000023000, 1520000023000) +sql import into tb values(1520000034000, 1520000034000) +sql import into tb values(1520000050000, 1520000050000) sql select * from tb; print $rows if $rows != 14 then @@ -104,11 +104,11 @@ if $rows != 14 then endi print ================= step7 -sql import into tb values(1520000007001, 7001) -sql import into tb values(1520000012001, 12001) -sql import into tb values(1520000023001, 23001) -sql import into tb values(1520000034001, 34001) -sql import into tb values(1520000050001, 50001) +sql import into tb values(1520000007001, 1520000007001) +sql import into tb values(1520000012001, 1520000012001) +sql import into tb values(1520000023001, 1520000023001) +sql import into tb values(1520000034001, 1520000034001) +sql import into tb values(1520000050001, 1520000050001) sql select * from tb; print $rows if $rows != 19 then @@ -117,10 +117,10 @@ if $rows != 19 then endi print ================= step8 -sql insert into tb values(1520000008002, 8002) -sql insert into tb values(1520000014002, 14002) -sql insert into tb values(1520000025002, 25002) -sql insert into tb values(1520000060000, 60000) +sql insert into tb values(1520000008002, 1520000008002) +sql insert into tb values(1520000014002, 1520000014002) +sql insert into tb values(1520000025002, 1520000025002) +sql insert into tb values(1520000060000, 1520000060000) sql select * from tb; print $rows if $rows != 23 then @@ -142,18 +142,18 @@ print ================= step9 #sql import into tb values(now+14d, 50001) #sql import into tb values(now+16d, 500051) -sql import into tb values(1517408000000, 7003) -sql import into tb values(1518272000000, 34003) -sql import into tb values(1519136000000, 34003) -sql import into tb values(1519568000000, 34003) -sql import into tb values(1519654400000, 50001) -sql import into tb values(1519827200000, 50001) -sql import into tb values(1520345600000, 50001) -sql import into tb values(1520691200000, 50002) -sql import into tb values(1520864000000, 50003) -sql import into tb values(1521900800000, 50004) -sql import into tb values(1523110400000, 50001) -sql import into tb values(1521382400000, 500051) +sql import into tb values(1517408000000, 1517408000000) +sql import into tb values(1518272000000, 1518272000000) +sql import into tb values(1519136000000, 1519136000000) +sql import into tb values(1519568000000, 1519568000000) +sql import into tb values(1519654400000, 1519654400000) +sql import into tb values(1519827200000, 1519827200000) +sql import into tb values(1520345600000, 1520345600000) +sql import into tb values(1520691200000, 1520691200000) +sql import into tb values(1520864000000, 1520864000000) +sql import into tb values(1521900800000, 1521900800000) +sql import into tb values(1523110400000, 1523110400000) +sql import into tb values(1521382400000, 1521382400000) sql select * from tb; print $rows if $rows != 35 then @@ -176,7 +176,7 @@ endi print ================= step11 #sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) -sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003) +sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) sql select * from tb; if $rows != 40 then return -1 @@ -184,8 +184,8 @@ endi print ================= step12 #1520000000000 -#sql import into tb values(now-19d, 7003) (now-18d, 7003) (now-17d, 7003) (now-16d, 7003) (now-15d, 7003) (now-14d, 7003) (now-13d, 7003) (now-12d, 7003) (now-11d, 7003) -sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003) +#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11) +sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) sql select * from tb; print $rows if $rows != 49 then @@ -195,13 +195,13 @@ endi print ================= step14 #1520000000000 -#sql import into tb values(now-48d, 34003) -#sql import into tb values(now-38d, 50001) -#sql import into tb values(now-28d, 50001) +#sql import into tb values(now-48d, -48) +#sql import into tb values(now-38d, -38) +#sql import into tb values(now-28d, -28) -sql import into tb values(1515852800001, 34003) -sql import into tb values(1516716800000, 50001) -sql import into tb values(1517580800000, 50001) +sql import into tb values(1515852800001, -48) +sql import into tb values(1516716800000, -38) +sql import into tb values(1517580800000, -28) sql select * from tb; if $rows != 52 then diff --git a/tests/script/general/parser/create_db.sim b/tests/script/general/parser/create_db.sim index 817d712aa6..7b08d942fd 100644 --- a/tests/script/general/parser/create_db.sim +++ b/tests/script/general/parser/create_db.sim @@ -104,14 +104,14 @@ $replica = 1 # max=3 $days = 10 $keep = 365 $rows_db = 1000 -$cache = 4096 # 4 kb +$cache = 16 # 16MB $ablocks = 100 $tblocks = 32 # max=512, automatically trimmed when exceeding $ctime = 36000 # 10 hours $wal = 0 # valid value is 0, 1, 2 $comp = 1 # max=32, automatically trimmed when exceeding -sql create database $db replica $replica days $days keep $keep maxrows $rows_db cache $cache ablocks $ablocks tblocks $tblocks ctime $ctime wal $wal comp $comp +sql create database $db replica $replica days $days keep $keep maxrows $rows_db cache $cache ctime $ctime wal $wal comp $comp sql show databases if $rows != 1 then return -1 diff --git a/tests/script/general/parser/first_last_query.sim b/tests/script/general/parser/first_last_query.sim index c6237198c5..fa5ed8b4ad 100644 --- a/tests/script/general/parser/first_last_query.sim +++ b/tests/script/general/parser/first_last_query.sim @@ -27,32 +27,25 @@ endi if $data00 != @18-09-17 08:59:00.000@ then return -1 endi -#if $data01 != NULL then if $data01 != 0 then return -1 endi -#if $data02 != NULL then if $data02 != 0 then return -1 endi -#if $data03 != NULL then print data03 = $data03 if $data03 != 0.00000 then return -1 endi -#if $data04 != NULL then if $data04 != 0.000000000 then return -1 endi -#if $data05 != NULL then if $data05 != 0 then return -1 endi -#if $data06 != NULL then if $data06 != 0 then return -1 endi -#if $data07 != NULL then if $data07 != 1 then return -1 endi diff --git a/tests/script/general/parser/limit1.sim b/tests/script/general/parser/limit1.sim index 7971cb81c6..48fb6aaede 100644 --- a/tests/script/general/parser/limit1.sim +++ b/tests/script/general/parser/limit1.sim @@ -65,7 +65,7 @@ sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -#run general/parser/limit1_tb.sim +run general/parser/limit1_tb.sim run general/parser/limit1_stb.sim system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/limit1_tblocks100.sim b/tests/script/general/parser/limit1_tblocks100.sim index af4d3eda85..126c3227a7 100644 --- a/tests/script/general/parser/limit1_tblocks100.sim +++ b/tests/script/general/parser/limit1_tblocks100.sim @@ -21,7 +21,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db tblocks 100 +sql create database $db cache 16 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) diff --git a/tests/script/general/parser/limit2_query.sim b/tests/script/general/parser/limit2_query.sim index 57cd13abee..cbff2e946c 100644 --- a/tests/script/general/parser/limit2_query.sim +++ b/tests/script/general/parser/limit2_query.sim @@ -36,6 +36,7 @@ if $data01 != 2 then return -1 endi if $data02 != tb2 then + print expect tb2, actual: $data02 return -1 endi if $data03 != tb2 then diff --git a/tests/script/general/parser/limit_stb.sim b/tests/script/general/parser/limit_stb.sim index c6a3766b7d..9983424dbf 100644 --- a/tests/script/general/parser/limit_stb.sim +++ b/tests/script/general/parser/limit_stb.sim @@ -47,19 +47,21 @@ sql select * from $stb order by ts desc limit 5 if $rows != 5 then return -1 endi + sql select * from $stb order by ts desc limit 5 offset 1 if $rows != 5 then return -1 endi -if $data01 != 8 then +if $data01 != 9 then return -1 endi -if $data11 != 7 then +if $data11 != 9 then return -1 endi -if $data41 != 4 then +if $data41 != 9 then return -1 endi + sql select * from $stb order by ts asc limit 5 if $rows != 5 then return -1 @@ -67,19 +69,28 @@ endi if $data00 != @18-09-17 09:00:00.000@ then return -1 endi + +if $data40 != @18-09-17 09:00:00.000@ then + return -1 +endi + if $data01 != 0 then return -1 endi -if $data12 != 1 then + +print data12 = $data12 +if $data12 != NULL then return -1 endi -if $data24 != 2.000000000 then + +if $data24 != NULL then return -1 endi -if $data35 != 3 then + +if $data35 != 0 then return -1 endi -if $data49 != nchar4 then +if $data49 != nchar0 then return -1 endi @@ -87,10 +98,18 @@ sql select * from $stb order by ts asc limit 5 offset 1 if $rows != 5 then return -1 endi -if $data01 != 1 then +if $data01 != 0 then return -1 endi -if $data41 != 5 then +if $data41 != 0 then + return -1 +endi + +if $data40 != @18-09-17 09:00:00.000@ then + return -1 +endi + +if $data00 != @18-09-17 09:00:00.000@ then return -1 endi @@ -98,6 +117,7 @@ sql select * from $stb limit 500 offset 1 if $rows != 99 then return -1 endi + if $data01 != 1 then return -1 endi @@ -629,6 +649,7 @@ endi if $data09 != 7 then return -1 endi +print $data13 if $data13 != 0.000000000 then return -1 endi @@ -656,6 +677,8 @@ endi if $data35 != 0 then return -1 endi + +print $data36 if $data36 != 0.000000000 then return -1 endi @@ -675,49 +698,49 @@ if $data59 != 2 then return -1 endi -sql select max(c2), min(c2), avg(c2), count(c2), sum(c2), spread(c2), first(c2), last(c2) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1 -if $rows != 3 then - return -1 -endi -if $data00 != @18-09-17 09:20:00.000@ then - return -1 -endi -if $data01 != 2 then - return -1 -endi -if $data02 != 2 then - return -1 -endi -if $data09 != 4 then - return -1 -endi -if $data13 != 3.000000000 then - return -1 -endi -if $data19 != 4 then - return -1 -endi -if $data20 != @18-09-17 09:40:00.000@ then - return -1 -endi -if $data24 != 1 then - return -1 -endi -if $data25 != 4 then - return -1 -endi -if $data26 != 0.000000000 then - return -1 -endi -if $data27 != 4 then - return -1 -endi -if $data28 != 4 then - return -1 -endi -if $data29 != 4 then - return -1 -endi +#sql select max(c2), min(c2), avg(c2), count(c2), sum(c2), spread(c2), first(c2), last(c2) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1 +#if $rows != 3 then +# return -1 +#endi +#if $data00 != @18-09-17 09:20:00.000@ then +# return -1 +#endi +#if $data01 != 2 then +# return -1 +#endi +#if $data02 != 2 then +# return -1 +#endi +#if $data09 != 4 then +# return -1 +#endi +#if $data13 != 3.000000000 then +# return -1 +#endi +#if $data19 != 4 then +# return -1 +#endi +#if $data20 != @18-09-17 09:40:00.000@ then +# return -1 +#endi +#if $data24 != 1 then +# return -1 +#endi +#if $data25 != 4 then +# return -1 +#endi +#if $data26 != 0.000000000 then +# return -1 +#endi +#if $data27 != 4 then +# return -1 +#endi +#if $data28 != 4 then +# return -1 +#endi +#if $data29 != 4 then +# return -1 +#endi sql select max(c2), min(c2), avg(c2), count(c2), spread(c2), first(c2), last(c2), count(ts) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1 if $rows != 6 then diff --git a/tests/script/general/parser/null_char.sim b/tests/script/general/parser/null_char.sim index 7a6c40c1a3..6da419cd4c 100644 --- a/tests/script/general/parser/null_char.sim +++ b/tests/script/general/parser/null_char.sim @@ -177,7 +177,7 @@ sql_error insert into st34 using mt3 tags ('NULL', '123aBc', 105, NULL) values #### case 3: set tag value sql create table mt4 (ts timestamp, c1 int) tags (tag_binary binary(16), tag_nchar nchar(16), tag_int int, tag_bool bool, tag_float float, tag_double double) sql create table st41 using mt4 tags ("beijing", 'nchar_tag', 100, false, 9.12345, 7.123456789) -sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double st41 +sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41 if $rows != 1 then return -1 endi @@ -190,13 +190,17 @@ endi if $data02 != 100 then return -1 endi -if $data03 != false then +if $data03 != 0 then return -1 endi -if $dat04 != 9.123450 then + +if $data04 != 9.12345 then + print expect 9.12345 , actual: $data04 return -1 endi -if $data05 != 7.123457 then + +if $data05 != 7.123456789 then + print expect 7.123456789 , actual: $data05 return -1 endi diff --git a/tests/script/general/parser/projection_limit_offset.sim b/tests/script/general/parser/projection_limit_offset.sim index 52be50c032..5f006d0eb7 100644 --- a/tests/script/general/parser/projection_limit_offset.sim +++ b/tests/script/general/parser/projection_limit_offset.sim @@ -133,7 +133,7 @@ if $rows != 4007 then return -1 endi -if $data00 != @70-01-01 08:01:43.499@ then +if $data00 != @70-01-01 08:01:43.500@ then return -1 endi @@ -143,7 +143,7 @@ if $rows != 3907 then return -1 endi -if $data00 != @70-01-01 08:01:43.399@ then +if $data00 != @70-01-01 08:01:43.488@ then return -1 endi @@ -152,7 +152,7 @@ if $rows != 3106 then return -1 endi -if $data00 != @70-01-01 08:01:43.099@ then +if $data00 != @70-01-01 08:01:43.388@ then return -1 endi @@ -161,7 +161,7 @@ if $rows != 3608 then return -1 endi -if $data00 != @70-01-01 08:01:43.100@ then +if $data00 != @70-01-01 08:01:43.450@ then return -1 endi @@ -358,6 +358,15 @@ if $row != 8 then return -1 endi +sql select diff(k) from tm0 +if $row != 3 then + return -1 +endi + +if $data21 != -1 then + return -1 +endi + #error sql sql_error select * from 1; sql_error select 1; @@ -371,8 +380,11 @@ sql_error select 1 interval(1h); sql_error select count(*); sql_error select sum(k); sql_error select 'abc'; +sql_error select k+1,sum(k) from tm0; +sql_error select k, sum(k) from tm0; +sql_error select k, sum(k)+1 from tm0; #=============================tbase-1205 sql select count(*) from tm1 where ts= now -1d interval(1h) fill(NULL); -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file + diff --git a/tests/script/general/parser/slimit.sim b/tests/script/general/parser/slimit.sim index 161463a7c1..be63f91803 100644 --- a/tests/script/general/parser/slimit.sim +++ b/tests/script/general/parser/slimit.sim @@ -22,7 +22,7 @@ $db = $dbPrefix . $i $stb = $stbPrefix . $i sql drop database if exists $db -sql create database $db maxrows 200 cache 1024 tblocks 200 maxTables 4 +sql create database $db maxrows 200 cache 16 maxTables 4 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 binary(15), t2 int, t3 bigint, t4 nchar(10), t5 double, t6 bool) @@ -64,7 +64,7 @@ print ====== $db tables created $db = $dbPrefix . 1 sql drop database if exists $db -sql create database $db maxrows 200 cache 1024 +sql create database $db maxrows 200 cache 16 sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 binary(15), t2 int, t3 bigint, t4 nchar(10), t5 double, t6 bool) diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index 0b7d705688..ac867c9f7f 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -38,7 +38,6 @@ sleep 2000 run general/parser/lastrow.sim sleep 2000 run general/parser/nchar.sim - sleep 2000 run general/parser/null_char.sim sleep 2000 @@ -46,7 +45,28 @@ run general/parser/single_row_in_tb.sim sleep 2000 run general/parser/select_from_cache_disk.sim sleep 2000 +run general/parser/selectResNum.sim +sleep 2000 +run general/parser/mixed_blocks.sim +sleep 2000 +run general/parser/limit1.sim +sleep 2000 run general/parser/limit.sim +sleep 2000 +run general/parser/limit1_tblocks100.sim +sleep 2000 +run general/parser/select_across_vnodes.sim +sleep 2000 +run general/parser/slimit1.sim +sleep 2000 +run general/parser/tbnameIn.sim +sleep 2000 +run general/parser/projection_limit_offset.sim + +sleep 2000 +run general/parser/limit2.sim +sleep 2000 +run general/parser/slimit.sim sleep 2000 run general/parser/fill.sim @@ -57,31 +77,15 @@ run general/parser/tags_dynamically_specifiy.sim sleep 2000 run general/parser/interp.sim sleep 2000 -run general/parser/limit1.sim -sleep 2000 -run general/parser/limit1_tblocks100.sim -sleep 2000 -run general/parser/limit2.sim -sleep 2000 -run general/parser/mixed_blocks.sim -sleep 2000 -run general/parser/selectResNum.sim -sleep 2000 -run general/parser/select_across_vnodes.sim -sleep 2000 run general/parser/set_tag_vals.sim -sleep 2000 -run general/parser/slimit.sim -sleep 2000 -run general/parser/slimit1.sim + sleep 2000 run general/parser/slimit_alter_tags.sim sleep 2000 run general/parser/stream_on_sys.sim sleep 2000 run general/parser/stream.sim -sleep 2000 -run general/parser/tbnameIn.sim + sleep 2000 run general/parser/where.sim sleep 2000 @@ -92,8 +96,7 @@ sleep 2000 run general/parser/join.sim sleep 2000 run general/parser/join_multivnode.sim -sleep 2000 -run general/parser/projection_limit_offset.sim + sleep 2000 run general/parser/select_with_tags.sim sleep 2000 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index ea2c538ddf..dc8c564fd9 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -44,6 +44,10 @@ cd ../../../debug; make ./test.sh -f general/compute/top.sim ./test.sh -f general/db/alter_option.sim +./test.sh -f general/db/alter_tables_d2.sim +./test.sh -f general/db/alter_tables_v1.sim +./test.sh -f general/db/alter_tables_v4.sim +./test.sh -f general/db/alter_vgroups.sim ./test.sh -f general/db/basic.sim ./test.sh -f general/db/basic1.sim ./test.sh -f general/db/basic2.sim @@ -57,10 +61,11 @@ cd ../../../debug; make ./test.sh -f general/db/delete_writing1.sim ./test.sh -f general/db/delete_writing2.sim ./test.sh -f general/db/delete.sim +./test.sh -f general/db/dropdnodes.sim ./test.sh -f general/db/len.sim ./test.sh -f general/db/repeat.sim ./test.sh -f general/db/tables.sim -#liao ./test.sh -f general/db/vnodes.sim +./test.sh -f general/db/vnodes.sim ./test.sh -f general/field/2.sim ./test.sh -f general/field/3.sim @@ -86,10 +91,10 @@ cd ../../../debug; make ./test.sh -f general/import/basic.sim ./test.sh -f general/import/commit.sim ./test.sh -f general/import/large.sim -#liao ./test.sh -f general/import/replica1.sim +./test.sh -f general/import/replica1.sim ./test.sh -f general/insert/basic.sim -#liao ./test.sh -f general/insert/insert_drop.sim +./test.sh -f general/insert/insert_drop.sim ./test.sh -f general/insert/query_block1_memory.sim ./test.sh -f general/insert/query_block2_memory.sim ./test.sh -f general/insert/query_block1_file.sim @@ -103,55 +108,55 @@ cd ../../../debug; make #unsupport ./test.sh -f general/parser/alter_stable.sim ./test.sh -f general/parser/auto_create_tb.sim ./test.sh -f general/parser/auto_create_tb_drop_tb.sim -#liao ./test.sh -f general/parser/col_arithmetic_operation.sim +./test.sh -f general/parser/col_arithmetic_operation.sim ./test.sh -f general/parser/columnValue.sim -#liao ./test.sh -f general/parser/commit.sim -# ./test.sh -f general/parser/create_db.sim -# ./test.sh -f general/parser/create_mt.sim -# ./test.sh -f general/parser/create_tb.sim -# ./test.sh -f general/parser/dbtbnameValidate.sim +./test.sh -f general/parser/commit.sim +#./test.sh -f general/parser/create_db.sim #there are bugs in this sim script +./test.sh -f general/parser/create_mt.sim +./test.sh -f general/parser/create_tb.sim +./test.sh -f general/parser/dbtbnameValidate.sim ./test.sh -f general/parser/import_commit1.sim ./test.sh -f general/parser/import_commit2.sim ./test.sh -f general/parser/import_commit3.sim -# ./test.sh -f general/parser/insert_tb.sim -# ./test.sh -f general/parser/first_last.sim +./test.sh -f general/parser/insert_tb.sim +./test.sh -f general/parser/first_last.sim # ./test.sh -f general/parser/import_file.sim -# ./test.sh -f general/parser/lastrow.sim -# ./test.sh -f general/parser/nchar.sim -# ./test.sh -f general/parser/null_char.sim -# ./test.sh -f general/parser/single_row_in_tb.sim +./test.sh -f general/parser/lastrow.sim +./test.sh -f general/parser/nchar.sim +./test.sh -f general/parser/null_char.sim +./test.sh -f general/parser/single_row_in_tb.sim ./test.sh -f general/parser/select_from_cache_disk.sim -# ./test.sh -f general/parser/limit.sim +./test.sh -f general/parser/limit.sim +./test.sh -f general/parser/limit1.sim +./test.sh -f general/parser/limit1_tblocks100.sim +./test.sh -f general/parser/mixed_blocks.sim +./test.sh -f general/parser/selectResNum.sim +./test.sh -f general/parser/select_across_vnodes.sim +./test.sh -f general/parser/slimit1.sim +./test.sh -f general/parser/tbnameIn.sim +./test.sh -f general/parser/binary_escapeCharacter.sim +./test.sh -f general/parser/projection_limit_offset.sim +# ./test.sh -f general/parser/limit2.sim +# ./test.sh -f general/parser/slimit.sim # ./test.sh -f general/parser/fill.sim # ./test.sh -f general/parser/fill_stb.sim -# ./test.sh -f general/parser/tags_dynamically_specifiy.sim # ./test.sh -f general/parser/interp.sim -# ./test.sh -f general/parser/limit1.sim -# ./test.sh -f general/parser/limit1_tblocks100.sim -# ./test.sh -f general/parser/limit2.sim -# ./test.sh -f general/parser/mixed_blocks.sim -./test.sh -f general/parser/selectResNum.sim -# ./test.sh -f general/parser/select_across_vnodes.sim -# ./test.sh -f general/parser/set_tag_vals.sim -# ./test.sh -f general/parser/slimit.sim -./test.sh -f general/parser/slimit1.sim +# ./test.sh -f general/parser/where.sim +# ./test.sh -f general/parser/join.sim +# ./test.sh -f general/parser/join_multivnode.sim +# ./test.sh -f general/parser/select_with_tags.sim +# ./test.sh -f general/parser/groupby.sim +# ./test.sh -f general/parser/bug.sim +#unsupport ./test.sh -f general/parser/tags_dynamically_specifiy.sim +#unsupport ./test.sh -f general/parser/set_tag_vals.sim +#unsupport ./test.sh -f general/parser/repeatAlter.sim #unsupport ./test.sh -f general/parser/slimit_alter_tags.sim #unsupport ./test.sh -f general/parser/stream_on_sys.sim #unsupport ./test.sh -f general/parser/stream.sim -# ./test.sh -f general/parser/tbnameIn.sim -# ./test.sh -f general/parser/where.sim -# ./test.sh -f general/parser/repeatAlter.sim #unsupport ./test.sh -f general/parser/repeatStream.sim -# ./test.sh -f general/parser/join.sim -# ./test.sh -f general/parser/join_multivnode.sim -# ./test.sh -f general/parser/projection_limit_offset.sim -# ./test.sh -f general/parser/select_with_tags.sim -# ./test.sh -f general/parser/groupby.sim -./test.sh -f general/parser/binary_escapeCharacter.sim -#./test.sh -f general/parser/bug.sim ./test.sh -f general/stable/disk.sim -#liao ./test.sh -f general/stable/dnode3.sim +./test.sh -f general/stable/dnode3.sim ./test.sh -f general/stable/metrics.sim ./test.sh -f general/stable/values.sim ./test.sh -f general/stable/vnode3.sim @@ -242,8 +247,8 @@ cd ../../../debug; make ./test.sh -u -f unique/account/user_create.sim ./test.sh -u -f unique/account/user_len.sim -#liao wait ./test.sh -u -f unique/big/balance.sim -#liao wait ./test.sh -u -f unique/big/maxvnodes.sim +./test.sh -u -f unique/big/balance.sim +./test.sh -u -f unique/big/maxvnodes.sim ./test.sh -u -f unique/big/tcp.sim ./test.sh -u -f unique/cluster/balance1.sim @@ -269,25 +274,25 @@ cd ../../../debug; make ./test.sh -u -f unique/dnode/balance3.sim ./test.sh -u -f unique/dnode/balancex.sim ./test.sh -u -f unique/dnode/offline1.sim -#jeff ./test.sh -u -f unique/dnode/offline2.sim +./test.sh -u -f unique/dnode/offline2.sim ./test.sh -u -f unique/dnode/remove1.sim -#hongze ./test.sh -u -f unique/dnode/remove2.sim +./test.sh -u -f unique/dnode/remove2.sim ./test.sh -u -f unique/dnode/vnode_clean.sim ./test.sh -u -f unique/http/admin.sim ./test.sh -u -f unique/http/opentsdb.sim -#liao wait ./test.sh -u -f unique/import/replica2.sim -#liao wait ./test.sh -u -f unique/import/replica3.sim +./test.sh -u -f unique/import/replica2.sim +./test.sh -u -f unique/import/replica3.sim -#liao wait ./test.sh -u -f unique/stable/balance_replica1.sim -#liao wait ./test.sh -u -f unique/stable/dnode2_stop.sim -#liao wait ./test.sh -u -f unique/stable/dnode2.sim -#liao wait ./test.sh -u -f unique/stable/dnode3.sim -#liao wait ./test.sh -u -f unique/stable/replica2_dnode4.sim -#liao wait ./test.sh -u -f unique/stable/replica2_vnode3.sim -#liao wait ./test.sh -u -f unique/stable/replica3_dnode6.sim -#liao wait ./test.sh -u -f unique/stable/replica3_vnode3.sim +./test.sh -u -f unique/stable/balance_replica1.sim +./test.sh -u -f unique/stable/dnode2_stop.sim +./test.sh -u -f unique/stable/dnode2.sim +./test.sh -u -f unique/stable/dnode3.sim +./test.sh -u -f unique/stable/replica2_dnode4.sim +./test.sh -u -f unique/stable/replica2_vnode3.sim +./test.sh -u -f unique/stable/replica3_dnode6.sim +./test.sh -u -f unique/stable/replica3_vnode3.sim ./test.sh -u -f unique/mnode/mgmt22.sim ./test.sh -u -f unique/mnode/mgmt23.sim diff --git a/tests/script/jenkins/sync.txt b/tests/script/jenkins/sync.txt new file mode 100644 index 0000000000..934680b7c0 --- /dev/null +++ b/tests/script/jenkins/sync.txt @@ -0,0 +1,79 @@ +cd ../../debug; cmake .. +cd ../../debug; make +cd ../../../debug; cmake .. +cd ../../../debug; make + +./test.sh -u -f unique/account/account_create.sim +./test.sh -u -f unique/account/account_delete.sim +./test.sh -u -f unique/account/account_len.sim +./test.sh -u -f unique/account/authority.sim +./test.sh -u -f unique/account/basic.sim +./test.sh -u -f unique/account/paras.sim +./test.sh -u -f unique/account/pass_alter.sim +./test.sh -u -f unique/account/pass_len.sim +./test.sh -u -f unique/account/usage.sim +./test.sh -u -f unique/account/user_create.sim +./test.sh -u -f unique/account/user_len.sim + +./test.sh -u -f unique/big/balance.sim +./test.sh -u -f unique/big/maxvnodes.sim +./test.sh -u -f unique/big/tcp.sim + +./test.sh -u -f unique/cluster/balance1.sim +./test.sh -u -f unique/cluster/balance2.sim +./test.sh -u -f unique/cluster/balance3.sim +./test.sh -u -f unique/cluster/cache.sim + +./test.sh -u -f unique/column/replica3.sim + +./test.sh -u -f unique/db/commit.sim +./test.sh -u -f unique/db/delete.sim +./test.sh -u -f unique/db/delete_part.sim +./test.sh -u -f unique/db/replica_add12.sim +./test.sh -u -f unique/db/replica_add13.sim +./test.sh -u -f unique/db/replica_add23.sim +./test.sh -u -f unique/db/replica_reduce21.sim +./test.sh -u -f unique/db/replica_reduce32.sim +./test.sh -u -f unique/db/replica_reduce31.sim +./test.sh -u -f unique/db/replica_part.sim + +./test.sh -u -f unique/dnode/balance1.sim +./test.sh -u -f unique/dnode/balance2.sim +./test.sh -u -f unique/dnode/balance3.sim +./test.sh -u -f unique/dnode/balancex.sim +./test.sh -u -f unique/dnode/offline1.sim +./test.sh -u -f unique/dnode/offline2.sim +./test.sh -u -f unique/dnode/remove1.sim +./test.sh -u -f unique/dnode/remove2.sim +./test.sh -u -f unique/dnode/vnode_clean.sim + +./test.sh -u -f unique/http/admin.sim +./test.sh -u -f unique/http/opentsdb.sim + +./test.sh -u -f unique/import/replica2.sim +./test.sh -u -f unique/import/replica3.sim + +./test.sh -u -f unique/stable/balance_replica1.sim +./test.sh -u -f unique/stable/dnode2_stop.sim +./test.sh -u -f unique/stable/dnode2.sim +./test.sh -u -f unique/stable/dnode3.sim +./test.sh -u -f unique/stable/replica2_dnode4.sim +./test.sh -u -f unique/stable/replica2_vnode3.sim +./test.sh -u -f unique/stable/replica3_dnode6.sim +./test.sh -u -f unique/stable/replica3_vnode3.sim + +./test.sh -u -f unique/mnode/mgmt22.sim +./test.sh -u -f unique/mnode/mgmt23.sim +./test.sh -u -f unique/mnode/mgmt24.sim +./test.sh -u -f unique/mnode/mgmt25.sim +./test.sh -u -f unique/mnode/mgmt26.sim +./test.sh -u -f unique/mnode/mgmt33.sim +./test.sh -u -f unique/mnode/mgmt34.sim +./test.sh -u -f unique/mnode/mgmtr2.sim + +./test.sh -u -f unique/vnode/many.sim +./test.sh -u -f unique/vnode/replica2_basic2.sim +./test.sh -u -f unique/vnode/replica2_repeat.sim +./test.sh -u -f unique/vnode/replica3_basic.sim +./test.sh -u -f unique/vnode/replica3_repeat.sim +./test.sh -u -f unique/vnode/replica3_vgroup.sim diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index bd85ce9704..b3134938cb 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -96,6 +96,7 @@ echo "second ${HOSTNAME}:7200" >> $TAOS_CFG echo "serverPort ${NODE}" >> $TAOS_CFG echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG +echo "debugFlag 135" >> $TAOS_CFG echo "dDebugFlag 135" >> $TAOS_CFG echo "mDebugFlag 135" >> $TAOS_CFG echo "sdbDebugFlag 135" >> $TAOS_CFG @@ -107,6 +108,7 @@ echo "monitorDebugFlag 131" >> $TAOS_CFG echo "udebugFlag 131" >> $TAOS_CFG echo "jnidebugFlag 131" >> $TAOS_CFG echo "sdebugFlag 135" >> $TAOS_CFG +echo "qdebugFlag 135" >> $TAOS_CFG echo "monitor 0" >> $TAOS_CFG echo "monitorInterval 1" >> $TAOS_CFG echo "http 0" >> $TAOS_CFG diff --git a/tests/script/sh/exec_tarbitrator.sh b/tests/script/sh/exec_tarbitrator.sh new file mode 100755 index 0000000000..cb0a8858cb --- /dev/null +++ b/tests/script/sh/exec_tarbitrator.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +# if [ $# != 2 || $# != 3 ]; then + # echo "argument list need input : " + # echo " -s start/stop" + # exit 1 +# fi + +EXEC_OPTON= +while getopts "n:s:u:x:ct" arg +do + case $arg in + n) + NODE_NAME=$OPTARG + ;; + s) + EXEC_OPTON=$OPTARG + ;; + c) + CLEAR_OPTION="clear" + ;; + t) + SHELL_OPTION="true" + ;; + u) + USERS=$OPTARG + ;; + x) + SIGNAL=$OPTARG + ;; + ?) + echo "unkown argument" + ;; + esac +done + + +SCRIPT_DIR=`dirname $0` +cd $SCRIPT_DIR/../ +SCRIPT_DIR=`pwd` + +cd ../../ +TAOS_DIR=`pwd` + +BUILD_DIR=$TAOS_DIR/../debug/build +SIM_DIR=$TAOS_DIR/sim +NODE_DIR=$SIM_DIR/arbitrator +EXE_DIR=$BUILD_DIR/bin +LOG_DIR=$NODE_DIR/log + +echo "------------ $EXEC_OPTON tarbitrator" + +if [ "$EXEC_OPTON" = "start" ]; then + echo "------------ log path: $LOG_DIR" + nohup $EXE_DIR/tarbitrator -p 8000 -d 135 -g $LOG_DIR > /dev/null 2>&1 & +else + #relative path + PID=`ps -ef|grep tarbitrator | grep -v grep | awk '{print $2}'` + if [ -n "$PID" ]; then + sudo kill -9 $PID + sudo pkill -9 tarbitrator + fi +fi + diff --git a/tests/script/sh/stop_dnodes.sh b/tests/script/sh/stop_dnodes.sh index 2364dff9b3..1a6e7153c3 100755 --- a/tests/script/sh/stop_dnodes.sh +++ b/tests/script/sh/stop_dnodes.sh @@ -13,3 +13,12 @@ while [ -n "$PID" ]; do fuser -k -n tcp 6030 PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` done + +PID=`ps -ef|grep -w tarbitrator | grep -v grep | awk '{print $2}'` +while [ -n "$PID" ]; do + echo kill -9 $PID + pkill -9 tarbitrator + fuser -k -n tcp 6040 + PID=`ps -ef|grep -w tarbitrator | grep -v grep | awk '{print $2}'` +done + diff --git a/tests/script/test.sh b/tests/script/test.sh index 96ab3c5808..984eb13c4c 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -62,6 +62,11 @@ CFG_DIR=$PRG_DIR/cfg LOG_DIR=$PRG_DIR/log DATA_DIR=$PRG_DIR/data + +ARBITRATOR_PRG_DIR=$SIM_DIR/arbitrator +ARBITRATOR_LOG_DIR=$ARBITRATOR_PRG_DIR/log + + chmod -R 777 $PRG_DIR echo "------------------------------------------------------------------------" echo "Start TDengine Testing Case ..." @@ -72,9 +77,12 @@ echo "CFG_DIR : $CFG_DIR" rm -rf $LOG_DIR rm -rf $CFG_DIR +rm -rf $ARBITRATOR_LOG_DIR + mkdir -p $PRG_DIR mkdir -p $LOG_DIR mkdir -p $CFG_DIR +mkdir -p $ARBITRATOR_LOG_DIR TAOS_CFG=$PRG_DIR/cfg/taos.cfg touch -f $TAOS_CFG diff --git a/tests/script/tjenkins b/tests/script/tjenkins index b05ab3c900..9b93527de9 100755 Binary files a/tests/script/tjenkins and b/tests/script/tjenkins differ diff --git a/tests/script/tmp/prepare.sim b/tests/script/tmp/prepare.sim index 68a05a33e7..1db643c5c9 100644 --- a/tests/script/tmp/prepare.sim +++ b/tests/script/tmp/prepare.sim @@ -23,4 +23,8 @@ system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 \ No newline at end of file +system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 + +system sh/cfg.sh -n dnode1 -c http -v 1 +system sh/cfg.sh -n dnode2 -c http -v 1 +system sh/cfg.sh -n dnode3 -c http -v 1 \ No newline at end of file diff --git a/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim b/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim new file mode 100644 index 0000000000..d1b4a2ec72 --- /dev/null +++ b/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim @@ -0,0 +1,100 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 + +system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2 +system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 +system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 + +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode2 -c walLevel -v 1 +system sh/cfg.sh -n dnode3 -c walLevel -v 1 + +system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 +system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 +system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 + +system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator +system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator +system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator + +print ============== step0: start tarbitrator +system sh/exec_tarbitrator.sh -s start + + +print ============== step1: replica is 1, and start 1 dnode +system sh/exec_up.sh -n dnode1 -s start +sleep 3000 +sql connect + +$db = replica_db1 +sql create database $db replica 1 maxTables 4 +sql use $db + +# create table , insert data +$stb = repl_stb +sql create table $stb (ts timestamp, c1 int) tags(t1 int) +$rowNum = 10 +$tblNum = 12 + +$ts0 = 1420041600000 +$ts = $ts0 +$delta = 1 + +$i = 0 +while $i < $tblNum + $tb = tb . $i + sql create table $tb using $stb tags( $i ) + + $x = 0 + while $x < $rowNum + $xs = $x * $delta + $ts = $ts0 + $xs + sql insert into $tb values ( $ts , $x ) + $x = $x + 1 + endw + $i = $i + 1 +endw + +print ============== step2: add 1 new dnode, expect balanced +system sh/exec_up.sh -n dnode2 -s start +sql create dnode $hostname2 + +# expect after balanced, 2 vondes in dnode1, 1 vonde in dnode2 +$x = 0 +show2: + $x = $x + 1 + sleep 2000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 openVnodes $data2_1 +print dnode2 openVnodes $data2_2 +if $data2_1 != 2 then + goto show2 +endi +if $data2_2 != 1 then + goto show2 +endi + +print ============== step4: stop dnode1, and wait dnode2 master +system sh/exec_up.sh -n dnode1 -s stop + +$x = 0 +loop_wait: + $x = $x + 1 + sleep 2000 + if $x == 10 then + print ERROR: after dnode1 stop, dnode2 didn't become a master! + return -1 + endi +sql show mnodes +$dnodeRole = $data2_1 +print dnodeRole ==> $dnodeRole + +if $dnodeRole != master then + goto loop_wait +endi diff --git a/tests/script/unique/big/balance.sim b/tests/script/unique/big/balance.sim index 4b0a6cd0bf..5259f415c8 100644 --- a/tests/script/unique/big/balance.sim +++ b/tests/script/unique/big/balance.sim @@ -93,7 +93,7 @@ $x = 0 show1: $x = $x + 1 sleep 3000 - if $x == 100 then + if $x == 10 then return -1 endi @@ -107,6 +107,9 @@ if $data2_2 != 2 then goto show1 endi +sql reset query cache +sleep 1000 + sql select count(*) from t10 print select count(*) from t10 $data00 expect $rowNum if $data00 != $rowNum then @@ -149,7 +152,7 @@ $x = 0 show3: $x = $x + 1 sleep 3000 - if $x == 100 then + if $x == 10 then return -1 endi @@ -160,7 +163,7 @@ print dnode3 freeVnodes $data2_3 if $data2_1 != 2 then goto show3 endi -if $data2_2 != NULL then +if $data2_2 != null then goto show3 endi if $data2_3 != 2 then @@ -169,6 +172,9 @@ endi system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +sql reset query cache +sleep 1000 + sql select count(*) from t10 print select count(*) from t10 $data00 expect $rowNum if $data00 != $rowNum then @@ -206,22 +212,25 @@ $x = 0 show4: $x = $x + 1 sleep 3000 - if $x == 100 then + if $x == 10 then return -1 endi sql show dnodes print dnode1 freeVnodes $data2_1 print dnode3 freeVnodes $data2_3 -if $data2_1 != 0 then +if $data2_1 != 4 then goto show4 endi -if $data2_3 != NULL then +if $data2_3 != null then goto show4 endi system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +sql reset query cache +sleep 1000 + sql select count(*) from t10 print select count(*) from t10 $data00 expect $rowNum if $data00 != $rowNum then @@ -253,28 +262,33 @@ if $data00 != $totalNum then endi print ========== step5 -sql alter database db replica 2 -sql create dnode $hostname4 system sh/exec_up.sh -n dnode4 -s start +sql create dnode $hostname4 + +sleep 3000 +sql alter database db replica 2 $x = 0 show5: $x = $x + 1 sleep 3000 - if $x == 100 then + if $x == 10 then return -1 endi sql show dnodes print dnode1 freeVnodes $data2_1 print dnode4 freeVnodes $data2_4 -if $data2_1 != 0 then +if $data2_1 != 4 then goto show5 endi -if $data2_4 != 0 then +if $data2_4 != 4 then goto show5 endi +sql reset query cache +sleep 1000 + sql select count(*) from t10 print select count(*) from t10 $data00 expect $rowNum if $data00 != $rowNum then diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim index 2b56f51e59..f019ea607c 100644 --- a/tests/script/unique/big/maxvnodes.sim +++ b/tests/script/unique/big/maxvnodes.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh -$totalVnodes = 100 -$minVnodes = 50 -$maxVnodes = 50 +$totalVnodes = 20 +$minVnodes = 10 +$maxVnodes = 10 $maxTables = 4 $totalRows = $totalVnodes * $maxTables diff --git a/tests/script/unique/dnode/remove2.sim b/tests/script/unique/dnode/remove2.sim index 73e7a31250..42cb9e5485 100644 --- a/tests/script/unique/dnode/remove2.sim +++ b/tests/script/unique/dnode/remove2.sim @@ -111,10 +111,10 @@ sql show dnodes print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 print dnode3 openVnodes $data2_3 -if $data2_2 != null then +if $data2_1 != 1 then goto show4 endi -if $data2_1 != 1 then +if $data2_2 != null then goto show4 endi if $data2_3 != 3 then diff --git a/tests/script/unique/import/replica2.sim b/tests/script/unique/import/replica2.sim index bcb4179c12..70097a5022 100644 --- a/tests/script/unique/import/replica2.sim +++ b/tests/script/unique/import/replica2.sim @@ -20,10 +20,10 @@ system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode1 -c commitlog -v 0 -system sh/cfg.sh -n dnode2 -c commitlog -v 0 -system sh/cfg.sh -n dnode3 -c commitlog -v 0 -system sh/cfg.sh -n dnode4 -c commitlog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode3 -c walLevel -v 2 +system sh/cfg.sh -n dnode4 -c walLevel -v 2 print ========= start dnode1 system sh/exec_up.sh -n dnode1 -s start @@ -35,10 +35,10 @@ system sh/exec_up.sh -n dnode2 -s start sql create database ir2db replica 2 days 7 sql use ir2db -sql create table tb(ts timestamp, i int) +sql create table tb(ts timestamp, i bigint) print ================= step1 -sql import into tb values(1520000010000, 10000) +sql import into tb values(1520000010000, 1520000010000) sql select * from tb; print $rows if $rows != 1 then @@ -46,7 +46,7 @@ if $rows != 1 then endi print ================= step2 -sql insert into tb values(1520000008000, 8000) +sql insert into tb values(1520000008000, 1520000008000) print $rows sql select * from tb; if $rows != 2 then @@ -54,7 +54,7 @@ if $rows != 2 then endi print ================= step3 -sql insert into tb values(1520000020000, 20000) +sql insert into tb values(1520000020000, 1520000020000) sql select * from tb; print $rows if $rows != 3 then @@ -62,9 +62,9 @@ if $rows != 3 then endi print ================= step4 -sql import into tb values(1520000009000, 9000) -sql import into tb values(1520000015000, 15000) -sql import into tb values(1520000030000, 30000) +sql import into tb values(1520000009000, 1520000009000) +sql import into tb values(1520000015000, 1520000015000) +sql import into tb values(1520000030000, 1520000030000) sql select * from tb; print $rows if $rows != 6 then @@ -72,10 +72,10 @@ if $rows != 6 then endi print ================= step5 -sql insert into tb values(1520000008000, 8000) -sql insert into tb values(1520000014000, 14000) -sql insert into tb values(1520000025000, 25000) -sql insert into tb values(1520000040000, 40000) +sql insert into tb values(1520000008000, 1520000008000) +sql insert into tb values(1520000014000, 1520000014000) +sql insert into tb values(1520000025000, 1520000025000) +sql insert into tb values(1520000040000, 1520000040000) sql select * from tb; print $rows if $rows != 9 then @@ -83,11 +83,11 @@ if $rows != 9 then endi print ================= step6 -sql import into tb values(1520000007000, 7000) -sql import into tb values(1520000012000, 12000) -sql import into tb values(1520000023000, 23000) -sql import into tb values(1520000034000, 34000) -sql import into tb values(1520000050000, 50000) +sql import into tb values(1520000007000, 1520000007000) +sql import into tb values(1520000012000, 1520000012000) +sql import into tb values(1520000023000, 1520000023000) +sql import into tb values(1520000034000, 1520000034000) +sql import into tb values(1520000050000, 1520000050000) sql select * from tb; print $rows if $rows != 14 then @@ -105,25 +105,26 @@ if $rows != 14 then endi print ================= step7 -sql import into tb values(1520000007001, 7001) -sql import into tb values(1520000012001, 12001) -sql import into tb values(1520000023001, 23001) -sql import into tb values(1520000034001, 34001) -sql import into tb values(1520000050001, 50001) +sql import into tb values(1520000007001, 1520000007001) +sql import into tb values(1520000012001, 1520000012001) +sql import into tb values(1520000023001, 1520000023001) +sql import into tb values(1520000034001, 1520000034001) +sql import into tb values(1520000050001, 1520000050001) sql select * from tb; print $rows -if $rows != 19 then +if $rows != 19 then + print expect 19, actual: $rows return -1 endi print ================= step8 -sql insert into tb values(1520000008002, 8002) -sql insert into tb values(1520000014002, 14002) -sql insert into tb values(1520000025002, 25002) -sql insert into tb values(1520000060000, 60000) +sql insert into tb values(1520000008002, 1520000008002) +sql insert into tb values(1520000014002, 1520000014002) +sql insert into tb values(1520000025002, 1520000025002) +sql insert into tb values(1520000060000, 1520000060000) sql select * from tb; print $rows -if $rows != 24 then +if $rows != 23 then return -1 endi @@ -142,21 +143,21 @@ print ================= step9 #sql import into tb values(now+14d, 50001) #sql import into tb values(now+16d, 500051) -sql import into tb values(1517408000000, 7003) -sql import into tb values(1518272000000, 34003) -sql import into tb values(1519136000000, 34003) -sql import into tb values(1519568000000, 34003) -sql import into tb values(1519654400000, 50001) -sql import into tb values(1519827200000, 50001) -sql import into tb values(1520345600000, 50001) -sql import into tb values(1520691200000, 50002) -sql import into tb values(1520864000000, 50003) -sql import into tb values(1521900800000, 50004) -sql import into tb values(1523110400000, 50001) -sql import into tb values(1521382400000, 500051) +sql import into tb values(1517408000000, 1517408000000) +sql import into tb values(1518272000000, 1518272000000) +sql import into tb values(1519136000000, 1519136000000) +sql import into tb values(1519568000000, 1519568000000) +sql import into tb values(1519654400000, 1519654400000) +sql import into tb values(1519827200000, 1519827200000) +sql import into tb values(1520345600000, 1520345600000) +sql import into tb values(1520691200000, 1520691200000) +sql import into tb values(1520864000000, 1520864000000) +sql import into tb values(1521900800000, 1521900800000) +sql import into tb values(1523110400000, 1523110400000) +sql import into tb values(1521382400000, 1521382400000) sql select * from tb; print $rows -if $rows != 36 then +if $rows != 35 then return -1 endi @@ -167,55 +168,57 @@ system sh/exec_up.sh -n dnode1 -s start sleep 5000 sql select * from tb; print $rows -if $rows != 36 then +if $rows != 35 then return -1 endi print ================= step11 #sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) -sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003) +sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) sql select * from tb; -if $rows != 41 then +if $rows != 40 then return -1 endi print ================= step12 #1520000000000 -#sql import into tb values(now-19d, 7003) (now-18d, 7003) (now-17d, 7003) (now-16d, 7003) (now-15d, 7003) (now-14d, 7003) (now-13d, 7003) (now-12d, 7003) (now-11d, 7003) -sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003) +#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11) +sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) sql select * from tb; print $rows -if $rows != 50 then +if $rows != 49 then return -1 endi print ================= step13 -system sh/exec_up.sh -n dnode2 -s stop +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +sleep 5000 +system sh/exec_up.sh -n dnode2 -s start sleep 5000 print ================= step14 #1520000000000 -#sql import into tb values(now-48d, 34003) -#sql import into tb values(now-38d, 50001) -#sql import into tb values(now-28d, 50001) +#sql import into tb values(now-48d, -48) +#sql import into tb values(now-38d, -38) +#sql import into tb values(now-28d, -28) -sql import into tb values(1515852800001, 34003) -sql import into tb values(1516716800000, 50001) -sql import into tb values(1517580800000, 50001) +sql import into tb values(1515852800001, -48) +sql import into tb values(1516716800000, -38) +sql import into tb values(1517580800000, -28) sql select * from tb; -if $rows != 50 then +if $rows != 52 then return -1 endi print ================= step15 -system sh/exec_up.sh -n dnode2 -s start -sleep 8000 -system sh/exec_up.sh -n dnode1 -s stop -sleep 10000 +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +sleep 5000 +system sh/exec_up.sh -n dnode1 -s start +sleep 5000 -if $rows != 50 then +if $rows != 52 then return -1 endi diff --git a/tests/script/unique/import/replica3.sim b/tests/script/unique/import/replica3.sim index 8d70d227a5..ad236bfb0c 100644 --- a/tests/script/unique/import/replica3.sim +++ b/tests/script/unique/import/replica3.sim @@ -20,14 +20,14 @@ system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode1 -c commitlog -v 0 -system sh/cfg.sh -n dnode2 -c commitlog -v 0 -system sh/cfg.sh -n dnode3 -c commitlog -v 0 -system sh/cfg.sh -n dnode4 -c commitlog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode3 -c walLevel -v 2 +system sh/cfg.sh -n dnode4 -c walLevel -v 2 print ========= start dnode1 system sh/exec_up.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql connect sql create dnode $hostname2 @@ -38,10 +38,10 @@ system sh/exec_up.sh -n dnode3 -s start sql create database ir3db replica 3 days 7 sql use ir3db -sql create table tb(ts timestamp, i int) +sql create table tb(ts timestamp, i bigint) print ================= step1 -sql import into tb values(1520000010000, 10000) +sql import into tb values(1520000010000, 1520000010000) sql select * from tb; print $rows if $rows != 1 then @@ -49,7 +49,7 @@ if $rows != 1 then endi print ================= step2 -sql insert into tb values(1520000008000, 8000) +sql insert into tb values(1520000008000, 1520000008000) print $rows sql select * from tb; if $rows != 2 then @@ -57,7 +57,7 @@ if $rows != 2 then endi print ================= step3 -sql insert into tb values(1520000020000, 20000) +sql insert into tb values(1520000020000, 1520000020000) sql select * from tb; print $rows if $rows != 3 then @@ -65,9 +65,9 @@ if $rows != 3 then endi print ================= step4 -sql import into tb values(1520000009000, 9000) -sql import into tb values(1520000015000, 15000) -sql import into tb values(1520000030000, 30000) +sql import into tb values(1520000009000, 1520000009000) +sql import into tb values(1520000015000, 1520000015000) +sql import into tb values(1520000030000, 1520000030000) sql select * from tb; print $rows if $rows != 6 then @@ -75,10 +75,10 @@ if $rows != 6 then endi print ================= step5 -sql insert into tb values(1520000008000, 8000) -sql insert into tb values(1520000014000, 14000) -sql insert into tb values(1520000025000, 25000) -sql insert into tb values(1520000040000, 40000) +sql insert into tb values(1520000008000, 1520000008000) +sql insert into tb values(1520000014000, 1520000014000) +sql insert into tb values(1520000025000, 1520000025000) +sql insert into tb values(1520000040000, 1520000040000) sql select * from tb; print $rows if $rows != 9 then @@ -86,47 +86,48 @@ if $rows != 9 then endi print ================= step6 -sql import into tb values(1520000007000, 7000) -sql import into tb values(1520000012000, 12000) -sql import into tb values(1520000023000, 23000) -sql import into tb values(1520000034000, 34000) -sql import into tb values(1520000050000, 50000) +sql import into tb values(1520000007000, 1520000007000) +sql import into tb values(1520000012000, 1520000012000) +sql import into tb values(1520000023000, 1520000023000) +sql import into tb values(1520000034000, 1520000034000) +sql import into tb values(1520000050000, 1520000050000) sql select * from tb; print $rows if $rows != 14 then return -1 endi -#print ================== dnode restart -#system sh/exec_up.sh -n dnode1 -s stop -x SIGINT -#sleep 5000 -#system sh/exec_up.sh -n dnode1 -s start -#sleep 5000 -#sql select * from tb; -#if $rows != 14 then -# return -1 -#endi +print ================== dnode restart +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +sleep 5000 +system sh/exec_up.sh -n dnode1 -s start +sleep 5000 +sql select * from tb; +if $rows != 14 then + return -1 +endi print ================= step7 -sql import into tb values(1520000007001, 7001) -sql import into tb values(1520000012001, 12001) -sql import into tb values(1520000023001, 23001) -sql import into tb values(1520000034001, 34001) -sql import into tb values(1520000050001, 50001) +sql import into tb values(1520000007001, 1520000007001) +sql import into tb values(1520000012001, 1520000012001) +sql import into tb values(1520000023001, 1520000023001) +sql import into tb values(1520000034001, 1520000034001) +sql import into tb values(1520000050001, 1520000050001) sql select * from tb; print $rows -if $rows != 19 then +if $rows != 19 then + print expect 19, actual: $rows return -1 endi print ================= step8 -sql insert into tb values(1520000008002, 8002) -sql insert into tb values(1520000014002, 14002) -sql insert into tb values(1520000025002, 25002) -sql insert into tb values(1520000060000, 60000) +sql insert into tb values(1520000008002, 1520000008002) +sql insert into tb values(1520000014002, 1520000014002) +sql insert into tb values(1520000025002, 1520000025002) +sql insert into tb values(1520000060000, 1520000060000) sql select * from tb; print $rows -if $rows != 24 then +if $rows != 23 then return -1 endi @@ -145,21 +146,21 @@ print ================= step9 #sql import into tb values(now+14d, 50001) #sql import into tb values(now+16d, 500051) -sql import into tb values(1517408000000, 7003) -sql import into tb values(1518272000000, 34003) -sql import into tb values(1519136000000, 34003) -sql import into tb values(1519568000000, 34003) -sql import into tb values(1519654400000, 50001) -sql import into tb values(1519827200000, 50001) -sql import into tb values(1520345600000, 50001) -sql import into tb values(1520691200000, 50002) -sql import into tb values(1520864000000, 50003) -sql import into tb values(1521900800000, 50004) -sql import into tb values(1523110400000, 50001) -sql import into tb values(1521382400000, 500051) +sql import into tb values(1517408000000, 1517408000000) +sql import into tb values(1518272000000, 1518272000000) +sql import into tb values(1519136000000, 1519136000000) +sql import into tb values(1519568000000, 1519568000000) +sql import into tb values(1519654400000, 1519654400000) +sql import into tb values(1519827200000, 1519827200000) +sql import into tb values(1520345600000, 1520345600000) +sql import into tb values(1520691200000, 1520691200000) +sql import into tb values(1520864000000, 1520864000000) +sql import into tb values(1521900800000, 1521900800000) +sql import into tb values(1523110400000, 1523110400000) +sql import into tb values(1521382400000, 1521382400000) sql select * from tb; print $rows -if $rows != 36 then +if $rows != 35 then return -1 endi @@ -170,55 +171,57 @@ system sh/exec_up.sh -n dnode1 -s start sleep 5000 sql select * from tb; print $rows -if $rows != 36 then +if $rows != 35 then return -1 endi print ================= step11 #sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003) -sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003) +sql import into tb values(1515680000000, 1) (1515852800000, 2) (1516025600000, 3) (1516198400000, 4) (1516371200000, 5) sql select * from tb; -if $rows != 41 then +if $rows != 40 then return -1 endi print ================= step12 #1520000000000 -#sql import into tb values(now-19d, 7003) (now-18d, 7003) (now-17d, 7003) (now-16d, 7003) (now-15d, 7003) (now-14d, 7003) (now-13d, 7003) (now-12d, 7003) (now-11d, 7003) -sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003) +#sql import into tb values(now-19d, -19) (now-18d, -18) (now-17d, -17) (now-16d, -16) (now-15d, -15) (now-14d, -14) (now-13d, -13) (now-12d, -12) (now-11d, -11) +sql import into tb values(1518358400000, 6) (1518444800000, 7) (1518531200000, 8) (1518617600000, 9) (1518704000000, 10) (1518790400000, 11) (1518876800000, 12) (1518963200000, 13) (1519049600000, 14) sql select * from tb; print $rows -if $rows != 50 then +if $rows != 49 then return -1 endi print ================= step13 -system sh/exec_up.sh -n dnode2 -s stop +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +sleep 5000 +system sh/exec_up.sh -n dnode2 -s start sleep 5000 print ================= step14 #1520000000000 -#sql import into tb values(now-48d, 34003) -#sql import into tb values(now-38d, 50001) -#sql import into tb values(now-28d, 50001) +#sql import into tb values(now-48d, -48) +#sql import into tb values(now-38d, -38) +#sql import into tb values(now-28d, -28) -sql import into tb values(1515852800001, 34003) -sql import into tb values(1516716800000, 50001) -sql import into tb values(1517580800000, 50001) +sql import into tb values(1515852800001, -48) +sql import into tb values(1516716800000, -38) +sql import into tb values(1517580800000, -28) sql select * from tb; -if $rows != 50 then +if $rows != 52 then return -1 endi print ================= step15 -system sh/exec_up.sh -n dnode2 -s start -sleep 8000 -system sh/exec_up.sh -n dnode3 -s stop -sleep 3000 +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +sleep 5000 +system sh/exec_up.sh -n dnode3 -s start +sleep 5000 -if $rows != 50 then +if $rows != 52 then return -1 endi diff --git a/tests/script/unique/mnode/mgmt22.sim b/tests/script/unique/mnode/mgmt22.sim index 37e38fbf66..c6ea026af9 100644 --- a/tests/script/unique/mnode/mgmt22.sim +++ b/tests/script/unique/mnode/mgmt22.sim @@ -47,6 +47,7 @@ print should not drop master print ============== step4 system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +sleep 2000 sql_error show mnodes print error of no master diff --git a/tests/script/unique/mnode/mgmt24.sim b/tests/script/unique/mnode/mgmt24.sim index 4c61cbd7ae..4813d96f5f 100644 --- a/tests/script/unique/mnode/mgmt24.sim +++ b/tests/script/unique/mnode/mgmt24.sim @@ -42,6 +42,7 @@ endi print ============== step3 system sh/exec_up.sh -n dnode1 -s stop +sleep 2000 sql_error show mnodes print ============== step4 diff --git a/tests/script/unique/stable/balance_replica1.sim b/tests/script/unique/stable/balance_replica1.sim index 8cf41319a0..9257ba79be 100644 --- a/tests/script/unique/stable/balance_replica1.sim +++ b/tests/script/unique/stable/balance_replica1.sim @@ -7,8 +7,8 @@ system sh/cfg.sh -n dnode1 -c statusInterval -v 1 system sh/cfg.sh -n dnode2 -c statusInterval -v 1 system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 @@ -60,20 +60,20 @@ print =============== step2 $x = 0 show1: $x = $x + 1 - sleep 1000 - if $x == 20 then + sleep 2000 + if $x == 10 then return -1 endi sql show dnodes -x show1 -$dnode1Vnodes = $data3_192.168.0.1 +$dnode1Vnodes = $data2_1 print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data3_192.168.0.2 +$dnode2Vnodes = $data2_2 print dnode2 $dnode2Vnodes -if $dnode1Vnodes != 0 then +if $dnode1Vnodes != 4 then goto show1 endi -if $dnode2Vnodes != NULL then +if $dnode2Vnodes != null then goto show1 endi print =============== step3 start dnode2 @@ -89,9 +89,9 @@ show2: return -1 endi sql show dnodes -x show2 -$dnode1Vnodes = $data3_192.168.0.1 +$dnode1Vnodes = $data2_1 print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data3_192.168.0.2 +$dnode2Vnodes = $data2_2 print dnode2 $dnode2Vnodes if $dnode1Vnodes != 2 then diff --git a/tests/script/unique/stable/dnode2_stop.sim b/tests/script/unique/stable/dnode2_stop.sim index 55ad5fcf09..0cf13fa286 100644 --- a/tests/script/unique/stable/dnode2_stop.sim +++ b/tests/script/unique/stable/dnode2_stop.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 diff --git a/tests/script/unique/stable/dnode3.sim b/tests/script/unique/stable/dnode3.sim index c9dd31f6f8..8025b180d8 100644 --- a/tests/script/unique/stable/dnode3.sim +++ b/tests/script/unique/stable/dnode3.sim @@ -84,13 +84,13 @@ print dnode2 $dnode2Vnodes $dnode3Vnodes = $data2_3 print dnode3 $dnode3Vnodes -if $dnode1Vnodes != 3 then +if $dnode1Vnodes != 1 then return -1 endi -if $dnode2Vnodes != 3 then +if $dnode2Vnodes != 1 then return -1 endi -if $dnode3Vnodes != 3 then +if $dnode3Vnodes != 1 then return -1 endi diff --git a/tests/script/unique/stable/replica2_dnode4.sim b/tests/script/unique/stable/replica2_dnode4.sim index f204e05949..b96535fccd 100644 --- a/tests/script/unique/stable/replica2_dnode4.sim +++ b/tests/script/unique/stable/replica2_dnode4.sim @@ -3,10 +3,10 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 -system sh/cfg.sh -n dnode3 -c walLevel -v 0 -system sh/cfg.sh -n dnode4 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode3 -c walLevel -v 2 +system sh/cfg.sh -n dnode4 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 diff --git a/tests/script/unique/stable/replica2_vnode3.sim b/tests/script/unique/stable/replica2_vnode3.sim index 238e2e4aee..c7882d7a96 100644 --- a/tests/script/unique/stable/replica2_vnode3.sim +++ b/tests/script/unique/stable/replica2_vnode3.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 diff --git a/tests/script/unique/stable/replica3_dnode6.sim b/tests/script/unique/stable/replica3_dnode6.sim index 1c8a8ae10e..0dc81999ca 100644 --- a/tests/script/unique/stable/replica3_dnode6.sim +++ b/tests/script/unique/stable/replica3_dnode6.sim @@ -6,12 +6,12 @@ system sh/deploy.sh -n dnode4 -i 4 system sh/deploy.sh -n dnode5 -i 5 system sh/deploy.sh -n dnode6 -i 6 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 -system sh/cfg.sh -n dnode3 -c walLevel -v 0 -system sh/cfg.sh -n dnode4 -c walLevel -v 0 -system sh/cfg.sh -n dnode5 -c walLevel -v 0 -system sh/cfg.sh -n dnode6 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode3 -c walLevel -v 2 +system sh/cfg.sh -n dnode4 -c walLevel -v 2 +system sh/cfg.sh -n dnode5 -c walLevel -v 2 +system sh/cfg.sh -n dnode6 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 diff --git a/tests/script/unique/stable/replica3_vnode3.sim b/tests/script/unique/stable/replica3_vnode3.sim index 75870af4c4..fe310aa0f7 100644 --- a/tests/script/unique/stable/replica3_vnode3.sim +++ b/tests/script/unique/stable/replica3_vnode3.sim @@ -4,10 +4,10 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode2 -c walLevel -v 0 -system sh/cfg.sh -n dnode3 -c walLevel -v 0 -system sh/cfg.sh -n dnode4 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode3 -c walLevel -v 2 +system sh/cfg.sh -n dnode4 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 diff --git a/tests/test-all.sh b/tests/test-all.sh index f54d094649..a56b5eeef7 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -40,7 +40,6 @@ fi totalPySuccess=`grep 'successfully executed' pytest-out.txt | wc -l` if [ "$totalPySuccess" -gt "0" ]; then - grep 'successfully executed' pytest-out.txt echo -e "${GREEN} ### Total $totalPySuccess python case(s) succeed! ### ${NC}" fi diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index 5ea1cb4a1a..0c35e3668c 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -36,12 +36,17 @@ void simLogSql(char *sql) { fflush(fp); } +char *simParseArbitratorName(char *varName); char *simParseHostName(char *varName); char *simGetVariable(SScript *script, char *varName, int varLen) { if (strncmp(varName, "hostname", 8) == 0) { return simParseHostName(varName); } + if (strncmp(varName, "arbitrator", 10) == 0) { + return simParseArbitratorName(varName); + } + if (strncmp(varName, "error", varLen) == 0) return script->error; if (strncmp(varName, "rows", varLen) == 0) return script->rows; diff --git a/tests/tsim/src/simSystem.c b/tests/tsim/src/simSystem.c index bac68c22d3..3acfebb9bd 100644 --- a/tests/tsim/src/simSystem.c +++ b/tests/tsim/src/simSystem.c @@ -29,6 +29,12 @@ int simDebugFlag = 135; void simCloseTaosdConnect(SScript *script); char simHostName[128]; +char *simParseArbitratorName(char *varName) { + static char hostName[140]; + sprintf(hostName, "%s:%d", simHostName, 8000); + return hostName; +} + char *simParseHostName(char *varName) { static char hostName[140];