diff --git a/.travis.yml b/.travis.yml index f9a27fdabd..2cb7b8e966 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,12 +59,12 @@ matrix: GREEN_UNDERLINE='\033[4;32m' NC='\033[0m' - grep 'ERROR SUMMARY' mem-error-out.txt | uniq | tee uniq-mem-error-out.txt + grep 'ERROR SUMMARY' mem-error-out.txt|grep -v 'grep'|uniq|tee uniq-mem-error-out.txt for memError in `cat uniq-mem-error-out.txt | awk '{print $4}'` do if [ -n "$memError" ]; then - if [ "$memError" -gt 16 ]; then + if [ "$memError" -gt 5 ]; then echo -e "${RED} ## Memory errors number valgrind reports is $memError.\ More than our threshold! ## ${NC}" travis_terminate $memError @@ -72,11 +72,11 @@ matrix: fi done - grep 'definitely lost' mem-error-out.txt | uniq | tee uniq-definitely-lost-out.txt - for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'` + grep 'definitely lost:' mem-error-out.txt|grep -v 'grep'|uniq|tee uniq-definitely-lost-out.txt + for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'` do if [ -n "$defiMemError" ]; then - if [ "$defiMemError" -gt 16 ]; then + if [ "$defiMemError" -gt 3 ]; then echo -e "${RED} ## Memory errors number valgrind reports \ Definitely lost is $defiMemError. More than our threshold! ## ${NC}" travis_terminate $defiMemError diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index 588f0650bd..38e960eb06 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -5,29 +5,16 @@ # # ######################################################## -# master IP for TDengine system -# masterIp 127.0.0.1 +# first full-qualified domain name (FQDN) for TDengine system +# first 127.0.0.1 -# second IP for TDengine system, for cluster version only -# secondIp 127.0.0.1 - -# IP address of the server -# privateIp 127.0.0.1 - -# public IP of server, on which the tdengine are deployed -# this IP is assigned by cloud service provider, for cluster version only -# publicIp 127.0.0.1 - -# network is bound to 0.0.0.0 -# anyIp 1 +# second full-qualified domain name (FQDN) for TDengine system, for cluster edition only +# second 127.0.0.1 # set socket type ("udp" and "tcp") # the server and client should have the same socket type. Otherwise, connect will fail # sockettype udp -# client local IP -# localIp 127.0.0.1 - # for the cluster version, data file's directory is configured this way # option mount_path tier_level # dataDir /mnt/disk1/taos 0 @@ -46,23 +33,8 @@ # http service port, default tcp[6020] # httpPort 6020 -# port for MNode connect to Client, default udp[6030-6034] tcp[6030] -# mgmtShellPort 6030 - -# port for DNode connect to Client, default udp[6035-6039] tcp[6035] -# vnodeShellPort 6035 - -# port for MNode connect to VNode, default udp[6040-6044] tcp[6040], for cluster version only -# mgmtVnodePort 6040 - -# port for DNode connect to DNode, default tcp[6045], for cluster version only -# vnodeVnodePort 6045 - -# port for MNode connect to MNode, default udp[6050], for cluster version only -# mgmtMgmtPort 6050 - -# port sync file MNode and MNode, default tcp[6050], for cluster version only -# mgmtSyncPort 6050 +# port for MNode connect to Client, default udp[6030-6055] tcp[6030] +# serverPort 6030 # number of threads per CPU core # numOfThreadsPerCore 1 @@ -73,20 +45,18 @@ # number of total vnodes in DNode # numOfTotalVnodes 0 -# max number of sessions per vnode -# tables 1024 +# max number of tables per vnode +# maxtablesPerVnode 1000 # cache block size # cache 16384 -# row in file block -# rows 4096 +# row of records in file block +# minRows 100 +# maxRows 4096 -# average cache blocks per meter -# ablocks 4 - -# max number of cache blocks per Meter -# tblocks 512 +# number of cache blocks per vnode +# blocks 2 # interval of system monitor # monitorInterval 60 @@ -118,11 +88,8 @@ # interval of MNode send HB to MNode, unit is Second, for cluster version only # mgmtPeerHBTimer 1 -# time to keep MeterMeta in Cache, seconds -# meterMetaKeepTimer 7200 - -# time to keep MetricMeta in Cache, seconds -# metricMetaKeepTimer 600 +# duration of to keep tableMeta kept in Cache, seconds +# tableMetaKeepTimer 7200 # max number of users # maxUsers 1000 @@ -148,8 +115,8 @@ # system time zone # timezone Asia/Shanghai (CST, +0800) -# enable/disable commit log -# clog 1 +# set write ahead log (WAL) level +# walLevel 1 # enable/disable async log # asyncLog 1 @@ -268,6 +235,9 @@ # debug flag for TDengine client # cDebugFlag 131 +# debug flag for query +# qDebugflag 131 + # debug flag for http server # httpDebugFlag 131 diff --git a/src/client/inc/tscLog.h b/src/client/inc/tscLog.h index e82b824123..346e1a6795 100644 --- a/src/client/inc/tscLog.h +++ b/src/client/inc/tscLog.h @@ -22,25 +22,25 @@ extern "C" { #include "tlog.h" -extern int32_t cdebugFlag; +extern int32_t cDebugFlag; #define tscError(...) \ - if (cdebugFlag & DEBUG_ERROR) { \ + if (cDebugFlag & DEBUG_ERROR) { \ taosPrintLog("ERROR TSC ", 255, __VA_ARGS__); \ } #define tscWarn(...) \ - if (cdebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN TSC ", cdebugFlag, __VA_ARGS__); \ + if (cDebugFlag & DEBUG_WARN) { \ + taosPrintLog("WARN TSC ", cDebugFlag, __VA_ARGS__); \ } #define tscTrace(...) \ - if (cdebugFlag & DEBUG_TRACE) { \ - taosPrintLog("TSC ", cdebugFlag, __VA_ARGS__); \ + if (cDebugFlag & DEBUG_TRACE) { \ + taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); \ } #define tscPrint(...) \ { taosPrintLog("TSC ", 255, __VA_ARGS__); } #define tscDump(...) \ - if (cdebugFlag & DEBUG_TRACE) { \ - taosPrintLongString("TSC ", cdebugFlag, __VA_ARGS__); \ + if (cDebugFlag & DEBUG_TRACE) { \ + taosPrintLongString("TSC ", cDebugFlag, __VA_ARGS__); \ } #ifdef __cplusplus diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index 2b53342e74..71c24501d1 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -31,11 +31,13 @@ extern "C" { #include "tscSecondaryMerge.h" #include "tsclient.h" -#define UTIL_TABLE_IS_SUPERTABLE(metaInfo) \ +#define UTIL_TABLE_IS_SUPERTABLE(metaInfo) \ (((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_SUPER_TABLE)) -#define UTIL_TABLE_IS_NOMRAL_TABLE(metaInfo) (!(UTIL_TABLE_IS_SUPERTABLE(metaInfo))) #define UTIL_TABLE_IS_CHILD_TABLE(metaInfo) \ (((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_CHILD_TABLE)) + +#define UTIL_TABLE_IS_NOMRAL_TABLE(metaInfo)\ + (!(UTIL_TABLE_IS_SUPERTABLE(metaInfo) || UTIL_TABLE_IS_CHILD_TABLE(metaInfo))) #define TSDB_COL_IS_TAG(f) (((f)&TSDB_COL_TAG) != 0) @@ -203,7 +205,6 @@ void tscGetSrcColumnInfo(SSrcColumnInfo* pColInfo, SQueryInfo* pQueryInfo); void tscSetFreeHeatBeat(STscObj* pObj); bool tscShouldFreeHeatBeat(SSqlObj* pHb); -void tscCleanSqlCmd(SSqlCmd* pCmd); bool tscShouldBeFreed(SSqlObj* pSql); STableMetaInfo* tscGetTableMetaInfoFromCmd(SSqlCmd *pCmd, int32_t subClauseIndex, int32_t tableIndex); @@ -220,7 +221,6 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST STableMetaInfo* tscAddEmptyMetaInfo(SQueryInfo *pQueryInfo); int32_t tscAddSubqueryInfo(SSqlCmd *pCmd); -void tscFreeQueryInfo(SSqlCmd* pCmd); void tscInitQueryInfo(SQueryInfo* pQueryInfo); void tscClearSubqueryInfo(SSqlCmd* pCmd); diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 203ba90c5f..61a5fdd311 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -88,7 +88,7 @@ typedef struct SSqlExpr { int16_t functionId; // function id in aAgg array int16_t resType; // return value type int16_t resBytes; // length of return value - int16_t interResBytes; // inter result buffer size + int16_t interBytes; // inter result buffer size int16_t numOfParams; // argument value of each function tVariant param[3]; // parameters are not more than 3 int32_t offset; // sub result column value of arithmetic expression. @@ -195,7 +195,7 @@ typedef struct SDataBlockList { // todo remove typedef struct SQueryInfo { int16_t command; // the command may be different for each subclause, so keep it seperately. - uint16_t type; // query/insert/import type + uint32_t type; // query/insert/import type char slidingTimeUnit; STimeWindow window; @@ -283,6 +283,8 @@ typedef struct { int32_t* length; // length for each field for current row char ** buffer; // Buffer used to put multibytes encoded using unicode (wchar_t) SColumnIndex * pColumnIndex; + SArithmeticSupport* pArithSup; // support the arithmetic expression calculation on agg functions + struct SLocalReducer *pLocalReducer; } SSqlRes; @@ -298,11 +300,11 @@ typedef struct STscObj { char sversion[TSDB_VERSION_LEN]; char writeAuth : 1; char superAuth : 1; - void* pMgmtConn; struct SSqlObj * pSql; struct SSqlObj * pHb; struct SSqlObj * sqlList; struct SSqlStream *streamList; + void* pDnodeConn; pthread_mutex_t mutex; } STscObj; @@ -358,7 +360,7 @@ typedef struct SSqlStream { struct SSqlStream *prev, *next; } SSqlStream; -int32_t tscInitRpc(const char *user, const char *secret, void** pMgmtConn); +int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn); void tscInitMsgsFp(); int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion); @@ -424,7 +426,6 @@ void tscQueueAsyncFreeResult(SSqlObj *pSql); int32_t tscToSQLCmd(SSqlObj *pSql, struct SSqlInfo *pInfo); void tscGetResultColumnChr(SSqlRes *pRes, SFieldInfo* pFieldInfo, int32_t column); -extern void * pVnodeConn; extern void * tscCacheHandle; extern void * tscTmr; extern void * tscQhandle; diff --git a/src/client/src/TSDBJNIConnector.c b/src/client/src/TSDBJNIConnector.c index 05b7a2be1e..812c197ef7 100644 --- a/src/client/src/TSDBJNIConnector.c +++ b/src/client/src/TSDBJNIConnector.c @@ -23,16 +23,16 @@ #include "ttime.h" #define jniError(...) \ - if (jnidebugFlag & DEBUG_ERROR) { \ - taosPrintLog("ERROR JNI ", jnidebugFlag, __VA_ARGS__); \ + if (jniDebugFlag & DEBUG_ERROR) { \ + taosPrintLog("ERROR JNI ", jniDebugFlag, __VA_ARGS__); \ } #define jniWarn(...) \ - if (jnidebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN JNI ", jnidebugFlag, __VA_ARGS__); \ + if (jniDebugFlag & DEBUG_WARN) { \ + taosPrintLog("WARN JNI ", jniDebugFlag, __VA_ARGS__); \ } #define jniTrace(...) \ - if (jnidebugFlag & DEBUG_TRACE) { \ - taosPrintLog("JNI ", jnidebugFlag, __VA_ARGS__); \ + if (jniDebugFlag & DEBUG_TRACE) { \ + taosPrintLog("JNI ", jniDebugFlag, __VA_ARGS__); \ } #define jniPrint(...) \ { taosPrintLog("JNI ", 255, __VA_ARGS__); } diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c index 9995f94dbe..c1944e96c9 100644 --- a/src/client/src/tscFunctionImpl.c +++ b/src/client/src/tscFunctionImpl.c @@ -153,7 +153,7 @@ typedef struct SRateInfo { int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, - int16_t *bytes, int16_t *interResBytes, int16_t extLength, bool isSuperTable) { + int16_t *bytes, int16_t *interBytes, int16_t extLength, bool isSuperTable) { if (!isValidDataType(dataType, dataBytes)) { tscError("Illegal data type %d or data type length %d", dataType, dataBytes); return TSDB_CODE_INVALID_SQL; @@ -164,35 +164,36 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_INTERP) { *type = (int16_t)dataType; *bytes = (int16_t)dataBytes; - *interResBytes = *bytes + sizeof(SResultInfo); + *interBytes = *bytes + sizeof(SResultInfo); return TSDB_CODE_SUCCESS; } + // (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE if (functionId == TSDB_FUNC_TID_TAG) { // todo use struct *type = TSDB_DATA_TYPE_BINARY; - *bytes = dataBytes + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t); // (uid, tid) + VGID + TAGSIZE - *interResBytes = *bytes; + *bytes = dataBytes + sizeof(int64_t) + sizeof(int32_t) + sizeof(int32_t) + VARSTR_HEADER_SIZE; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } if (functionId == TSDB_FUNC_COUNT) { *type = TSDB_DATA_TYPE_BIGINT; *bytes = sizeof(int64_t); - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } if (functionId == TSDB_FUNC_ARITHM) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } if (functionId == TSDB_FUNC_TS_COMP) { *type = TSDB_DATA_TYPE_BINARY; *bytes = sizeof(int32_t); // this results is compressed ts data - *interResBytes = POINTER_BYTES; + *interBytes = POINTER_BYTES; return TSDB_CODE_SUCCESS; } @@ -200,54 +201,54 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) { *type = TSDB_DATA_TYPE_BINARY; *bytes = dataBytes + DATA_SET_FLAG_SIZE; - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_SUM) { *type = TSDB_DATA_TYPE_BINARY; *bytes = sizeof(SSumInfo); - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_AVG) { *type = TSDB_DATA_TYPE_BINARY; *bytes = sizeof(SAvgInfo); - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId >= TSDB_FUNC_RATE && functionId <= TSDB_FUNC_AVG_IRATE) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(SRateInfo); - *interResBytes = sizeof(SRateInfo); + *interBytes = sizeof(SRateInfo); return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { *type = TSDB_DATA_TYPE_BINARY; *bytes = sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param; - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_SPREAD) { *type = TSDB_DATA_TYPE_BINARY; *bytes = sizeof(SSpreadInfo); - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_APERCT) { *type = TSDB_DATA_TYPE_BINARY; *bytes = sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1) + sizeof(SHistogramInfo) + sizeof(SAPercentileInfo); - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_LAST_ROW) { *type = TSDB_DATA_TYPE_BINARY; *bytes = sizeof(SLastrowInfo) + dataBytes; - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_TWA) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(STwaInfo); - *interResBytes = *bytes; + *interBytes = *bytes; return TSDB_CODE_SUCCESS; } } @@ -260,57 +261,57 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI } *bytes = sizeof(int64_t); - *interResBytes = sizeof(SSumInfo); + *interBytes = sizeof(SSumInfo); return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_APERCT) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); - *interResBytes = + *interBytes = sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1); return TSDB_CODE_SUCCESS; } else if (functionId == TSDB_FUNC_TWA) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); - *interResBytes = sizeof(STwaInfo); + *interBytes = sizeof(STwaInfo); return TSDB_CODE_SUCCESS; } if (functionId == TSDB_FUNC_AVG) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); - *interResBytes = sizeof(SAvgInfo); + *interBytes = sizeof(SAvgInfo); } else if (functionId >= TSDB_FUNC_RATE && functionId <= TSDB_FUNC_AVG_IRATE) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); - *interResBytes = sizeof(SRateInfo); + *interBytes = sizeof(SRateInfo); } else if (functionId == TSDB_FUNC_STDDEV) { *type = TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); - *interResBytes = sizeof(SStddevInfo); + *interBytes = sizeof(SStddevInfo); } else if (functionId == TSDB_FUNC_MIN || functionId == TSDB_FUNC_MAX) { *type = (int16_t)dataType; *bytes = (int16_t)dataBytes; - *interResBytes = dataBytes + DATA_SET_FLAG_SIZE; + *interBytes = dataBytes + DATA_SET_FLAG_SIZE; } else if (functionId == TSDB_FUNC_FIRST || functionId == TSDB_FUNC_LAST) { *type = (int16_t)dataType; *bytes = (int16_t)dataBytes; - *interResBytes = dataBytes + sizeof(SResultInfo); + *interBytes = dataBytes + sizeof(SResultInfo); } else if (functionId == TSDB_FUNC_SPREAD) { *type = (int16_t)TSDB_DATA_TYPE_DOUBLE; *bytes = sizeof(double); - *interResBytes = sizeof(SSpreadInfo); + *interBytes = sizeof(SSpreadInfo); } else if (functionId == TSDB_FUNC_PERCT) { *type = (int16_t)TSDB_DATA_TYPE_DOUBLE; *bytes = (int16_t)sizeof(double); - *interResBytes = (int16_t)sizeof(double); + *interBytes = (int16_t)sizeof(double); } else if (functionId == TSDB_FUNC_LEASTSQR) { *type = TSDB_DATA_TYPE_BINARY; *bytes = TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE; // string - *interResBytes = *bytes + sizeof(SResultInfo); + *interBytes = *bytes + sizeof(SResultInfo); } else if (functionId == TSDB_FUNC_FIRST_DST || functionId == TSDB_FUNC_LAST_DST) { *type = TSDB_DATA_TYPE_BINARY; *bytes = dataBytes + sizeof(SFirstLastInfo); - *interResBytes = *bytes; + *interBytes = *bytes; } else if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { *type = (int16_t)dataType; *bytes = (int16_t)dataBytes; @@ -318,11 +319,11 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI size_t size = sizeof(STopBotInfo) + (sizeof(tValuePair) + POINTER_BYTES + extLength) * param; // the output column may be larger than sizeof(STopBotInfo) - *interResBytes = size; + *interBytes = size; } else if (functionId == TSDB_FUNC_LAST_ROW) { *type = (int16_t)dataType; *bytes = (int16_t)dataBytes; - *interResBytes = dataBytes + sizeof(SLastrowInfo); + *interBytes = dataBytes + sizeof(SLastrowInfo); } else { return TSDB_CODE_INVALID_SQL; } @@ -5285,10 +5286,10 @@ SQLAggFuncElem aAggs[] = {{ }, { // 34 - "tid_tag", // return table id and the corresponding tags for join match + "tid_tag", // return table id and the corresponding tags for join match and subscribe TSDB_FUNC_TID_TAG, TSDB_FUNC_TID_TAG, - TSDB_FUNCSTATE_MO, + TSDB_FUNCSTATE_MO | TSDB_FUNCSTATE_STABLE, function_setup, noop1, noop2, diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 600ef88344..5ae226a577 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -156,7 +156,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) { char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; - STR_WITH_SIZE_TO_VARSTR(output, "TAG", 3); + const char *src = "TAG"; + STR_WITH_SIZE_TO_VARSTR(output, src, strlen(src)); } } @@ -191,7 +192,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { // tag value pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); char *target = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; - STR_WITH_SIZE_TO_VARSTR(target, "TAG", 3); + const char *src = "TAG"; + STR_WITH_SIZE_TO_VARSTR(target, src, strlen(src)); pTagValue += pSchema[i].bytes; } diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 4bee595dac..65555dba13 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -305,10 +305,8 @@ 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) { - *(int16_t*) payload = sizeof(int8_t); - payload += VARSTR_HEADER_SIZE; - - *payload = TSDB_DATA_BINARY_NULL; + varDataSetLen(payload, sizeof(int8_t)); + *(uint8_t*) varDataVal(payload) = TSDB_DATA_BINARY_NULL; } 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); @@ -321,21 +319,18 @@ int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload, case TSDB_DATA_TYPE_NCHAR: if (pToken->type == TK_NULL) { - *(int16_t*) payload = sizeof(int32_t); - payload += VARSTR_HEADER_SIZE; - - *(uint32_t*) payload = TSDB_DATA_NCHAR_NULL; + varDataSetLen(payload, sizeof(int32_t)); + *(uint32_t*) varDataVal(payload) = TSDB_DATA_NCHAR_NULL; } else { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' - int32_t resLen = -1; - if (!taosMbsToUcs4(pToken->z, pToken->n, payload + VARSTR_HEADER_SIZE, pSchema->bytes - VARSTR_HEADER_SIZE, &resLen)) { + size_t output = 0; + if (!taosMbsToUcs4(pToken->z, pToken->n, varDataVal(payload), pSchema->bytes - VARSTR_HEADER_SIZE, &output)) { char buf[512] = {0}; - snprintf(buf, 512, "%s", strerror(errno)); - + snprintf(buf, tListLen(buf), "%s", strerror(errno)); return tscInvalidSQLErrMsg(msg, buf, pToken->z); } - *(uint16_t*)payload = (uint16_t) (resLen * TSDB_NCHAR_SIZE); + varDataSetLen(payload, output); } break; @@ -479,10 +474,19 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[ char *ptr = payload; for (int32_t i = 0; i < spd->numOfCols; ++i) { + if (!spd->hasVal[i]) { // current column do not have any value to insert, set it to null - setNull(ptr, schema[i].type, schema[i].bytes); + if (schema[i].type == TSDB_DATA_TYPE_BINARY) { + varDataSetLen(ptr, sizeof(int8_t)); + *(uint8_t*) varDataVal(ptr) = TSDB_DATA_BINARY_NULL; + } else if (schema[i].type == TSDB_DATA_TYPE_NCHAR) { + varDataSetLen(ptr, sizeof(int32_t)); + *(uint32_t*) varDataVal(ptr) = TSDB_DATA_NCHAR_NULL; + } else { + setNull(ptr, schema[i].type, schema[i].bytes); + } } - + ptr += schema[i].bytes; } @@ -960,6 +964,10 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { *sqlstr = sql; } + if (*sqlstr == NULL) { + code = TSDB_CODE_INVALID_SQL; + } + return code; } @@ -1283,6 +1291,7 @@ int tsParseInsertSql(SSqlObj *pSql) { pCmd->count = 0; pCmd->command = TSDB_SQL_INSERT; + pSql->res.numOfRows = 0; SQueryInfo *pQueryInfo = NULL; tscGetQueryInfoDetailSafely(pCmd, pCmd->clauseIndex, &pQueryInfo); @@ -1295,7 +1304,6 @@ int tsParseInsertSql(SSqlObj *pSql) { return tscInvalidSQLErrMsg(pCmd->payload, "keyword INTO is expected", sToken.z); } - pSql->res.numOfRows = 0; return doParseInsertSql(pSql, pSql->sqlstr + index); } diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 12032725c3..4cc03f7ad9 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -370,10 +370,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } - char* pMsg = pCmd->payload + tsRpcHeadSize; - pMsg += sizeof(SMgmtHead); + char* pMsg = pCmd->payload; SCMCfgDnodeMsg* pCfg = (SCMCfgDnodeMsg*)pMsg; + pDCL->a[0].n = strdequote(pDCL->a[0].z); + strncpy(pCfg->ep, pDCL->a[0].z, pDCL->a[0].n); strncpy(pCfg->config, pDCL->a[1].z, pDCL->a[1].n); @@ -1117,13 +1118,13 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel // if the name of column is quoted, remove it and set the right information for later process extractColumnNameFromString(pItem); - pQueryInfo->type |= TSDB_QUERY_TYPE_PROJECTION_QUERY; + TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_PROJECTION_QUERY); // select table_name1.field_name1, table_name2.field_name2 from table_name1, table_name2 if (addProjectionExprAndResultField(pQueryInfo, pItem) != TSDB_CODE_SUCCESS) { return TSDB_CODE_INVALID_SQL; } - } else if (pItem->pNode->nSQLOptr >= TK_COUNT && pItem->pNode->nSQLOptr <= TK_AVG_IRATE) { + } else if (pItem->pNode->nSQLOptr >= TK_COUNT && pItem->pNode->nSQLOptr <= TK_TBID) { // sql function in selection clause, append sql function info in pSqlCmd structure sequentially if (addExprAndResultField(pQueryInfo, outputIndex, pItem, true) != TSDB_CODE_SUCCESS) { return TSDB_CODE_INVALID_SQL; @@ -1198,48 +1199,26 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel columnList.num = 0; columnList.ids[0] = (SColumnIndex) {0, 0}; - insertResultField(pQueryInfo, i, &columnList, sizeof(double), TSDB_DATA_TYPE_DOUBLE, "abc", NULL); + insertResultField(pQueryInfo, i, &columnList, sizeof(double), TSDB_DATA_TYPE_DOUBLE, "dummy_column", NULL); int32_t slot = tscNumOfFields(pQueryInfo) - 1; SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, slot); if (pInfo->pSqlExpr == NULL) { - SExprInfo* pFuncExpr = calloc(1, sizeof(SExprInfo)); - pInfo->pArithExprInfo = pFuncExpr; + SExprInfo* pArithExprInfo = calloc(1, sizeof(SExprInfo)); // arithmetic expression always return result in the format of double float - pFuncExpr->bytes = sizeof(double); - pFuncExpr->interResBytes = sizeof(double); - pFuncExpr->type = TSDB_DATA_TYPE_DOUBLE; + pArithExprInfo->bytes = sizeof(double); + pArithExprInfo->interBytes = sizeof(double); + pArithExprInfo->type = TSDB_DATA_TYPE_DOUBLE; - tExprNode* pNode = NULL; -// SArray* colList = taosArrayInit(10, sizeof(SColIndex)); - - int32_t ret = exprTreeFromSqlExpr(&pNode, pItem->pNode, pQueryInfo->exprList, pQueryInfo, NULL); + int32_t ret = exprTreeFromSqlExpr(&pArithExprInfo->pExpr, pItem->pNode, pQueryInfo->exprList, pQueryInfo, NULL); if (ret != TSDB_CODE_SUCCESS) { - tExprTreeDestroy(&pNode, NULL); + tExprTreeDestroy(&pArithExprInfo->pExpr, NULL); return invalidSqlErrMsg(pQueryInfo->msg, "invalid expression in select clause"); } - pFuncExpr->pExpr = pNode; - assert(0); -// pExprInfo->pReqColumns = pColIndex; - -// for(int32_t k = 0; k < pFuncExpr->numOfCols; ++k) { -// SColIndex* pCol = &pFuncExpr->colList[k]; -// size_t size = tscSqlExprNumOfExprs(pQueryInfo); -// -// for(int32_t f = 0; f < size; ++f) { -// SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, f); -// if (strcmp(pExpr->aliasName, pCol->name) == 0) { -// pCol->colIndex = f; -// break; -// } -// } -// -// assert(pCol->colIndex >= 0 && pCol->colIndex < size); -// tfree(pNode); -// } + pInfo->pArithExprInfo = pArithExprInfo; } } } else { @@ -1260,7 +1239,6 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel } if (isSTable) { - pQueryInfo->type |= TSDB_QUERY_TYPE_STABLE_QUERY; /* * transfer sql functions that need secondary merge into another format * in dealing with metric queries such as: count/first/last @@ -1311,10 +1289,8 @@ SSqlExpr* doAddProjectCol(SQueryInfo* pQueryInfo, int32_t outputIndex, int32_t c index.columnIndex = colIndex - tscGetNumOfColumns(pTableMeta); tscColumnListInsert(pTableMetaInfo->tagColList, &index); - pQueryInfo->type = TSDB_QUERY_TYPE_STABLE_QUERY; } else { index.columnIndex = colIndex; - pQueryInfo->type |= TSDB_QUERY_TYPE_PROJECTION_QUERY; } return tscSqlExprAppend(pQueryInfo, functionId, &index, pSchema->type, pSchema->bytes, @@ -1399,7 +1375,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum int32_t addProjectionExprAndResultField(SQueryInfo* pQueryInfo, tSQLExprItem* pItem) { const char* msg0 = "invalid column name"; - const char* msg1 = "tag for table query is not allowed"; + const char* msg1 = "tag for normal table query is not allowed"; int32_t startPos = tscSqlExprNumOfExprs(pQueryInfo); @@ -1493,7 +1469,8 @@ static int32_t setExprInfoForFunctions(SQueryInfo* pQueryInfo, SSchema* pSchema, int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExprItem* pItem, bool finalResult) { STableMetaInfo* pTableMetaInfo = NULL; - int32_t optr = pItem->pNode->nSQLOptr; + + int32_t optr = pItem->pNode->nSQLOptr; const char* msg1 = "not support column types"; const char* msg2 = "invalid parameters"; @@ -1501,7 +1478,8 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr const char* msg4 = "invalid table name"; const char* msg5 = "parameter is out of range [0, 100]"; const char* msg6 = "function applied to tags not allowed"; - + const char* msg7 = "normal table can not apply this function"; + switch (optr) { case TK_COUNT: { if (pItem->pNode->pParam != NULL && pItem->pNode->pParam->nExpr != 1) { @@ -1883,13 +1861,68 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr } } + return TSDB_CODE_SUCCESS; + }; + + case TK_TBID: { + pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + if (UTIL_TABLE_IS_NOMRAL_TABLE(pTableMetaInfo)) { + return invalidSqlErrMsg(pQueryInfo->msg, msg7); + } + + // no parameters or more than one parameter for function + if (pItem->pNode->pParam == NULL || pItem->pNode->pParam->nExpr != 1) { + return invalidSqlErrMsg(pQueryInfo->msg, msg2); + } + + tSQLExpr* pParam = pItem->pNode->pParam->a[0].pNode; + + SColumnIndex index = COLUMN_INDEX_INITIALIZER; + if (getColumnIndexByName(&pParam->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(pQueryInfo->msg, msg3); + } + + pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex); + SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); + + // functions can not be applied to normal columns + int32_t numOfCols = tscGetNumOfColumns(pTableMetaInfo->pTableMeta); + if (index.columnIndex < numOfCols) { + return invalidSqlErrMsg(pQueryInfo->msg, msg6); + } + + index.columnIndex -= numOfCols; + + // 2. valid the column type + int16_t colType = pSchema[index.columnIndex].type; + if (colType == TSDB_DATA_TYPE_BOOL || colType >= TSDB_DATA_TYPE_BINARY) { + return invalidSqlErrMsg(pQueryInfo->msg, msg1); + } + + tscColumnListInsert(pTableMetaInfo->tagColList, &index); + SSchema* pTagSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); + SSchema s = pTagSchema[index.columnIndex]; + + int16_t bytes = 0; + int16_t type = 0; + int16_t inter = 0; + + int32_t ret = getResultDataInfo(s.type, s.bytes, TSDB_FUNC_TID_TAG, 0, &type, &bytes, &inter, 0, 0); + assert(ret == TSDB_CODE_SUCCESS); + + s.type = type; + s.bytes = bytes; + + TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY); + tscAddSpecialColumnForSelect(pQueryInfo, 0, TSDB_FUNC_TID_TAG, &index, &s, TSDB_COL_TAG); + return TSDB_CODE_SUCCESS; } + default: return TSDB_CODE_INVALID_SQL; } - } // todo refactor @@ -2222,14 +2255,14 @@ int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { char* portStr = strtok(NULL, &delim); if (!validateIpAddress(ipStr, strlen(ipStr))) { - memset(pCmd->payload, 0, tListLen(pCmd->payload)); + memset(pCmd->payload, 0, strlen(pCmd->payload)); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } uint16_t port = (uint16_t)strtol(portStr, NULL, 10); if (port <= 0 || port > 65535) { - memset(pCmd->payload, 0, tListLen(pCmd->payload)); + memset(pCmd->payload, 0, strlen(pCmd->payload)); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -2278,7 +2311,7 @@ int32_t tscTansformSQLFuncForSTableQuery(SQueryInfo* pQueryInfo) { tscSqlExprUpdate(pQueryInfo, k, functionId, pExpr->colInfo.colIndex, TSDB_DATA_TYPE_BINARY, bytes); // todo refactor - pExpr->interResBytes = intermediateBytes; + pExpr->interBytes = intermediateBytes; } } @@ -4765,7 +4798,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo* return TSDB_CODE_SUCCESS; } -static int32_t setTimePrecisionOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDbInfo) { +static int32_t setTimePrecision(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDbInfo) { const char* msg = "invalid time precision"; pMsg->precision = TSDB_TIME_PRECISION_MILLI; // millisecond by default @@ -4790,15 +4823,15 @@ static int32_t setTimePrecisionOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCrea } static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { - pMsg->maxSessions = htonl(pCreateDb->tablesPerVnode); - pMsg->cacheBlockSize = htonl(-1); - pMsg->totalBlocks = htonl(-1); + pMsg->maxTables = htonl(pCreateDb->maxTablesPerVnode); + pMsg->cacheBlockSize = htonl(pCreateDb->cacheBlockSize); + pMsg->numOfBlocks = htonl(pCreateDb->numOfBlocks); pMsg->daysPerFile = htonl(pCreateDb->daysPerFile); pMsg->commitTime = htonl(pCreateDb->commitTime); - pMsg->minRowsPerFileBlock = htonl(-1); - pMsg->maxRowsPerFileBlock = htonl(-1); + pMsg->minRowsPerFileBlock = htonl(pCreateDb->minRowsPerBlock); + pMsg->maxRowsPerFileBlock = htonl(pCreateDb->maxRowsPerBlock); pMsg->compression = pCreateDb->compressionLevel; - pMsg->commitLog = (char)pCreateDb->commitLog; + pMsg->walLevel = (char)pCreateDb->walLevel; pMsg->replications = pCreateDb->replica; pMsg->ignoreExist = pCreateDb->ignoreExists; } @@ -4811,7 +4844,7 @@ int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDBInfo* pCreateDbSql) { return TSDB_CODE_INVALID_SQL; } - if (setTimePrecisionOption(pCmd, pMsg, pCreateDbSql) != TSDB_CODE_SUCCESS) { + if (setTimePrecision(pCmd, pMsg, pCreateDbSql) != TSDB_CODE_SUCCESS) { return TSDB_CODE_INVALID_SQL; } @@ -4937,7 +4970,7 @@ static void doUpdateSqlFunctionForTagPrj(SQueryInfo* pQueryInfo) { if (pExpr->functionId != TSDB_FUNC_TAG_DUMMY && pExpr->functionId != TSDB_FUNC_TS_DUMMY) { SSchema* pColSchema = &pSchema[pExpr->colInfo.colIndex]; getResultDataInfo(pColSchema->type, pColSchema->bytes, pExpr->functionId, pExpr->param[0].i64Key, &pExpr->resType, - &pExpr->resBytes, &pExpr->interResBytes, tagLength, true); + &pExpr->resBytes, &pExpr->interBytes, tagLength, true); } } } @@ -5331,8 +5364,8 @@ int32_t doLocalQueryProcess(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql) { int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) { char msg[512] = {0}; - if (pCreate->commitLog != -1 && (pCreate->commitLog < TSDB_MIN_CLOG_LEVEL || pCreate->commitLog > TSDB_MAX_CLOG_LEVEL)) { - snprintf(msg, tListLen(msg), "invalid db option commitLog: %d, only 0-2 allowed", pCreate->commitLog); + if (pCreate->walLevel != -1 && (pCreate->walLevel < TSDB_MIN_WAL_LEVEL || pCreate->walLevel > TSDB_MAX_WAL_LEVEL)) { + snprintf(msg, tListLen(msg), "invalid db option walLevel: %d, only 0-2 allowed", pCreate->walLevel); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } @@ -5357,7 +5390,7 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } - val = htonl(pCreate->maxSessions); + val = htonl(pCreate->maxTables); if (val != -1 && (val < TSDB_MIN_TABLES || val > TSDB_MAX_TABLES)) { snprintf(msg, tListLen(msg), "invalid db option maxSessions: %d valid range: [%d, %d]", val, TSDB_MIN_TABLES, TSDB_MAX_TABLES); @@ -5738,12 +5771,16 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { } assert(pQueryInfo->numOfTables == pQuerySql->from->nExpr); + bool isSTable = false; if (UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { - code = tscGetSTableVgroupInfo(pSql, index); - if (code != TSDB_CODE_SUCCESS) { - return code; - } + isSTable = true; + code = tscGetSTableVgroupInfo(pSql, index); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_STABLE_QUERY); } else { TSDB_QUERY_SET_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TABLE_QUERY); } @@ -5753,7 +5790,6 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { return TSDB_CODE_INVALID_SQL; } - bool isSTable = UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo); if (parseSelectClause(pCmd, index, pQuerySql->pSelection, isSTable) != TSDB_CODE_SUCCESS) { return TSDB_CODE_INVALID_SQL; } diff --git a/src/client/src/tscSecondaryMerge.c b/src/client/src/tscSecondaryMerge.c index 1abefdfd5a..8c75ed6c35 100644 --- a/src/client/src/tscSecondaryMerge.c +++ b/src/client/src/tscSecondaryMerge.c @@ -101,7 +101,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SSqlRes *pRes, SLocalReducer *pRedu } SResultInfo *pResInfo = &pReducer->pResInfo[i]; - pResInfo->bufLen = pExpr->interResBytes; + pResInfo->bufLen = pExpr->interBytes; pResInfo->interResultBuf = calloc(1, (size_t)pResInfo->bufLen); pCtx->resultInfo = &pReducer->pResInfo[i]; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index a6ed575686..119a84e964 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -201,30 +201,22 @@ int tscSendMsgToServer(SSqlObj *pSql) { } if (pSql->cmd.command < TSDB_SQL_MGMT) { - tscTrace("%p msg:%s is sent to server %d", pSql, taosMsg[pSql->cmd.msgType], pSql->ipList.port[0]); memcpy(pMsg, pSql->cmd.payload + tsRpcHeadSize, pSql->cmd.payloadLen); + } else { + pSql->ipList = tscMgmtIpSet; + memcpy(pMsg, pSql->cmd.payload, pSql->cmd.payloadLen); + } - SRpcMsg rpcMsg = { + tscTrace("%p msg:%s is sent to server", pSql, taosMsg[pSql->cmd.msgType]); + + SRpcMsg rpcMsg = { .msgType = pSql->cmd.msgType, .pCont = pMsg, .contLen = pSql->cmd.payloadLen, .handle = pSql, .code = 0 - }; - rpcSendRequest(pVnodeConn, &pSql->ipList, &rpcMsg); - } else { - pSql->ipList = tscMgmtIpSet; - memcpy(pMsg, pSql->cmd.payload, pSql->cmd.payloadLen); - SRpcMsg rpcMsg = { - .msgType = pSql->cmd.msgType, - .pCont = pMsg, - .contLen = pSql->cmd.payloadLen, - .handle = pSql, - .code = 0 - }; - tscTrace("%p msg:%s is sent to server", pSql, taosMsg[pSql->cmd.msgType]); - rpcSendRequest(pObj->pMgmtConn, &pSql->ipList, &rpcMsg); - } + }; + rpcSendRequest(pObj->pDnodeConn, &pSql->ipList, &rpcMsg); return TSDB_CODE_SUCCESS; } @@ -439,25 +431,6 @@ int tscProcessSql(SSqlObj *pSql) { } else { // local handler return (*tscProcessMsgRsp[pCmd->command])(pSql); } - -// if (QUERY_IS_JOIN_QUERY(type)) { -// if ((pQueryInfo->type & TSDB_QUERY_TYPE_SUBQUERY) == 0) { -// return tscHandleMasterJoinQuery(pSql); -// } else { -// // for first stage sub query, iterate all vnodes to get all timestamp -// if ((pQueryInfo->type & TSDB_QUERY_TYPE_JOIN_SEC_STAGE) != TSDB_QUERY_TYPE_JOIN_SEC_STAGE) { -// return doProcessSql(pSql); -// } -// } -// } -// -// if (tscIsTwoStageSTableQuery(pQueryInfo, 0)) { // super table query -// tscHandleMasterSTableQuery(pSql); -// return pRes->code; -// } else if (pSql->fp == (void(*)())tscHandleMultivnodeInsert) { // multi-vnodes insertion -// tscHandleMultivnodeInsert(pSql); -// return pRes->code; -// } return doProcessSql(pSql); } @@ -504,7 +477,7 @@ void tscKillSTableQuery(SSqlObj *pSql) { tscTrace("%p super table query cancelled", pSql); } -int tscBuildRetrieveMsg(SSqlObj *pSql, SSqlInfo *pInfo) { +int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) { char *pMsg, *pStart; pStart = pSql->cmd.payload + tsRpcHeadSize; @@ -533,7 +506,7 @@ int tscBuildRetrieveMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pRetrieveMsg->header.contLen = htonl(pSql->cmd.payloadLen); - pSql->cmd.msgType = TSDB_MSG_TYPE_RETRIEVE; + pSql->cmd.msgType = TSDB_MSG_TYPE_FETCH; return TSDB_CODE_SUCCESS; } @@ -599,14 +572,14 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char if (UTIL_TABLE_IS_NOMRAL_TABLE(pTableMetaInfo) || pTableMetaInfo->pVgroupTables == NULL) { SCMVgroupInfo* pVgroupInfo = NULL; - if (UTIL_TABLE_IS_NOMRAL_TABLE(pTableMetaInfo)) { - pVgroupInfo = &pTableMeta->vgroupInfo; - } else { + if (UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { int32_t index = pTableMetaInfo->vgroupIndex; assert(index >= 0); - + pVgroupInfo = &pTableMetaInfo->vgroupList->vgroups[index]; tscTrace("%p query on stable, vgIndex:%d, numOfVgroups:%d", pSql, index, pTableMetaInfo->vgroupList->numOfVgroups); + } else { + pVgroupInfo = &pTableMeta->vgroupInfo; } tscSetDnodeIpList(pSql, pVgroupInfo); @@ -1032,13 +1005,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int32_t tscBuildCfgDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &pSql->cmd; pCmd->payloadLen = sizeof(SCMCfgDnodeMsg); - - if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) { - tscError("%p failed to malloc for query msg", pSql); - return TSDB_CODE_CLI_OUT_OF_MEMORY; - } - - pCmd->msgType = TSDB_MSG_TYPE_MD_CONFIG_DNODE; + pCmd->msgType = TSDB_MSG_TYPE_CM_CONFIG_DNODE; return TSDB_CODE_SUCCESS; } @@ -1216,7 +1183,7 @@ int32_t tscBuildKillMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscEstimateCreateTableMsgLength(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &(pSql->cmd); - int32_t size = minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMCreateTableMsg); + int32_t size = minMsgSize() + sizeof(SCMCreateTableMsg); SCreateTableSQL *pCreateTableInfo = pInfo->pCreateTableInfo; if (pCreateTableInfo->type == TSQL_CREATE_TABLE_FROM_STABLE) { @@ -1304,7 +1271,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscEstimateAlterTableMsgLength(SSqlCmd *pCmd) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); - return minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMAlterTableMsg) + sizeof(SSchema) * tscNumOfFields(pQueryInfo) + + return minMsgSize() + sizeof(SCMAlterTableMsg) + sizeof(SSchema) * tscNumOfFields(pQueryInfo) + TSDB_EXTRA_PAYLOAD_SIZE; } @@ -1372,7 +1339,7 @@ int tscAlterDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscBuildRetrieveFromMgmtMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &pSql->cmd; - pCmd->msgType = TSDB_MSG_TYPE_RETRIEVE; + pCmd->msgType = TSDB_MSG_TYPE_CM_RETRIEVE; pCmd->payloadLen = sizeof(SRetrieveTableMsg); if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) { @@ -1561,6 +1528,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { * no used 4B **/ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { +#if 0 SSqlCmd *pCmd = &pSql->cmd; // copy payload content to temp buff @@ -1593,6 +1561,8 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pCmd->payloadLen); return pCmd->payloadLen; +#endif + return 0; } //static UNUSED_FUNC int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) { @@ -1792,7 +1762,7 @@ int tscEstimateHeartBeatMsgLength(SSqlObj *pSql) { int size = 0; STscObj *pObj = pSql->pTscObj; - size += tsRpcHeadSize + sizeof(SMgmtHead); + size += tsRpcHeadSize; size += sizeof(SQqueryList); SSqlObj *tpSql = pObj->sqlList; @@ -1828,13 +1798,9 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) { return -1; } - pMsg = pCmd->payload + tsRpcHeadSize; + pMsg = pCmd->payload; pStart = pMsg; - SMgmtHead *pMgmt = (SMgmtHead *)pMsg; - strcpy(pMgmt->db, pObj->db); - pMsg += sizeof(SMgmtHead); - pMsg = tscBuildQueryStreamDesc(pMsg, pObj); pthread_mutex_unlock(&pObj->mutex); @@ -1907,7 +1873,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { assert(pTableMetaInfo->pTableMeta == NULL); pTableMetaInfo->pTableMeta = - (STableMeta *) taosCachePut(tscCacheHandle, pTableMetaInfo->name, pTableMeta, size, tsMeterMetaKeepTimer); + (STableMeta *) taosCachePut(tscCacheHandle, pTableMetaInfo->name, pTableMeta, size, tsTableMetaKeepTimer); // todo handle out of memory case if (pTableMetaInfo->pTableMeta == NULL) { @@ -2016,7 +1982,7 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) { // int32_t size = (int32_t)(rsp - ((char *)pMeta)); // Consistent with STableMeta in cache // // pMeta->index = 0; - // (void)taosCachePut(tscCacheHandle, pMeta->tableId, (char *)pMeta, size, tsMeterMetaKeepTimer); + // (void)taosCachePut(tscCacheHandle, pMeta->tableId, (char *)pMeta, size, tsTableMetaKeepTimer); // } } @@ -2215,7 +2181,7 @@ int tscProcessShowRsp(SSqlObj *pSql) { size_t size = 0; STableMeta* pTableMeta = tscCreateTableMetaFromMsg(pMetaMsg, &size); - pTableMetaInfo->pTableMeta = taosCachePut(tscCacheHandle, key, (char *)pTableMeta, size, tsMeterMetaKeepTimer); + pTableMetaInfo->pTableMeta = taosCachePut(tscCacheHandle, key, (char *)pTableMeta, size, tsTableMetaKeepTimer); SSchema *pTableSchema = tscGetTableSchema(pTableMetaInfo->pTableMeta); if (pQueryInfo->colList == NULL) { @@ -2363,8 +2329,10 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) { pRes->data = pRetrieve->data; SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - tscSetResultPointer(pQueryInfo, pRes); - + if (tscCreateResPointerInfo(pRes, pQueryInfo) != TSDB_CODE_SUCCESS) { + return pRes->code; + } + if (pSql->pSubscription != NULL) { int32_t numOfCols = pQueryInfo->fieldsInfo.numOfOutput; @@ -2436,7 +2404,7 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf strncpy(pNewMeterMetaInfo->name, pTableMetaInfo->name, tListLen(pNewMeterMetaInfo->name)); memcpy(pNew->cmd.payload, pSql->cmd.payload, TSDB_DEFAULT_PAYLOAD_SIZE); // tag information if table does not exists. - tscTrace("%p new pSqlObj:%p to get tableMeta", pSql, pNew); + tscTrace("%p new pSqlObj:%p to get tableMeta, auto create:%d", pSql, pNew, pNew->cmd.autoCreated); pNew->fp = tscTableMetaCallBack; pNew->param = pSql; @@ -2586,7 +2554,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) { void tscInitMsgsFp() { tscBuildMsg[TSDB_SQL_SELECT] = tscBuildQueryMsg; tscBuildMsg[TSDB_SQL_INSERT] = tscBuildSubmitMsg; - tscBuildMsg[TSDB_SQL_FETCH] = tscBuildRetrieveMsg; + tscBuildMsg[TSDB_SQL_FETCH] = tscBuildFetchMsg; tscBuildMsg[TSDB_SQL_CREATE_DB] = tscBuildCreateDbMsg; tscBuildMsg[TSDB_SQL_CREATE_USER] = tscBuildUserMsg; diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index afac69350c..14f0fa07ca 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -65,9 +65,9 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con terrno = TSDB_CODE_INVALID_PASS; return NULL; } - - void* pMgmtConn = NULL; - if (tscInitRpc(user, pass, &pMgmtConn) != 0) { + + void *pDnodeConn = NULL; + if (tscInitRpc(user, pass, &pDnodeConn) != 0) { terrno = TSDB_CODE_NETWORK_UNAVAIL; return NULL; } @@ -78,7 +78,7 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con tscMgmtIpSet.inUse = 0; tscMgmtIpSet.numOfIps = 1; strcpy(tscMgmtIpSet.fqdn[0], ip); - tscMgmtIpSet.port[0] = port? port: tsMnodeShellPort; + tscMgmtIpSet.port[0] = port? port: tsDnodeShellPort; } else { if (tsFirst[0] != 0) { taosGetFqdnPortFromEp(tsFirst, tscMgmtIpSet.fqdn[tscMgmtIpSet.numOfIps], &tscMgmtIpSet.port[tscMgmtIpSet.numOfIps]); @@ -94,6 +94,7 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con STscObj *pObj = (STscObj *)calloc(1, sizeof(STscObj)); if (NULL == pObj) { terrno = TSDB_CODE_CLI_OUT_OF_MEMORY; + rpcClose(pDnodeConn); return NULL; } @@ -101,14 +102,15 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con strncpy(pObj->user, user, TSDB_USER_LEN); taosEncryptPass((uint8_t *)pass, strlen(pass), pObj->pass); - pObj->mgmtPort = port ? port : tsMnodeShellPort; + pObj->mgmtPort = port ? port : tsDnodeShellPort; if (db) { int32_t len = strlen(db); /* db name is too long */ if (len > TSDB_DB_NAME_LEN) { - free(pObj); terrno = TSDB_CODE_INVALID_DB; + rpcClose(pDnodeConn); + free(pObj); return NULL; } @@ -119,12 +121,12 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con strtolower(pObj->db, tmp); } - pObj->pMgmtConn = pMgmtConn; pthread_mutex_init(&pObj->mutex, NULL); SSqlObj *pSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); if (NULL == pSql) { terrno = TSDB_CODE_CLI_OUT_OF_MEMORY; + rpcClose(pDnodeConn); free(pObj); return NULL; } @@ -136,6 +138,8 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con tsem_init(&pSql->rspSem, 0, 0); pObj->pSql = pSql; + pObj->pDnodeConn = pDnodeConn; + pSql->fp = fp; pSql->param = param; if (taos != NULL) { @@ -145,6 +149,7 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con pSql->cmd.command = TSDB_SQL_CONNECT; if (TSDB_CODE_SUCCESS != tscAllocPayload(&pSql->cmd, TSDB_DEFAULT_PAYLOAD_SIZE)) { terrno = TSDB_CODE_CLI_OUT_OF_MEMORY; + rpcClose(pDnodeConn); free(pSql); free(pObj); return NULL; @@ -167,14 +172,7 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) { } TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) { - tscTrace("try to create a connection to %s", ip); - if (port != 0) { - tsServerPort = port; - tsMnodeShellPort = tsServerPort + TSDB_PORT_MNODESHELL; - tsDnodeShellPort = tsServerPort + TSDB_PORT_DNODESHELL; - tsMnodeDnodePort = tsServerPort + TSDB_PORT_MNODEDNODE; - tsDnodeMnodePort = tsServerPort + TSDB_PORT_DNODEMNODE; - } + tscTrace("try to create a connection to %s:%u, user:%s db:%s", ip, port, user, db); STscObj *pObj = taosConnectImpl(ip, user, pass, db, port, NULL, NULL, NULL); if (pObj != NULL) { @@ -193,7 +191,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha return NULL; } - tscTrace("%p DB connection is opening", pObj); + tscTrace("%p DB connection is opening, dnodeConn:%p", pObj, pObj->pDnodeConn); // version compare only requires the first 3 segments of the version string int code = taosCheckVersion(version, taos_get_server_info(pObj), 3); @@ -440,23 +438,6 @@ int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) { return (pQueryInfo->order.order == TSDB_ORDER_DESC) ? pRes->numOfRows : -pRes->numOfRows; } -static UNUSED_FUNC char *getArithemicInputSrc(void *param, const char *name, int32_t colId) { -// SArithmeticSupport *pSupport = (SArithmeticSupport *)param; -// SExprInfo * pExpr = pSupport->pArithExpr; - -// int32_t index = -1; -// for (int32_t i = 0; i < pExpr->numOfCols; ++i) { -// if (strcmp(name, pExpr->colList[i].name) == 0) { -// index = i; -// break; -// } -// } -// -// assert(index >= 0 && index < pExpr->numOfCols); -// return pSupport->data[index] + pSupport->offset * pSupport->elemSize[index]; -return 0; -} - static void waitForRetrieveRsp(void *param, TAOS_RES *tres, int numOfRows) { SSqlObj* pSql = (SSqlObj*) tres; @@ -618,42 +599,18 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) { tscTrace("%p code:%d, numOfRows:%d, command:%d", pSql, pRes->code, pRes->numOfRows, pCmd->command); - void *fp = pSql->fp; - if (fp != NULL) { - pSql->freed = 1; - } - + pSql->freed = 1; tscProcessSql(pSql); /* * If release connection msg is sent to vnode, the corresponding SqlObj for async query can not be freed instantly, * since its free operation is delegated to callback function, which is tscProcessMsgFromServer. */ - if (fp == NULL) { - /* - * fp may be released here, so we cannot use the pSql->fp - * - * In case of handle sync model query, the main SqlObj cannot be freed. - * So, we only free part attributes, including allocated resources and references on metermeta/metricmeta - * data in cache. - * - * Then this object will be reused and no free operation is required. - */ - if (keepCmd) { - tscFreeSqlResult(pSql); - tscTrace("%p sql result is freed by app while sql command is kept", pSql); - } else { - tscPartiallyFreeSqlObj(pSql); - tscTrace("%p sql result is freed by app", pSql); - } - } else { // for async release, remove its link - STscObj* pObj = pSql->pTscObj; - if (pObj->pSql == pSql) { - pObj->pSql = NULL; - } + STscObj* pObj = pSql->pTscObj; + if (pObj->pSql == pSql) { + pObj->pSql = NULL; } - } else { - // if no free resource msg is sent to vnode, we free this object immediately. + } else { // if no free resource msg is sent to vnode, we free this object immediately. STscObj* pTscObj = pSql->pTscObj; if (pTscObj->pSql != pSql) { @@ -885,7 +842,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) { static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t tblListLen) { // must before clean the sqlcmd object - tscCleanSqlCmd(&pSql->cmd); + tscResetSqlCmdObj(&pSql->cmd); SSqlCmd *pCmd = &pSql->cmd; diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index 5f5af09cf8..d7c22b2248 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -508,7 +508,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p SSqlInfo SQLInfo = {0}; tSQLParse(&SQLInfo, pSql->sqlstr); - tscCleanSqlCmd(&pSql->cmd); + tscResetSqlCmdObj(&pSql->cmd); ret = tscAllocPayload(&pSql->cmd, TSDB_DEFAULT_PAYLOAD_SIZE); if (TSDB_CODE_SUCCESS != ret) { setErrorInfo(pObj, ret, NULL); diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 7b40d69f1b..856b678391 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -374,7 +374,7 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) { } else { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); - uint16_t type = pQueryInfo->type; + uint32_t type = pQueryInfo->type; taos_free_result_imp(pSql, 1); pRes->numOfRows = 1; pRes->numOfTotal = 0; diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index c3d6c0f5fc..d3a81adca6 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -14,6 +14,7 @@ */ #include "tscSubquery.h" +#include #include #include #include "os.h" @@ -411,10 +412,6 @@ static void updateQueryTimeRange(SQueryInfo* pQueryInfo, int64_t st, int64_t et) static void tSIntersectionAndLaunchSecQuery(SJoinSupporter* pSupporter, SSqlObj* pSql) { SSqlObj* pParentSql = pSupporter->pObj; -// SSqlCmd* pCmd = &pSql->cmd; -// SSqlRes* pRes = &pSql->res; - -// SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); SQueryInfo* pParentQueryInfo = tscGetQueryInfoDetail(&pParentSql->cmd, pParentSql->cmd.clauseIndex); // if (tscNonOrderedProjectionQueryOnSTable(pParentQueryInfo, 0)) { @@ -601,21 +598,6 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); -// if (pSupporter->pState->code != TSDB_CODE_SUCCESS) { -// tscError("%p abort query due to other subquery failure. code:%d, global code:%s", pSql, numOfRows, -// tstrerror(pSupporter->pState->code)); -// -// quitAllSubquery(pParentSql, pSupporter); -// return; -// } -// -// if (numOfRows < 0) { -// tscError("%p sub query failed, code:%s, index:%d", pSql, tstrerror(numOfRows), pSupporter->subqueryIndex); -// pSupporter->pState->code = numOfRows; -// quitAllSubquery(pParentSql, pSupporter); -// return; -// } - // response of tag retrieve if (TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY)) { if (numOfRows == 0 || pSql->res.completed) { @@ -1454,7 +1436,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO return; } else { // reach the maximum retry count, abort atomic_val_compare_exchange_32(&pState->code, TSDB_CODE_SUCCESS, numOfRows); - tscError("%p sub:%p retrieve failed,code:%s,orderOfSub:%d failed.no more retry,set global code:%d", pPObj, pSql, + tscError("%p sub:%p retrieve failed,code:%d,orderOfSub:%d failed.no more retry,set global code:%d", pPObj, pSql, numOfRows, subqueryIndex, tstrerror(pState->code)); } } @@ -1924,7 +1906,7 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) { static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pField) { SSqlRes *pRes = &pSql->res; - if (isNull(pRes->tsrow[columnIndex], pField->type)) { + if (pRes->tsrow[columnIndex] != NULL && isNull(pRes->tsrow[columnIndex], pField->type)) { pRes->tsrow[columnIndex] = NULL; } else if (pField->type == TSDB_DATA_TYPE_NCHAR) { // convert unicode to native code in a temporary buffer extra one byte for terminated symbol @@ -1944,6 +1926,24 @@ static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pF } } +static char *getArithemicInputSrc(void *param, const char *name, int32_t colId) { + SArithmeticSupport *pSupport = (SArithmeticSupport *) param; + + int32_t index = -1; + SSqlExpr* pExpr = NULL; + + for (int32_t i = 0; i < pSupport->numOfCols; ++i) { + pExpr = taosArrayGetP(pSupport->exprList, i); + if (strncmp(name, pExpr->aliasName, TSDB_COL_NAME_LEN) == 0) { + index = i; + break; + } + } + + assert(index >= 0 && index < pSupport->numOfCols); + return pSupport->data[index] + pSupport->offset * pExpr->resBytes; +} + void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; @@ -1981,28 +1981,30 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { // calculate the result from several other columns if (pSup->pArithExprInfo != NULL) { -// SArithmeticSupport *sas = (SArithmeticSupport *)calloc(1, sizeof(SArithmeticSupport)); -// sas->offset = 0; -// sas-> = pQueryInfo->fieldsInfo.pExpr[i]; -// -// sas->numOfCols = sas->pExpr->binExprInfo.numOfCols; -// -// if (pRes->buffer[i] == NULL) { -// pRes->buffer[i] = malloc(tscFieldInfoGetField(pQueryInfo, i)->bytes); -// } -// -// for(int32_t k = 0; k < sas->numOfCols; ++k) { -// int32_t columnIndex = sas->pExpr->binExprInfo.pReqColumns[k].colIdxInBuf; -// SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, columnIndex); -// -// sas->elemSize[k] = pExpr->resBytes; -// sas->data[k] = (pRes->data + pRes->numOfRows* pExpr->offset) + pRes->row*pExpr->resBytes; -// } -// -// tSQLBinaryExprCalcTraverse(sas->pExpr->binExprInfo.pBinExpr, 1, pRes->buffer[i], sas, TSQL_SO_ASC, getArithemicInputSrc); -// pRes->tsrow[i] = pRes->buffer[i]; -// -// free(sas); //todo optimization + if (pRes->pArithSup == NULL) { + SArithmeticSupport *sas = (SArithmeticSupport *) calloc(1, sizeof(SArithmeticSupport)); + sas->offset = 0; + sas->pArithExpr = pSup->pArithExprInfo; + sas->numOfCols = tscSqlExprNumOfExprs(pQueryInfo); + sas->exprList = pQueryInfo->exprList; + sas->data = calloc(sas->numOfCols, POINTER_BYTES); + + pRes->pArithSup = sas; + } + + if (pRes->buffer[i] == NULL) { + TAOS_FIELD* field = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); + pRes->buffer[i] = malloc(field->bytes); + } + + for(int32_t k = 0; k < pRes->pArithSup->numOfCols; ++k) { + SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, k); + pRes->pArithSup->data[k] = (pRes->data + pRes->numOfRows* pExpr->offset) + pRes->row*pExpr->resBytes; + } + + tExprTreeCalcTraverse(pRes->pArithSup->pArithExpr->pExpr, 1, pRes->buffer[i], pRes->pArithSup, + TSDB_ORDER_ASC, getArithemicInputSrc); + pRes->tsrow[i] = pRes->buffer[i]; } } @@ -2010,7 +2012,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { return pRes->tsrow; } -static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) { +static UNUSED_FUNC bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) { bool hasData = true; SSqlCmd *pCmd = &pSql->cmd; diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index c0ad91cd59..07926306db 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -30,7 +30,6 @@ #include "tlocale.h" // global, not configurable -void * pVnodeConn; void * tscCacheHandle; void * tscTmr; void * tscQhandle; @@ -48,15 +47,15 @@ void tscCheckDiskUsage(void *UNUSED_PARAM(para), void* UNUSED_PARAM(param)) { taosTmrReset(tscCheckDiskUsage, 1000, NULL, tscTmr, &tscCheckDiskUsageTmr); } -int32_t tscInitRpc(const char *user, const char *secret, void** pMgmtConn) { +int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { SRpcInit rpcInit; char secretEncrypt[32] = {0}; taosEncryptPass((uint8_t *)secret, strlen(secret), secretEncrypt); - if (pVnodeConn == NULL) { + if (*pDnodeConn == NULL) { memset(&rpcInit, 0, sizeof(rpcInit)); rpcInit.localPort = 0; - rpcInit.label = "TSC-vnode"; + rpcInit.label = "TSC"; rpcInit.numOfThreads = tscNumOfThreads; rpcInit.cfp = tscProcessMsgFromServer; rpcInit.sessions = tsMaxVnodeConnections; @@ -66,32 +65,12 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pMgmtConn) { rpcInit.ckey = "key"; rpcInit.secret = secretEncrypt; - pVnodeConn = rpcOpen(&rpcInit); - if (pVnodeConn == NULL) { - tscError("failed to init connection to vnode"); - return -1; - } - } - - if (*pMgmtConn == NULL) { - memset(&rpcInit, 0, sizeof(rpcInit)); - rpcInit.localPort = 0; - rpcInit.label = "TSC-mgmt"; - rpcInit.numOfThreads = 1; - rpcInit.cfp = tscProcessMsgFromServer; - rpcInit.ufp = tscUpdateIpSet; - rpcInit.sessions = tsMaxMgmtConnections; - rpcInit.connType = TAOS_CONN_CLIENT; - rpcInit.idleTime = 2000; - rpcInit.user = (char*)user; - rpcInit.ckey = "key"; - rpcInit.spi = 1; - rpcInit.secret = secretEncrypt; - - *pMgmtConn = rpcOpen(&rpcInit); - if (*pMgmtConn == NULL) { - tscError("failed to init connection to mgmt"); + *pDnodeConn = rpcOpen(&rpcInit); + if (*pDnodeConn == NULL) { + tscError("failed to init connection to TDengine"); return -1; + } else { + tscTrace("dnodeConn:%p is created, user:%s", *pDnodeConn, user); } } @@ -165,7 +144,7 @@ void taos_init_imp() { taosTmrReset(tscCheckDiskUsage, 10, NULL, tscTmr, &tscCheckDiskUsageTmr); } - int64_t refreshTime = tsMetricMetaKeepTimer < tsMeterMetaKeepTimer ? tsMetricMetaKeepTimer : tsMeterMetaKeepTimer; + int64_t refreshTime = tsTableMetaKeepTimer; refreshTime = refreshTime > 2 ? 2 : refreshTime; refreshTime = refreshTime < 1 ? 1 : refreshTime; @@ -190,11 +169,6 @@ void taos_cleanup() { taosCloseLog(); - if (pVnodeConn != NULL) { - rpcClose(pVnodeConn); - pVnodeConn = NULL; - } - taosTmrCleanUp(tscTmr); } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index d49fff1583..dd3cb76cbf 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -30,7 +30,10 @@ #include "ttokendef.h" #include "tscLog.h" -SCond* tsGetSTableQueryCond(STagCond* pTagCond, uint64_t uid) { +static void freeQueryInfoImpl(SQueryInfo* pQueryInfo); +static void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool removeFromCache); + + SCond* tsGetSTableQueryCond(STagCond* pTagCond, uint64_t uid) { if (pTagCond->pCond == NULL) { return NULL; } @@ -309,6 +312,7 @@ void tscDestroyResPointerInfo(SSqlRes* pRes) { for (int i = 0; i < pRes->numOfCols; i++) { tfree(pRes->buffer[i]); } + pRes->numOfCols = 0; } @@ -320,9 +324,32 @@ void tscDestroyResPointerInfo(SSqlRes* pRes) { tfree(pRes->pColumnIndex); tfree(pRes->buffer); + if (pRes->pArithSup != NULL) { + tfree(pRes->pArithSup->data); + tfree(pRes->pArithSup); + } + pRes->data = NULL; // pRes->data points to the buffer of pRsp, no need to free } +static void tscFreeQueryInfo(SSqlCmd* pCmd) { + if (pCmd == NULL || pCmd->numOfClause == 0) { + return; + } + + for (int32_t i = 0; i < pCmd->numOfClause; ++i) { + char* addr = (char*)pCmd - offsetof(SSqlObj, cmd); + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, i); + + freeQueryInfoImpl(pQueryInfo); + clearAllTableMetaInfo(pQueryInfo, (const char*)addr, false); + tfree(pQueryInfo); + } + + pCmd->numOfClause = 0; + tfree(pCmd->pQueryInfo); +} + void tscResetSqlCmdObj(SSqlCmd* pCmd) { pCmd->command = 0; pCmd->numOfCols = 0; @@ -330,11 +357,13 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd) { pCmd->curSql = NULL; pCmd->msgType = 0; pCmd->parseFinished = 0; + pCmd->autoCreated = 0; taosHashCleanup(pCmd->pTableList); - pCmd->pTableList= NULL; + pCmd->pTableList = NULL; pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks); + tscFreeQueryInfo(pCmd); } @@ -343,6 +372,7 @@ void tscFreeSqlResult(SSqlObj* pSql) { SSqlRes* pRes = &pSql->res; tscDestroyResPointerInfo(pRes); + memset(&pSql->res, 0, sizeof(SSqlRes)); } @@ -366,8 +396,8 @@ void tscPartiallyFreeSqlObj(SSqlObj* pSql) { pthread_mutex_unlock(&pObj->mutex); tscFreeSqlResult(pSql); - tfree(pSql->pSubs); + tfree(pSql->pSubs); pSql->freed = 0; pSql->numOfSubs = 0; @@ -726,10 +756,17 @@ void tscCloseTscObj(STscObj* pObj) { taosTmrStopA(&(pObj->pTimer)); tscFreeSqlObj(pSql); - rpcClose(pObj->pMgmtConn); + if (pSql) { + sem_destroy(&pSql->rspSem); + } + pthread_mutex_destroy(&pObj->mutex); - tscTrace("%p DB connection is closed", pObj); + if (pObj->pDnodeConn != NULL) { + rpcClose(pObj->pDnodeConn); + } + + tscTrace("%p DB connection is closed, dnodeConn:%p", pObj, pObj->pDnodeConn); tfree(pObj); } @@ -913,6 +950,7 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) { if (pInfo->pArithExprInfo != NULL) { tExprTreeDestroy(&pInfo->pArithExprInfo->pExpr, NULL); + tfree(pInfo->pArithExprInfo); } } @@ -947,7 +985,7 @@ static SSqlExpr* doBuildSqlExpr(SQueryInfo* pQueryInfo, int16_t functionId, SCol pExpr->colInfo.colIndex = pColIndex->columnIndex; pExpr->resType = type; pExpr->resBytes = size; - pExpr->interResBytes = interSize; + pExpr->interBytes = interSize; pExpr->uid = pTableMetaInfo->pTableMeta->uid; return pExpr; @@ -1422,20 +1460,6 @@ bool tscShouldFreeHeatBeat(SSqlObj* pHb) { return pQueryInfo->type == TSDB_QUERY_TYPE_FREE_RESOURCE; } -void tscCleanSqlCmd(SSqlCmd* pCmd) { - pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks); - tscFreeQueryInfo(pCmd); - - uint32_t allocSize = pCmd->allocSize; - char* allocPtr = pCmd->payload; - - memset(pCmd, 0, sizeof(SSqlCmd)); - - // restore values - pCmd->allocSize = allocSize; - pCmd->payload = allocPtr; -} - /* * the following three kinds of SqlObj should not be freed * 1. SqlObj for stream computing @@ -1630,24 +1654,6 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool rem tfree(pQueryInfo->pTableMetaInfo); } -void tscFreeQueryInfo(SSqlCmd* pCmd) { - if (pCmd == NULL || pCmd->numOfClause == 0) { - return; - } - - for (int32_t i = 0; i < pCmd->numOfClause; ++i) { - char* addr = (char*)pCmd - offsetof(SSqlObj, cmd); - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, i); - - freeQueryInfoImpl(pQueryInfo); - clearAllTableMetaInfo(pQueryInfo, (const char*)addr, false); - tfree(pQueryInfo); - } - - pCmd->numOfClause = 0; - tfree(pCmd->pQueryInfo); -} - STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, STableMeta* pTableMeta, SVgroupsInfo* vgroupList, SArray* pTagCols) { void* pAlloc = realloc(pQueryInfo->pTableMetaInfo, (pQueryInfo->numOfTables + 1) * POINTER_BYTES); diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h index 10ca75f785..ec52bcd2ae 100644 --- a/src/common/inc/tdataformat.h +++ b/src/common/inc/tdataformat.h @@ -28,16 +28,16 @@ extern "C" { #define STR_TO_VARSTR(x, str) do {VarDataLenT __len = strlen(str); \ *(VarDataLenT*)(x) = __len; \ - strncpy((char*)(x) + VARSTR_HEADER_SIZE, (str), __len);} while(0); + strncpy(varDataVal(x), (str), __len);} while(0); #define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) do {\ - char* _e = stpncpy((char*)(x) + VARSTR_HEADER_SIZE, (str), (_maxs));\ - *(VarDataLenT*)(x) = (_e - (x) - VARSTR_HEADER_SIZE);\ + char* _e = stpncpy(varDataVal(x), (str), (_maxs));\ + varDataSetLen(x, (_e - (x) - VARSTR_HEADER_SIZE));\ } while(0) #define STR_WITH_SIZE_TO_VARSTR(x, str, _size) do {\ *(VarDataLenT*)(x) = (_size); \ - strncpy((char*)(x) + VARSTR_HEADER_SIZE, (str), (_size));\ + strncpy(varDataVal(x), (str), (_size));\ } while(0); // ----------------- TSDB COLUMN DEFINITION @@ -97,7 +97,7 @@ typedef void *SDataRow; #define TD_DATA_ROW_HEAD_SIZE sizeof(int32_t) #define dataRowLen(r) (*(int32_t *)(r)) -#define dataRowTuple(r) POINTER_DRIFT(r, TD_DATA_ROW_HEAD_SIZE) +#define dataRowTuple(r) POINTER_SHIFT(r, TD_DATA_ROW_HEAD_SIZE) #define dataRowKey(r) (*(TSKEY *)(dataRowTuple(r))) #define dataRowSetLen(r, l) (dataRowLen(r) = (l)) #define dataRowCpy(dst, r) memcpy((dst), (r), dataRowLen(r)) @@ -114,10 +114,10 @@ static FORCE_INLINE void *tdGetRowDataOfCol(SDataRow row, int8_t type, int32_t o switch (type) { case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - return POINTER_DRIFT(row, *(VarDataOffsetT *)POINTER_DRIFT(row, offset)); + return POINTER_SHIFT(row, *(VarDataOffsetT *)POINTER_SHIFT(row, offset)); break; default: - return POINTER_DRIFT(row, offset); + return POINTER_SHIFT(row, offset); break; } } @@ -149,11 +149,11 @@ static FORCE_INLINE void *tdGetColDataOfRow(SDataCol *pCol, int row) { switch (pCol->type) { case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - return POINTER_DRIFT(pCol->pData, pCol->dataOff[row]); + return POINTER_SHIFT(pCol->pData, pCol->dataOff[row]); break; default: - return POINTER_DRIFT(pCol->pData, TYPE_BYTES[pCol->type] * row); + return POINTER_SHIFT(pCol->pData, TYPE_BYTES[pCol->type] * row); break; } } diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index dd0dd230fd..b077f40945 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -55,18 +55,15 @@ extern char tsFirst[]; extern char tsSecond[]; extern char tsLocalEp[]; extern uint16_t tsServerPort; -extern uint16_t tsMnodeDnodePort; -extern uint16_t tsMnodeShellPort; extern uint16_t tsDnodeShellPort; -extern uint16_t tsDnodeMnodePort; +extern uint16_t tsDnodeDnodePort; extern uint16_t tsSyncPort; extern int32_t tsStatusInterval; extern int32_t tsShellActivityTimer; extern int32_t tsVnodePeerHBTimer; extern int32_t tsMgmtPeerHBTimer; -extern int32_t tsMeterMetaKeepTimer; -extern int32_t tsMetricMetaKeepTimer; +extern int32_t tsTableMetaKeepTimer; extern float tsNumOfThreadsPerCore; extern float tsRatioOfQueryThreads; @@ -77,8 +74,8 @@ extern int16_t tsNumOfTotalVnodes; extern uint32_t tsPublicIpInt; extern int32_t tsCacheBlockSize; -extern int32_t tsTotalBlocks; -extern int32_t tsTablesPerVnode; +extern int32_t tsBlocksPerVnode; +extern int32_t tsMaxTablePerVnode; extern int16_t tsDaysPerFile; extern int32_t tsDaysToKeep; extern int32_t tsMinRowsInFileBlock; @@ -86,7 +83,7 @@ extern int32_t tsMaxRowsInFileBlock; extern int16_t tsCommitTime; // seconds extern int32_t tsTimePrecision; extern int16_t tsCompression; -extern int16_t tsCommitLog; +extern int16_t tsWAL; extern int32_t tsReplications; extern int16_t tsAffectedRowsMod; @@ -94,7 +91,6 @@ extern int32_t tsNumOfMPeers; extern int32_t tsMaxShellConns; extern int32_t tsMaxTables; -extern char tsLocalIp[]; extern char tsDefaultDB[]; extern char tsDefaultUser[]; extern char tsDefaultPass[]; @@ -136,7 +132,6 @@ extern int32_t tsHttpEnableRecordSql; extern int32_t tsTelegrafUseFieldNum; extern int32_t tsTscEnableRecordSql; -extern int32_t tsAnyIp; extern char tsMonitorDbName[]; extern char tsInternalPass[]; @@ -144,10 +139,11 @@ extern int32_t tsMonitorInterval; extern int32_t tsAsyncLog; extern int32_t tsNumOfLogLines; -extern int32_t ddebugFlag; -extern int32_t mdebugFlag; -extern int32_t cdebugFlag; -extern int32_t jnidebugFlag; +extern int32_t dDebugFlag; +extern int32_t vDebugFlag; +extern int32_t mDebugFlag; +extern int32_t cDebugFlag; +extern int32_t jniDebugFlag; extern int32_t tmrDebugFlag; extern int32_t sdbDebugFlag; extern int32_t httpDebugFlag; @@ -155,8 +151,8 @@ extern int32_t monitorDebugFlag; extern int32_t uDebugFlag; extern int32_t rpcDebugFlag; extern int32_t debugFlag; -extern int32_t odbcdebugFlag; -extern int32_t qdebugFlag; +extern int32_t odbcDebugFlag; +extern int32_t qDebugFlag; extern uint32_t taosMaxTmrCtrl; diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 28f42f85a5..9d81cd07af 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -167,17 +167,17 @@ void tdFreeDataRow(SDataRow row) { int tdAppendColVal(SDataRow row, void *value, int8_t type, int32_t bytes, int32_t offset) { ASSERT(value != NULL); int32_t toffset = offset + TD_DATA_ROW_HEAD_SIZE; - char * ptr = POINTER_DRIFT(row, dataRowLen(row)); + char * ptr = POINTER_SHIFT(row, dataRowLen(row)); switch (type) { case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - *(VarDataOffsetT *)POINTER_DRIFT(row, toffset) = dataRowLen(row); + *(VarDataOffsetT *)POINTER_SHIFT(row, toffset) = dataRowLen(row); memcpy(ptr, value, varDataTLen(value)); dataRowLen(row) += varDataTLen(value); break; default: - memcpy(POINTER_DRIFT(row, toffset), value, TYPE_BYTES[type]); + memcpy(POINTER_SHIFT(row, toffset), value, TYPE_BYTES[type]); break; } @@ -202,13 +202,13 @@ void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints) if (pDataCol->type == TSDB_DATA_TYPE_BINARY || pDataCol->type == TSDB_DATA_TYPE_NCHAR) { pDataCol->spaceSize = (sizeof(VarDataLenT) + pDataCol->bytes) * maxPoints; pDataCol->dataOff = (VarDataOffsetT *)(*pBuf); - pDataCol->pData = POINTER_DRIFT(*pBuf, TYPE_BYTES[pDataCol->type] * maxPoints); - *pBuf = POINTER_DRIFT(*pBuf, pDataCol->spaceSize + TYPE_BYTES[pDataCol->type] * maxPoints); + pDataCol->pData = POINTER_SHIFT(*pBuf, TYPE_BYTES[pDataCol->type] * maxPoints); + *pBuf = POINTER_SHIFT(*pBuf, pDataCol->spaceSize + TYPE_BYTES[pDataCol->type] * maxPoints); } else { pDataCol->spaceSize = pDataCol->bytes * maxPoints; pDataCol->dataOff = NULL; pDataCol->pData = *pBuf; - *pBuf = POINTER_DRIFT(*pBuf, pDataCol->spaceSize); + *pBuf = POINTER_SHIFT(*pBuf, pDataCol->spaceSize); } } @@ -222,13 +222,13 @@ void dataColAppendVal(SDataCol *pCol, void *value, int numOfPoints, int maxPoint // set offset pCol->dataOff[numOfPoints] = pCol->len; // Copy data - memcpy(POINTER_DRIFT(pCol->pData, pCol->len), value, varDataTLen(value)); + 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); - memcpy(POINTER_DRIFT(pCol->pData, pCol->len), value, pCol->bytes); + memcpy(POINTER_SHIFT(pCol->pData, pCol->len), value, pCol->bytes); pCol->len += pCol->bytes; break; } @@ -244,12 +244,12 @@ void dataColPopPoints(SDataCol *pCol, int pointsToPop, int numOfPoints) { VarDataOffsetT toffset = pCol->dataOff[pointsToPop]; pCol->len = pCol->len - toffset; ASSERT(pCol->len > 0); - memmove(pCol->pData, POINTER_DRIFT(pCol->pData, toffset), pCol->len); + memmove(pCol->pData, POINTER_SHIFT(pCol->pData, toffset), pCol->len); dataColSetOffset(pCol, pointsLeft); } else { ASSERT(pCol->len == TYPE_BYTES[pCol->type] * numOfPoints); pCol->len = TYPE_BYTES[pCol->type] * pointsLeft; - memmove(pCol->pData, POINTER_DRIFT(pCol->pData, TYPE_BYTES[pCol->type] * pointsToPop), pCol->len); + memmove(pCol->pData, POINTER_SHIFT(pCol->pData, TYPE_BYTES[pCol->type] * pointsToPop), pCol->len); } } @@ -301,7 +301,7 @@ void dataColSetOffset(SDataCol *pCol, int nEle) { for (int i = 0; i < nEle; i++) { pCol->dataOff[i] = offset; offset += varDataTLen(tptr); - tptr = POINTER_DRIFT(tptr, varDataTLen(tptr)); + tptr = POINTER_SHIFT(tptr, varDataTLen(tptr)); } } diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 70b55b9d92..90637265b3 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -66,16 +66,13 @@ char tsSecond[TSDB_FQDN_LEN] = {0}; char tsArbitrator[TSDB_FQDN_LEN] = {0}; char tsLocalEp[TSDB_FQDN_LEN] = {0}; // Local End Point, hostname:port uint16_t tsServerPort = 6030; -uint16_t tsMnodeShellPort = 6030; // udp[6030-6034] tcp[6030] -uint16_t tsDnodeShellPort = 6035; // udp[6035-6039] tcp[6035] -uint16_t tsMnodeDnodePort = 6040; // udp/tcp -uint16_t tsDnodeMnodePort = 6045; // udp/tcp -uint16_t tsSyncPort = 6050; +uint16_t tsDnodeShellPort = 6030; // udp[6035-6039] tcp[6035] +uint16_t tsDnodeDnodePort = 6035; // udp/tcp +uint16_t tsSyncPort = 6040; int32_t tsStatusInterval = 1; // second int32_t tsShellActivityTimer = 3; // second -int32_t tsMeterMetaKeepTimer = 7200; // second -int32_t tsMetricMetaKeepTimer = 600; // second +int32_t tsTableMetaKeepTimer = 7200; // second int32_t tsRpcTimer = 300; int32_t tsRpcMaxTime = 600; // seconds; @@ -85,22 +82,22 @@ int16_t tsNumOfVnodesPerCore = 8; int16_t tsNumOfTotalVnodes = TSDB_INVALID_VNODE_NUM; #ifdef _TD_ARM_32_ -int32_t tsTablesPerVnode = 100; +int32_t tsMaxTablePerVnode = 100; #else -int32_t tsTablesPerVnode = TSDB_DEFAULT_TABLES; +int32_t tsMaxTablePerVnode = TSDB_DEFAULT_TABLES; #endif int32_t tsCacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE; -int32_t tsTotalBlocks = TSDB_DEFAULT_TOTAL_BLOCKS; -int16_t tsDaysPerFile = TSDB_DEFAULT_DAYS_PER_FILE; -int32_t tsDaysToKeep = TSDB_DEFAULT_KEEP; +int32_t tsBlocksPerVnode = TSDB_DEFAULT_TOTAL_BLOCKS; +int16_t tsDaysPerFile = TSDB_DEFAULT_DAYS_PER_FILE; +int32_t tsDaysToKeep = TSDB_DEFAULT_KEEP; int32_t tsMinRowsInFileBlock = TSDB_DEFAULT_MIN_ROW_FBLOCK; int32_t tsMaxRowsInFileBlock = TSDB_DEFAULT_MAX_ROW_FBLOCK; -int16_t tsCommitTime = TSDB_DEFAULT_COMMIT_TIME; // seconds +int16_t tsCommitTime = TSDB_DEFAULT_COMMIT_TIME; // seconds int32_t tsTimePrecision = TSDB_DEFAULT_PRECISION; -int16_t tsCompression = TSDB_DEFAULT_COMP_LEVEL; -int16_t tsCommitLog = TSDB_DEFAULT_CLOG_LEVEL; -int32_t tsReplications = TSDB_DEFAULT_REPLICA_NUM; +int16_t tsCompression = TSDB_DEFAULT_COMP_LEVEL; +int16_t tsWAL = TSDB_DEFAULT_WAL_LEVEL; +int32_t tsReplications = TSDB_DEFAULT_REPLICA_NUM; /** * Change the meaning of affected rows: @@ -130,19 +127,20 @@ int32_t tsRestRowLimit = 10240; int32_t tsMaxSQLStringLen = TSDB_MAX_SQL_LEN; int32_t tsNumOfLogLines = 10000000; -int32_t mdebugFlag = 135; +int32_t mDebugFlag = 135; int32_t sdbDebugFlag = 135; -int32_t ddebugFlag = 131; -int32_t cdebugFlag = 131; -int32_t jnidebugFlag = 131; -int32_t odbcdebugFlag = 131; +int32_t dDebugFlag = 135; +int32_t vDebugFlag = 135; +int32_t cDebugFlag = 135; +int32_t jniDebugFlag = 131; +int32_t odbcDebugFlag = 131; int32_t httpDebugFlag = 131; int32_t monitorDebugFlag = 131; -int32_t qdebugFlag = 131; -int32_t rpcDebugFlag = 131; +int32_t qDebugFlag = 131; +int32_t rpcDebugFlag = 135; int32_t uDebugFlag = 131; int32_t debugFlag = 131; -int32_t sDebugFlag = 131; +int32_t sDebugFlag = 135; // the maximum number of results for projection query on super table that are returned from // one virtual node, to order according to timestamp @@ -206,10 +204,19 @@ static pthread_once_t tsInitGlobalCfgOnce = PTHREAD_ONCE_INIT; void taosSetAllDebugFlag() { for (int32_t i = 0; i < tsGlobalConfigNum; ++i) { - SGlobalCfg *cfg = &tsGlobalConfig[i]; - if ((cfg->cfgType & TSDB_CFG_CTYPE_B_LOG) && cfg->cfgType == TAOS_CFG_VTYPE_INT32) { - *((int32_t*)cfg->ptr) = debugFlag; - } + mDebugFlag = debugFlag; + sdbDebugFlag = debugFlag; + dDebugFlag = debugFlag; + vDebugFlag = debugFlag; + cDebugFlag = debugFlag; + jniDebugFlag = debugFlag; + odbcDebugFlag = debugFlag; + httpDebugFlag = debugFlag; + monitorDebugFlag = debugFlag; + rpcDebugFlag = debugFlag; + uDebugFlag = debugFlag; + sDebugFlag = debugFlag; + //qDebugFlag = debugFlag; } uPrint("all debug flag are set to %d", debugFlag); } @@ -506,18 +513,8 @@ static void doInitGlobalConfig() { cfg.unitType = TAOS_CFG_UTYPE_SECOND; taosInitConfigOption(cfg); - cfg.option = "meterMetaKeepTimer"; - cfg.ptr = &tsMeterMetaKeepTimer; - cfg.valType = TAOS_CFG_VTYPE_INT32; - cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT; - cfg.minValue = 1; - cfg.maxValue = 8640000; - cfg.ptrLength = 0; - cfg.unitType = TAOS_CFG_UTYPE_SECOND; - taosInitConfigOption(cfg); - - cfg.option = "metricMetaKeepTimer"; - cfg.ptr = &tsMetricMetaKeepTimer; + cfg.option = "tableMetaKeepTimer"; + cfg.ptr = &tsTableMetaKeepTimer; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT; cfg.minValue = 1; @@ -587,8 +584,8 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); // database configs - cfg.option = "tables"; - cfg.ptr = &tsTablesPerVnode; + cfg.option = "maxtablesPerVnode"; + cfg.ptr = &tsMaxTablePerVnode; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; cfg.minValue = TSDB_MIN_TABLES; @@ -608,7 +605,7 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); cfg.option = "blocks"; - cfg.ptr = &tsTotalBlocks; + cfg.ptr = &tsBlocksPerVnode; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; cfg.minValue = TSDB_MIN_TOTAL_BLOCKS; @@ -677,12 +674,12 @@ static void doInitGlobalConfig() { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); - cfg.option = "clog"; - cfg.ptr = &tsCommitLog; + cfg.option = "wallevel"; + cfg.ptr = &tsWAL; cfg.valType = TAOS_CFG_VTYPE_INT16; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; - cfg.minValue = TSDB_MIN_CLOG_LEVEL; - cfg.maxValue = TSDB_MAX_CLOG_LEVEL; + cfg.minValue = TSDB_MIN_WAL_LEVEL; + cfg.maxValue = TSDB_MAX_WAL_LEVEL; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); @@ -1005,7 +1002,7 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); cfg.option = "mDebugFlag"; - cfg.ptr = &mdebugFlag; + cfg.ptr = &mDebugFlag; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG; cfg.minValue = 0; @@ -1015,7 +1012,7 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); cfg.option = "dDebugFlag"; - cfg.ptr = &ddebugFlag; + cfg.ptr = &dDebugFlag; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG; cfg.minValue = 0; @@ -1065,7 +1062,7 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); cfg.option = "cDebugFlag"; - cfg.ptr = &cdebugFlag; + cfg.ptr = &cDebugFlag; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT; cfg.minValue = 0; @@ -1075,7 +1072,7 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); cfg.option = "jniDebugFlag"; - cfg.ptr = &jnidebugFlag; + cfg.ptr = &jniDebugFlag; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT; cfg.minValue = 0; @@ -1085,7 +1082,7 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); cfg.option = "odbcDebugFlag"; - cfg.ptr = &odbcdebugFlag; + cfg.ptr = &odbcDebugFlag; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT; cfg.minValue = 0; @@ -1125,7 +1122,7 @@ static void doInitGlobalConfig() { taosInitConfigOption(cfg); cfg.option = "qDebugFlag"; - cfg.ptr = &qdebugFlag; + cfg.ptr = &qDebugFlag; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT; cfg.minValue = 0; @@ -1201,6 +1198,10 @@ void taosInitGlobalCfg() { } bool taosCheckGlobalCfg() { + if (debugFlag == 135 || debugFlag == 199) { + taosSetAllDebugFlag(); + } + taosGetFqdn(tsLocalEp); sprintf(tsLocalEp + strlen(tsLocalEp), ":%d", tsServerPort); uPrint("localEp is %s", tsLocalEp); @@ -1244,10 +1245,8 @@ bool taosCheckGlobalCfg() { tsVersion = 10 * tsVersion; - tsMnodeShellPort = tsServerPort + TSDB_PORT_MNODESHELL; // udp[6030-6034] tcp[6030] tsDnodeShellPort = tsServerPort + TSDB_PORT_DNODESHELL; // udp[6035-6039] tcp[6035] - tsMnodeDnodePort = tsServerPort + TSDB_PORT_MNODEDNODE; // udp/tcp - tsDnodeMnodePort = tsServerPort + TSDB_PORT_DNODEMNODE; // udp/tcp + tsDnodeDnodePort = tsServerPort + TSDB_PORT_DNODEDNODE; // udp/tcp tsSyncPort = tsServerPort + TSDB_PORT_SYNC; return true; diff --git a/src/common/src/ttypes.c b/src/common/src/ttypes.c index 533f992151..626fde3293 100644 --- a/src/common/src/ttypes.c +++ b/src/common/src/ttypes.c @@ -92,9 +92,9 @@ bool isNull(const char *val, int32_t type) { case TSDB_DATA_TYPE_DOUBLE: return *(uint64_t *)val == TSDB_DATA_DOUBLE_NULL; case TSDB_DATA_TYPE_NCHAR: - return *(uint32_t *)val == TSDB_DATA_NCHAR_NULL; + return *(uint32_t*) varDataVal(val) == TSDB_DATA_NCHAR_NULL; case TSDB_DATA_TYPE_BINARY: - return *(uint8_t *)val == TSDB_DATA_BINARY_NULL; + return *(uint8_t *) varDataVal(val) == TSDB_DATA_BINARY_NULL; default: return false; }; diff --git a/src/connector/python/linux/python2/taos/cinterface.py b/src/connector/python/linux/python2/taos/cinterface.py index d9460efb21..76c0a4be9d 100644 --- a/src/connector/python/linux/python2/taos/cinterface.py +++ b/src/connector/python/linux/python2/taos/cinterface.py @@ -96,7 +96,8 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False): for i in range(abs(num_of_rows)): try: if num_of_rows >= 0: - res.append( (ctypes.cast(data+nbytes*(abs(num_of_rows - i -1)), ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) + tmpstr = ctypes.c_char_p(data) + res.append( tmpstr.value.decode() ) else: res.append( (ctypes.cast(data+nbytes*i, ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) except ValueError: @@ -146,6 +147,7 @@ class CTaosInterface(object): libtaos.taos_errstr.restype = ctypes.c_char_p libtaos.taos_subscribe.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p + libtaos.taos_fetch_lengths.restype = ctypes.c_void_p def __init__(self, config=None): ''' @@ -314,6 +316,8 @@ class CTaosInterface(object): isMicro = (CTaosInterface.libtaos.taos_result_precision(result) == FieldType.C_TIMESTAMP_MICRO) blocks = [None] * len(fields) + fieldL = CTaosInterface.libtaos.taos_fetch_lengths(result) + fieldLen = [ele for ele in ctypes.cast(fieldL, ctypes.POINTER(ctypes.c_int))[:len(fields)]] for i in range(len(fields)): data = ctypes.cast(pblock, ctypes.POINTER(ctypes.c_void_p))[i] if data == None: @@ -323,7 +327,7 @@ class CTaosInterface(object): if fields[i]['type'] not in _CONVERT_FUNC: raise DatabaseError("Invalid data type returned from database") - blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fields[i]['bytes'], isMicro) + blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fieldLen[i], isMicro) return blocks, abs(num_of_rows) diff --git a/src/connector/python/linux/python3/taos/cinterface.py b/src/connector/python/linux/python3/taos/cinterface.py index 77001609b6..d516aad5a7 100644 --- a/src/connector/python/linux/python3/taos/cinterface.py +++ b/src/connector/python/linux/python3/taos/cinterface.py @@ -96,7 +96,8 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False): for i in range(abs(num_of_rows)): try: if num_of_rows >= 0: - res.append( (ctypes.cast(data+nbytes*(abs(num_of_rows - i -1)), ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) + tmpstr = ctypes.c_char_p(data) + res.append( tmpstr.value.decode() ) else: res.append( (ctypes.cast(data+nbytes*i, ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) except ValueError: @@ -146,6 +147,7 @@ class CTaosInterface(object): libtaos.taos_errstr.restype = ctypes.c_char_p libtaos.taos_subscribe.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p + libtaos.taos_fetch_lengths.restype = ctypes.c_void_p def __init__(self, config=None): ''' @@ -314,6 +316,8 @@ class CTaosInterface(object): isMicro = (CTaosInterface.libtaos.taos_result_precision(result) == FieldType.C_TIMESTAMP_MICRO) blocks = [None] * len(fields) + fieldL = CTaosInterface.libtaos.taos_fetch_lengths(result) + fieldLen = [ele for ele in ctypes.cast(fieldL, ctypes.POINTER(ctypes.c_int))[:len(fields)]] for i in range(len(fields)): data = ctypes.cast(pblock, ctypes.POINTER(ctypes.c_void_p))[i] if data == None: @@ -323,7 +327,7 @@ class CTaosInterface(object): if fields[i]['type'] not in _CONVERT_FUNC: raise DatabaseError("Invalid data type returned from database") - blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fields[i]['bytes'], isMicro) + blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fieldLen[i], isMicro) return blocks, abs(num_of_rows) diff --git a/src/connector/python/windows/python2/taos/cinterface.py b/src/connector/python/windows/python2/taos/cinterface.py index a18d372db2..c4b8fa8328 100644 --- a/src/connector/python/windows/python2/taos/cinterface.py +++ b/src/connector/python/windows/python2/taos/cinterface.py @@ -96,7 +96,8 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False): for i in range(abs(num_of_rows)): try: if num_of_rows >= 0: - res.append( (ctypes.cast(data+nbytes*(abs(num_of_rows - i -1)), ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) + tmpstr = ctypes.c_char_p(data) + res.append( tmpstr.value.decode() ) else: res.append( (ctypes.cast(data+nbytes*i, ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) except ValueError: @@ -146,6 +147,7 @@ class CTaosInterface(object): libtaos.taos_errstr.restype = ctypes.c_char_p libtaos.taos_subscribe.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p + libtaos.taos_fetch_lengths.restype = ctypes.c_void_p def __init__(self, config=None): ''' @@ -314,6 +316,8 @@ class CTaosInterface(object): isMicro = (CTaosInterface.libtaos.taos_result_precision(result) == FieldType.C_TIMESTAMP_MICRO) blocks = [None] * len(fields) + fieldL = CTaosInterface.libtaos.taos_fetch_lengths(result) + fieldLen = [ele for ele in ctypes.cast(fieldL, ctypes.POINTER(ctypes.c_int))[:len(fields)]] for i in range(len(fields)): data = ctypes.cast(pblock, ctypes.POINTER(ctypes.c_void_p))[i] if data == None: @@ -323,7 +327,7 @@ class CTaosInterface(object): if fields[i]['type'] not in _CONVERT_FUNC: raise DatabaseError("Invalid data type returned from database") - blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fields[i]['bytes'], isMicro) + blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fieldLen[i], isMicro) return blocks, abs(num_of_rows) diff --git a/src/connector/python/windows/python3/taos/cinterface.py b/src/connector/python/windows/python3/taos/cinterface.py index cbcf2d884e..d8c45f1171 100644 --- a/src/connector/python/windows/python3/taos/cinterface.py +++ b/src/connector/python/windows/python3/taos/cinterface.py @@ -96,7 +96,8 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False): for i in range(abs(num_of_rows)): try: if num_of_rows >= 0: - res.append( (ctypes.cast(data+nbytes*(abs(num_of_rows - i -1)), ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) + tmpstr = ctypes.c_char_p(data) + res.append( tmpstr.value.decode() ) else: res.append( (ctypes.cast(data+nbytes*i, ctypes.POINTER(ctypes.c_wchar * (nbytes//4))))[0].value ) except ValueError: @@ -146,6 +147,7 @@ class CTaosInterface(object): libtaos.taos_errstr.restype = ctypes.c_char_p libtaos.taos_subscribe.restype = ctypes.c_void_p libtaos.taos_consume.restype = ctypes.c_void_p + libtaos.taos_fetch_lengths.restype = ctypes.c_void_p def __init__(self, config=None): ''' @@ -314,6 +316,8 @@ class CTaosInterface(object): isMicro = (CTaosInterface.libtaos.taos_result_precision(result) == FieldType.C_TIMESTAMP_MICRO) blocks = [None] * len(fields) + fieldL = CTaosInterface.libtaos.taos_fetch_lengths(result) + fieldLen = [ele for ele in ctypes.cast(fieldL, ctypes.POINTER(ctypes.c_int))[:len(fields)]] for i in range(len(fields)): data = ctypes.cast(pblock, ctypes.POINTER(ctypes.c_void_p))[i] if data == None: @@ -323,7 +327,7 @@ class CTaosInterface(object): if fields[i]['type'] not in _CONVERT_FUNC: raise DatabaseError("Invalid data type returned from database") - blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fields[i]['bytes'], isMicro) + blocks[i] = _CONVERT_FUNC[fields[i]['type']](data, num_of_rows, fieldLen[i], isMicro) return blocks, abs(num_of_rows) diff --git a/src/cq/src/cqMain.c b/src/cq/src/cqMain.c index 62b9a41494..e4f3142b89 100644 --- a/src/cq/src/cqMain.c +++ b/src/cq/src/cqMain.c @@ -26,10 +26,10 @@ #include "tcq.h" #include "taos.h" -#define cError(...) if (cqDebugFlag & DEBUG_ERROR) {taosPrintLog("ERROR CQ ", cqDebugFlag, __VA_ARGS__);} -#define cWarn(...) if (cqDebugFlag & DEBUG_WARN) {taosPrintLog("WARN CQ ", cqDebugFlag, __VA_ARGS__);} -#define cTrace(...) if (cqDebugFlag & DEBUG_TRACE) {taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__);} -#define cPrint(...) {taosPrintLog("WAL ", 255, __VA_ARGS__);} +#define cError(...) if (cqDebugFlag & DEBUG_ERROR) {taosPrintLog("ERROR CQ ", cqDebugFlag, __VA_ARGS__);} +#define cWarn(...) if (cqDebugFlag & DEBUG_WARN) {taosPrintLog("WARN CQ ", cqDebugFlag, __VA_ARGS__);} +#define cTrace(...) if (cqDebugFlag & DEBUG_TRACE) {taosPrintLog("CQ ", cqDebugFlag, __VA_ARGS__);} +#define cPrint(...) {taosPrintLog("CQ ", 255, __VA_ARGS__);} typedef struct { int vgId; diff --git a/src/cq/test/cqtest.c b/src/cq/test/cqtest.c index f620f44382..7977bd85bc 100644 --- a/src/cq/test/cqtest.c +++ b/src/cq/test/cqtest.c @@ -33,13 +33,13 @@ int main(int argc, char *argv[]) { for (int i=1; i + * + * 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_DNODE_LOG_H +#define TDENGINE_DNODE_LOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "tlog.h" + +extern int32_t dDebugFlag; + +#define dError(...) if (dDebugFlag & DEBUG_ERROR) {taosPrintLog("ERROR DND ", 255, __VA_ARGS__); } +#define dWarn(...) if (dDebugFlag & DEBUG_WARN) {taosPrintLog("WARN DND ", dDebugFlag, __VA_ARGS__); } +#define dTrace(...) if (dDebugFlag & DEBUG_TRACE) {taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); } +#define dPrint(...) {taosPrintLog("DND ", 255, __VA_ARGS__); } + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/dnode/inc/dnodeLog.h b/src/dnode/inc/dnodeLog.h deleted file mode 100644 index 18a5874e44..0000000000 --- a/src/dnode/inc/dnodeLog.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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_DNODE_LOG_H -#define TDENGINE_DNODE_LOG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "tlog.h" - -extern int32_t ddebugFlag; - -#define dError(...) \ - if (ddebugFlag & DEBUG_ERROR) { \ - taosPrintLog("ERROR DND ", 255, __VA_ARGS__); \ - } -#define dWarn(...) \ - if (ddebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN DND ", ddebugFlag, __VA_ARGS__); \ - } -#define dTrace(...) \ - if (ddebugFlag & DEBUG_TRACE) { \ - taosPrintLog("DND ", ddebugFlag, __VA_ARGS__); \ - } -#define dPrint(...) \ - { taosPrintLog("DND ", 255, __VA_ARGS__); } - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/dnode/inc/dnodeMgmt.h b/src/dnode/inc/dnodeMgmt.h index b8d01916fe..6f2af423bc 100644 --- a/src/dnode/inc/dnodeMgmt.h +++ b/src/dnode/inc/dnodeMgmt.h @@ -22,7 +22,7 @@ extern "C" { int32_t dnodeInitMgmt(); void dnodeCleanupMgmt(); -void dnodeMgmt(SRpcMsg *rpcMsg); +void dnodeDispatchToDnodeMgmt(SRpcMsg *rpcMsg); void* dnodeGetVnode(int32_t vgId); int32_t dnodeGetVnodeStatus(void *pVnode); diff --git a/src/dnode/inc/dnodeMClient.h b/src/dnode/inc/dnodePeer.h similarity index 80% rename from src/dnode/inc/dnodeMClient.h rename to src/dnode/inc/dnodePeer.h index 6d413ada88..2ce8d80c0f 100644 --- a/src/dnode/inc/dnodeMClient.h +++ b/src/dnode/inc/dnodePeer.h @@ -13,16 +13,17 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_DNODE_MCLIENT_H -#define TDENGINE_DNODE_MCLIENT_H +#ifndef TDENGINE_DNODE_DNODE_H +#define TDENGINE_DNODE_DNODE_H #ifdef __cplusplus extern "C" { #endif -int32_t dnodeInitMClient(); -void dnodeCleanupMClient(); -void dnodeSendMsgToMnode(SRpcMsg *rpcMsg); +int32_t dnodeInitServer(); +void dnodeCleanupServer(); +int32_t dnodeInitClient(); +void dnodeCleanupClient(); #ifdef __cplusplus } diff --git a/src/dnode/inc/dnodeRead.h b/src/dnode/inc/dnodeVRead.h similarity index 93% rename from src/dnode/inc/dnodeRead.h rename to src/dnode/inc/dnodeVRead.h index 0d521b6bb5..9e0c7b3120 100644 --- a/src/dnode/inc/dnodeRead.h +++ b/src/dnode/inc/dnodeVRead.h @@ -22,7 +22,7 @@ extern "C" { int32_t dnodeInitRead(); void dnodeCleanupRead(); -void dnodeRead(SRpcMsg *pMsg); +void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg); #ifdef __cplusplus } diff --git a/src/dnode/inc/dnodeWrite.h b/src/dnode/inc/dnodeVWrite.h similarity index 94% rename from src/dnode/inc/dnodeWrite.h rename to src/dnode/inc/dnodeVWrite.h index 028eaa95c2..461e51983f 100644 --- a/src/dnode/inc/dnodeWrite.h +++ b/src/dnode/inc/dnodeVWrite.h @@ -22,7 +22,7 @@ extern "C" { int32_t dnodeInitWrite(); void dnodeCleanupWrite(); -void dnodeWrite(SRpcMsg *pMsg); +void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg); void dnodeSendWriteResponse(void *pVnode, void *param, int32_t code); #ifdef __cplusplus diff --git a/src/dnode/src/dnodeMClient.c b/src/dnode/src/dnodeMClient.c deleted file mode 100644 index 3aa863799b..0000000000 --- a/src/dnode/src/dnodeMClient.c +++ /dev/null @@ -1,468 +0,0 @@ -/* - * 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 "os.h" -#include "cJSON.h" -#include "taosmsg.h" -#include "trpc.h" -#include "tutil.h" -#include "tsync.h" -#include "ttime.h" -#include "ttimer.h" -#include "tbalance.h" -#include "tglobal.h" -#include "vnode.h" -#include "mnode.h" -#include "dnode.h" -#include "dnodeLog.h" -#include "dnodeMClient.h" -#include "dnodeModule.h" -#include "dnodeMgmt.h" - -#define MPEER_CONTENT_LEN 2000 - -static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes); -static bool dnodeReadMnodeInfos(); -static void dnodeSaveMnodeInfos(); -static void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg); -static bool dnodeReadDnodeCfg(); -static void dnodeSaveDnodeCfg(); -static void dnodeProcessRspFromMnode(SRpcMsg *pMsg); -static void dnodeProcessStatusRsp(SRpcMsg *pMsg); -static void dnodeSendStatusMsg(void *handle, void *tmrId); -static void (*tsDnodeProcessMgmtRspFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); - -static void *tsDnodeMClientRpc = NULL; -static void *tsDnodeTmr = NULL; -static void *tsStatusTimer = NULL; -static uint32_t tsRebootTime; - -static SRpcIpSet tsMnodeIpSet = {0}; -static SDMMnodeInfos tsMnodeInfos = {0}; -static SDMDnodeCfg tsDnodeCfg = {0}; - -void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) { - dTrace("mgmt IP list is changed for ufp is called"); - tsMnodeIpSet = *pIpSet; -} - -void dnodeGetMnodeDnodeIpSet(void *ipSetRaw) { - SRpcIpSet *ipSet = ipSetRaw; - ipSet->numOfIps = tsMnodeInfos.nodeNum; - ipSet->inUse = tsMnodeInfos.inUse; - for (int32_t i = 0; i < tsMnodeInfos.nodeNum; ++i) { - taosGetFqdnPortFromEp(tsMnodeInfos.nodeInfos[i].nodeEp, ipSet->fqdn[i], &ipSet->port[i]); - ipSet->port[i] += TSDB_PORT_MNODEDNODE; - } -} - -int32_t dnodeInitMClient() { - dnodeReadDnodeCfg(); - tsRebootTime = taosGetTimestampSec(); - - tsDnodeTmr = taosTmrInit(100, 200, 60000, "DND-DM"); - if (tsDnodeTmr == NULL) { - dError("failed to init dnode timer"); - return -1; - } - - if (!dnodeReadMnodeInfos()) { - memset(&tsMnodeIpSet, 0, sizeof(SRpcIpSet)); - memset(&tsMnodeInfos, 0, sizeof(SDMMnodeInfos)); - tsMnodeIpSet.numOfIps = 1; - taosGetFqdnPortFromEp(tsFirst, tsMnodeIpSet.fqdn[0], &tsMnodeIpSet.port[0]); - tsMnodeIpSet.port[0] += TSDB_PORT_MNODEDNODE; - if (strcmp(tsSecond, tsFirst) != 0) { - tsMnodeIpSet.numOfIps = 2; - taosGetFqdnPortFromEp(tsSecond, tsMnodeIpSet.fqdn[1], &tsMnodeIpSet.port[1]); - tsMnodeIpSet.port[1] += TSDB_PORT_MNODEDNODE; - } - } else { - tsMnodeIpSet.inUse = tsMnodeInfos.inUse; - tsMnodeIpSet.numOfIps = tsMnodeInfos.nodeNum; - for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { - taosGetFqdnPortFromEp(tsMnodeInfos.nodeInfos[i].nodeEp, tsMnodeIpSet.fqdn[i], &tsMnodeIpSet.port[i]); - tsMnodeIpSet.port[i] += TSDB_PORT_MNODEDNODE; - } - } - - SRpcInit rpcInit; - memset(&rpcInit, 0, sizeof(rpcInit)); - rpcInit.label = "DND-MC"; - rpcInit.numOfThreads = 1; - rpcInit.cfp = dnodeProcessRspFromMnode; - rpcInit.ufp = dnodeUpdateIpSet; - rpcInit.sessions = 100; - rpcInit.connType = TAOS_CONN_CLIENT; - rpcInit.idleTime = tsShellActivityTimer * 2000; - rpcInit.user = "t"; - rpcInit.ckey = "key"; - rpcInit.secret = "secret"; - - tsDnodeMClientRpc = rpcOpen(&rpcInit); - if (tsDnodeMClientRpc == NULL) { - dError("failed to init mnode rpc client"); - return -1; - } - - tsDnodeProcessMgmtRspFp[TSDB_MSG_TYPE_DM_STATUS_RSP] = dnodeProcessStatusRsp; - taosTmrReset(dnodeSendStatusMsg, 500, NULL, tsDnodeTmr, &tsStatusTimer); - - dPrint("mnode rpc client is opened"); - return 0; -} - -void dnodeCleanupMClient() { - if (tsStatusTimer != NULL) { - taosTmrStopA(&tsStatusTimer); - tsStatusTimer = NULL; - } - - if (tsDnodeTmr != NULL) { - taosTmrCleanUp(tsDnodeTmr); - tsDnodeTmr = NULL; - } - - if (tsDnodeMClientRpc) { - rpcClose(tsDnodeMClientRpc); - tsDnodeMClientRpc = NULL; - dPrint("mnode rpc client is closed"); - } -} - -static void dnodeProcessRspFromMnode(SRpcMsg *pMsg) { - if (tsDnodeProcessMgmtRspFp[pMsg->msgType]) { - (*tsDnodeProcessMgmtRspFp[pMsg->msgType])(pMsg); - } else { - dError("%s is not processed in dnode mclient", taosMsg[pMsg->msgType]); - SRpcMsg rpcRsp = {.pCont = 0, .contLen = 0, .code = TSDB_CODE_OPS_NOT_SUPPORT, .handle = pMsg->handle}; - rpcSendResponse(&rpcRsp); - } - - rpcFreeCont(pMsg->pCont); -} - -static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { - if (pMsg->code != TSDB_CODE_SUCCESS) { - dError("status rsp is received, error:%s", tstrerror(pMsg->code)); - taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); - return; - } - - SDMStatusRsp *pStatusRsp = pMsg->pCont; - SDMMnodeInfos *pMnodes = &pStatusRsp->mnodes; - if (pMnodes->nodeNum <= 0) { - dError("status msg is invalid, num of ips is %d", pMnodes->nodeNum); - taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); - return; - } - - SDMDnodeCfg *pCfg = &pStatusRsp->dnodeCfg; - pCfg->numOfVnodes = htonl(pCfg->numOfVnodes); - pCfg->moduleStatus = htonl(pCfg->moduleStatus); - pCfg->dnodeId = htonl(pCfg->dnodeId); - - for (int32_t i = 0; i < pMnodes->nodeNum; ++i) { - SDMMnodeInfo *pMnodeInfo = &pMnodes->nodeInfos[i]; - pMnodeInfo->nodeId = htonl(pMnodeInfo->nodeId); - } - - SDMVgroupAccess *pVgAcccess = pStatusRsp->vgAccess; - for (int32_t i = 0; i < pCfg->numOfVnodes; ++i) { - pVgAcccess[i].vgId = htonl(pVgAcccess[i].vgId); - } - - dnodeProcessModuleStatus(pCfg->moduleStatus); - dnodeUpdateDnodeCfg(pCfg); - dnodeUpdateMnodeInfos(pMnodes); - taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); -} - -static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) { - bool mnodesChanged = (memcmp(&tsMnodeInfos, pMnodes, sizeof(SDMMnodeInfos)) != 0); - bool mnodesNotInit = (tsMnodeInfos.nodeNum == 0); - if (!(mnodesChanged || mnodesNotInit)) return; - - memcpy(&tsMnodeInfos, pMnodes, sizeof(SDMMnodeInfos)); - - tsMnodeIpSet.inUse = tsMnodeInfos.inUse; - tsMnodeIpSet.numOfIps = tsMnodeInfos.nodeNum; - for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { - taosGetFqdnPortFromEp(tsMnodeInfos.nodeInfos[i].nodeEp, tsMnodeIpSet.fqdn[i], &tsMnodeIpSet.port[i]); - tsMnodeIpSet.port[i] += TSDB_PORT_MNODEDNODE; - } - - dPrint("mnodes is changed, nodeNum:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); - for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { - dPrint("mnode:%d, %s", tsMnodeInfos.nodeInfos[i].nodeId, tsMnodeInfos.nodeInfos[i].nodeEp); - } - - dnodeSaveMnodeInfos(); - sdbUpdateSync(); -} - -void dnodeSendMsgToMnode(SRpcMsg *rpcMsg) { - if (tsDnodeMClientRpc) { - rpcSendRequest(tsDnodeMClientRpc, &tsMnodeIpSet, rpcMsg); - } -} - -static bool dnodeReadMnodeInfos() { - char ipFile[TSDB_FILENAME_LEN] = {0}; - sprintf(ipFile, "%s/mgmtIpList.json", tsDnodeDir); - FILE *fp = fopen(ipFile, "r"); - if (!fp) { - dTrace("failed to read mnode mgmtIpList.json, file not exist"); - return false; - } - - bool ret = false; - int maxLen = 2000; - char *content = calloc(1, maxLen + 1); - int len = fread(content, 1, maxLen, fp); - if (len <= 0) { - free(content); - fclose(fp); - dError("failed to read mnode mgmtIpList.json, content is null"); - return false; - } - - cJSON* root = cJSON_Parse(content); - if (root == NULL) { - dError("failed to read mnode mgmtIpList.json, invalid json format"); - goto PARSE_OVER; - } - - cJSON* inUse = cJSON_GetObjectItem(root, "inUse"); - if (!inUse || inUse->type != cJSON_Number) { - dError("failed to read mnode mgmtIpList.json, inUse not found"); - goto PARSE_OVER; - } - tsMnodeInfos.inUse = inUse->valueint; - - cJSON* nodeNum = cJSON_GetObjectItem(root, "nodeNum"); - if (!nodeNum || nodeNum->type != cJSON_Number) { - dError("failed to read mnode mgmtIpList.json, nodeNum not found"); - goto PARSE_OVER; - } - tsMnodeInfos.nodeNum = nodeNum->valueint; - - cJSON* nodeInfos = cJSON_GetObjectItem(root, "nodeInfos"); - if (!nodeInfos || nodeInfos->type != cJSON_Array) { - dError("failed to read mnode mgmtIpList.json, nodeInfos not found"); - goto PARSE_OVER; - } - - int size = cJSON_GetArraySize(nodeInfos); - if (size != tsMnodeInfos.nodeNum) { - dError("failed to read mnode mgmtIpList.json, nodeInfos size not matched"); - goto PARSE_OVER; - } - - for (int i = 0; i < size; ++i) { - cJSON* nodeInfo = cJSON_GetArrayItem(nodeInfos, i); - if (nodeInfo == NULL) continue; - - cJSON *nodeId = cJSON_GetObjectItem(nodeInfo, "nodeId"); - if (!nodeId || nodeId->type != cJSON_Number) { - dError("failed to read mnode mgmtIpList.json, nodeId not found"); - goto PARSE_OVER; - } - tsMnodeInfos.nodeInfos[i].nodeId = nodeId->valueint; - - cJSON *nodeEp = cJSON_GetObjectItem(nodeInfo, "nodeEp"); - if (!nodeEp || nodeEp->type != cJSON_String || nodeEp->valuestring == NULL) { - dError("failed to read mnode mgmtIpList.json, nodeName not found"); - goto PARSE_OVER; - } - strncpy(tsMnodeInfos.nodeInfos[i].nodeEp, nodeEp->valuestring, TSDB_FQDN_LEN); - } - - ret = true; - - dPrint("read mnode iplist successed, numOfIps:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); - for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { - dPrint("mnode:%d, %s", tsMnodeInfos.nodeInfos[i].nodeId, tsMnodeInfos.nodeInfos[i].nodeEp); - } - -PARSE_OVER: - free(content); - cJSON_Delete(root); - fclose(fp); - return ret; -} - -static void dnodeSaveMnodeInfos() { - char ipFile[TSDB_FILENAME_LEN] = {0}; - sprintf(ipFile, "%s/mgmtIpList.json", tsDnodeDir); - FILE *fp = fopen(ipFile, "w"); - if (!fp) return; - - int32_t len = 0; - int32_t maxLen = 2000; - char * content = calloc(1, maxLen + 1); - - len += snprintf(content + len, maxLen - len, "{\n"); - len += snprintf(content + len, maxLen - len, " \"inUse\": %d,\n", tsMnodeInfos.inUse); - len += snprintf(content + len, maxLen - len, " \"nodeNum\": %d,\n", tsMnodeInfos.nodeNum); - len += snprintf(content + len, maxLen - len, " \"nodeInfos\": [{\n"); - for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { - len += snprintf(content + len, maxLen - len, " \"nodeId\": %d,\n", tsMnodeInfos.nodeInfos[i].nodeId); - len += snprintf(content + len, maxLen - len, " \"nodeEp\": \"%s\"\n", tsMnodeInfos.nodeInfos[i].nodeEp); - if (i < tsMnodeInfos.nodeNum -1) { - len += snprintf(content + len, maxLen - len, " },{\n"); - } else { - len += snprintf(content + len, maxLen - len, " }]\n"); - } - } - len += snprintf(content + len, maxLen - len, "}\n"); - - fwrite(content, 1, len, fp); - fclose(fp); - free(content); - - dPrint("save mnode iplist successed"); -} - -char *dnodeGetMnodeMasterEp() { - return tsMnodeInfos.nodeInfos[tsMnodeIpSet.inUse].nodeEp; -} - -void* dnodeGetMnodeInfos() { - return &tsMnodeInfos; -} - -static void dnodeSendStatusMsg(void *handle, void *tmrId) { - if (tsDnodeTmr == NULL) { - dError("dnode timer is already released"); - return; - } - - if (tsStatusTimer == NULL) { - taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); - dError("failed to start status timer"); - return; - } - - int32_t contLen = sizeof(SDMStatusMsg) + TSDB_MAX_VNODES * sizeof(SVnodeLoad); - SDMStatusMsg *pStatus = rpcMallocCont(contLen); - if (pStatus == NULL) { - taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); - dError("failed to malloc status message"); - return; - } - - //strcpy(pStatus->dnodeName, tsDnodeName); - pStatus->version = htonl(tsVersion); - pStatus->dnodeId = htonl(tsDnodeCfg.dnodeId); - strcpy(pStatus->dnodeEp, tsLocalEp); - pStatus->lastReboot = htonl(tsRebootTime); - pStatus->numOfTotalVnodes = htons((uint16_t) tsNumOfTotalVnodes); - pStatus->numOfCores = htons((uint16_t) tsNumOfCores); - pStatus->diskAvailable = tsAvailDataDirGB; - pStatus->alternativeRole = (uint8_t) tsAlternativeRole; - - vnodeBuildStatusMsg(pStatus); - contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad); - pStatus->openVnodes = htons(pStatus->openVnodes); - - SRpcMsg rpcMsg = { - .pCont = pStatus, - .contLen = contLen, - .msgType = TSDB_MSG_TYPE_DM_STATUS - }; - - dnodeSendMsgToMnode(&rpcMsg); -} - -static bool dnodeReadDnodeCfg() { - char dnodeCfgFile[TSDB_FILENAME_LEN] = {0}; - sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir); - - FILE *fp = fopen(dnodeCfgFile, "r"); - if (!fp) { - dTrace("failed to read dnodeCfg.json, file not exist"); - return false; - } - - bool ret = false; - int maxLen = 100; - char *content = calloc(1, maxLen + 1); - int len = fread(content, 1, maxLen, fp); - if (len <= 0) { - free(content); - fclose(fp); - dError("failed to read dnodeCfg.json, content is null"); - return false; - } - - cJSON* root = cJSON_Parse(content); - if (root == NULL) { - dError("failed to read dnodeCfg.json, invalid json format"); - goto PARSE_CFG_OVER; - } - - cJSON* dnodeId = cJSON_GetObjectItem(root, "dnodeId"); - if (!dnodeId || dnodeId->type != cJSON_Number) { - dError("failed to read dnodeCfg.json, dnodeId not found"); - goto PARSE_CFG_OVER; - } - tsDnodeCfg.dnodeId = dnodeId->valueint; - - ret = true; - - dPrint("read numOfVnodes successed, dnodeId:%d", tsDnodeCfg.dnodeId); - -PARSE_CFG_OVER: - free(content); - cJSON_Delete(root); - fclose(fp); - return ret; -} - -static void dnodeSaveDnodeCfg() { - char dnodeCfgFile[TSDB_FILENAME_LEN] = {0}; - sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir); - - FILE *fp = fopen(dnodeCfgFile, "w"); - if (!fp) return; - - int32_t len = 0; - int32_t maxLen = 100; - char * content = calloc(1, maxLen + 1); - - len += snprintf(content + len, maxLen - len, "{\n"); - len += snprintf(content + len, maxLen - len, " \"dnodeId\": %d\n", tsDnodeCfg.dnodeId); - len += snprintf(content + len, maxLen - len, "}\n"); - - fwrite(content, 1, len, fp); - fclose(fp); - free(content); - - dPrint("save dnodeId successed"); -} - -void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg) { - if (tsDnodeCfg.dnodeId == 0) { - dPrint("dnodeId is set to %d", pCfg->dnodeId); - tsDnodeCfg.dnodeId = pCfg->dnodeId; - dnodeSaveDnodeCfg(); - } -} - -int32_t dnodeGetDnodeId() { - return tsDnodeCfg.dnodeId; -} diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 940b884927..dc5f7d192f 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -22,14 +22,13 @@ #include "tconfig.h" #include "tglobal.h" #include "dnode.h" -#include "dnodeLog.h" -#include "dnodeMClient.h" +#include "dnodeInt.h" #include "dnodeMgmt.h" -#include "dnodeMnode.h" +#include "dnodePeer.h" #include "dnodeModule.h" -#include "dnodeRead.h" +#include "dnodeVRead.h" #include "dnodeShell.h" -#include "dnodeWrite.h" +#include "dnodeVWrite.h" #include "tgrant.h" static int32_t dnodeInitSystem(); @@ -167,10 +166,10 @@ static int32_t dnodeInitSystem() { if (dnodeInitStorage() != 0) return -1; if (dnodeInitRead() != 0) return -1; if (dnodeInitWrite() != 0) return -1; - if (dnodeInitMClient() != 0) return -1; - if (dnodeInitModules() != 0) return -1; - if (dnodeInitMnode() != 0) return -1; + if (dnodeInitClient() != 0) return -1; + if (dnodeInitServer() != 0) return -1; if (dnodeInitMgmt() != 0) return -1; + if (dnodeInitModules() != 0) return -1; if (dnodeInitShell() != 0) return -1; dnodeStartModules(); @@ -185,14 +184,14 @@ static void dnodeCleanUpSystem() { if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_STOPPED) { dnodeSetRunStatus(TSDB_DNODE_RUN_STATUS_STOPPED); dnodeCleanupShell(); - dnodeCleanupMnode(); + dnodeCleanUpModules(); dnodeCleanupMgmt(); - dnodeCleanupMClient(); + dnodeCleanupServer(); + dnodeCleanupClient(); dnodeCleanupWrite(); dnodeCleanupRead(); - dnodeCleanUpModules(); - taos_cleanup(); dnodeCleanupStorage(); + taos_cleanup(); taosCloseLog(); } } diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index fbf1ceea71..62d22573ff 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -15,19 +15,47 @@ #define _DEFAULT_SOURCE #include "os.h" +#include "cJSON.h" #include "ihash.h" #include "taoserror.h" #include "taosmsg.h" +#include "ttime.h" +#include "ttimer.h" #include "trpc.h" #include "tsdb.h" #include "twal.h" -#include "vnode.h" +#include "tsync.h" +#include "ttime.h" +#include "ttimer.h" +#include "tbalance.h" #include "tglobal.h" -#include "dnodeLog.h" -#include "dnodeMClient.h" +#include "dnode.h" +#include "vnode.h" +#include "mnode.h" +#include "dnodeInt.h" #include "dnodeMgmt.h" -#include "dnodeRead.h" -#include "dnodeWrite.h" +#include "dnodeVRead.h" +#include "dnodeVWrite.h" +#include "dnodeModule.h" + +#define MPEER_CONTENT_LEN 2000 + +static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes); +static bool dnodeReadMnodeInfos(); +static void dnodeSaveMnodeInfos(); +static void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg); +static bool dnodeReadDnodeCfg(); +static void dnodeSaveDnodeCfg(); +static void dnodeProcessStatusRsp(SRpcMsg *pMsg); +static void dnodeSendStatusMsg(void *handle, void *tmrId); + +static void *tsDnodeTmr = NULL; +static void *tsStatusTimer = NULL; +static uint32_t tsRebootTime; + +static SRpcIpSet tsMnodeIpSet = {0}; +static SDMMnodeInfos tsMnodeInfos = {0}; +static SDMDnodeCfg tsDnodeCfg = {0}; static int32_t dnodeOpenVnodes(); static void dnodeCloseVnodes(); @@ -43,19 +71,63 @@ int32_t dnodeInitMgmt() { dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_STREAM] = dnodeProcessAlterStreamMsg; dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CONFIG_DNODE] = dnodeProcessConfigDnodeMsg; + dnodeAddClientRspHandle(TSDB_MSG_TYPE_DM_STATUS_RSP, dnodeProcessStatusRsp); + dnodeReadDnodeCfg(); + tsRebootTime = taosGetTimestampSec(); + + tsDnodeTmr = taosTmrInit(100, 200, 60000, "DND-DM"); + if (tsDnodeTmr == NULL) { + dError("failed to init dnode timer"); + return -1; + } + + if (!dnodeReadMnodeInfos()) { + memset(&tsMnodeIpSet, 0, sizeof(SRpcIpSet)); + memset(&tsMnodeInfos, 0, sizeof(SDMMnodeInfos)); + tsMnodeIpSet.numOfIps = 1; + taosGetFqdnPortFromEp(tsFirst, tsMnodeIpSet.fqdn[0], &tsMnodeIpSet.port[0]); + tsMnodeIpSet.port[0] += TSDB_PORT_DNODEDNODE; + if (strcmp(tsSecond, tsFirst) != 0) { + tsMnodeIpSet.numOfIps = 2; + taosGetFqdnPortFromEp(tsSecond, tsMnodeIpSet.fqdn[1], &tsMnodeIpSet.port[1]); + tsMnodeIpSet.port[1] += TSDB_PORT_DNODEDNODE; + } + } else { + tsMnodeIpSet.inUse = tsMnodeInfos.inUse; + tsMnodeIpSet.numOfIps = tsMnodeInfos.nodeNum; + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { + taosGetFqdnPortFromEp(tsMnodeInfos.nodeInfos[i].nodeEp, tsMnodeIpSet.fqdn[i], &tsMnodeIpSet.port[i]); + tsMnodeIpSet.port[i] += TSDB_PORT_DNODEDNODE; + } + } + int32_t code = dnodeOpenVnodes(); if (code != TSDB_CODE_SUCCESS) { return -1; } + taosTmrReset(dnodeSendStatusMsg, 500, NULL, tsDnodeTmr, &tsStatusTimer); + + dPrint("dnode mgmt is initialized"); + return TSDB_CODE_SUCCESS; } void dnodeCleanupMgmt() { + if (tsStatusTimer != NULL) { + taosTmrStopA(&tsStatusTimer); + tsStatusTimer = NULL; + } + + if (tsDnodeTmr != NULL) { + taosTmrCleanUp(tsDnodeTmr); + tsDnodeTmr = NULL; + } + dnodeCloseVnodes(); } -void dnodeMgmt(SRpcMsg *pMsg) { +void dnodeDispatchToDnodeMgmt(SRpcMsg *pMsg) { SRpcMsg rsp; if (dnodeProcessMgmtMsgFp[pMsg->msgType]) { @@ -116,7 +188,7 @@ static int32_t dnodeOpenVnodes() { free(vnodeList); - dPrint("there are total vnodes:%d, failed to open:%d", numOfVnodes, failed); + dPrint("there are total vnodes:%d, openned:%d failed:%d", numOfVnodes, numOfVnodes-failed, failed); return TSDB_CODE_SUCCESS; } @@ -193,3 +265,326 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) { SMDCfgDnodeMsg *pCfg = (SMDCfgDnodeMsg *)pMsg->pCont; return taosCfgDynamicOptions(pCfg->config); } + + +void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) { + dTrace("mgmt IP list is changed for ufp is called"); + tsMnodeIpSet = *pIpSet; +} + +void dnodeGetMnodeDnodeIpSet(void *ipSetRaw) { + SRpcIpSet *ipSet = ipSetRaw; + ipSet->numOfIps = tsMnodeInfos.nodeNum; + ipSet->inUse = tsMnodeInfos.inUse; + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; ++i) { + taosGetFqdnPortFromEp(tsMnodeInfos.nodeInfos[i].nodeEp, ipSet->fqdn[i], &ipSet->port[i]); + ipSet->port[i] += TSDB_PORT_DNODEDNODE; + } +} + +static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { + if (pMsg->code != TSDB_CODE_SUCCESS) { + dError("status rsp is received, error:%s", tstrerror(pMsg->code)); + taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); + return; + } + + SDMStatusRsp *pStatusRsp = pMsg->pCont; + SDMMnodeInfos *pMnodes = &pStatusRsp->mnodes; + if (pMnodes->nodeNum <= 0) { + dError("status msg is invalid, num of ips is %d", pMnodes->nodeNum); + taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); + return; + } + + SDMDnodeCfg *pCfg = &pStatusRsp->dnodeCfg; + pCfg->numOfVnodes = htonl(pCfg->numOfVnodes); + pCfg->moduleStatus = htonl(pCfg->moduleStatus); + pCfg->dnodeId = htonl(pCfg->dnodeId); + + for (int32_t i = 0; i < pMnodes->nodeNum; ++i) { + SDMMnodeInfo *pMnodeInfo = &pMnodes->nodeInfos[i]; + pMnodeInfo->nodeId = htonl(pMnodeInfo->nodeId); + } + + SDMVgroupAccess *pVgAcccess = pStatusRsp->vgAccess; + for (int32_t i = 0; i < pCfg->numOfVnodes; ++i) { + pVgAcccess[i].vgId = htonl(pVgAcccess[i].vgId); + } + + dnodeProcessModuleStatus(pCfg->moduleStatus); + dnodeUpdateDnodeCfg(pCfg); + dnodeUpdateMnodeInfos(pMnodes); + taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); +} + +static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) { + bool mnodesChanged = (memcmp(&tsMnodeInfos, pMnodes, sizeof(SDMMnodeInfos)) != 0); + bool mnodesNotInit = (tsMnodeInfos.nodeNum == 0); + if (!(mnodesChanged || mnodesNotInit)) return; + + memcpy(&tsMnodeInfos, pMnodes, sizeof(SDMMnodeInfos)); + + tsMnodeIpSet.inUse = tsMnodeInfos.inUse; + tsMnodeIpSet.numOfIps = tsMnodeInfos.nodeNum; + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { + taosGetFqdnPortFromEp(tsMnodeInfos.nodeInfos[i].nodeEp, tsMnodeIpSet.fqdn[i], &tsMnodeIpSet.port[i]); + tsMnodeIpSet.port[i] += TSDB_PORT_DNODEDNODE; + } + + dPrint("mnodes is changed, nodeNum:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { + dPrint("mnode:%d, %s", tsMnodeInfos.nodeInfos[i].nodeId, tsMnodeInfos.nodeInfos[i].nodeEp); + } + + dnodeSaveMnodeInfos(); + sdbUpdateSync(); +} + +static bool dnodeReadMnodeInfos() { + char ipFile[TSDB_FILENAME_LEN] = {0}; + sprintf(ipFile, "%s/mgmtIpList.json", tsDnodeDir); + FILE *fp = fopen(ipFile, "r"); + if (!fp) { + dTrace("failed to read mnode mgmtIpList.json, file not exist"); + return false; + } + + bool ret = false; + int maxLen = 2000; + char *content = calloc(1, maxLen + 1); + int len = fread(content, 1, maxLen, fp); + if (len <= 0) { + free(content); + fclose(fp); + dError("failed to read mnode mgmtIpList.json, content is null"); + return false; + } + + cJSON* root = cJSON_Parse(content); + if (root == NULL) { + dError("failed to read mnode mgmtIpList.json, invalid json format"); + goto PARSE_OVER; + } + + cJSON* inUse = cJSON_GetObjectItem(root, "inUse"); + if (!inUse || inUse->type != cJSON_Number) { + dError("failed to read mnode mgmtIpList.json, inUse not found"); + goto PARSE_OVER; + } + tsMnodeInfos.inUse = inUse->valueint; + + cJSON* nodeNum = cJSON_GetObjectItem(root, "nodeNum"); + if (!nodeNum || nodeNum->type != cJSON_Number) { + dError("failed to read mnode mgmtIpList.json, nodeNum not found"); + goto PARSE_OVER; + } + tsMnodeInfos.nodeNum = nodeNum->valueint; + + cJSON* nodeInfos = cJSON_GetObjectItem(root, "nodeInfos"); + if (!nodeInfos || nodeInfos->type != cJSON_Array) { + dError("failed to read mnode mgmtIpList.json, nodeInfos not found"); + goto PARSE_OVER; + } + + int size = cJSON_GetArraySize(nodeInfos); + if (size != tsMnodeInfos.nodeNum) { + dError("failed to read mnode mgmtIpList.json, nodeInfos size not matched"); + goto PARSE_OVER; + } + + for (int i = 0; i < size; ++i) { + cJSON* nodeInfo = cJSON_GetArrayItem(nodeInfos, i); + if (nodeInfo == NULL) continue; + + cJSON *nodeId = cJSON_GetObjectItem(nodeInfo, "nodeId"); + if (!nodeId || nodeId->type != cJSON_Number) { + dError("failed to read mnode mgmtIpList.json, nodeId not found"); + goto PARSE_OVER; + } + tsMnodeInfos.nodeInfos[i].nodeId = nodeId->valueint; + + cJSON *nodeEp = cJSON_GetObjectItem(nodeInfo, "nodeEp"); + if (!nodeEp || nodeEp->type != cJSON_String || nodeEp->valuestring == NULL) { + dError("failed to read mnode mgmtIpList.json, nodeName not found"); + goto PARSE_OVER; + } + strncpy(tsMnodeInfos.nodeInfos[i].nodeEp, nodeEp->valuestring, TSDB_FQDN_LEN); + } + + ret = true; + + dPrint("read mnode iplist successed, numOfIps:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { + dPrint("mnode:%d, %s", tsMnodeInfos.nodeInfos[i].nodeId, tsMnodeInfos.nodeInfos[i].nodeEp); + } + +PARSE_OVER: + free(content); + cJSON_Delete(root); + fclose(fp); + return ret; +} + +static void dnodeSaveMnodeInfos() { + char ipFile[TSDB_FILENAME_LEN] = {0}; + sprintf(ipFile, "%s/mgmtIpList.json", tsDnodeDir); + FILE *fp = fopen(ipFile, "w"); + if (!fp) return; + + int32_t len = 0; + int32_t maxLen = 2000; + char * content = calloc(1, maxLen + 1); + + len += snprintf(content + len, maxLen - len, "{\n"); + len += snprintf(content + len, maxLen - len, " \"inUse\": %d,\n", tsMnodeInfos.inUse); + len += snprintf(content + len, maxLen - len, " \"nodeNum\": %d,\n", tsMnodeInfos.nodeNum); + len += snprintf(content + len, maxLen - len, " \"nodeInfos\": [{\n"); + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { + len += snprintf(content + len, maxLen - len, " \"nodeId\": %d,\n", tsMnodeInfos.nodeInfos[i].nodeId); + len += snprintf(content + len, maxLen - len, " \"nodeEp\": \"%s\"\n", tsMnodeInfos.nodeInfos[i].nodeEp); + if (i < tsMnodeInfos.nodeNum -1) { + len += snprintf(content + len, maxLen - len, " },{\n"); + } else { + len += snprintf(content + len, maxLen - len, " }]\n"); + } + } + len += snprintf(content + len, maxLen - len, "}\n"); + + fwrite(content, 1, len, fp); + fclose(fp); + free(content); + + dPrint("save mnode iplist successed"); +} + +char *dnodeGetMnodeMasterEp() { + return tsMnodeInfos.nodeInfos[tsMnodeIpSet.inUse].nodeEp; +} + +void* dnodeGetMnodeInfos() { + return &tsMnodeInfos; +} + +static void dnodeSendStatusMsg(void *handle, void *tmrId) { + if (tsDnodeTmr == NULL) { + dError("dnode timer is already released"); + return; + } + + if (tsStatusTimer == NULL) { + taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); + dError("failed to start status timer"); + return; + } + + int32_t contLen = sizeof(SDMStatusMsg) + TSDB_MAX_VNODES * sizeof(SVnodeLoad); + SDMStatusMsg *pStatus = rpcMallocCont(contLen); + if (pStatus == NULL) { + taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); + dError("failed to malloc status message"); + return; + } + + //strcpy(pStatus->dnodeName, tsDnodeName); + pStatus->version = htonl(tsVersion); + pStatus->dnodeId = htonl(tsDnodeCfg.dnodeId); + strcpy(pStatus->dnodeEp, tsLocalEp); + pStatus->lastReboot = htonl(tsRebootTime); + pStatus->numOfTotalVnodes = htons((uint16_t) tsNumOfTotalVnodes); + pStatus->numOfCores = htons((uint16_t) tsNumOfCores); + pStatus->diskAvailable = tsAvailDataDirGB; + pStatus->alternativeRole = (uint8_t) tsAlternativeRole; + + vnodeBuildStatusMsg(pStatus); + contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad); + pStatus->openVnodes = htons(pStatus->openVnodes); + + SRpcMsg rpcMsg = { + .pCont = pStatus, + .contLen = contLen, + .msgType = TSDB_MSG_TYPE_DM_STATUS + }; + + dnodeSendMsgToDnode(&tsMnodeIpSet, &rpcMsg); +} + +static bool dnodeReadDnodeCfg() { + char dnodeCfgFile[TSDB_FILENAME_LEN] = {0}; + sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir); + + FILE *fp = fopen(dnodeCfgFile, "r"); + if (!fp) { + dTrace("failed to read dnodeCfg.json, file not exist"); + return false; + } + + bool ret = false; + int maxLen = 100; + char *content = calloc(1, maxLen + 1); + int len = fread(content, 1, maxLen, fp); + if (len <= 0) { + free(content); + fclose(fp); + dError("failed to read dnodeCfg.json, content is null"); + return false; + } + + cJSON* root = cJSON_Parse(content); + if (root == NULL) { + dError("failed to read dnodeCfg.json, invalid json format"); + goto PARSE_CFG_OVER; + } + + cJSON* dnodeId = cJSON_GetObjectItem(root, "dnodeId"); + if (!dnodeId || dnodeId->type != cJSON_Number) { + dError("failed to read dnodeCfg.json, dnodeId not found"); + goto PARSE_CFG_OVER; + } + tsDnodeCfg.dnodeId = dnodeId->valueint; + + ret = true; + + dPrint("read numOfVnodes successed, dnodeId:%d", tsDnodeCfg.dnodeId); + +PARSE_CFG_OVER: + free(content); + cJSON_Delete(root); + fclose(fp); + return ret; +} + +static void dnodeSaveDnodeCfg() { + char dnodeCfgFile[TSDB_FILENAME_LEN] = {0}; + sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir); + + FILE *fp = fopen(dnodeCfgFile, "w"); + if (!fp) return; + + int32_t len = 0; + int32_t maxLen = 100; + char * content = calloc(1, maxLen + 1); + + len += snprintf(content + len, maxLen - len, "{\n"); + len += snprintf(content + len, maxLen - len, " \"dnodeId\": %d\n", tsDnodeCfg.dnodeId); + len += snprintf(content + len, maxLen - len, "}\n"); + + fwrite(content, 1, len, fp); + fclose(fp); + free(content); + + dPrint("save dnodeId successed"); +} + +void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg) { + if (tsDnodeCfg.dnodeId == 0) { + dPrint("dnodeId is set to %d", pCfg->dnodeId); + tsDnodeCfg.dnodeId = pCfg->dnodeId; + dnodeSaveDnodeCfg(); + } +} + +int32_t dnodeGetDnodeId() { + return tsDnodeCfg.dnodeId; +} + diff --git a/src/dnode/src/dnodeMnode.c b/src/dnode/src/dnodeMnode.c deleted file mode 100644 index 75c09d43ba..0000000000 --- a/src/dnode/src/dnodeMnode.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 . - */ - -#include "os.h" -#include "taosmsg.h" -#include "tglobal.h" -#include "trpc.h" -#include "dnode.h" -#include "dnodeLog.h" -#include "dnodeMgmt.h" -#include "dnodeWrite.h" - -static void (*dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); -static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg); -static void *tsDnodeMnodeRpc = NULL; - -int32_t dnodeInitMnode() { - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CREATE_TABLE] = dnodeWrite; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_DROP_TABLE] = dnodeWrite; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_TABLE] = dnodeWrite; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_DROP_STABLE] = dnodeWrite; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CREATE_VNODE] = dnodeMgmt; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_DROP_VNODE] = dnodeMgmt; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_STREAM] = dnodeMgmt; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CONFIG_DNODE] = dnodeMgmt; - - SRpcInit rpcInit; - memset(&rpcInit, 0, sizeof(rpcInit)); - rpcInit.localPort = tsDnodeMnodePort; - rpcInit.label = "DND-MS"; - rpcInit.numOfThreads = 1; - rpcInit.cfp = dnodeProcessMsgFromMnode; - rpcInit.sessions = 100; - rpcInit.connType = TAOS_CONN_SERVER; - rpcInit.idleTime = tsShellActivityTimer * 2000; - - tsDnodeMnodeRpc = rpcOpen(&rpcInit); - if (tsDnodeMnodeRpc == NULL) { - dError("failed to init mnode rpc server"); - return -1; - } - - dPrint("mnode rpc server is opened"); - return 0; -} - -void dnodeCleanupMnode() { - if (tsDnodeMnodeRpc) { - rpcClose(tsDnodeMnodeRpc); - tsDnodeMnodeRpc = NULL; - dPrint("mnode rpc server is closed"); - } -} - -static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg) { - SRpcMsg rspMsg; - rspMsg.handle = pMsg->handle; - rspMsg.pCont = NULL; - rspMsg.contLen = 0; - - if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) { - rspMsg.code = TSDB_CODE_NOT_READY; - rpcSendResponse(&rspMsg); - rpcFreeCont(pMsg->pCont); - dTrace("thandle:%p, query msg is ignored since dnode not running", pMsg->handle); - return; - } - - if (pMsg->pCont == NULL) { - rspMsg.code = TSDB_CODE_INVALID_MSG_LEN; - rpcSendResponse(&rspMsg); - return; - } - - if (dnodeProcessMgmtMsgFp[pMsg->msgType]) { - (*dnodeProcessMgmtMsgFp[pMsg->msgType])(pMsg); - } else { - dError("%s is not processed in dnode mserver", taosMsg[pMsg->msgType]); - rspMsg.code = TSDB_CODE_MSG_NOT_PROCESSED; - rpcSendResponse(&rspMsg); - rpcFreeCont(pMsg->pCont); - } -} - - diff --git a/src/dnode/src/dnodeModule.c b/src/dnode/src/dnodeModule.c index e1aa48d477..2e081de2a8 100644 --- a/src/dnode/src/dnodeModule.c +++ b/src/dnode/src/dnodeModule.c @@ -17,10 +17,11 @@ #include "os.h" #include "taosdef.h" #include "tglobal.h" +#include "trpc.h" #include "mnode.h" #include "http.h" #include "monitor.h" -#include "dnodeLog.h" +#include "dnodeInt.h" #include "dnodeModule.h" typedef struct { diff --git a/src/dnode/src/dnodePeer.c b/src/dnode/src/dnodePeer.c new file mode 100644 index 0000000000..ea21ed0206 --- /dev/null +++ b/src/dnode/src/dnodePeer.c @@ -0,0 +1,165 @@ +/* + * 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 . + */ + +/* this file is mainly responsible for the communication between DNODEs. Each + * dnode works as both server and client. Dnode may send status, grant, config + * messages to mnode, mnode may send create/alter/drop table/vnode messages + * to dnode. All theses messages are handled from here + */ + +#include "os.h" +#include "taosmsg.h" +#include "tglobal.h" +#include "trpc.h" +#include "dnode.h" +#include "dnodeInt.h" +#include "dnodeMgmt.h" +#include "dnodeVWrite.h" +#include "mnode.h" + +extern void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet); +static void (*dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); +static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg); +static void (*dnodeProcessRspMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg); +static void dnodeProcessRspFromDnode(SRpcMsg *pMsg); +static void *tsDnodeServerRpc = NULL; +static void *tsDnodeClientRpc = NULL; + +int32_t dnodeInitServer() { + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_CREATE_TABLE] = dnodeDispatchToVnodeWriteQueue; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_DROP_TABLE] = dnodeDispatchToVnodeWriteQueue; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_ALTER_TABLE] = dnodeDispatchToVnodeWriteQueue; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_DROP_STABLE] = dnodeDispatchToVnodeWriteQueue; + + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_CREATE_VNODE] = dnodeDispatchToDnodeMgmt; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_DROP_VNODE] = dnodeDispatchToDnodeMgmt; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_ALTER_STREAM] = dnodeDispatchToDnodeMgmt; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_CONFIG_DNODE] = dnodeDispatchToDnodeMgmt; + + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_CONFIG_TABLE] = mgmtProcessReqMsgFromDnode; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_CONFIG_VNODE] = mgmtProcessReqMsgFromDnode; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_GRANT] = mgmtProcessReqMsgFromDnode; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_STATUS] = mgmtProcessReqMsgFromDnode; + + SRpcInit rpcInit; + memset(&rpcInit, 0, sizeof(rpcInit)); + rpcInit.localPort = tsDnodeDnodePort; + rpcInit.label = "DND-S"; + rpcInit.numOfThreads = 1; + rpcInit.cfp = dnodeProcessReqMsgFromDnode; + rpcInit.sessions = 100; + rpcInit.connType = TAOS_CONN_SERVER; + rpcInit.idleTime = tsShellActivityTimer * 1000; + + tsDnodeServerRpc = rpcOpen(&rpcInit); + if (tsDnodeServerRpc == NULL) { + dError("failed to init inter-dnodes RPC server"); + return -1; + } + + dPrint("inter-dnodes RPC server is opened"); + return 0; +} + +void dnodeCleanupServer() { + if (tsDnodeServerRpc) { + rpcClose(tsDnodeServerRpc); + tsDnodeServerRpc = NULL; + dPrint("inter-dnodes RPC server is closed"); + } +} + +static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg) { + SRpcMsg rspMsg; + rspMsg.handle = pMsg->handle; + rspMsg.pCont = NULL; + rspMsg.contLen = 0; + + if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) { + rspMsg.code = TSDB_CODE_NOT_READY; + rpcSendResponse(&rspMsg); + rpcFreeCont(pMsg->pCont); + dTrace("RPC %p, msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]); + return; + } + + if (pMsg->pCont == NULL) { + rspMsg.code = TSDB_CODE_INVALID_MSG_LEN; + rpcSendResponse(&rspMsg); + return; + } + + if (dnodeProcessReqMsgFp[pMsg->msgType]) { + (*dnodeProcessReqMsgFp[pMsg->msgType])(pMsg); + } else { + rspMsg.code = TSDB_CODE_MSG_NOT_PROCESSED; + rpcSendResponse(&rspMsg); + rpcFreeCont(pMsg->pCont); + dTrace("RPC %p, message:%s not processed", pMsg->handle, taosMsg[pMsg->msgType]); + return; + + } +} + +int32_t dnodeInitClient() { + SRpcInit rpcInit; + memset(&rpcInit, 0, sizeof(rpcInit)); + rpcInit.label = "DND-C"; + rpcInit.numOfThreads = 1; + rpcInit.cfp = dnodeProcessRspFromDnode; + rpcInit.ufp = dnodeUpdateIpSet; + rpcInit.sessions = 100; + rpcInit.connType = TAOS_CONN_CLIENT; + rpcInit.idleTime = tsShellActivityTimer * 1000; + rpcInit.user = "t"; + rpcInit.ckey = "key"; + rpcInit.secret = "secret"; + + tsDnodeClientRpc = rpcOpen(&rpcInit); + if (tsDnodeClientRpc == NULL) { + dError("failed to init mnode rpc client"); + return -1; + } + + dPrint("inter-dnodes rpc client is opened"); + return 0; +} + +void dnodeCleanupClient() { + if (tsDnodeClientRpc) { + rpcClose(tsDnodeClientRpc); + tsDnodeClientRpc = NULL; + dPrint("inter-dnodes rpc client is closed"); + } +} + +static void dnodeProcessRspFromDnode(SRpcMsg *pMsg) { + + if (dnodeProcessRspMsgFp[pMsg->msgType]) { + (*dnodeProcessRspMsgFp[pMsg->msgType])(pMsg); + } else { + dError("RPC %p, msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]); + } + + rpcFreeCont(pMsg->pCont); +} + +void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) { + dnodeProcessRspMsgFp[msgType] = fp; +} + +void dnodeSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg) { + rpcSendRequest(tsDnodeClientRpc, ipSet, rpcMsg); +} diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 544d443bc0..28679262fa 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -22,9 +22,9 @@ #include "tglobal.h" #include "http.h" #include "dnode.h" -#include "dnodeLog.h" -#include "dnodeRead.h" -#include "dnodeWrite.h" +#include "dnodeInt.h" +#include "dnodeVRead.h" +#include "dnodeVWrite.h" #include "dnodeShell.h" static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); @@ -34,10 +34,43 @@ static void * tsDnodeShellRpc = NULL; static int32_t tsDnodeQueryReqNum = 0; static int32_t tsDnodeSubmitReqNum = 0; +void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg); + int32_t dnodeInitShell() { - dnodeProcessShellMsgFp[TSDB_MSG_TYPE_SUBMIT] = dnodeWrite; - dnodeProcessShellMsgFp[TSDB_MSG_TYPE_QUERY] = dnodeRead; - dnodeProcessShellMsgFp[TSDB_MSG_TYPE_RETRIEVE] = dnodeRead; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_SUBMIT] = dnodeDispatchToVnodeWriteQueue; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_QUERY] = dnodeDispatchToVnodeReadQueue; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_FETCH] = dnodeDispatchToVnodeReadQueue; + + // the following message shall be treated as mnode write + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CONNECT] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_ACCT] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_ACCT] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_ACCT] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_USER] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_USER] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_USER] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_DNODE]= mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_DNODE] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_DB] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_DB] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_DB] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_TABLE]= mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_TABLE] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_TABLE] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_STREAM]= mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_KILL_QUERY] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_KILL_STREAM] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_KILL_CONN] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_HEARTBEAT] = mgmtProcessMsgFromShell; + + // the following message shall be treated as mnode query + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_USE_DB] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_TABLE_META] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_STABLE_VGROUP]= mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_TABLES_META] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_SHOW] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_RETRIEVE] = mgmtProcessMsgFromShell; + dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CONFIG_DNODE]= mgmtProcessMsgFromShell; int32_t numOfThreads = tsNumOfCores * tsNumOfThreadsPerCore; numOfThreads = (int32_t) ((1.0 - tsRatioOfQueryThreads) * numOfThreads / 2.0); @@ -48,12 +81,12 @@ int32_t dnodeInitShell() { SRpcInit rpcInit; memset(&rpcInit, 0, sizeof(rpcInit)); rpcInit.localPort = tsDnodeShellPort; - rpcInit.label = "DND-shell"; + rpcInit.label = "SHELL"; rpcInit.numOfThreads = numOfThreads; rpcInit.cfp = dnodeProcessMsgFromShell; rpcInit.sessions = TSDB_SESSIONS_PER_DNODE; rpcInit.connType = TAOS_CONN_SERVER; - rpcInit.idleTime = tsShellActivityTimer * 1500; + rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.afp = dnodeRetrieveUserAuthInfo; tsDnodeShellRpc = rpcOpen(&rpcInit); @@ -80,7 +113,7 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { rpcMsg.contLen = 0; if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) { - dError("RPC %p, shell msg is ignored since dnode not running", pMsg->handle); + dError("RPC %p, shell msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]); rpcMsg.code = TSDB_CODE_NOT_READY; rpcSendResponse(&rpcMsg); rpcFreeCont(pMsg->pCont); @@ -96,10 +129,11 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { if ( dnodeProcessShellMsgFp[pMsg->msgType] ) { (*dnodeProcessShellMsgFp[pMsg->msgType])(pMsg); } else { - dError("RPC %p, msg:%s from shell is not handled", pMsg->handle, taosMsg[pMsg->msgType]); + dError("RPC %p, shell msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]); rpcMsg.code = TSDB_CODE_MSG_NOT_PROCESSED; rpcSendResponse(&rpcMsg); rpcFreeCont(pMsg->pCont); + return; } } diff --git a/src/dnode/src/dnodeRead.c b/src/dnode/src/dnodeVRead.c similarity index 97% rename from src/dnode/src/dnodeRead.c rename to src/dnode/src/dnodeVRead.c index efa5dc7695..aaf71838bf 100644 --- a/src/dnode/src/dnodeRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -21,9 +21,9 @@ #include "trpc.h" #include "twal.h" #include "tglobal.h" -#include "dnodeLog.h" +#include "dnodeInt.h" #include "dnodeMgmt.h" -#include "dnodeRead.h" +#include "dnodeVRead.h" #include "vnode.h" typedef struct { @@ -81,10 +81,12 @@ void dnodeCleanupRead() { } taosCloseQset(readQset); + free(readPool.readWorker); + dPrint("dnode read is closed"); } -void dnodeRead(SRpcMsg *pMsg) { +void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) { int32_t queuedMsgNum = 0; int32_t leftLen = pMsg->contLen; char *pCont = (char *) pMsg->pCont; @@ -97,7 +99,7 @@ void dnodeRead(SRpcMsg *pMsg) { pHead->vgId = htonl(pHead->vgId); pHead->contLen = htonl(pHead->contLen); - if (pMsg->msgType == TSDB_MSG_TYPE_RETRIEVE) { + if (pMsg->msgType == TSDB_MSG_TYPE_FETCH) { pVnode = vnodeGetVnode(pHead->vgId); } else { pVnode = vnodeAccquireVnode(pHead->vgId); diff --git a/src/dnode/src/dnodeWrite.c b/src/dnode/src/dnodeVWrite.c similarity index 97% rename from src/dnode/src/dnodeWrite.c rename to src/dnode/src/dnodeVWrite.c index 4ca9b1935d..5de4c16c50 100644 --- a/src/dnode/src/dnodeWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -24,8 +24,8 @@ #include "tglobal.h" #include "vnode.h" #include "tdataformat.h" -#include "dnodeLog.h" -#include "dnodeWrite.h" +#include "dnodeInt.h" +#include "dnodeVWrite.h" #include "dnodeMgmt.h" typedef struct { @@ -82,10 +82,10 @@ void dnodeCleanupWrite() { dPrint("dnode write is closed"); } -void dnodeWrite(SRpcMsg *pMsg) { +void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg) { char *pCont = (char *)pMsg->pCont; - if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT || pMsg->msgType == TSDB_MSG_TYPE_MD_DROP_STABLE) { + if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT) { SMsgDesc *pDesc = (SMsgDesc *)pCont; pDesc->numOfVnodes = htonl(pDesc->numOfVnodes); pCont += sizeof(SMsgDesc); diff --git a/src/inc/dnode.h b/src/inc/dnode.h index c4b893ab86..5145a46831 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -20,6 +20,8 @@ extern "C" { #endif +#include "trpc.h" + typedef struct { int32_t queryReqNum; int32_t submitReqNum; @@ -47,6 +49,10 @@ void dnodeGetMnodeDnodeIpSet(void *ipSet); void * dnodeGetMnodeInfos(); int32_t dnodeGetDnodeId(); +void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); +void dnodeAddServerMsgHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); +void dnodeSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg); + #ifdef __cplusplus } #endif diff --git a/src/inc/mnode.h b/src/inc/mnode.h index 35f7650c20..37fec24c20 100644 --- a/src/inc/mnode.h +++ b/src/inc/mnode.h @@ -26,6 +26,9 @@ void mgmtCleanUpSystem(); void mgmtStopSystem(); void sdbUpdateSync(); +void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg); +void mgmtProcessReqMsgFromDnode(SRpcMsg *rpcMsg); + #ifdef __cplusplus } #endif diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index e60124cf0a..571b551368 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -40,9 +40,10 @@ typedef int16_t VarDataLenT; #define varDataLen(v) ((VarDataLenT *)(v))[0] #define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v)) -#define varDataVal(v) ((void *)((char *)v + sizeof(VarDataLenT))) +#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE)) #define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v)) #define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE)) +#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len)) // this data type is internally used only in 'in' query to hold the values #define TSDB_DATA_TYPE_ARRAY (TSDB_DATA_TYPE_NCHAR + 1) @@ -240,7 +241,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_MULTI_METERMETA_MAX_NUM 100000 // maximum batch size allowed to load metermeta #define TSDB_MIN_CACHE_BLOCK_SIZE 1 -#define TSDB_MAX_CACHE_BLOCK_SIZE 1000000 +#define TSDB_MAX_CACHE_BLOCK_SIZE 10240 // 10GB for each vnode #define TSDB_DEFAULT_CACHE_BLOCK_SIZE 16 #define TSDB_MIN_TOTAL_BLOCKS 2 @@ -279,9 +280,9 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_MAX_COMP_LEVEL 2 #define TSDB_DEFAULT_COMP_LEVEL 2 -#define TSDB_MIN_CLOG_LEVEL 0 -#define TSDB_MAX_CLOG_LEVEL 2 -#define TSDB_DEFAULT_CLOG_LEVEL 2 +#define TSDB_MIN_WAL_LEVEL 0 +#define TSDB_MAX_WAL_LEVEL 2 +#define TSDB_DEFAULT_WAL_LEVEL 2 #define TSDB_MIN_REPLICA_NUM 1 #define TSDB_MAX_REPLICA_NUM 3 @@ -338,11 +339,9 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_MAX_NORMAL_TABLES 1000 #define TSDB_MAX_CHILD_TABLES 100000 -#define TSDB_PORT_MNODESHELL 0 -#define TSDB_PORT_DNODESHELL 5 -#define TSDB_PORT_DNODEMNODE 10 -#define TSDB_PORT_MNODEDNODE 15 -#define TSDB_PORT_SYNC 20 +#define TSDB_PORT_DNODESHELL 0 +#define TSDB_PORT_DNODEDNODE 5 +#define TSDB_PORT_SYNC 10 #define TAOS_QTYPE_RPC 0 #define TAOS_QTYPE_FWD 1 diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index a91a1e2128..8dac73606d 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -39,56 +39,70 @@ enum { TSDB_MESSAGE_NULL = 0, #endif -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_REG, "registration" ) // 1 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_SUBMIT, "submit" ) // 3 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_QUERY, "query" ) // 5 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_RETRIEVE, "retrieve" ) // 7 +// message from client to dnode +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_SUBMIT, "submit" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_QUERY, "query" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_FETCH, "fetch" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY0, "dummy0" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY1, "dummy1" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY2, "dummy2" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY3, "dummy3" ) // message from mnode to dnode -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CREATE_TABLE, "create-table" ) // 9 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_TABLE, "drop-table" ) // 11 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_TABLE, "alter-table" ) // 13 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CREATE_VNODE, "create-vnode" ) // 15 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_VNODE, "drop-vnode" ) // 17 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_STABLE, "drop-stable" ) // 19 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_STREAM, "alter-stream" ) // 21 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CONFIG_DNODE, "config-dnode" ) // 23 +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CREATE_TABLE, "create-table" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_TABLE, "drop-table" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_TABLE, "alter-table" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CREATE_VNODE, "create-vnode" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_VNODE, "drop-vnode" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_STABLE, "drop-stable" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_STREAM, "alter-stream" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CONFIG_DNODE, "config-dnode" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY4, "dummy4" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY5, "dummy5" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY6, "dummy6" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY7, "dummy7" ) // message from client to mnode -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CONNECT, "connect" ) // 31 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_ACCT, "create-acct" ) // 33 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_ACCT, "alter-acct" ) // 35 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_ACCT, "drop-acct" ) // 37 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_USER, "create-user" ) // 39 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_USER, "alter-user" ) // 41 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_USER, "drop-user" ) // 43 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_DNODE, "create-dnode" ) // 45 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_DNODE, "drop-dnode" ) // 47 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_DB, "create-db" ) // 49 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_DB, "drop-db" ) // 51 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_USE_DB, "use-db" ) // 53 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_DB, "alter-db" ) // 55 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_TABLE, "create-table" ) // 57 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_TABLE, "drop-table" ) // 59 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_TABLE, "alter-table" ) // 61 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_TABLE_META, "table-meta" ) // 63 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_STABLE_VGROUP, "stable-vgroup" ) // 65 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_TABLES_META, "tables-meta" ) // 67 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_STREAM, "alter-stream" ) // 69 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_SHOW, "show" ) // 71 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_KILL_QUERY, "kill-query" ) // 73 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_KILL_STREAM, "kill-stream" ) // 75 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_KILL_CONN, "kill-conn" ) // 77 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_HEARTBEAT, "heartbeat" ) // 79 +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CONNECT, "connect" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_ACCT, "create-acct" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_ACCT, "alter-acct" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_ACCT, "drop-acct" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_USER, "create-user" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_USER, "alter-user" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_USER, "drop-user" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_DNODE, "create-dnode" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_DNODE, "drop-dnode" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_DB, "create-db" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_DB, "drop-db" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_USE_DB, "use-db" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_DB, "alter-db" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_TABLE, "create-table" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_TABLE, "drop-table" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_TABLE, "alter-table" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_TABLE_META, "table-meta" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_STABLE_VGROUP, "stable-vgroup" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_TABLES_META, "tables-meta" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_STREAM, "alter-stream" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_SHOW, "show" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_RETRIEVE, "retrieve" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_KILL_QUERY, "kill-query" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_KILL_STREAM, "kill-stream" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_KILL_CONN, "kill-conn" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CONFIG_DNODE, "cm-config-dnode" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_HEARTBEAT, "heartbeat" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY8, "dummy8" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY9, "dummy9" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY10, "dummy10" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY11, "dummy11" ) // message from dnode to mnode -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_TABLE, "config-table" ) // 91 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_VNODE, "config-vnode" ) // 93 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_STATUS, "status" ) // 95 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_GRANT, "grant" ) // 97 - -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_SDB_SYNC, "sdb-sync" ) // 101 -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_SDB_FORWARD, "sdb-forward" ) // 103 +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_TABLE, "config-table" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_VNODE, "config-vnode" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_STATUS, "status" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_GRANT, "grant" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY12, "dummy12" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY13, "dummy13" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY14, "dummy14" ) #ifndef TAOS_MESSAGE_C TSDB_MSG_TYPE_MAX // 105 @@ -96,9 +110,6 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_SDB_FORWARD, "sdb-forward" ) // 10 }; -#define TSDB_MSG_TYPE_CM_CONFIG_DNODE TSDB_MSG_TYPE_MD_CONFIG_DNODE -#define TSDB_MSG_TYPE_CM_CONFIG_DNODE_RSP TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP - // IE type #define TSDB_IE_TYPE_SEC 1 #define TSDB_IE_TYPE_META 2 @@ -306,10 +317,6 @@ typedef struct { int8_t flag; } SCMCreateUserMsg, SCMAlterUserMsg; -typedef struct { - char db[TSDB_TABLE_ID_LEN + 1]; -} SMgmtHead; - typedef struct { int32_t contLen; int32_t vgId; @@ -319,6 +326,7 @@ typedef struct { } SMDDropTableMsg; typedef struct { + int32_t contLen; int32_t vgId; int64_t uid; char tableId[TSDB_TABLE_ID_LEN + 1]; @@ -358,7 +366,7 @@ typedef struct SExprInfo { struct tExprNode* pExpr; int16_t bytes; int16_t type; - int16_t interResBytes; + int16_t interBytes; } SExprInfo; typedef struct SColumnFilterInfo { @@ -475,9 +483,9 @@ typedef struct { typedef struct { char acct[TSDB_USER_LEN + 1]; char db[TSDB_DB_NAME_LEN + 1]; - int32_t maxSessions; + int32_t maxTables; int32_t cacheBlockSize; //MB - int32_t totalBlocks; + int32_t numOfBlocks; int32_t daysPerFile; int32_t daysToKeep1; int32_t daysToKeep2; @@ -486,7 +494,7 @@ typedef struct { int32_t minRowsPerFileBlock; int32_t maxRowsPerFileBlock; int8_t compression; - int8_t commitLog; + int8_t walLevel; int8_t replications; uint8_t precision; // time resolution int8_t ignoreExist; @@ -565,7 +573,7 @@ typedef struct { int32_t commitTime; int8_t precision; int8_t compression; - int8_t commitLog; + int8_t walLevel; int8_t replications; int8_t wals; int8_t quorum; diff --git a/src/inc/tsync.h b/src/inc/tsync.h index 797de063b9..0d6004bba5 100644 --- a/src/inc/tsync.h +++ b/src/inc/tsync.h @@ -54,8 +54,8 @@ typedef struct { int role[TAOS_SYNC_MAX_REPLICA]; } SNodesRole; -// if name is null, get the file from index or after, used by master -// if name is provided, get the named file at the specified index, used by unsynced node +// if name is empty(name[0] is zero), get the file from index or after, used by master +// if name is provided(name[0] is not zero), get the named file at the specified index, used by unsynced node // it returns the file magic number and size, if file not there, magic shall be 0. typedef uint32_t (*FGetFileInfo)(void *ahandle, char *name, uint32_t *index, int32_t *size); @@ -72,6 +72,9 @@ typedef void (*FConfirmForward)(void *ahandle, void *mhandle, int32_t code); // when role is changed, call this to notify app typedef void (*FNotifyRole)(void *ahandle, int8_t role); +// when data file is synced successfully, notity app +typedef void (*FNotifyFileSynced)(void *ahandle); + typedef struct { int32_t vgId; // vgroup ID uint64_t version; // initial version @@ -84,7 +87,7 @@ typedef struct { FWriteToCache writeToCache; FConfirmForward confirmForward; FNotifyRole notifyRole; - + FNotifyFileSynced notifyFileSynced; } SSyncInfo; typedef void* tsync_h; diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index 182860e67c..effaafc4e7 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_TSQLDEF_H -#define TDENGINE_TSQLDEF_H +#ifndef TDENGINE_TTOKENDEF_H +#define TDENGINE_TTOKENDEF_H #define TK_ID 1 #define TK_BOOL 2 @@ -101,123 +101,125 @@ #define TK_CONNS 83 #define TK_STATE 84 #define TK_KEEP 85 -#define TK_CACHE 86 -#define TK_REPLICA 87 -#define TK_DAYS 88 -#define TK_ROWS 89 -#define TK_ABLOCKS 90 -#define TK_TBLOCKS 91 -#define TK_CTIME 92 -#define TK_CLOG 93 -#define TK_COMP 94 -#define TK_PRECISION 95 -#define TK_LP 96 -#define TK_RP 97 -#define TK_TAGS 98 -#define TK_USING 99 -#define TK_AS 100 -#define TK_COMMA 101 -#define TK_NULL 102 -#define TK_SELECT 103 -#define TK_UNION 104 -#define TK_ALL 105 -#define TK_FROM 106 -#define TK_VARIABLE 107 -#define TK_INTERVAL 108 -#define TK_FILL 109 -#define TK_SLIDING 110 -#define TK_ORDER 111 -#define TK_BY 112 -#define TK_ASC 113 -#define TK_DESC 114 -#define TK_GROUP 115 -#define TK_HAVING 116 -#define TK_LIMIT 117 -#define TK_OFFSET 118 -#define TK_SLIMIT 119 -#define TK_SOFFSET 120 -#define TK_WHERE 121 -#define TK_NOW 122 -#define TK_RESET 123 -#define TK_QUERY 124 -#define TK_ADD 125 -#define TK_COLUMN 126 -#define TK_TAG 127 -#define TK_CHANGE 128 -#define TK_SET 129 -#define TK_KILL 130 -#define TK_CONNECTION 131 -#define TK_COLON 132 -#define TK_STREAM 133 -#define TK_ABORT 134 -#define TK_AFTER 135 -#define TK_ATTACH 136 -#define TK_BEFORE 137 -#define TK_BEGIN 138 -#define TK_CASCADE 139 -#define TK_CLUSTER 140 -#define TK_CONFLICT 141 -#define TK_COPY 142 -#define TK_DEFERRED 143 -#define TK_DELIMITERS 144 -#define TK_DETACH 145 -#define TK_EACH 146 -#define TK_END 147 -#define TK_EXPLAIN 148 -#define TK_FAIL 149 -#define TK_FOR 150 -#define TK_IGNORE 151 -#define TK_IMMEDIATE 152 -#define TK_INITIALLY 153 -#define TK_INSTEAD 154 -#define TK_MATCH 155 -#define TK_KEY 156 -#define TK_OF 157 -#define TK_RAISE 158 -#define TK_REPLACE 159 -#define TK_RESTRICT 160 -#define TK_ROW 161 -#define TK_STATEMENT 162 -#define TK_TRIGGER 163 -#define TK_VIEW 164 -#define TK_COUNT 165 -#define TK_SUM 166 -#define TK_AVG 167 -#define TK_MIN 168 -#define TK_MAX 169 -#define TK_FIRST 170 -#define TK_LAST 171 -#define TK_TOP 172 -#define TK_BOTTOM 173 -#define TK_STDDEV 174 -#define TK_PERCENTILE 175 -#define TK_APERCENTILE 176 -#define TK_LEASTSQUARES 177 -#define TK_HISTOGRAM 178 -#define TK_DIFF 179 -#define TK_SPREAD 180 -#define TK_TWA 181 -#define TK_INTERP 182 -#define TK_LAST_ROW 183 -#define TK_RATE 184 -#define TK_IRATE 185 -#define TK_SUM_RATE 186 -#define TK_SUM_IRATE 187 -#define TK_AVG_RATE 188 -#define TK_AVG_IRATE 189 -#define TK_SEMI 190 -#define TK_NONE 191 -#define TK_PREV 192 -#define TK_LINEAR 193 -#define TK_IMPORT 194 -#define TK_METRIC 195 -#define TK_TBNAME 196 -#define TK_JOIN 197 -#define TK_METRICS 198 -#define TK_STABLE 199 -#define TK_INSERT 200 -#define TK_INTO 201 -#define TK_VALUES 202 +#define TK_MAXTABLES 86 +#define TK_CACHE 87 +#define TK_REPLICA 88 +#define TK_DAYS 89 +#define TK_MINROWS 90 +#define TK_MAXROWS 91 +#define TK_BLOCKS 92 +#define TK_CTIME 93 +#define TK_WAL 94 +#define TK_COMP 95 +#define TK_PRECISION 96 +#define TK_LP 97 +#define TK_RP 98 +#define TK_TAGS 99 +#define TK_USING 100 +#define TK_AS 101 +#define TK_COMMA 102 +#define TK_NULL 103 +#define TK_SELECT 104 +#define TK_UNION 105 +#define TK_ALL 106 +#define TK_FROM 107 +#define TK_VARIABLE 108 +#define TK_INTERVAL 109 +#define TK_FILL 110 +#define TK_SLIDING 111 +#define TK_ORDER 112 +#define TK_BY 113 +#define TK_ASC 114 +#define TK_DESC 115 +#define TK_GROUP 116 +#define TK_HAVING 117 +#define TK_LIMIT 118 +#define TK_OFFSET 119 +#define TK_SLIMIT 120 +#define TK_SOFFSET 121 +#define TK_WHERE 122 +#define TK_NOW 123 +#define TK_RESET 124 +#define TK_QUERY 125 +#define TK_ADD 126 +#define TK_COLUMN 127 +#define TK_TAG 128 +#define TK_CHANGE 129 +#define TK_SET 130 +#define TK_KILL 131 +#define TK_CONNECTION 132 +#define TK_COLON 133 +#define TK_STREAM 134 +#define TK_ABORT 135 +#define TK_AFTER 136 +#define TK_ATTACH 137 +#define TK_BEFORE 138 +#define TK_BEGIN 139 +#define TK_CASCADE 140 +#define TK_CLUSTER 141 +#define TK_CONFLICT 142 +#define TK_COPY 143 +#define TK_DEFERRED 144 +#define TK_DELIMITERS 145 +#define TK_DETACH 146 +#define TK_EACH 147 +#define TK_END 148 +#define TK_EXPLAIN 149 +#define TK_FAIL 150 +#define TK_FOR 151 +#define TK_IGNORE 152 +#define TK_IMMEDIATE 153 +#define TK_INITIALLY 154 +#define TK_INSTEAD 155 +#define TK_MATCH 156 +#define TK_KEY 157 +#define TK_OF 158 +#define TK_RAISE 159 +#define TK_REPLACE 160 +#define TK_RESTRICT 161 +#define TK_ROW 162 +#define TK_STATEMENT 163 +#define TK_TRIGGER 164 +#define TK_VIEW 165 +#define TK_COUNT 166 +#define TK_SUM 167 +#define TK_AVG 168 +#define TK_MIN 169 +#define TK_MAX 170 +#define TK_FIRST 171 +#define TK_LAST 172 +#define TK_TOP 173 +#define TK_BOTTOM 174 +#define TK_STDDEV 175 +#define TK_PERCENTILE 176 +#define TK_APERCENTILE 177 +#define TK_LEASTSQUARES 178 +#define TK_HISTOGRAM 179 +#define TK_DIFF 180 +#define TK_SPREAD 181 +#define TK_TWA 182 +#define TK_INTERP 183 +#define TK_LAST_ROW 184 +#define TK_RATE 185 +#define TK_IRATE 186 +#define TK_SUM_RATE 187 +#define TK_SUM_IRATE 188 +#define TK_AVG_RATE 189 +#define TK_AVG_IRATE 190 +#define TK_TBID 191 +#define TK_SEMI 192 +#define TK_NONE 193 +#define TK_PREV 194 +#define TK_LINEAR 195 +#define TK_IMPORT 196 +#define TK_METRIC 197 +#define TK_TBNAME 198 +#define TK_JOIN 199 +#define TK_METRICS 200 +#define TK_STABLE 201 +#define TK_INSERT 202 +#define TK_INTO 203 +#define TK_VALUES 204 #endif diff --git a/src/inc/twal.h b/src/inc/twal.h index 06dc2e881b..8c2c3c69a1 100644 --- a/src/inc/twal.h +++ b/src/inc/twal.h @@ -34,7 +34,7 @@ typedef struct { } SWalHead; typedef struct { - int8_t commitLog; // commitLog + int8_t walLevel; // wal level int8_t wals; // number of WAL files; int8_t keep; // keep the wal file when closed } SWalCfg; diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index 152397c044..69475371dc 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -60,12 +60,10 @@ TAOS *shellInit(struct arguments *args) { taos_init(); /* - * set tsMetricMetaKeepTimer = 3000ms - * set tsMeterMetaKeepTimer = 3000ms + * set tsTableMetaKeepTimer = 3000ms * means not save cache in shell */ - tsMetricMetaKeepTimer = 3; - tsMeterMetaKeepTimer = 3000; + tsTableMetaKeepTimer = 3000; // Connect to the database. TAOS *con = taos_connect(args->host, args->user, args->password, args->database, args->port); diff --git a/src/kit/shell/src/shellImport.c b/src/kit/shell/src/shellImport.c index e5c50bb74e..b29b96379b 100644 --- a/src/kit/shell/src/shellImport.c +++ b/src/kit/shell/src/shellImport.c @@ -229,7 +229,7 @@ static void shellRunImportThreads(struct arguments* args) ShellThreadObj *pThread = threadObj + t; pThread->threadIndex = t; pThread->totalThreads = args->threadNum; - pThread->taos = taos_connect(args->host, args->user, args->password, args->database, tsMnodeShellPort); + pThread->taos = taos_connect(args->host, args->user, args->password, args->database, tsDnodeShellPort); if (pThread->taos == NULL) { fprintf(stderr, "ERROR: thread:%d failed connect to TDengine, error:%s\n", pThread->threadIndex, taos_errstr(pThread->taos)); exit(0); diff --git a/src/kit/shell/src/shellLinux.c b/src/kit/shell/src/shellLinux.c index 0d9458e00c..f5a1145cf8 100644 --- a/src/kit/shell/src/shellLinux.c +++ b/src/kit/shell/src/shellLinux.c @@ -63,7 +63,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { break; case 'P': if (arg) { - arguments->port = atoi(arg); + tsDnodeShellPort = atoi(arg); } else { fprintf(stderr, "Invalid port\n"); return -1; diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 937c8d177d..33b76cea2d 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -634,7 +634,7 @@ void *readMetric(void *sarg) { fprintf(fp, "Querying On %d records:\n", totalData); for (int j = 0; j < n; j++) { - char condition[BUFFER_SIZE] = "\0"; + char condition[BUFFER_SIZE - 30] = "\0"; char tempS[BUFFER_SIZE] = "\0"; int m = 10 < num_of_tables ? 10 : num_of_tables; diff --git a/src/mnode/inc/mgmtDef.h b/src/mnode/inc/mgmtDef.h index 8e5240910d..ba71f9373b 100644 --- a/src/mnode/inc/mgmtDef.h +++ b/src/mnode/inc/mgmtDef.h @@ -151,7 +151,7 @@ typedef struct { int32_t commitTime; int8_t precision; int8_t compression; - int8_t commitLog; + int8_t walLevel; int8_t replications; int8_t reserved[16]; } SDbCfg; diff --git a/src/mnode/inc/mgmtLog.h b/src/mnode/inc/mgmtInt.h similarity index 52% rename from src/mnode/inc/mgmtLog.h rename to src/mnode/inc/mgmtInt.h index a99fa22593..a83d5beee0 100644 --- a/src/mnode/inc/mgmtLog.h +++ b/src/mnode/inc/mgmtInt.h @@ -23,43 +23,23 @@ extern "C" { #include "tlog.h" #include "monitor.h" -extern int32_t mdebugFlag; +extern int32_t mDebugFlag; extern int32_t sdbDebugFlag; // mnode log function -#define mError(...) \ - if (mdebugFlag & DEBUG_ERROR) { \ - taosPrintLog("ERROR MND ", 255, __VA_ARGS__); \ - } -#define mWarn(...) \ - if (mdebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN MND ", mdebugFlag, __VA_ARGS__); \ - } -#define mTrace(...) \ - if (mdebugFlag & DEBUG_TRACE) { \ - taosPrintLog("MND ", mdebugFlag, __VA_ARGS__); \ - } -#define mPrint(...) \ - { taosPrintLog("MND ", 255, __VA_ARGS__); } +#define mError(...) if (mDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND ", 255, __VA_ARGS__); } +#define mWarn(...) if (mDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND ", mDebugFlag, __VA_ARGS__); } +#define mTrace(...) if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); } +#define mPrint(...) { taosPrintLog("MND ", 255, __VA_ARGS__); } #define mLError(...) monitorSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) #define mLWarn(...) monitorSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) #define mLPrint(...) monitorSaveLog(0, __VA_ARGS__); mPrint(__VA_ARGS__) -#define sdbError(...) \ - if (sdbDebugFlag & DEBUG_ERROR) { \ - taosPrintLog("ERROR MND-SDB ", 255, __VA_ARGS__); \ - } -#define sdbWarn(...) \ - if (sdbDebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN MND-SDB ", sdbDebugFlag, __VA_ARGS__); \ - } -#define sdbTrace(...) \ - if (sdbDebugFlag & DEBUG_TRACE) { \ - taosPrintLog("MND-SDB ", sdbDebugFlag, __VA_ARGS__); \ - } -#define sdbPrint(...) \ - { taosPrintLog("MND-SDB ", 255, __VA_ARGS__); } +#define sdbError(...) if (sdbDebugFlag & DEBUG_ERROR) { taosPrintLog("ERROR MND-SDB ", 255, __VA_ARGS__); } +#define sdbWarn(...) if (sdbDebugFlag & DEBUG_WARN) { taosPrintLog("WARN MND-SDB ", sdbDebugFlag, __VA_ARGS__); } +#define sdbTrace(...) if (sdbDebugFlag & DEBUG_TRACE) { taosPrintLog("MND-SDB ", sdbDebugFlag, __VA_ARGS__);} +#define sdbPrint(...) { taosPrintLog("MND-SDB ", 255, __VA_ARGS__); } #define sdbLError(...) monitorSaveLog(2, __VA_ARGS__); sdbError(__VA_ARGS__) #define sdbLWarn(...) monitorSaveLog(1, __VA_ARGS__); sdbWarn(__VA_ARGS__) diff --git a/src/dnode/inc/dnodeMnode.h b/src/mnode/inc/mgmtServer.h similarity index 85% rename from src/dnode/inc/dnodeMnode.h rename to src/mnode/inc/mgmtServer.h index 76a65a06c9..08e4463ad8 100644 --- a/src/dnode/inc/dnodeMnode.h +++ b/src/mnode/inc/mgmtServer.h @@ -13,15 +13,15 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_DNODE_MNODE_H -#define TDENGINE_DNODE_MNODE_H +#ifndef TDENGINE_MGMT_DSERVER_H +#define TDENGINE_MGMT_DSERVER_H #ifdef __cplusplus extern "C" { #endif -int32_t dnodeInitMnode(); -void dnodeCleanupMnode(); +int32_t mgmtInitServer(); +void mgmtCleanupServer(); #ifdef __cplusplus } diff --git a/src/mnode/src/mgmtAcct.c b/src/mnode/src/mgmtAcct.c index 9b7815af12..1cacec96ee 100644 --- a/src/mnode/src/mgmtAcct.c +++ b/src/mnode/src/mgmtAcct.c @@ -20,7 +20,7 @@ #include "tutil.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDb.h" #include "mgmtSdb.h" diff --git a/src/mnode/src/mgmtBalance.c b/src/mnode/src/mgmtBalance.c index d16a06fc5c..ff5b4008bb 100644 --- a/src/mnode/src/mgmtBalance.c +++ b/src/mnode/src/mgmtBalance.c @@ -19,7 +19,7 @@ #include "tbalance.h" #include "tglobal.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtMnode.h" #include "mgmtDnode.h" #include "mgmtVgroup.h" diff --git a/src/mnode/src/mgmtDClient.c b/src/mnode/src/mgmtDClient.c deleted file mode 100644 index 229964e1d6..0000000000 --- a/src/mnode/src/mgmtDClient.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 "os.h" -#include "taoserror.h" -#include "tsched.h" -#include "tsystem.h" -#include "tutil.h" -#include "tglobal.h" -#include "dnode.h" -#include "tgrant.h" -#include "mgmtDef.h" -#include "mgmtLog.h" -#include "mgmtMnode.h" -#include "mgmtDb.h" -#include "mgmtDnode.h" -#include "mgmtProfile.h" -#include "mgmtShell.h" -#include "mgmtTable.h" -#include "mgmtVgroup.h" - -static void mgmtProcessRspFromDnode(SRpcMsg *rpcMsg); -static void (*mgmtProcessDnodeRspFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg); -static void *tsMgmtDClientRpc = NULL; - -int32_t mgmtInitDClient() { - SRpcInit rpcInit = {0}; - rpcInit.localPort = 0; - rpcInit.label = "MND-DC"; - rpcInit.numOfThreads = 1; - rpcInit.cfp = mgmtProcessRspFromDnode; - rpcInit.sessions = 100; - rpcInit.connType = TAOS_CONN_CLIENT; - rpcInit.idleTime = tsShellActivityTimer * 1000; - rpcInit.user = "mgmtDClient"; - rpcInit.ckey = "key"; - rpcInit.secret = "secret"; - - tsMgmtDClientRpc = rpcOpen(&rpcInit); - if (tsMgmtDClientRpc == NULL) { - mError("failed to init client connection to dnode"); - return -1; - } - - mPrint("client connection to dnode is opened"); - return 0; -} - -void mgmtCleanupDClient() { - if (tsMgmtDClientRpc) { - rpcClose(tsMgmtDClientRpc); - tsMgmtDClientRpc = NULL; - } -} - -void mgmtAddDClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) { - mgmtProcessDnodeRspFp[msgType] = fp; -} - -void mgmtSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg) { - rpcSendRequest(tsMgmtDClientRpc, ipSet, rpcMsg); -} - -static void mgmtProcessRspFromDnode(SRpcMsg *rpcMsg) { - if (mgmtProcessDnodeRspFp[rpcMsg->msgType]) { - (*mgmtProcessDnodeRspFp[rpcMsg->msgType])(rpcMsg); - } else { - mError("%s is not processed in mgmt dclient", taosMsg[rpcMsg->msgType]); - SRpcMsg rpcRsp = {.pCont = 0, .contLen = 0, .code = TSDB_CODE_OPS_NOT_SUPPORT, .handle = rpcMsg->handle}; - rpcSendResponse(&rpcRsp); - } - - rpcFreeCont(rpcMsg->pCont); -} diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 9eb8b8dce1..4f54a85baa 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -25,7 +25,7 @@ #include "tbalance.h" #include "tdataformat.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDb.h" #include "mgmtDnode.h" @@ -251,8 +251,8 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { return TSDB_CODE_INVALID_OPTION; } - if (pCfg->commitLog < TSDB_MIN_CLOG_LEVEL || pCfg->commitLog > TSDB_MAX_CLOG_LEVEL) { - mError("invalid db option commitLog:%d, only 0-2 allowed", pCfg->commitLog); + if (pCfg->walLevel < TSDB_MIN_WAL_LEVEL || pCfg->walLevel > TSDB_MAX_WAL_LEVEL) { + mError("invalid db option walLevel:%d, only 0-2 allowed", pCfg->walLevel); return TSDB_CODE_INVALID_OPTION; } @@ -274,8 +274,8 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { static void mgmtSetDefaultDbCfg(SDbCfg *pCfg) { if (pCfg->cacheBlockSize < 0) pCfg->cacheBlockSize = tsCacheBlockSize; - if (pCfg->totalBlocks < 0) pCfg->totalBlocks = tsTotalBlocks; - if (pCfg->maxTables < 0) pCfg->maxTables = tsTablesPerVnode; + if (pCfg->totalBlocks < 0) pCfg->totalBlocks = tsBlocksPerVnode; + if (pCfg->maxTables < 0) pCfg->maxTables = tsMaxTablePerVnode; if (pCfg->daysPerFile < 0) pCfg->daysPerFile = tsDaysPerFile; if (pCfg->daysToKeep < 0) pCfg->daysToKeep = tsDaysToKeep; if (pCfg->daysToKeep1 < 0) pCfg->daysToKeep1 = pCfg->daysToKeep; @@ -285,7 +285,7 @@ static void mgmtSetDefaultDbCfg(SDbCfg *pCfg) { if (pCfg->commitTime < 0) pCfg->commitTime = tsCommitTime; if (pCfg->precision < 0) pCfg->precision = tsTimePrecision; if (pCfg->compression < 0) pCfg->compression = tsCompression; - if (pCfg->commitLog < 0) pCfg->commitLog = tsCommitLog; + if (pCfg->walLevel < 0) pCfg->walLevel = tsWAL; if (pCfg->replications < 0) pCfg->replications = tsReplications; } @@ -312,8 +312,8 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) { pDb->createdTime = taosGetTimestampMs(); pDb->cfg = (SDbCfg) { .cacheBlockSize = pCreate->cacheBlockSize, - .totalBlocks = pCreate->totalBlocks, - .maxTables = pCreate->maxSessions, + .totalBlocks = pCreate->numOfBlocks, + .maxTables = pCreate->maxTables, .daysPerFile = pCreate->daysPerFile, .daysToKeep = pCreate->daysToKeep, .daysToKeep1 = pCreate->daysToKeep1, @@ -323,7 +323,7 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) { .commitTime = pCreate->commitTime, .precision = pCreate->precision, .compression = pCreate->compression, - .commitLog = pCreate->commitLog, + .walLevel = pCreate->walLevel, .replications = pCreate->replications }; @@ -491,7 +491,7 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) #endif pShow->bytes[cols] = 4; pSchema[cols].type = TSDB_DATA_TYPE_INT; - strcpy(pSchema[cols].name, "tables"); + strcpy(pSchema[cols].name, "maxtables"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; @@ -521,13 +521,13 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) pShow->bytes[cols] = 4; pSchema[cols].type = TSDB_DATA_TYPE_INT; - strcpy(pSchema[cols].name, "ctime(s)"); + strcpy(pSchema[cols].name, "ctime(Sec.)"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; pShow->bytes[cols] = 1; pSchema[cols].type = TSDB_DATA_TYPE_TINYINT; - strcpy(pSchema[cols].name, "clog"); + strcpy(pSchema[cols].name, "wallevel"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; @@ -659,7 +659,7 @@ static int32_t mgmtRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void * cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int8_t *)pWrite = pDb->cfg.commitLog; + *(int8_t *)pWrite = pDb->cfg.walLevel; cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -677,9 +677,11 @@ static int32_t mgmtRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void * pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; if (pDb->status == TSDB_DB_STATUS_READY) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "ready", 5); + const char *src = "ready"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else { - STR_WITH_SIZE_TO_VARSTR(pWrite, "dropping", 8); + const char *src = "dropping"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } cols++; @@ -728,9 +730,10 @@ static int32_t mgmtSetDbDropping(SDbObj *pDb) { static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) { SCMCreateDbMsg *pCreate = pMsg->pCont; - pCreate->maxSessions = htonl(pCreate->maxSessions); + + pCreate->maxTables = htonl(pCreate->maxTables); pCreate->cacheBlockSize = htonl(pCreate->cacheBlockSize); - pCreate->totalBlocks = htonl(pCreate->totalBlocks); + pCreate->numOfBlocks = htonl(pCreate->numOfBlocks); pCreate->daysPerFile = htonl(pCreate->daysPerFile); pCreate->daysToKeep = htonl(pCreate->daysToKeep); pCreate->daysToKeep1 = htonl(pCreate->daysToKeep1); @@ -757,14 +760,15 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) { static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { SDbCfg newCfg = pDb->cfg; int32_t cacheBlockSize = htonl(pAlter->daysToKeep); - int32_t totalBlocks = htonl(pAlter->totalBlocks); - int32_t maxTables = htonl(pAlter->maxSessions); - int32_t daysToKeep = htonl(pAlter->daysToKeep); + int32_t totalBlocks = htonl(pAlter->numOfBlocks); + int32_t maxTables = htonl(pAlter->maxTables); + int32_t daysToKeep = htonl(pAlter->daysToKeep); int32_t daysToKeep1 = htonl(pAlter->daysToKeep1); int32_t daysToKeep2 = htonl(pAlter->daysToKeep2); int8_t compression = pAlter->compression; int8_t replications = pAlter->replications; - + int8_t walLevel = pAlter->walLevel; + terrno = TSDB_CODE_SUCCESS; if (cacheBlockSize > 0 && cacheBlockSize != pDb->cfg.cacheBlockSize) { @@ -801,7 +805,7 @@ static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { newCfg.daysToKeep2 = daysToKeep2; } - if (compression > 0 && compression != pDb->cfg.compression) { + if (compression >= 0 && compression != pDb->cfg.compression) { mTrace("db:%s, compression:%d change to %d", pDb->name, pDb->cfg.compression, compression); newCfg.compression = compression; } @@ -809,15 +813,20 @@ static SDbCfg mgmtGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { if (replications > 0 && replications != pDb->cfg.replications) { mTrace("db:%s, replications:%d change to %d", pDb->name, pDb->cfg.replications, replications); newCfg.replications = replications; - } - if (replications > mgmtGetDnodesNum()) { - mError("db:%s, no enough dnode to change replica:%d", pDb->name, replications); - terrno = TSDB_CODE_NO_ENOUGH_DNODES; + if (replications > mgmtGetDnodesNum()) { + mError("db:%s, no enough dnode to change replica:%d", pDb->name, replications); + terrno = TSDB_CODE_NO_ENOUGH_DNODES; + } + + if (pDb->cfg.replications - replications >= 2) { + mError("db:%s, replica number can't change from 3 to 1", pDb->name, replications); + terrno = TSDB_CODE_INVALID_OPTION; + } } - if (pDb->cfg.replications - replications >= 2) { - mError("db:%s, replica number can't change from 3 to 1", pDb->name, replications); + if (walLevel >= 0 && (walLevel < TSDB_MIN_WAL_LEVEL || walLevel > TSDB_MAX_WAL_LEVEL)) { + mError("db:%s, wal level %d should be between 0-2, origin:%d", pDb->name, walLevel, pDb->cfg.walLevel); terrno = TSDB_CODE_INVALID_OPTION; } diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index bb98e1c3e6..d60dae32ae 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -27,9 +27,7 @@ #include "tdataformat.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" -#include "mgmtDClient.h" -#include "mgmtDServer.h" +#include "mgmtInt.h" #include "mgmtDnode.h" #include "mgmtMnode.h" #include "mgmtSdb.h" @@ -153,8 +151,8 @@ int32_t mgmtInitDnodes() { mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CREATE_DNODE, mgmtProcessCreateDnodeMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_DNODE, mgmtProcessDropDnodeMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CONFIG_DNODE, mgmtProcessCfgDnodeMsg); - mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP, mgmtProcessCfgDnodeMsgRsp); - mgmtAddDServerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mgmtProcessDnodeStatusMsg); + dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP, mgmtProcessCfgDnodeMsgRsp); + dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mgmtProcessDnodeStatusMsg); mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_MODULE, mgmtGetModuleMeta); mgmtAddShellShowRetrieveHandle(TSDB_MGMT_TABLE_MODULE, mgmtRetrieveModules); mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_CONFIGS, mgmtGetConfigMeta); @@ -225,7 +223,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { if (pCmCfgDnode->ep[0] == 0) { strcpy(pCmCfgDnode->ep, tsLocalEp); } else { - strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep); + // TODO temporary disabled for compiling: strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep); } if (strcmp(pMsg->pUser->user, "root") != 0) { @@ -242,7 +240,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { .pCont = pMdCfgDnode, .contLen = sizeof(SMDCfgDnodeMsg) }; - mgmtSendMsgToDnode(&ipSet, &rpcMdCfgDnodeMsg); + dnodeSendMsgToDnode(&ipSet, &rpcMdCfgDnodeMsg); rpcRsp.code = TSDB_CODE_SUCCESS; } @@ -254,7 +252,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { } static void mgmtProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { - mPrint("cfg vnode rsp is received, result:%s", tstrerror(rpcMsg->code)); + mPrint("cfg dnode rsp is received"); } void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { diff --git a/src/mnode/src/mgmtGrant.c b/src/mnode/src/mgmtGrant.c index 449799ef95..f44b47e20c 100644 --- a/src/mnode/src/mgmtGrant.c +++ b/src/mnode/src/mgmtGrant.c @@ -18,7 +18,7 @@ #include "os.h" #include "taoserror.h" #include "tgrant.h" -#include "mgmtLog.h" +#include "mgmtInt.h" int32_t grantInit() { return TSDB_CODE_SUCCESS; } void grantCleanUp() {} diff --git a/src/mnode/src/mgmtMain.c b/src/mnode/src/mgmtMain.c index 0f18c95539..2a8e139eec 100644 --- a/src/mnode/src/mgmtMain.c +++ b/src/mnode/src/mgmtMain.c @@ -23,13 +23,12 @@ #include "tglobal.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" +#include "mgmtServer.h" #include "mgmtAcct.h" #include "mgmtDnode.h" #include "mgmtMnode.h" #include "mgmtDb.h" -#include "mgmtDClient.h" -#include "mgmtDServer.h" #include "mgmtSdb.h" #include "mgmtVgroup.h" #include "mgmtUser.h" @@ -56,11 +55,6 @@ int32_t mgmtStartSystem() { return -1; } - if (grantInit() < 0) { - mError("failed to init grant"); - return -1; - } - if (mgmtInitUsers() < 0) { mError("failed to init users"); return -1; @@ -100,11 +94,12 @@ int32_t mgmtStartSystem() { mError("failed to init balance") } - if (mgmtInitDClient() < 0) { + if (grantInit() < 0) { + mError("failed to init grant"); return -1; } - if (mgmtInitDServer() < 0) { + if (mgmtInitServer() < 0) { return -1; } @@ -137,21 +132,19 @@ int32_t mgmtInitSystem() { void mgmtCleanUpSystem() { mPrint("starting to clean up mgmt"); - grantCleanUp(); - mgmtCleanupMnodes(); - balanceCleanUp(); + tsMgmtIsRunning = false; mgmtCleanUpShell(); - mgmtCleanupDClient(); - mgmtCleanupDServer(); - mgmtCleanUpAccts(); + mgmtCleanupServer(); + grantCleanUp(); + balanceCleanUp(); + sdbCleanUp(); + mgmtCleanupMnodes(); mgmtCleanUpTables(); mgmtCleanUpVgroups(); mgmtCleanUpDbs(); mgmtCleanupDnodes(); mgmtCleanUpUsers(); - sdbCleanUp(); - taosTmrCleanUp(tsMgmtTmr); - tsMgmtIsRunning = false; + mgmtCleanUpAccts(); mPrint("mgmt is cleaned up"); } diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index f28e286f79..a78e5574c0 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -24,7 +24,7 @@ #include "tsocket.h" #include "tdataformat.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtMnode.h" #include "mgmtDnode.h" #include "mgmtSdb.h" diff --git a/src/mnode/src/mgmtProfile.c b/src/mnode/src/mgmtProfile.c index 77871f037b..64ac8ed710 100644 --- a/src/mnode/src/mgmtProfile.c +++ b/src/mnode/src/mgmtProfile.c @@ -19,7 +19,7 @@ #include "taoserror.h" #include "tutil.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDnode.h" #include "mgmtDb.h" diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index a55869222d..c25f4457a9 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -27,7 +27,7 @@ #include "hashstr.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtMnode.h" #include "mgmtSdb.h" @@ -142,7 +142,7 @@ static void *sdbGetTableFromId(int32_t tableId) { } static int32_t sdbInitWal() { - SWalCfg walCfg = {.commitLog = 2, .wals = 2, .keep = 1}; + SWalCfg walCfg = {.walLevel = 2, .wals = 2, .keep = 1}; char temp[TSDB_FILENAME_LEN]; sprintf(temp, "%s/wal", tsMnodeDir); tsSdbObj.wal = walOpen(temp, &walCfg); @@ -278,7 +278,7 @@ void sdbUpdateSync() { sdbPrint("mnode:%d, %s:%d", syncCfg.nodeInfo[i].nodeId, syncCfg.nodeInfo[i].nodeFqdn, syncCfg.nodeInfo[i].nodePort); } - SSyncInfo syncInfo; + SSyncInfo syncInfo = {0}; syncInfo.vgId = 1; syncInfo.version = sdbGetVersion(); syncInfo.syncCfg = syncCfg; @@ -323,12 +323,19 @@ void sdbCleanUp() { if (tsSdbObj.status != SDB_STATUS_SERVING) return; tsSdbObj.status = SDB_STATUS_CLOSING; - syncStop(tsSdbObj.sync); - free(tsSdbObj.sync); - walClose(tsSdbObj.wal); + + if (tsSdbObj.sync) { + syncStop(tsSdbObj.sync); + tsSdbObj.sync = NULL; + } + + if (tsSdbObj.wal) { + walClose(tsSdbObj.wal); + tsSdbObj.wal = NULL; + } + sem_destroy(&tsSdbObj.sem); pthread_mutex_destroy(&tsSdbObj.mutex); - memset(&tsSdbObj, 0, sizeof(tsSdbObj)); } void sdbIncRef(void *handle, void *pRow) { diff --git a/src/mnode/src/mgmtDServer.c b/src/mnode/src/mgmtServer.c similarity index 51% rename from src/mnode/src/mgmtDServer.c rename to src/mnode/src/mgmtServer.c index 726554e490..7810189e34 100644 --- a/src/mnode/src/mgmtDServer.c +++ b/src/mnode/src/mgmtServer.c @@ -25,9 +25,8 @@ #include "tglobal.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtDb.h" -#include "mgmtDServer.h" #include "mgmtMnode.h" #include "mgmtProfile.h" #include "mgmtShell.h" @@ -35,67 +34,49 @@ #include "mgmtTable.h" #include "mgmtVgroup.h" -static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg); -static int mgmtDServerRetrieveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey); static void (*mgmtProcessDnodeMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg); -static void *tsMgmtDServerRpc; -static void *tsMgmtDServerQhandle = NULL; +static void *tsMgmtServerQhandle = NULL; -int32_t mgmtInitDServer() { - SRpcInit rpcInit = {0}; - rpcInit.localPort = tsMnodeDnodePort; - rpcInit.label = "MND-DS"; - rpcInit.numOfThreads = 1; - rpcInit.cfp = mgmtProcessMsgFromDnode; - rpcInit.sessions = 100; - rpcInit.connType = TAOS_CONN_SERVER; - rpcInit.idleTime = tsShellActivityTimer * 1000; - rpcInit.afp = mgmtDServerRetrieveAuth; +int32_t mgmtInitServer() { - tsMgmtDServerRpc = rpcOpen(&rpcInit); - if (tsMgmtDServerRpc == NULL) { - mError("failed to init server connection to dnode"); - return -1; - } - - tsMgmtDServerQhandle = taosInitScheduler(tsMaxShellConns, 1, "MS"); + tsMgmtServerQhandle = taosInitScheduler(tsMaxShellConns, 1, "MS"); mPrint("server connection to dnode is opened"); return 0; } -void mgmtCleanupDServer() { - if (tsMgmtDServerQhandle) { - taosCleanUpScheduler(tsMgmtDServerQhandle); - tsMgmtDServerQhandle = NULL; - } - - if (tsMgmtDServerRpc) { - rpcClose(tsMgmtDServerRpc); - tsMgmtDServerRpc = NULL; - mPrint("server connection to dnode is closed"); +void mgmtCleanupServer() { + if (tsMgmtServerQhandle) { + taosCleanUpScheduler(tsMgmtServerQhandle); + tsMgmtServerQhandle = NULL; } } -void mgmtAddDServerMsgHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) { +void dnodeAddServerMsgHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) { mgmtProcessDnodeMsgFp[msgType] = fp; } -static void mgmtProcessDServerRequest(SSchedMsg *sched) { +static void mgmtProcessRequestFromDnode(SSchedMsg *sched) { SRpcMsg *pMsg = sched->msg; (*mgmtProcessDnodeMsgFp[pMsg->msgType])(pMsg); rpcFreeCont(pMsg->pCont); free(pMsg); } -static void mgmtAddToDServerQueue(SRpcMsg *pMsg) { +static void mgmtAddToServerQueue(SRpcMsg *pMsg) { SSchedMsg schedMsg; schedMsg.msg = pMsg; - schedMsg.fp = mgmtProcessDServerRequest; - taosScheduleTask(tsMgmtDServerQhandle, &schedMsg); + schedMsg.fp = mgmtProcessRequestFromDnode; + taosScheduleTask(tsMgmtServerQhandle, &schedMsg); } -static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) { +void mgmtProcessReqMsgFromDnode(SRpcMsg *rpcMsg) { + if (mgmtProcessDnodeMsgFp[rpcMsg->msgType] == NULL) { + mError("%s is not processed in mnode", taosMsg[rpcMsg->msgType]); + mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_MSG_NOT_PROCESSED); + rpcFreeCont(rpcMsg->pCont); + } + if (rpcMsg->pCont == NULL) { mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_INVALID_MSG_LEN); return; @@ -107,26 +88,19 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) { SRpcIpSet ipSet = {0}; dnodeGetMnodeDnodeIpSet(&ipSet); + for (int i = 0; i < ipSet.numOfIps; ++i) + ipSet.port[i] = htons(ipSet.port[i]); mTrace("conn from dnode ip:%s user:%s redirect msg, inUse:%d", taosIpStr(connInfo.clientIp), connInfo.user, ipSet.inUse); for (int32_t i = 0; i < ipSet.numOfIps; ++i) { - mTrace("index:%d %s:%d", i, ipSet.fqdn[i], ipSet.port[i]); + mTrace("mnode index:%d %s:%d", i, ipSet.fqdn[i], htons(ipSet.port[i])); } rpcSendRedirectRsp(rpcMsg->handle, &ipSet); return; } - if (mgmtProcessDnodeMsgFp[rpcMsg->msgType]) { - SRpcMsg *pMsg = malloc(sizeof(SRpcMsg)); - memcpy(pMsg, rpcMsg, sizeof(SRpcMsg)); - mgmtAddToDServerQueue(pMsg); - } else { - mError("%s is not processed in mgmt dserver", taosMsg[rpcMsg->msgType]); - mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_MSG_NOT_PROCESSED); - rpcFreeCont(rpcMsg->pCont); - } + SRpcMsg *pMsg = malloc(sizeof(SRpcMsg)); + memcpy(pMsg, rpcMsg, sizeof(SRpcMsg)); + mgmtAddToServerQueue(pMsg); } -static int mgmtDServerRetrieveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) { - return TSDB_CODE_SUCCESS; -} diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index c86bf2a2dd..cd74c166d1 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -26,7 +26,7 @@ #include "tcache.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtDb.h" #include "mgmtDnode.h" @@ -41,9 +41,8 @@ typedef int32_t (*SShowMetaFp)(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); typedef int32_t (*SShowRetrieveFp)(SShowObj *pShow, char *data, int32_t rows, void *pConn); -static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey); +//static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey); static bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg); -static void mgmtProcessMsgFromShell(SRpcMsg *pMsg); static void mgmtProcessUnSupportMsg(SRpcMsg *rpcMsg); static void mgmtProcessShowMsg(SQueuedMsg *queuedMsg); static void mgmtProcessRetrieveMsg(SQueuedMsg *queuedMsg); @@ -52,7 +51,6 @@ static void mgmtProcessConnectMsg(SQueuedMsg *queuedMsg); static void mgmtProcessUseMsg(SQueuedMsg *queuedMsg); void *tsMgmtTmr; -static void *tsMgmtShellRpc = NULL; static void *tsMgmtTranQhandle = NULL; static void (*tsMgmtProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SQueuedMsg *) = {0}; static void *tsQhandleCache = NULL; @@ -61,57 +59,33 @@ static SShowRetrieveFp tsMgmtShowRetrieveFp[TSDB_MGMT_TABLE_MAX] = {0}; int32_t mgmtInitShell() { mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_SHOW, mgmtProcessShowMsg); - mgmtAddShellMsgHandle(TSDB_MSG_TYPE_RETRIEVE, mgmtProcessRetrieveMsg); + mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_RETRIEVE, mgmtProcessRetrieveMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_HEARTBEAT, mgmtProcessHeartBeatMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CONNECT, mgmtProcessConnectMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_USE_DB, mgmtProcessUseMsg); tsMgmtTmr = taosTmrInit((tsMaxShellConns) * 3, 200, 3600000, "MND"); tsMgmtTranQhandle = taosInitScheduler(tsMaxShellConns, 1, "mnodeT"); - tsQhandleCache = taosCacheInit(tsMgmtTmr, 2); + tsQhandleCache = taosCacheInit(tsMgmtTmr, 10); - int32_t numOfThreads = tsNumOfCores * tsNumOfThreadsPerCore / 4.0; - if (numOfThreads < 1) { - numOfThreads = 1; - } - - SRpcInit rpcInit = {0}; - rpcInit.localPort = tsMnodeShellPort; - rpcInit.label = "MND-shell"; - rpcInit.numOfThreads = numOfThreads; - rpcInit.cfp = mgmtProcessMsgFromShell; - rpcInit.sessions = tsMaxShellConns; - rpcInit.connType = TAOS_CONN_SERVER; - rpcInit.idleTime = tsShellActivityTimer * 1000; - rpcInit.afp = mgmtShellRetriveAuth; - - tsMgmtShellRpc = rpcOpen(&rpcInit); - if (tsMgmtShellRpc == NULL) { - mError("failed to init server connection to shell"); - return -1; - } - - mPrint("server connection to shell is opened"); return 0; } void mgmtCleanUpShell() { - if (tsMgmtTranQhandle) { - taosCleanUpScheduler(tsMgmtTranQhandle); - tsMgmtTranQhandle = NULL; + if (tsMgmtTmr != NULL){ + taosTmrCleanUp(tsMgmtTmr); + tsMgmtTmr = NULL; } - if (tsMgmtShellRpc) { - rpcClose(tsMgmtShellRpc); - tsMgmtShellRpc = NULL; - mPrint("server connection to shell is closed"); - } - - if (tsQhandleCache) { - taosCacheEmpty(tsQhandleCache); + if (tsQhandleCache != NULL) { taosCacheCleanup(tsQhandleCache); tsQhandleCache = NULL; } + + if (tsMgmtTranQhandle != NULL) { + taosCleanUpScheduler(tsMgmtTranQhandle); + tsMgmtTranQhandle = NULL; + } } void mgmtAddShellMsgHandle(uint8_t showType, void (*fp)(SQueuedMsg *queuedMsg)) { @@ -148,8 +122,7 @@ void mgmtDealyedAddToShellQueue(SQueuedMsg *queuedMsg) { taosTmrReset(mgmtDoDealyedAddToShellQueue, 1000, queuedMsg, tsMgmtTmr, &unUsed); } -static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) { - assert(rpcMsg); +void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) { if (rpcMsg->pCont == NULL) { mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_INVALID_MSG_LEN); @@ -164,7 +137,7 @@ static void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg) { mgmtGetMnodeIpSet(&ipSet); mTrace("conn from shell ip:%s user:%s redirect msg, inUse:%d", taosIpStr(connInfo.clientIp), connInfo.user, ipSet.inUse); for (int32_t i = 0; i < ipSet.numOfIps; ++i) { - mTrace("index:%d ip:%s:%d", i, ipSet.fqdn[i], ipSet.port[i]); + mTrace("mnode index:%d ip:%s:%d", i, ipSet.fqdn[i], htons(ipSet.port[i])); } rpcSendRedirectRsp(rpcMsg->handle, &ipSet); @@ -370,6 +343,7 @@ static void mgmtProcessHeartBeatMsg(SQueuedMsg *pMsg) { rpcSendResponse(&rpcRsp); } +/* static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) { *spi = 1; *encrypt = 0; @@ -390,6 +364,7 @@ static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secr return TSDB_CODE_SUCCESS; } } +*/ static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) { SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0}; @@ -490,7 +465,7 @@ static bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg) { return mgmtCheckTableMetaMsgReadOnly(pMsg); } - if (pMsg->msgType == TSDB_MSG_TYPE_CM_STABLE_VGROUP || pMsg->msgType == TSDB_MSG_TYPE_RETRIEVE || + if (pMsg->msgType == TSDB_MSG_TYPE_CM_STABLE_VGROUP || pMsg->msgType == TSDB_MSG_TYPE_CM_RETRIEVE || pMsg->msgType == TSDB_MSG_TYPE_CM_SHOW || pMsg->msgType == TSDB_MSG_TYPE_CM_TABLES_META || pMsg->msgType == TSDB_MSG_TYPE_CM_CONNECT) { return true; diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 53a208745c..bfe357cf7c 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -24,13 +24,12 @@ #include "tname.h" #include "tidpool.h" #include "tglobal.h" +#include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" -#include "mgmtDClient.h" #include "mgmtDb.h" #include "mgmtDnode.h" -#include "mgmtDServer.h" #include "tgrant.h" #include "mgmtMnode.h" #include "mgmtProfile.h" @@ -539,12 +538,12 @@ int32_t mgmtInitTables() { mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_TABLE_META, mgmtProcessTableMetaMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_STABLE_VGROUP, mgmtProcessSuperTableVgroupMsg); - mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_CREATE_TABLE_RSP, mgmtProcessCreateChildTableRsp); - mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_DROP_TABLE_RSP, mgmtProcessDropChildTableRsp); - mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_DROP_STABLE_RSP, mgmtProcessDropSuperTableRsp); - mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_ALTER_TABLE_RSP, mgmtProcessAlterTableRsp); + dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CREATE_TABLE_RSP, mgmtProcessCreateChildTableRsp); + dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_DROP_TABLE_RSP, mgmtProcessDropChildTableRsp); + dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_DROP_STABLE_RSP, mgmtProcessDropSuperTableRsp); + dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_ALTER_TABLE_RSP, mgmtProcessAlterTableRsp); - mgmtAddDServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_TABLE, mgmtProcessTableCfgMsg); + dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_TABLE, mgmtProcessTableCfgMsg); mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_TABLE, mgmtGetShowTableMeta); mgmtAddShellShowRetrieveHandle(TSDB_MGMT_TABLE_TABLE, mgmtRetrieveShowTables); @@ -702,10 +701,10 @@ static void mgmtProcessDropTableMsg(SQueuedMsg *pMsg) { } if (pMsg->pTable->type == TSDB_SUPER_TABLE) { - mTrace("table:%s, start to drop stable", pDrop->tableId); + mPrint("table:%s, start to drop stable", pDrop->tableId); mgmtProcessDropSuperTableMsg(pMsg); } else { - mTrace("table:%s, start to drop ctable", pDrop->tableId); + mPrint("table:%s, start to drop ctable", pDrop->tableId); mgmtProcessDropChildTableMsg(pMsg); } } @@ -803,36 +802,39 @@ static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) { int32_t vgId = pStable->vgList[vg]; if (vgId == 0) break; + SVgObj *pVgroup = mgmtGetVgroup(vgId); + if (pVgroup == NULL) break; + SMDDropSTableMsg *pDrop = rpcMallocCont(sizeof(SMDDropSTableMsg)); + pDrop->contLen = htonl(sizeof(SMDDropSTableMsg)); pDrop->vgId = htonl(vgId); pDrop->uid = htobe64(pStable->uid); mgmtExtractTableName(pStable->info.tableId, pDrop->tableId); - - SVgObj *pVgroup = mgmtGetVgroup(vgId); - if (pVgroup != NULL) { - SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); - SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; - mgmtSendMsgToDnode(&ipSet, &rpcMsg); - mgmtDecVgroupRef(pVgroup); - } + + mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, vgId); + SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); + SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; + dnodeSendMsgToDnode(&ipSet, &rpcMsg); + mgmtDecVgroupRef(pVgroup); } - } else { - SSdbOper oper = { - .type = SDB_OPER_GLOBAL, - .table = tsSuperTableSdb, - .pObj = pStable - }; - int32_t code = sdbDeleteRow(&oper); - mLPrint("stable:%s, is dropped from sdb, result:%s", pStable->info.tableId, tstrerror(code)); - mgmtSendSimpleResp(pMsg->thandle, code); - } + } + + SSdbOper oper = { + .type = SDB_OPER_GLOBAL, + .table = tsSuperTableSdb, + .pObj = pStable + }; + + int32_t code = sdbDeleteRow(&oper); + mLPrint("stable:%s, is dropped from sdb, result:%s", pStable->info.tableId, tstrerror(code)); + mgmtSendSimpleResp(pMsg->thandle, code); } static int32_t mgmtFindSuperTableTagIndex(SSuperTableObj *pStable, const char *tagName) { - for (int32_t i = 0; i < pStable->numOfTags; i++) { - SSchema *schema = (SSchema *)(pStable->schema + (pStable->numOfColumns + i) * sizeof(SSchema)); - if (strcasecmp(tagName, schema->name) == 0) { - return i; + SSchema *schema = (SSchema *) pStable->schema; + for (int32_t tag = 0; tag < pStable->numOfTags; tag++) { + if (strcasecmp(schema[pStable->numOfColumns + tag].name, tagName) == 0) { + return tag; } } @@ -1304,7 +1306,7 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { } static void mgmtProcessDropSuperTableRsp(SRpcMsg *rpcMsg) { - mTrace("drop stable rsp received, handle:%p code:%s", rpcMsg->handle, tstrerror(rpcMsg->code)); + mPrint("drop stable rsp received, result:%s", tstrerror(rpcMsg->code)); } static void *mgmtBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableObj *pTable) { @@ -1514,7 +1516,7 @@ static void mgmtProcessCreateChildTableMsg(SQueuedMsg *pMsg) { .msgType = TSDB_MSG_TYPE_MD_CREATE_TABLE }; - mgmtSendMsgToDnode(&ipSet, &rpcMsg); + dnodeSendMsgToDnode(&ipSet, &rpcMsg); } static void mgmtProcessDropChildTableMsg(SQueuedMsg *pMsg) { @@ -1541,7 +1543,7 @@ static void mgmtProcessDropChildTableMsg(SQueuedMsg *pMsg) { SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pMsg->pVgroup); - mTrace("table:%s, send drop ctable msg", pDrop->tableId); + mPrint("table:%s, send drop ctable msg", pDrop->tableId); SQueuedMsg *newMsg = mgmtCloneQueuedMsg(pMsg); newMsg->ahandle = pMsg->pTable; SRpcMsg rpcMsg = { @@ -1552,7 +1554,7 @@ static void mgmtProcessDropChildTableMsg(SQueuedMsg *pMsg) { .msgType = TSDB_MSG_TYPE_MD_DROP_TABLE }; - mgmtSendMsgToDnode(&ipSet, &rpcMsg); + dnodeSendMsgToDnode(&ipSet, &rpcMsg); } static int32_t mgmtModifyChildTableTagValue(SChildTableObj *pTable, char *tagName, char *nContent) { @@ -1854,7 +1856,7 @@ static void mgmtProcessTableCfgMsg(SRpcMsg *rpcMsg) { .code = 0, .msgType = TSDB_MSG_TYPE_MD_CREATE_TABLE }; - mgmtSendMsgToDnode(&ipSet, &rpcRsp); + dnodeSendMsgToDnode(&ipSet, &rpcRsp); mgmtDecTableRef(pTable); mgmtDecDnodeRef(pDnode); @@ -1868,7 +1870,7 @@ static void mgmtProcessDropChildTableRsp(SRpcMsg *rpcMsg) { queueMsg->received++; SChildTableObj *pTable = queueMsg->ahandle; - mTrace("table:%s, drop table rsp received, thandle:%p result:%s", pTable->info.tableId, queueMsg->thandle, tstrerror(rpcMsg->code)); + mPrint("table:%s, drop table rsp received, thandle:%p result:%s", pTable->info.tableId, queueMsg->thandle, tstrerror(rpcMsg->code)); if (rpcMsg->code != TSDB_CODE_SUCCESS) { mError("table:%s, failed to drop in dnode, reason:%s", pTable->info.tableId, tstrerror(rpcMsg->code)); diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index b4dd58cb3b..9630ab3d58 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -23,7 +23,7 @@ #include "tdataformat.h" #include "dnode.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtAcct.h" #include "mgmtMnode.h" #include "mgmtSdb.h" @@ -309,11 +309,14 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; if (pUser->superAuth) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "super", 5); + const char *src = "super"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else if (pUser->writeAuth) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "writable", 8); + const char *src = "writable"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else { - STR_WITH_SIZE_TO_VARSTR(pWrite, "readable", 8); + const char *src = "readable"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } cols++; @@ -396,7 +399,7 @@ static void mgmtProcessAlterUserMsg(SQueuedMsg *pMsg) { code = mgmtUpdateUser(pUser); mLPrint("user:%s, password is altered by %s, result:%s", pUser->user, pOperUser->user, tstrerror(code)); } else { - mError("user:%s, no rights to ater user", pOperUser->user); + mError("user:%s, no rights to alter user", pOperUser->user); code = TSDB_CODE_NO_RIGHTS; } @@ -439,13 +442,13 @@ static void mgmtProcessAlterUserMsg(SQueuedMsg *pMsg) { code = mgmtUpdateUser(pUser); mLPrint("user:%s, privilege is altered by %s, result:%s", pUser->user, pOperUser->user, tstrerror(code)); } else { - mError("user:%s, no rights to ater user", pOperUser->user); + mError("user:%s, no rights to alter user", pOperUser->user); code = TSDB_CODE_NO_RIGHTS; } mgmtSendSimpleResp(pMsg->thandle, code); } else { - mError("user:%s, no rights to ater user", pOperUser->user); + mError("user:%s, no rights to alter user", pOperUser->user); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_NO_RIGHTS); } @@ -525,4 +528,4 @@ void mgmtDropAllUsers(SAcctObj *pAcct) { } mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers); -} \ No newline at end of file +} diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index f83268e760..b87c6ad727 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -23,12 +23,11 @@ #include "ttime.h" #include "tbalance.h" #include "tglobal.h" +#include "dnode.h" #include "tdataformat.h" #include "mgmtDef.h" -#include "mgmtLog.h" +#include "mgmtInt.h" #include "mgmtDb.h" -#include "mgmtDClient.h" -#include "mgmtDServer.h" #include "mgmtDnode.h" #include "mgmtMnode.h" #include "mgmtProfile.h" @@ -218,9 +217,9 @@ int32_t mgmtInitVgroups() { mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_VGROUP, mgmtGetVgroupMeta); mgmtAddShellShowRetrieveHandle(TSDB_MGMT_TABLE_VGROUP, mgmtRetrieveVgroups); - mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mgmtProcessCreateVnodeRsp); - mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_DROP_VNODE_RSP, mgmtProcessDropVnodeRsp); - mgmtAddDServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_VNODE, mgmtProcessVnodeCfgMsg); + dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mgmtProcessCreateVnodeRsp); + dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_DROP_VNODE_RSP, mgmtProcessDropVnodeRsp); + dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_VNODE, mgmtProcessVnodeCfgMsg); mTrace("table:vgroups is created"); @@ -495,11 +494,12 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo cols++; } else { pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4); + const char *src = "NULL"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4); + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); cols++; } } @@ -560,7 +560,7 @@ SMDCreateVnodeMsg *mgmtBuildCreateVnodeMsg(SVgObj *pVgroup) { pCfg->commitTime = htonl(pDb->cfg.commitTime); pCfg->precision = pDb->cfg.precision; pCfg->compression = pDb->cfg.compression; - pCfg->commitLog = pDb->cfg.commitLog; + pCfg->walLevel = pDb->cfg.walLevel; pCfg->replications = (int8_t) pVgroup->numOfVnodes; pCfg->wals = 3; pCfg->quorum = 1; @@ -584,7 +584,7 @@ SRpcIpSet mgmtGetIpSetFromVgroup(SVgObj *pVgroup) { }; for (int i = 0; i < pVgroup->numOfVnodes; ++i) { strcpy(ipSet.fqdn[i], pVgroup->vnodeGid[i].pDnode->dnodeFqdn); - ipSet.port[i] = pVgroup->vnodeGid[i].pDnode->dnodePort + TSDB_PORT_DNODEMNODE; + ipSet.port[i] = pVgroup->vnodeGid[i].pDnode->dnodePort + TSDB_PORT_DNODEDNODE; } return ipSet; } @@ -595,7 +595,7 @@ SRpcIpSet mgmtGetIpSetFromIp(char *ep) { ipSet.numOfIps = 1; ipSet.inUse = 0; taosGetFqdnPortFromEp(ep, ipSet.fqdn[0], &ipSet.port[0]); - ipSet.port[0] += TSDB_PORT_DNODEMNODE; + ipSet.port[0] += TSDB_PORT_DNODEDNODE; return ipSet; } @@ -609,7 +609,7 @@ void mgmtSendCreateVnodeMsg(SVgObj *pVgroup, SRpcIpSet *ipSet, void *ahandle) { .code = 0, .msgType = TSDB_MSG_TYPE_MD_CREATE_VNODE }; - mgmtSendMsgToDnode(ipSet, &rpcMsg); + dnodeSendMsgToDnode(ipSet, &rpcMsg); } void mgmtSendCreateVgroupMsg(SVgObj *pVgroup, void *ahandle) { @@ -675,7 +675,7 @@ void mgmtSendDropVnodeMsg(int32_t vgId, SRpcIpSet *ipSet, void *ahandle) { .code = 0, .msgType = TSDB_MSG_TYPE_MD_DROP_VNODE }; - mgmtSendMsgToDnode(ipSet, &rpcMsg); + dnodeSendMsgToDnode(ipSet, &rpcMsg); } static void mgmtSendDropVgroupMsg(SVgObj *pVgroup, void *ahandle) { diff --git a/src/os/linux/CMakeLists.txt b/src/os/linux/CMakeLists.txt index 83d717f905..7be4a13f25 100644 --- a/src/os/linux/CMakeLists.txt +++ b/src/os/linux/CMakeLists.txt @@ -12,3 +12,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ADD_LIBRARY(os ${SRC}) TARGET_LINK_LIBRARIES(os m rt) ENDIF () + +SET_SOURCE_FILES_PROPERTIES(src/linuxSysPara.c PROPERTIES COMPILE_FLAGS -w) diff --git a/src/os/linux/inc/os.h b/src/os/linux/inc/os.h index 27a8363050..cab899753d 100644 --- a/src/os/linux/inc/os.h +++ b/src/os/linux/inc/os.h @@ -23,13 +23,6 @@ extern "C" { #include #include -#ifndef _ALPINE - #include - #include -#else - #include -#endif - #include #include #include @@ -82,6 +75,7 @@ extern "C" { #include #include #include +#include #define taosCloseSocket(x) \ { \ diff --git a/src/mnode/inc/mgmtDServer.h b/src/os/linux/inc/tsysctl.h similarity index 75% rename from src/mnode/inc/mgmtDServer.h rename to src/os/linux/inc/tsysctl.h index 937ae8f1ac..559d5653ee 100644 --- a/src/mnode/inc/mgmtDServer.h +++ b/src/os/linux/inc/tsysctl.h @@ -13,19 +13,18 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_MGMT_DSERVER_H -#define TDENGINE_MGMT_DSERVER_H +#ifndef TDENGINE_TSYSCTL_H +#define TDENGINE_TSYSCTL_H #ifdef __cplusplus extern "C" { #endif -int32_t mgmtInitDServer(); -void mgmtCleanupDServer(); -void mgmtAddDServerMsgHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); - -#ifdef __cplusplus -} +#ifndef _ALPINE + #include + #include +#else + #include #endif #endif diff --git a/src/os/linux/src/linuxSysPara.c b/src/os/linux/src/linuxSysPara.c index f43ed44a4b..8b8607a58d 100644 --- a/src/os/linux/src/linuxSysPara.c +++ b/src/os/linux/src/linuxSysPara.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" +#include "tsysctl.h" #include "tconfig.h" #include "tglobal.h" #include "tulog.h" @@ -356,10 +357,15 @@ static bool taosGetCardName(char *ip, char *name) { break; } - if (strcmp(host, ip) == 0) { - strcpy(name, ifa->ifa_name); - ret = true; + if (strcmp(host, "127.0.0.1") == 0) { + continue; } + + // TODO: the ip not config + // if (strcmp(host, ip) == 0) { + strcpy(name, ifa->ifa_name); + ret = true; + // } } freeifaddrs(ifaddr); diff --git a/src/plugins/http/src/gcJson.c b/src/plugins/http/src/gcJson.c index 09990c123e..544a11b5fc 100644 --- a/src/plugins/http/src/gcJson.c +++ b/src/plugins/http/src/gcJson.c @@ -121,10 +121,11 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, for (int k = 0; k < numOfRows; ++k) { TAOS_ROW row = taos_fetch_row(result); + int32_t* length = taos_fetch_lengths(result); // for group by if (groupFields != -1) { - char target[HTTP_GC_TARGET_SIZE]; + char target[HTTP_GC_TARGET_SIZE] = {0}; int len; len = snprintf(target,HTTP_GC_TARGET_SIZE,"%s{",aliasBuffer); for (int i = dataFields + 1; inumOfThreads; ++i) { pThread = pServer->pThreads + i; + if (pThread == NULL) continue; //taosCloseSocket(pThread->pollFd); - while (pThread->pHead) { - httpCleanUpContext(pThread->pHead, 0); - } + //while (pThread->pHead) { + // httpCleanUpContext(pThread->pHead, 0); + //} pthread_cancel(pThread->thread); pthread_join(pThread->thread, NULL); @@ -504,8 +505,8 @@ void httpAcceptHttpConnection(void *arg) { sockFd = taosOpenTcpServerSocket(pServer->serverIp, pServer->serverPort); if (sockFd < 0) { - httpError("http server:%s, failed to open http socket, ip:%s:%u", pServer->label, pServer->serverIp, - pServer->serverPort); + httpError("http server:%s, failed to open http socket, ip:%s:%u error:%s", pServer->label, taosIpStr(pServer->serverIp), + pServer->serverPort, strerror(errno)); return; } else { httpPrint("http service init success at %u", pServer->serverPort); @@ -645,7 +646,7 @@ bool httpInitConnect(HttpServer *pServer) { } pthread_attr_destroy(&thattr); - httpTrace("http server:%s, initialized, ip:%s:%u, numOfThreads:%d", pServer->label, pServer->serverIp, + httpTrace("http server:%s, initialized, ip:%s:%u, numOfThreads:%d", pServer->label, taosIpStr(pServer->serverIp), pServer->serverPort, pServer->numOfThreads); return true; } diff --git a/src/plugins/http/src/httpSystem.c b/src/plugins/http/src/httpSystem.c index 89dc11796f..8b95077632 100644 --- a/src/plugins/http/src/httpSystem.c +++ b/src/plugins/http/src/httpSystem.c @@ -117,7 +117,7 @@ void httpCleanUpSystem() { httpPrint("http service cleanup"); httpStopSystem(); -#if 0 +//#if 0 if (httpServer == NULL) { return; } @@ -131,7 +131,13 @@ void httpCleanUpSystem() { httpServer->timerHandle = NULL; } - httpCleanUpConnect(httpServer); + if (httpServer->pThreads != NULL) { + httpCleanUpConnect(httpServer); + httpServer->pThreads = NULL; + } + + +#if 0 httpRemoveAllSessions(httpServer); if (httpServer->pContextPool != NULL) { diff --git a/src/plugins/http/src/restJson.c b/src/plugins/http/src/restJson.c index 9277d7d045..2d9c31935c 100644 --- a/src/plugins/http/src/restJson.c +++ b/src/plugins/http/src/restJson.c @@ -94,6 +94,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, for (int k = 0; k < numOfRows; ++k) { TAOS_ROW row = taos_fetch_row(result); + int32_t* length = taos_fetch_lengths(result); // data row array begin httpJsonItemToken(jsonBuf); @@ -129,7 +130,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - httpJsonStringForTransMean(jsonBuf, row[i], fields[i].bytes); + httpJsonStringForTransMean(jsonBuf, row[i], length[i]); break; case TSDB_DATA_TYPE_TIMESTAMP: if (timestampFormat == REST_TIMESTAMP_FMT_LOCAL_STRING) { diff --git a/src/plugins/monitor/src/monitorMain.c b/src/plugins/monitor/src/monitorMain.c index a4f9f32050..76b322d01b 100644 --- a/src/plugins/monitor/src/monitorMain.c +++ b/src/plugins/monitor/src/monitorMain.c @@ -43,8 +43,8 @@ { taosPrintLog("MON ", 255, __VA_ARGS__); } #define SQL_LENGTH 1024 -#define LOG_LEN_STR 80 -#define IP_LEN_STR 15 +#define LOG_LEN_STR 100 +#define IP_LEN_STR 18 #define CHECK_INTERVAL 1000 typedef enum { @@ -115,6 +115,13 @@ static void monitorInitConn(void *para, void *unused) { if (tsMonitorConn.ep[0] == 0) strcpy(tsMonitorConn.ep, tsLocalEp); + int len = strlen(tsMonitorConn.ep); + for (int i = 0; i < len; ++i) { + if (tsMonitorConn.ep[i] == ':' || tsMonitorConn.ep[i] == '-') { + tsMonitorConn.ep[i] = '_'; + } + } + if (tsMonitorConn.conn == NULL) { taos_connect_a(NULL, "monitor", tsInternalPass, "", 0, monitorInitConnCb, &tsMonitorConn, &(tsMonitorConn.conn)); } else { @@ -141,8 +148,8 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) { if (cmd == MONITOR_CMD_CREATE_DB) { snprintf(sql, SQL_LENGTH, - "create database if not exists %s replica 1 days 10 keep 30 rows 1024 cache 2048 " - "ablocks 2 tblocks 32 tables 32 precision 'us'", + "create database if not exists %s replica 1 days 10 keep 30 cache 1 " + "blocks 2 maxtables 16 precision 'us'", tsMonitorDbName); } else if (cmd == MONITOR_CMD_CREATE_MT_DN) { snprintf(sql, SQL_LENGTH, @@ -153,11 +160,11 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) { ", band_speed float" ", io_read float, io_write float" ", req_http int, req_select int, req_insert int" - ") tags (ipaddr binary(%d))", - tsMonitorDbName, IP_LEN_STR + 1); + ") tags (dnodeid int, fqdn binary(%d))", + tsMonitorDbName, TSDB_FQDN_LEN + 1); } else if (cmd == MONITOR_CMD_CREATE_TB_DN) { - snprintf(sql, SQL_LENGTH, "create table if not exists %s.dn_%s using %s.dn tags('%s')", tsMonitorDbName, - tsMonitorConn.ep, tsMonitorDbName, tsLocalEp); + snprintf(sql, SQL_LENGTH, "create table if not exists %s.dn%d using %s.dn tags(%d, '%s')", tsMonitorDbName, + dnodeGetDnodeId(), tsMonitorDbName, dnodeGetDnodeId(), tsLocalEp); } else if (cmd == MONITOR_CMD_CREATE_MT_ACCT) { snprintf(sql, SQL_LENGTH, "create table if not exists %s.acct(ts timestamp " @@ -340,7 +347,7 @@ static void monitorSaveSystemInfo() { int64_t ts = taosGetTimestampUs(); char * sql = tsMonitorConn.sql; - int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.dn_%s values(%" PRId64, tsMonitorDbName, tsMonitorConn.ep, ts); + int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.dn%d values(%" PRId64, tsMonitorDbName, dnodeGetDnodeId(), ts); pos += monitorBuildCpuSql(sql + pos); pos += monitorBuildMemorySql(sql + pos); @@ -400,7 +407,7 @@ void monitorSaveLog(int32_t level, const char *const format, ...) { if (tsMonitorConn.state != MONITOR_STATE_INITIALIZED) return; - int32_t len = snprintf(sql, (size_t)max_length, "import into %s.log values(%" PRId64 ", %d,'", tsMonitorDbName, + int32_t len = snprintf(sql, (size_t)max_length, "insert into %s.log values(%" PRId64 ", %d,'", tsMonitorDbName, taosGetTimestampUs(), level); va_start(argpointer, format); diff --git a/src/query/inc/qast.h b/src/query/inc/qast.h index 8698b3af82..9bc36413de 100644 --- a/src/query/inc/qast.h +++ b/src/query/inc/qast.h @@ -48,16 +48,16 @@ typedef struct tQueryInfo { int32_t colIndex; // index of column in schema uint8_t optr; // expression operator SSchema sch; // schema of tags -// tVariant q; // query condition value on the specific schema, filter expression char* q; __compar_fn_t compare; // filter function + void* param; // STSchema, } tQueryInfo; -typedef struct SBinaryFilterSupp { +typedef struct SExprTraverseSupp { __result_filter_fn_t fp; __do_filter_suppl_fn_t setupInfoFn; void * pExtInfo; -} SBinaryFilterSupp; +} SExprTraverseSupp; typedef struct tExprNode { uint8_t nodeType; @@ -81,7 +81,7 @@ void tSQLBinaryExprToString(tExprNode *pExpr, char *dst, int32_t *len); void tExprTreeDestroy(tExprNode **pExprs, void (*fp)(void*)); -void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, SBinaryFilterSupp *param); +void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, SExprTraverseSupp *param); void tExprTreeCalcTraverse(tExprNode *pExprs, int32_t numOfRows, char *pOutput, void *param, int32_t order, char *(*cb)(void *, const char*, int32_t)); diff --git a/src/query/inc/qsqlparser.h b/src/query/inc/qsqlparser.h index 08d4186291..d2fad227e6 100644 --- a/src/query/inc/qsqlparser.h +++ b/src/query/inc/qsqlparser.h @@ -111,13 +111,13 @@ typedef struct SCreateDBInfo { SSQLToken dbname; int32_t replica; int32_t cacheBlockSize; - int32_t tablesPerVnode; + int32_t maxTablesPerVnode; + int32_t numOfBlocks; int32_t daysPerFile; - int32_t rowPerFileBlock; - float numOfAvgCacheBlocks; - int32_t numOfBlocksPerTable; + int32_t minRowsPerBlock; + int32_t maxRowsPerBlock; int64_t commitTime; - int32_t commitLog; + int32_t walLevel; int32_t compressionLevel; SSQLToken precision; bool ignoreExists; diff --git a/src/query/inc/queryLog.h b/src/query/inc/queryLog.h index 2c77ee6032..4894d67e04 100644 --- a/src/query/inc/queryLog.h +++ b/src/query/inc/queryLog.h @@ -22,20 +22,20 @@ extern "C" { #include "tlog.h" -extern int32_t qdebugFlag; +extern int32_t qDebugFlag; #define qTrace(...) \ - if (qdebugFlag & DEBUG_TRACE) { \ - taosPrintLog("DND QRY ", qdebugFlag, __VA_ARGS__); \ + if (qDebugFlag & DEBUG_TRACE) { \ + taosPrintLog("DND QRY ", qDebugFlag, __VA_ARGS__); \ } #define qError(...) \ - if (qdebugFlag & DEBUG_ERROR) { \ - taosPrintLog("ERROR QRY ", qdebugFlag, __VA_ARGS__); \ + if (qDebugFlag & DEBUG_ERROR) { \ + taosPrintLog("ERROR QRY ", qDebugFlag, __VA_ARGS__); \ } #define qWarn(...) \ - if (qdebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN QRY ", qdebugFlag, __VA_ARGS__); \ + if (qDebugFlag & DEBUG_WARN) { \ + taosPrintLog("WARN QRY ", qDebugFlag, __VA_ARGS__); \ } #ifdef __cplusplus diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index be8d922a84..dd104ba2d2 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -212,31 +212,30 @@ acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K %destructor keep {tVariantListDestroy($$);} keep(Y) ::= KEEP tagitemlist(X). { Y = X; } -tables(Y) ::= TABLES INTEGER(X). { Y = X; } +tables(Y) ::= MAXTABLES INTEGER(X). { Y = X; } cache(Y) ::= CACHE INTEGER(X). { Y = X; } replica(Y) ::= REPLICA INTEGER(X). { Y = X; } days(Y) ::= DAYS INTEGER(X). { Y = X; } -rows(Y) ::= ROWS INTEGER(X). { Y = X; } - -ablocks(Y) ::= ABLOCKS ID(X). { Y = X; } -tblocks(Y) ::= TBLOCKS INTEGER(X). { Y = X; } +minrows(Y) ::= MINROWS INTEGER(X). { Y = X; } +maxrows(Y) ::= MAXROWS INTEGER(X). { Y = X; } +blocks(Y) ::= BLOCKS INTEGER(X). { Y = X; } ctime(Y) ::= CTIME INTEGER(X). { Y = X; } -clog(Y) ::= CLOG INTEGER(X). { Y = X; } +wal(Y) ::= WAL INTEGER(X). { Y = X; } comp(Y) ::= COMP INTEGER(X). { Y = X; } prec(Y) ::= PRECISION STRING(X). { Y = X; } %type db_optr {SCreateDBInfo} db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);} -db_optr(Y) ::= db_optr(Z) tables(X). { Y = Z; Y.tablesPerVnode = strtol(X.z, NULL, 10); } +db_optr(Y) ::= db_optr(Z) tables(X). { Y = Z; Y.maxTablesPerVnode = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) days(X). { Y = Z; Y.daysPerFile = strtol(X.z, NULL, 10); } -db_optr(Y) ::= db_optr(Z) rows(X). { Y = Z; Y.rowPerFileBlock = strtol(X.z, NULL, 10); } -db_optr(Y) ::= db_optr(Z) ablocks(X). { Y = Z; Y.numOfAvgCacheBlocks = strtod(X.z, NULL); } -db_optr(Y) ::= db_optr(Z) tblocks(X). { Y = Z; Y.numOfBlocksPerTable = strtol(X.z, NULL, 10); } +db_optr(Y) ::= db_optr(Z) minrows(X). { Y = Z; Y.minRowsPerBlock = strtod(X.z, NULL); } +db_optr(Y) ::= db_optr(Z) maxrows(X). { Y = Z; Y.maxRowsPerBlock = strtod(X.z, NULL); } +db_optr(Y) ::= db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) ctime(X). { Y = Z; Y.commitTime = strtol(X.z, NULL, 10); } -db_optr(Y) ::= db_optr(Z) clog(X). { Y = Z; Y.commitLog = strtol(X.z, NULL, 10); } +db_optr(Y) ::= db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) prec(X). { Y = Z; Y.precision = X; } db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; } @@ -245,7 +244,11 @@ db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; } alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y);} alter_db_optr(Y) ::= alter_db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); } -alter_db_optr(Y) ::= alter_db_optr(Z) tables(X). { Y = Z; Y.tablesPerVnode = strtol(X.z, NULL, 10); } +alter_db_optr(Y) ::= alter_db_optr(Z) tables(X). { Y = Z; Y.maxTablesPerVnode = strtol(X.z, NULL, 10); } +alter_db_optr(Y) ::= alter_db_optr(Z) keep(X). { Y = Z; Y.keep = X; } +alter_db_optr(Y) ::= alter_db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); } +alter_db_optr(Y) ::= alter_db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); } +alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); } %type typename {TAOS_FIELD} typename(A) ::= ids(X). { tSQLSetColumnType (&A, &X); } @@ -652,5 +655,5 @@ cmd ::= KILL QUERY IPTOKEN(X) COLON(Z) INTEGER(Y) COLON(K) INTEGER(F). {X DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY OF OFFSET RAISE REPLACE RESTRICT ROW STATEMENT TRIGGER VIEW ALL COUNT SUM AVG MIN MAX FIRST LAST TOP BOTTOM STDDEV PERCENTILE APERCENTILE LEASTSQUARES HISTOGRAM DIFF - SPREAD TWA INTERP LAST_ROW RATE IRATE SUM_RATE SUM_IRATE AVG_RATE AVG_IRATE NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT + SPREAD TWA INTERP LAST_ROW RATE IRATE SUM_RATE SUM_IRATE AVG_RATE AVG_IRATE TBID NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT METRIC TBNAME JOIN METRICS STABLE NULL INSERT INTO VALUES. diff --git a/src/query/inc/tsqlfunction.h b/src/query/inc/tsqlfunction.h index b148410bfb..a92f401323 100644 --- a/src/query/inc/tsqlfunction.h +++ b/src/query/inc/tsqlfunction.h @@ -119,6 +119,7 @@ typedef struct SArithmeticSupport { SExprInfo *pArithExpr; int32_t numOfCols; SColumnInfo *colList; + SArray* exprList; // client side used int32_t offset; char** data; } SArithmeticSupport; @@ -220,7 +221,7 @@ typedef struct SQLAggFuncElem { #define GET_RES_INFO(ctx) ((ctx)->resultInfo) int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionId, int32_t param, int16_t *type, - int16_t *len, int16_t *interResBytes, int16_t extLength, bool isSuperTable); + int16_t *len, int16_t *interBytes, int16_t extLength, bool isSuperTable); #define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0) #define IS_MULTIOUTPUT(x) (((x)&TSDB_FUNCSTATE_MO) != 0) @@ -244,21 +245,8 @@ enum { BLK_DATA_ALL_NEEDED = 0x3, }; -#define IS_FILE_BLOCK(x) (((x)&BLK_FILE_BLOCK) != 0) - -#define SET_FILE_BLOCK_FLAG(x) \ - do { \ - (x) &= (~BLK_CACHE_BLOCK); \ - (x) |= BLK_FILE_BLOCK; \ - } while (0); - -#define SET_CACHE_BLOCK_FLAG(x) ((x) = BLK_CACHE_BLOCK | BLK_BLOCK_LOADED); - #define SET_DATA_BLOCK_NOT_LOADED(x) ((x) &= (~BLK_BLOCK_LOADED)); -#define SET_DATA_BLOCK_LOADED(x) ((x) |= BLK_BLOCK_LOADED); -#define IS_DATA_BLOCK_LOADED(x) (((x)&BLK_BLOCK_LOADED) != 0) - typedef struct STwaInfo { TSKEY lastKey; int8_t hasResult; // flag to denote has value @@ -290,7 +278,6 @@ bool top_bot_datablock_filter(SQLFunctionCtx *pCtx, int32_t functionId, char *mi bool stableQueryFunctChanged(int32_t funcId); - void resetResultInfo(SResultInfo *pResInfo); void initResultInfo(SResultInfo *pResInfo); void setResultInfoBuf(SResultInfo *pResInfo, int32_t size, bool superTable); diff --git a/src/query/src/qast.c b/src/query/src/qast.c index e78f36ed31..98682ce778 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -544,13 +544,11 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr setQueryCond(pQueryInfo, &cond); if (cond.start != NULL) { - iter = tSkipListCreateIterFromVal(pSkipList, (char*) &cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC); + iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC); } else { - iter = tSkipListCreateIterFromVal(pSkipList, (char*) &cond.end->v, pSkipList->keyInfo.type, TSDB_ORDER_DESC); + iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.end->v, pSkipList->keyInfo.type, TSDB_ORDER_DESC); } - __compar_fn_t func = getKeyComparFunc(pSkipList->keyInfo.type); - if (cond.start != NULL) { int32_t optr = cond.start->optr; @@ -558,7 +556,7 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr while(tSkipListIterNext(iter)) { SSkipListNode* pNode = tSkipListIterGet(iter); - int32_t ret = func(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v); + int32_t ret = pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v); if (ret == 0) { taosArrayPush(result, SL_GET_NODE_DATA(pNode)); } else { @@ -573,7 +571,7 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr SSkipListNode* pNode = tSkipListIterGet(iter); if (comp) { - ret = func(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v); + ret = pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v); assert(ret >= 0); } @@ -600,7 +598,7 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr SSkipListNode* pNode = tSkipListIterGet(iter); if (comp) { - ret = func(SL_GET_NODE_KEY(pSkipList, pNode), cond.end->v); + ret = pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.end->v); assert(ret <= 0); } @@ -708,7 +706,7 @@ static void tArrayTraverse(tExprNode *pExpr, __result_filter_fn_t fp, SArray *pR } } -static bool filterItem(tExprNode *pExpr, const void *pItem, SBinaryFilterSupp *param) { +static bool filterItem(tExprNode *pExpr, const void *pItem, SExprTraverseSupp *param) { tExprNode *pLeft = pExpr->_node.pLeft; tExprNode *pRight = pExpr->_node.pRight; @@ -747,7 +745,7 @@ static bool filterItem(tExprNode *pExpr, const void *pItem, SBinaryFilterSupp *p * @param pSchema tag schemas * @param fp filter callback function */ -static void exprTreeTraverseImpl(tExprNode *pExpr, SArray *pResult, SBinaryFilterSupp *param) { +static void exprTreeTraverseImpl(tExprNode *pExpr, SArray *pResult, SExprTraverseSupp *param) { size_t size = taosArrayGetSize(pResult); SArray* array = taosArrayInit(size, POINTER_BYTES); @@ -763,7 +761,7 @@ static void exprTreeTraverseImpl(tExprNode *pExpr, SArray *pResult, SBinaryFilte } -static void tSQLBinaryTraverseOnSkipList(tExprNode *pExpr, SArray *pResult, SSkipList *pSkipList, SBinaryFilterSupp *param ) { +static void tSQLBinaryTraverseOnSkipList(tExprNode *pExpr, SArray *pResult, SSkipList *pSkipList, SExprTraverseSupp *param ) { SSkipListIterator* iter = tSkipListCreateIter(pSkipList); while (tSkipListIterNext(iter)) { @@ -813,7 +811,7 @@ static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, // post-root order traverse syntax tree -void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, SBinaryFilterSupp *param) { +void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, SExprTraverseSupp *param) { if (pExpr == NULL) { return; } @@ -979,7 +977,8 @@ void tExprTreeCalcTraverse(tExprNode *pExprs, int32_t numOfRows, char *pOutput, } else if (pRight->nodeType == TSQL_NODE_COL) { // 12 + columnRight // column data specified on right-hand-side - char * pRightInputData = getSourceDataBlock(param, pRight->pSchema->name, pRight->pSchema->colId); + char *pRightInputData = getSourceDataBlock(param, pRight->pSchema->name, pRight->pSchema->colId); + _bi_consumer_fn_t fp = tGetBiConsumerFn(pLeft->pVal->nType, pRight->pSchema->type, pExprs->_node.optr); fp(&pLeft->pVal->i64Key, pRightInputData, 1, numOfRows, pOutput, order); diff --git a/src/query/src/qparserImpl.c b/src/query/src/qparserImpl.c index d8e48de918..b8d1189129 100644 --- a/src/query/src/qparserImpl.c +++ b/src/query/src/qparserImpl.c @@ -52,6 +52,8 @@ int32_t tSQLParse(SSqlInfo *pSQLInfo, const char *pStr) { Parse(pParser, 0, t0, pSQLInfo); goto abort_parse; } + + case TK_QUESTION: case TK_ILLEGAL: { snprintf(pSQLInfo->pzErrMsg, tListLen(pSQLInfo->pzErrMsg), "unrecognized token: \"%s\"", t0.z); pSQLInfo->valid = false; @@ -818,7 +820,7 @@ void setCreateDBSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pToken, SCreateDBI pInfo->pDCLInfo->dbOpt = *pDB; pInfo->pDCLInfo->dbOpt.dbname = *pToken; - pInfo->pDCLInfo->dbOpt.ignoreExists = (pIgExists != NULL); + pInfo->pDCLInfo->dbOpt.ignoreExists = (pIgExists->z != NULL); } void setCreateAcctSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pName, SSQLToken *pPwd, SCreateAcctSQL *pAcctInfo) { @@ -886,16 +888,16 @@ void setKillSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *ip) { } void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) { - pDBInfo->numOfBlocksPerTable = 50; pDBInfo->compressionLevel = -1; - pDBInfo->commitLog = -1; + pDBInfo->walLevel = -1; pDBInfo->commitTime = -1; - pDBInfo->tablesPerVnode = -1; - pDBInfo->numOfAvgCacheBlocks = -1; + pDBInfo->maxTablesPerVnode = -1; pDBInfo->cacheBlockSize = -1; - pDBInfo->rowPerFileBlock = -1; + pDBInfo->numOfBlocks = -1; + pDBInfo->maxRowsPerBlock = -1; + pDBInfo->minRowsPerBlock = -1; pDBInfo->daysPerFile = -1; pDBInfo->replica = -1; diff --git a/src/query/src/qtokenizer.c b/src/query/src/qtokenizer.c index 51b196a9da..fc8e712530 100644 --- a/src/query/src/qtokenizer.c +++ b/src/query/src/qtokenizer.c @@ -117,12 +117,13 @@ static SKeyword keywordTable[] = { {"KEEP", TK_KEEP}, {"REPLICA", TK_REPLICA}, {"DAYS", TK_DAYS}, - {"ROWS", TK_ROWS}, + {"MINROWS", TK_MINROWS}, + {"MAXROWS", TK_MAXROWS}, + {"BLOCKS", TK_BLOCKS}, + {"MAXTABLES", TK_MAXTABLES}, {"CACHE", TK_CACHE}, - {"ABLOCKS", TK_ABLOCKS}, - {"TBLOCKS", TK_TBLOCKS}, {"CTIME", TK_CTIME}, - {"CLOG", TK_CLOG}, + {"WAL", TK_WAL}, {"COMP", TK_COMP}, {"PRECISION", TK_PRECISION}, {"LP", TK_LP}, @@ -224,6 +225,7 @@ static SKeyword keywordTable[] = { {"TBNAME", TK_TBNAME}, {"JOIN", TK_JOIN}, {"METRICS", TK_METRICS}, + {"TBID", TK_TBID}, {"STABLE", TK_STABLE}, {"FILE", TK_FILE}, {"VNODES", TK_VNODES}, @@ -265,11 +267,15 @@ static pthread_once_t keywordsHashTableInit = PTHREAD_ONCE_INIT; int tSQLKeywordCode(const char* z, int n) { pthread_once(&keywordsHashTableInit, doInitKeywordsTable); - - char key[128] = {0}; + + char key[512] = {0}; + if (n > tListLen(key)) { // too long token, can not be any other token type + return TK_ID; + } + for (int32_t j = 0; j < n; ++j) { if (z[j] >= 'a' && z[j] <= 'z') { - key[j] = (char)(z[j] & 0xDF); // touppercase and set the null-terminated + key[j] = (char)(z[j] & 0xDF); // to uppercase and set the null-terminated } else { key[j] = z[j]; } diff --git a/src/query/src/queryExecutor.c b/src/query/src/queryExecutor.c index e8abe9d819..0ffc665e55 100644 --- a/src/query/src/queryExecutor.c +++ b/src/query/src/queryExecutor.c @@ -39,10 +39,10 @@ #define TSDB_COL_IS_TAG(f) (((f)&TSDB_COL_TAG) != 0) #define QUERY_IS_ASC_QUERY(q) (GET_FORWARD_DIRECTION_FACTOR((q)->order.order) == QUERY_ASC_FORWARD_STEP) -#define IS_MASTER_SCAN(runtime) (((runtime)->scanFlag & 1u) == MASTER_SCAN) -#define IS_SUPPLEMENT_SCAN(runtime) ((runtime)->scanFlag == SUPPLEMENTARY_SCAN) -#define SET_SUPPLEMENT_SCAN_FLAG(runtime) ((runtime)->scanFlag = SUPPLEMENTARY_SCAN) -#define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN) +#define IS_MASTER_SCAN(runtime) ((runtime)->scanFlag == MASTER_SCAN) +#define IS_REVERSE_SCAN(runtime) ((runtime)->scanFlag == SUPPLEMENTARY_SCAN) +#define SET_MASTER_SCAN_FLAG(runtime) ((runtime)->scanFlag = MASTER_SCAN) +#define SET_REVERSE_SCAN_FLAG(runtime) ((runtime)->scanFlag = SUPPLEMENTARY_SCAN) #define GET_QINFO_ADDR(x) ((void *)((char *)(x)-offsetof(SQInfo, runtimeEnv))) @@ -1101,7 +1101,7 @@ static bool functionNeedToExecute(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx } // in the supplementary scan, only the following functions need to be executed - if (IS_SUPPLEMENT_SCAN(pRuntimeEnv) && + if (IS_REVERSE_SCAN(pRuntimeEnv) && !(functionId == TSDB_FUNC_LAST_DST || functionId == TSDB_FUNC_FIRST_DST || functionId == TSDB_FUNC_FIRST || functionId == TSDB_FUNC_LAST || functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TS)) { return false; @@ -1402,7 +1402,7 @@ static void setCtxTagColumnInfo(SQuery *pQuery, SQLFunctionCtx *pCtx) { static void setWindowResultInfo(SResultInfo *pResultInfo, SQuery *pQuery, bool isStableQuery) { for (int32_t i = 0; i < pQuery->numOfOutput; ++i) { - setResultInfoBuf(&pResultInfo[i], pQuery->pSelectExpr[i].interResBytes, isStableQuery); + setResultInfoBuf(&pResultInfo[i], pQuery->pSelectExpr[i].interBytes, isStableQuery); } } @@ -2450,8 +2450,7 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) { qTrace("QInfo:%p query start, qrange:%" PRId64 "-%" PRId64 ", lastkey:%" PRId64 ", order:%d", GET_QINFO_ADDR(pRuntimeEnv), pQuery->window.skey, pQuery->window.ekey, pQuery->lastKey, pQuery->order.order); - TsdbQueryHandleT pQueryHandle = - pRuntimeEnv->scanFlag == MASTER_SCAN ? pRuntimeEnv->pQueryHandle : pRuntimeEnv->pSecQueryHandle; + TsdbQueryHandleT pQueryHandle = IS_MASTER_SCAN(pRuntimeEnv)? pRuntimeEnv->pQueryHandle : pRuntimeEnv->pSecQueryHandle; while (tsdbNextDataBlock(pQueryHandle)) { if (isQueryKilled(GET_QINFO_ADDR(pRuntimeEnv))) { return 0; @@ -2835,11 +2834,12 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) { return; // failed to save data in the disk } - // set current query completed - // if (pQInfo->numOfGroupResultPages == 0 && pQInfo->groupIndex == pQInfo->pSidSet->numOfSubSet) { - // pQInfo->tableIndex = pQInfo->pSidSet->numOfTables; - // return; - // } + // check if all results has been sent to client + int32_t numOfGroup = taosArrayGetSize(pQInfo->groupInfo.pGroupList); + if (pQInfo->numOfGroupResultPages == 0 && pQInfo->groupIndex == numOfGroup) { + pQInfo->tableIndex = pQInfo->groupInfo.numOfTables; // set query completed + return; + } } SQueryRuntimeEnv * pRuntimeEnv = &pQInfo->runtimeEnv; @@ -3087,7 +3087,31 @@ void setTableDataInfo(STableQueryInfo *pTableQueryInfo, int32_t tableIndex, int3 pTableQueryInfo->tableIndex = tableIndex; } -static void doDisableFunctsForSupplementaryScan(SQuery *pQuery, SWindowResInfo *pWindowResInfo, int32_t order) { +static void updateTableQueryInfoForReverseScan(SQuery *pQuery, STableQueryInfo *pTableQueryInfo) { + if (pTableQueryInfo == NULL) { + return; + } + + // order has change already! + int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); + if (!QUERY_IS_ASC_QUERY(pQuery)) { + assert(pTableQueryInfo->win.ekey >= pTableQueryInfo->lastKey + step); + } else { + assert(pTableQueryInfo->win.ekey <= pTableQueryInfo->lastKey + step); + } + + pTableQueryInfo->win.ekey = pTableQueryInfo->lastKey + step; + + SWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey, TSKEY); + pTableQueryInfo->lastKey = pTableQueryInfo->win.skey; + + SWITCH_ORDER(pTableQueryInfo->cur.order); + pTableQueryInfo->cur.vgroupIndex = -1; +} + +static void disableFuncInReverseScanImpl(SQInfo* pQInfo, SWindowResInfo *pWindowResInfo, int32_t order) { + SQuery* pQuery = pQInfo->runtimeEnv.pQuery; + for (int32_t i = 0; i < pWindowResInfo->size; ++i) { SWindowStatus *pStatus = getTimeWindowResStatus(pWindowResInfo, i); if (!pStatus->closed) { @@ -3108,18 +3132,32 @@ static void doDisableFunctsForSupplementaryScan(SQuery *pQuery, SWindowResInfo * } } } + + int32_t numOfGroups = taosArrayGetSize(pQInfo->groupInfo.pGroupList); + + for(int32_t i = 0; i < numOfGroups; ++i) { + SArray *group = taosArrayGetP(pQInfo->groupInfo.pGroupList, i); + qTrace("QInfo:%p no result in group %d, continue", pQInfo, pQInfo->groupIndex - 1); + + size_t t = taosArrayGetSize(group); + for (int32_t j = 0; j < t; ++j) { + SGroupItem *item = taosArrayGet(group, j); + updateTableQueryInfoForReverseScan(pQuery, item->info); + } + } } -void disableFuncInReverseScan(SQueryRuntimeEnv *pRuntimeEnv) { +void disableFuncInReverseScan(SQInfo *pQInfo) { + SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv; SQuery *pQuery = pRuntimeEnv->pQuery; int32_t order = pQuery->order.order; // group by normal columns and interval query on normal table SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo; if (isGroupbyNormalCol(pQuery->pGroupbyExpr) || isIntervalQuery(pQuery)) { - doDisableFunctsForSupplementaryScan(pQuery, pWindowResInfo, order); + disableFuncInReverseScanImpl(pQInfo, pWindowResInfo, order); } else { // for simple result of table query, - for (int32_t j = 0; j < pQuery->numOfOutput; ++j) { + for (int32_t j = 0; j < pQuery->numOfOutput; ++j) { // todo refactor int32_t functId = pQuery->pSelectExpr[j].base.functionId; SQLFunctionCtx *pCtx = &pRuntimeEnv->pCtx[j]; @@ -3134,34 +3172,10 @@ void disableFuncInReverseScan(SQueryRuntimeEnv *pRuntimeEnv) { } } -void disableFuncForReverseScan(SQInfo *pQInfo, int32_t order) { - SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; - SQuery * pQuery = pRuntimeEnv->pQuery; - - for (int32_t i = 0; i < pQuery->numOfOutput; ++i) { - pRuntimeEnv->pCtx[i].order = (pRuntimeEnv->pCtx[i].order) ^ 1u; - } - - if (isIntervalQuery(pQuery)) { - // for (int32_t i = 0; i < pQInfo->groupInfo.numOfTables; ++i) { - // STableQueryInfo *pTableQueryInfo = pQInfo->pTableQueryInfo[i].pTableQInfo; - // SWindowResInfo * pWindowResInfo = &pTableQueryInfo->windowResInfo; - // - // doDisableFunctsForSupplementaryScan(pQuery, pWindowResInfo, order); - // } - } else { - SWindowResInfo *pWindowResInfo = &pRuntimeEnv->windowResInfo; - doDisableFunctsForSupplementaryScan(pQuery, pWindowResInfo, order); - } - - pQuery->order.order = (pQuery->order.order) ^ 1u; -} - void switchCtxOrder(SQueryRuntimeEnv *pRuntimeEnv) { SQuery *pQuery = pRuntimeEnv->pQuery; for (int32_t i = 0; i < pQuery->numOfOutput; ++i) { - SWITCH_ORDER(pRuntimeEnv->pCtx[i] - .order); // = (pRuntimeEnv->pCtx[i].order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC; + SWITCH_ORDER(pRuntimeEnv->pCtx[i] .order); } } @@ -3358,7 +3372,7 @@ static void setEnvBeforeReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusI SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY); SWITCH_ORDER(pQuery->order.order); - SET_SUPPLEMENT_SCAN_FLAG(pRuntimeEnv); + SET_REVERSE_SCAN_FLAG(pRuntimeEnv); STsdbQueryCond cond = { .twindow = pQuery->window, @@ -3376,7 +3390,7 @@ static void setEnvBeforeReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusI setQueryStatus(pQuery, QUERY_NOT_COMPLETED); switchCtxOrder(pRuntimeEnv); - disableFuncInReverseScan(pRuntimeEnv); + disableFuncInReverseScan(pQInfo); } static void clearEnvAfterReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusInfo *pStatus) { @@ -3533,28 +3547,6 @@ void destroyTableQueryInfo(STableQueryInfo *pTableQueryInfo, int32_t numOfCols) free(pTableQueryInfo); } -void changeMeterQueryInfoForSuppleQuery(SQuery *pQuery, STableQueryInfo *pTableQueryInfo) { - if (pTableQueryInfo == NULL) { - return; - } - - // order has change already! - int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); - if (!QUERY_IS_ASC_QUERY(pQuery)) { - assert(pTableQueryInfo->win.ekey >= pTableQueryInfo->lastKey + step); - } else { - assert(pTableQueryInfo->win.ekey <= pTableQueryInfo->lastKey + step); - } - - pTableQueryInfo->win.ekey = pTableQueryInfo->lastKey + step; - - SWAP(pTableQueryInfo->win.skey, pTableQueryInfo->win.ekey, TSKEY); - pTableQueryInfo->lastKey = pTableQueryInfo->win.skey; - - pTableQueryInfo->cur.order = pTableQueryInfo->cur.order ^ 1u; - pTableQueryInfo->cur.vgroupIndex = -1; -} - void restoreIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, STableQueryInfo *pTableQueryInfo) { SQuery *pQuery = pRuntimeEnv->pQuery; @@ -3943,9 +3935,16 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data data += bytes * numOfRows; } + // all data returned, set query over if (Q_STATUS_EQUAL(pQuery->status, QUERY_COMPLETED)) { - setQueryStatus(pQuery, QUERY_OVER); + if (pQInfo->runtimeEnv.stableQuery && isIntervalQuery(pQuery)) { + if (pQInfo->tableIndex >= pQInfo->groupInfo.numOfTables) { + setQueryStatus(pQuery, QUERY_OVER); + } + } else { + setQueryStatus(pQuery, QUERY_OVER); + } } } @@ -4233,10 +4232,12 @@ int32_t doInitQInfo(SQInfo *pQInfo, void *param, void *tsdb, int32_t vgId, bool // normal query setup the queryhandle here - if (isFirstLastRowQuery(pQuery) && !isSTableQuery) { // in case of last_row query, invoke a different API. - pRuntimeEnv->pQueryHandle = tsdbQueryLastRow(tsdb, &cond, &pQInfo->tableIdGroupInfo); - } else if (!isSTableQuery || isIntervalQuery(pQuery) || isFixedOutputQuery(pQuery)) { - pRuntimeEnv->pQueryHandle = tsdbQueryTables(tsdb, &cond, &pQInfo->tableIdGroupInfo); + if (!onlyQueryTags(pQuery)) { + if (!isSTableQuery && isFirstLastRowQuery(pQuery)) { // in case of last_row query, invoke a different API. + pRuntimeEnv->pQueryHandle = tsdbQueryLastRow(tsdb, &cond, &pQInfo->tableIdGroupInfo); + } else if (!isSTableQuery || isIntervalQuery(pQuery) || isFixedOutputQuery(pQuery)) { + pRuntimeEnv->pQueryHandle = tsdbQueryTables(tsdb, &cond, &pQInfo->tableIdGroupInfo); + } } pQInfo->tsdb = tsdb; @@ -4366,7 +4367,8 @@ static int64_t queryOnDataBlocks(SQInfo *pQInfo) { int64_t st = taosGetTimestampMs(); - TsdbQueryHandleT *pQueryHandle = pRuntimeEnv->pQueryHandle; + TsdbQueryHandleT pQueryHandle = IS_MASTER_SCAN(pRuntimeEnv)? pRuntimeEnv->pQueryHandle : pRuntimeEnv->pSecQueryHandle; + while (tsdbNextDataBlock(pQueryHandle)) { if (isQueryKilled(pQInfo)) { break; @@ -4398,7 +4400,7 @@ static int64_t queryOnDataBlocks(SQInfo *pQInfo) { } } - assert(pTableQueryInfo != NULL && pTableQueryInfo != NULL); + assert(pTableQueryInfo != NULL); restoreIntervalQueryRange(pRuntimeEnv, pTableQueryInfo); SDataStatis *pStatis = NULL; @@ -4757,28 +4759,35 @@ static void createTableQueryInfo(SQInfo *pQInfo) { } } -static void prepareQueryInfoForReverseScan(SQInfo *pQInfo) { - // SQuery *pQuery = pQInfo->runtimeEnv.pQuery; - - // for (int32_t i = 0; i < pQInfo->groupInfo.numOfTables; ++i) { - // STableQueryInfo *pTableQueryInfo = pQInfo->pTableQueryInfo[i].pTableQInfo; - // changeMeterQueryInfoForSuppleQuery(pQuery, pTableQueryInfo); - // } -} - static void doSaveContext(SQInfo *pQInfo) { SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; SQuery * pQuery = pRuntimeEnv->pQuery; - SET_SUPPLEMENT_SCAN_FLAG(pRuntimeEnv); - disableFuncForReverseScan(pQInfo, pQuery->order.order); - - if (pRuntimeEnv->pTSBuf != NULL) { - pRuntimeEnv->pTSBuf->cur.order = pRuntimeEnv->pTSBuf->cur.order ^ 1u; - } - + SET_REVERSE_SCAN_FLAG(pRuntimeEnv); SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY); - prepareQueryInfoForReverseScan(pQInfo); + SWITCH_ORDER(pQuery->order.order); + + if (pRuntimeEnv->pTSBuf != NULL) { + pRuntimeEnv->pTSBuf->cur.order = pQuery->order.order; + } + + STsdbQueryCond cond = { + .twindow = pQuery->window, + .order = pQuery->order.order, + .colList = pQuery->colList, + .numOfCols = pQuery->numOfCols, + }; + + // clean unused handle + if (pRuntimeEnv->pSecQueryHandle != NULL) { + tsdbCleanupQueryHandle(pRuntimeEnv->pSecQueryHandle); + } + + pRuntimeEnv->pSecQueryHandle = tsdbQueryTables(pQInfo->tsdb, &cond, &pQInfo->tableIdGroupInfo); + + setQueryStatus(pQuery, QUERY_NOT_COMPLETED); + switchCtxOrder(pRuntimeEnv); + disableFuncInReverseScan(pQInfo); } static void doRestoreContext(SQInfo *pQInfo) { @@ -4833,8 +4842,6 @@ static void multiTableQueryProcess(SQInfo *pQInfo) { copyFromWindowResToSData(pQInfo, pRuntimeEnv->windowResInfo.pResult); } - pQuery->rec.rows += pQuery->rec.rows; - if (pQuery->rec.rows == 0) { // vnodePrintQueryStatistics(pSupporter); } @@ -5540,7 +5547,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo int32_t param = pExprs[i].base.arg[0].argValue.i64; if (getResultDataInfo(type, bytes, pExprs[i].base.functionId, param, &pExprs[i].type, &pExprs[i].bytes, - &pExprs[i].interResBytes, 0, isSuperTable) != TSDB_CODE_SUCCESS) { + &pExprs[i].interBytes, 0, isSuperTable) != TSDB_CODE_SUCCESS) { tfree(pExprs); return TSDB_CODE_INVALID_QUERY_MSG; } @@ -5566,7 +5573,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo int32_t ret = getResultDataInfo(pCol->type, pCol->bytes, functId, pExprs[i].base.arg[0].argValue.i64, - &pExprs[i].type, &pExprs[i].bytes, &pExprs[i].interResBytes, tagLen, isSuperTable); + &pExprs[i].type, &pExprs[i].bytes, &pExprs[i].interBytes, tagLen, isSuperTable); assert(ret == TSDB_CODE_SUCCESS); } } @@ -5780,10 +5787,10 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SSqlGroupbyExpr *pGrou pQuery->rec.threshold = 4000; for (int32_t col = 0; col < pQuery->numOfOutput; ++col) { - assert(pExprs[col].interResBytes >= pExprs[col].bytes); + assert(pExprs[col].interBytes >= pExprs[col].bytes); // allocate additional memory for interResults that are usually larger then final results - size_t size = (pQuery->rec.capacity + 1) * pExprs[col].bytes + pExprs[col].interResBytes + sizeof(SData); + size_t size = (pQuery->rec.capacity + 1) * pExprs[col].bytes + pExprs[col].interBytes + sizeof(SData); pQuery->sdata[col] = (SData *)calloc(1, size); if (pQuery->sdata[col] == NULL) { goto _cleanup; @@ -6285,7 +6292,10 @@ static void buildTagQueryResult(SQInfo* pQInfo) { SGroupItem* item = taosArrayGet(pa, i); char* output = pQuery->sdata[0]->data + i * rsize; - *(int64_t*) output = item->id.uid; // memory align problem + varDataSetLen(output, rsize - VARSTR_HEADER_SIZE); + + output = varDataVal(output); + *(int64_t*) output = item->id.uid; // memory align problem, todo serialize output += sizeof(item->id.uid); *(int32_t*) output = item->id.tid; diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 223068ef91..d079e5a24e 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -97,26 +97,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 268 +#define YYNOCODE 270 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SSQLToken typedef union { int yyinit; ParseTOKENTYPE yy0; - tVariantList* yy30; - SLimitVal yy150; - SCreateTableSQL* yy212; - SCreateAcctSQL yy239; - int yy250; - SSubclauseInfo* yy309; - tFieldList* yy325; - tVariant yy380; - tSQLExpr* yy388; - SQuerySQL* yy444; - int64_t yy489; - TAOS_FIELD yy505; - tSQLExprList* yy506; - SCreateDBInfo yy532; + int yy150; + SQuerySQL* yy190; + SCreateAcctSQL yy219; + tSQLExprList* yy260; + SSubclauseInfo* yy263; + int64_t yy279; + SLimitVal yy284; + tVariantList* yy322; + TAOS_FIELD yy325; + tFieldList* yy369; + SCreateDBInfo yy374; + SCreateTableSQL* yy408; + tSQLExpr* yy500; + tVariant yy518; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -127,16 +127,16 @@ typedef union { #define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 #define YYNSTATE 247 -#define YYNRULE 216 -#define YYNTOKEN 203 +#define YYNRULE 220 +#define YYNTOKEN 205 #define YY_MAX_SHIFT 246 -#define YY_MIN_SHIFTREDUCE 399 -#define YY_MAX_SHIFTREDUCE 614 -#define YY_ERROR_ACTION 615 -#define YY_ACCEPT_ACTION 616 -#define YY_NO_ACTION 617 -#define YY_MIN_REDUCE 618 -#define YY_MAX_REDUCE 833 +#define YY_MIN_SHIFTREDUCE 403 +#define YY_MAX_SHIFTREDUCE 622 +#define YY_ERROR_ACTION 623 +#define YY_ACCEPT_ACTION 624 +#define YY_NO_ACTION 625 +#define YY_MIN_REDUCE 626 +#define YY_MAX_REDUCE 845 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -202,213 +202,217 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (529) +#define YY_ACTTAB_COUNT (547) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 752, 440, 135, 153, 244, 10, 616, 246, 135, 441, - /* 10 */ 135, 158, 821, 41, 43, 20, 35, 36, 820, 157, - /* 20 */ 821, 29, 741, 440, 203, 39, 37, 40, 38, 134, - /* 30 */ 499, 441, 99, 34, 33, 103, 154, 32, 31, 30, - /* 40 */ 41, 43, 741, 35, 36, 155, 139, 166, 29, 727, - /* 50 */ 749, 203, 39, 37, 40, 38, 188, 103, 227, 226, - /* 60 */ 34, 33, 165, 730, 32, 31, 30, 400, 401, 402, - /* 70 */ 403, 404, 405, 406, 407, 408, 409, 410, 411, 245, - /* 80 */ 730, 41, 43, 191, 35, 36, 218, 238, 200, 29, - /* 90 */ 58, 20, 203, 39, 37, 40, 38, 32, 31, 30, - /* 100 */ 56, 34, 33, 76, 730, 32, 31, 30, 43, 238, - /* 110 */ 35, 36, 776, 817, 198, 29, 20, 20, 203, 39, - /* 120 */ 37, 40, 38, 167, 570, 727, 229, 34, 33, 440, - /* 130 */ 170, 32, 31, 30, 240, 35, 36, 441, 7, 816, - /* 140 */ 29, 61, 113, 203, 39, 37, 40, 38, 225, 230, - /* 150 */ 727, 727, 34, 33, 50, 728, 32, 31, 30, 15, - /* 160 */ 217, 239, 216, 215, 214, 213, 212, 211, 210, 209, - /* 170 */ 712, 51, 701, 702, 703, 704, 705, 706, 707, 708, - /* 180 */ 709, 710, 711, 162, 583, 11, 815, 574, 103, 577, - /* 190 */ 103, 580, 171, 162, 583, 224, 223, 574, 16, 577, - /* 200 */ 20, 580, 34, 33, 148, 26, 32, 31, 30, 240, - /* 210 */ 88, 87, 142, 177, 657, 159, 160, 126, 147, 202, - /* 220 */ 185, 715, 182, 714, 151, 159, 160, 162, 583, 531, - /* 230 */ 60, 574, 152, 577, 726, 580, 239, 16, 39, 37, - /* 240 */ 40, 38, 27, 775, 26, 59, 34, 33, 551, 552, - /* 250 */ 32, 31, 30, 140, 116, 117, 68, 64, 67, 159, - /* 260 */ 160, 98, 515, 666, 187, 512, 126, 513, 26, 514, - /* 270 */ 523, 150, 130, 128, 91, 90, 89, 190, 42, 161, - /* 280 */ 74, 78, 83, 86, 77, 572, 528, 729, 42, 582, - /* 290 */ 80, 17, 658, 168, 169, 126, 243, 242, 95, 582, - /* 300 */ 47, 542, 543, 600, 581, 45, 13, 12, 584, 576, - /* 310 */ 141, 579, 12, 575, 581, 578, 2, 73, 72, 48, - /* 320 */ 505, 573, 42, 743, 45, 504, 207, 9, 8, 21, - /* 330 */ 21, 143, 519, 582, 520, 517, 144, 518, 85, 84, - /* 340 */ 145, 146, 137, 133, 138, 830, 136, 786, 581, 785, - /* 350 */ 163, 782, 781, 164, 751, 721, 768, 228, 100, 767, - /* 360 */ 114, 115, 516, 668, 208, 112, 131, 24, 221, 665, - /* 370 */ 222, 829, 26, 70, 828, 826, 189, 118, 686, 25, - /* 380 */ 93, 22, 132, 655, 79, 653, 81, 82, 651, 538, - /* 390 */ 650, 172, 192, 127, 648, 647, 646, 196, 52, 740, - /* 400 */ 645, 644, 636, 129, 642, 640, 49, 638, 44, 105, - /* 410 */ 755, 756, 201, 199, 195, 769, 197, 193, 28, 220, - /* 420 */ 75, 231, 232, 233, 234, 235, 236, 205, 237, 241, - /* 430 */ 53, 614, 173, 174, 175, 149, 62, 65, 176, 613, - /* 440 */ 179, 181, 649, 178, 180, 612, 92, 94, 183, 121, - /* 450 */ 184, 120, 687, 119, 122, 725, 123, 125, 124, 109, - /* 460 */ 106, 104, 643, 107, 110, 108, 111, 23, 1, 190, - /* 470 */ 605, 186, 525, 55, 539, 57, 156, 101, 194, 18, - /* 480 */ 19, 4, 544, 102, 204, 585, 3, 14, 5, 6, - /* 490 */ 63, 480, 206, 479, 478, 477, 476, 475, 474, 473, - /* 500 */ 471, 45, 219, 444, 66, 21, 501, 500, 46, 498, - /* 510 */ 54, 465, 463, 455, 461, 457, 69, 459, 453, 451, - /* 520 */ 472, 470, 71, 442, 96, 97, 415, 413, 618, + /* 0 */ 724, 444, 723, 11, 722, 134, 624, 246, 725, 445, + /* 10 */ 727, 726, 764, 41, 43, 21, 35, 36, 153, 244, + /* 20 */ 135, 29, 135, 444, 203, 39, 37, 40, 38, 158, + /* 30 */ 833, 445, 832, 34, 33, 139, 135, 32, 31, 30, + /* 40 */ 41, 43, 753, 35, 36, 157, 833, 166, 29, 739, + /* 50 */ 103, 203, 39, 37, 40, 38, 188, 21, 103, 99, + /* 60 */ 34, 33, 761, 155, 32, 31, 30, 404, 405, 406, + /* 70 */ 407, 408, 409, 410, 411, 412, 413, 414, 415, 245, + /* 80 */ 444, 742, 41, 43, 103, 35, 36, 103, 445, 168, + /* 90 */ 29, 738, 21, 203, 39, 37, 40, 38, 32, 31, + /* 100 */ 30, 56, 34, 33, 753, 787, 32, 31, 30, 43, + /* 110 */ 191, 35, 36, 788, 829, 198, 29, 21, 154, 203, + /* 120 */ 39, 37, 40, 38, 167, 578, 739, 8, 34, 33, + /* 130 */ 61, 113, 32, 31, 30, 665, 35, 36, 126, 59, + /* 140 */ 200, 29, 58, 17, 203, 39, 37, 40, 38, 221, + /* 150 */ 26, 739, 169, 34, 33, 220, 219, 32, 31, 30, + /* 160 */ 16, 239, 214, 238, 213, 212, 211, 237, 210, 236, + /* 170 */ 235, 209, 720, 828, 709, 710, 711, 712, 713, 714, + /* 180 */ 715, 716, 717, 718, 719, 162, 591, 234, 76, 582, + /* 190 */ 165, 585, 240, 588, 234, 162, 591, 98, 827, 582, + /* 200 */ 225, 585, 60, 588, 26, 162, 591, 12, 742, 582, + /* 210 */ 742, 585, 674, 588, 27, 126, 21, 159, 160, 34, + /* 220 */ 33, 202, 842, 32, 31, 30, 148, 159, 160, 740, + /* 230 */ 536, 539, 88, 87, 142, 18, 666, 159, 160, 126, + /* 240 */ 147, 559, 560, 39, 37, 40, 38, 50, 226, 550, + /* 250 */ 739, 34, 33, 46, 507, 32, 31, 30, 523, 531, + /* 260 */ 17, 520, 151, 521, 51, 522, 190, 26, 16, 239, + /* 270 */ 152, 238, 243, 242, 95, 237, 551, 236, 235, 177, + /* 280 */ 14, 42, 223, 222, 580, 741, 185, 187, 182, 170, + /* 290 */ 171, 42, 590, 584, 150, 587, 74, 78, 83, 86, + /* 300 */ 77, 42, 590, 161, 608, 592, 80, 589, 13, 13, + /* 310 */ 140, 583, 590, 586, 513, 47, 141, 589, 46, 798, + /* 320 */ 581, 116, 117, 68, 64, 67, 143, 589, 130, 128, + /* 330 */ 91, 90, 89, 512, 48, 207, 527, 22, 528, 22, + /* 340 */ 144, 3, 73, 72, 10, 9, 145, 525, 146, 526, + /* 350 */ 85, 84, 137, 797, 133, 138, 136, 163, 794, 524, + /* 360 */ 793, 164, 763, 733, 224, 100, 755, 780, 779, 114, + /* 370 */ 26, 115, 112, 676, 208, 131, 24, 217, 673, 218, + /* 380 */ 841, 70, 840, 838, 118, 694, 25, 93, 23, 132, + /* 390 */ 663, 79, 189, 546, 661, 192, 81, 82, 659, 658, + /* 400 */ 172, 127, 656, 196, 655, 654, 653, 652, 644, 129, + /* 410 */ 650, 648, 646, 52, 752, 767, 49, 44, 768, 781, + /* 420 */ 201, 199, 197, 195, 193, 28, 216, 75, 227, 228, + /* 430 */ 229, 230, 205, 232, 231, 53, 233, 241, 622, 149, + /* 440 */ 173, 62, 65, 174, 176, 175, 621, 178, 179, 180, + /* 450 */ 181, 657, 121, 120, 695, 125, 119, 122, 123, 92, + /* 460 */ 124, 651, 1, 106, 104, 737, 94, 105, 620, 109, + /* 470 */ 107, 108, 110, 111, 2, 184, 613, 183, 186, 190, + /* 480 */ 533, 55, 547, 156, 101, 57, 552, 194, 102, 5, + /* 490 */ 6, 63, 484, 593, 4, 19, 20, 15, 204, 7, + /* 500 */ 206, 481, 479, 478, 477, 475, 448, 215, 66, 45, + /* 510 */ 22, 509, 508, 69, 506, 54, 469, 467, 459, 465, + /* 520 */ 461, 463, 457, 455, 71, 483, 482, 480, 476, 474, + /* 530 */ 46, 446, 419, 417, 626, 625, 625, 625, 625, 625, + /* 540 */ 96, 625, 625, 625, 625, 625, 97, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 207, 1, 256, 206, 207, 256, 204, 205, 256, 9, - /* 10 */ 256, 265, 266, 13, 14, 207, 16, 17, 266, 265, - /* 20 */ 266, 21, 240, 1, 24, 25, 26, 27, 28, 256, - /* 30 */ 5, 9, 207, 33, 34, 207, 254, 37, 38, 39, - /* 40 */ 13, 14, 240, 16, 17, 224, 256, 239, 21, 241, - /* 50 */ 257, 24, 25, 26, 27, 28, 254, 207, 33, 34, - /* 60 */ 33, 34, 224, 242, 37, 38, 39, 45, 46, 47, + /* 0 */ 225, 1, 227, 258, 229, 258, 206, 207, 233, 9, + /* 10 */ 235, 236, 209, 13, 14, 209, 16, 17, 208, 209, + /* 20 */ 258, 21, 258, 1, 24, 25, 26, 27, 28, 267, + /* 30 */ 268, 9, 268, 33, 34, 258, 258, 37, 38, 39, + /* 40 */ 13, 14, 242, 16, 17, 267, 268, 241, 21, 243, + /* 50 */ 209, 24, 25, 26, 27, 28, 256, 209, 209, 209, + /* 60 */ 33, 34, 259, 226, 37, 38, 39, 45, 46, 47, /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 80 */ 242, 13, 14, 258, 16, 17, 224, 78, 260, 21, - /* 90 */ 262, 207, 24, 25, 26, 27, 28, 37, 38, 39, - /* 100 */ 100, 33, 34, 72, 242, 37, 38, 39, 14, 78, - /* 110 */ 16, 17, 262, 256, 264, 21, 207, 207, 24, 25, - /* 120 */ 26, 27, 28, 239, 97, 241, 207, 33, 34, 1, - /* 130 */ 63, 37, 38, 39, 60, 16, 17, 9, 96, 256, - /* 140 */ 21, 99, 100, 24, 25, 26, 27, 28, 239, 239, - /* 150 */ 241, 241, 33, 34, 101, 236, 37, 38, 39, 85, - /* 160 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - /* 170 */ 223, 118, 225, 226, 227, 228, 229, 230, 231, 232, - /* 180 */ 233, 234, 235, 1, 2, 44, 256, 5, 207, 7, - /* 190 */ 207, 9, 125, 1, 2, 128, 129, 5, 96, 7, - /* 200 */ 207, 9, 33, 34, 63, 103, 37, 38, 39, 60, - /* 210 */ 69, 70, 71, 124, 211, 33, 34, 214, 77, 37, - /* 220 */ 131, 225, 133, 227, 256, 33, 34, 1, 2, 37, - /* 230 */ 243, 5, 256, 7, 241, 9, 87, 96, 25, 26, - /* 240 */ 27, 28, 255, 262, 103, 262, 33, 34, 113, 114, - /* 250 */ 37, 38, 39, 256, 64, 65, 66, 67, 68, 33, - /* 260 */ 34, 96, 2, 211, 123, 5, 214, 7, 103, 9, - /* 270 */ 97, 130, 64, 65, 66, 67, 68, 104, 96, 59, - /* 280 */ 64, 65, 66, 67, 68, 1, 101, 242, 96, 107, - /* 290 */ 74, 106, 211, 33, 34, 214, 60, 61, 62, 107, - /* 300 */ 101, 97, 97, 97, 122, 101, 101, 101, 97, 5, - /* 310 */ 256, 7, 101, 5, 122, 7, 96, 126, 127, 120, - /* 320 */ 97, 37, 96, 240, 101, 97, 97, 126, 127, 101, - /* 330 */ 101, 256, 5, 107, 7, 5, 256, 7, 72, 73, - /* 340 */ 256, 256, 256, 256, 256, 242, 256, 237, 122, 237, - /* 350 */ 237, 237, 237, 237, 207, 238, 263, 237, 207, 263, - /* 360 */ 207, 207, 102, 207, 207, 244, 207, 207, 207, 207, - /* 370 */ 207, 207, 103, 207, 207, 207, 240, 207, 207, 207, - /* 380 */ 59, 207, 207, 207, 207, 207, 207, 207, 207, 107, - /* 390 */ 207, 207, 259, 207, 207, 207, 207, 259, 117, 253, - /* 400 */ 207, 207, 207, 207, 207, 207, 119, 207, 116, 251, - /* 410 */ 208, 208, 111, 115, 109, 208, 110, 108, 121, 75, - /* 420 */ 84, 83, 49, 80, 82, 53, 81, 208, 79, 75, - /* 430 */ 208, 5, 132, 5, 132, 208, 212, 212, 58, 5, - /* 440 */ 5, 58, 208, 132, 132, 5, 209, 209, 132, 216, - /* 450 */ 58, 220, 222, 221, 219, 240, 217, 215, 218, 247, - /* 460 */ 250, 252, 208, 249, 246, 248, 245, 210, 213, 104, - /* 470 */ 86, 124, 97, 105, 97, 101, 1, 96, 96, 101, - /* 480 */ 101, 112, 97, 96, 98, 97, 96, 96, 112, 96, - /* 490 */ 72, 9, 98, 5, 5, 5, 5, 1, 5, 5, - /* 500 */ 5, 101, 15, 76, 72, 101, 5, 5, 16, 97, - /* 510 */ 96, 5, 5, 5, 5, 5, 127, 5, 5, 5, - /* 520 */ 5, 5, 127, 76, 21, 21, 59, 58, 0, 267, - /* 530 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 540 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 550 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 560 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 570 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 580 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 590 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 600 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 610 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 620 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 630 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 640 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 650 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 660 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 670 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 680 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 690 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 700 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 710 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 720 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - /* 730 */ 267, 267, + /* 80 */ 1, 244, 13, 14, 209, 16, 17, 209, 9, 63, + /* 90 */ 21, 243, 209, 24, 25, 26, 27, 28, 37, 38, + /* 100 */ 39, 101, 33, 34, 242, 264, 37, 38, 39, 14, + /* 110 */ 260, 16, 17, 264, 258, 266, 21, 209, 256, 24, + /* 120 */ 25, 26, 27, 28, 241, 98, 243, 97, 33, 34, + /* 130 */ 100, 101, 37, 38, 39, 213, 16, 17, 216, 264, + /* 140 */ 262, 21, 264, 97, 24, 25, 26, 27, 28, 241, + /* 150 */ 104, 243, 126, 33, 34, 129, 130, 37, 38, 39, + /* 160 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + /* 170 */ 95, 96, 225, 258, 227, 228, 229, 230, 231, 232, + /* 180 */ 233, 234, 235, 236, 237, 1, 2, 78, 72, 5, + /* 190 */ 226, 7, 226, 9, 78, 1, 2, 97, 258, 5, + /* 200 */ 209, 7, 245, 9, 104, 1, 2, 44, 244, 5, + /* 210 */ 244, 7, 213, 9, 257, 216, 209, 33, 34, 33, + /* 220 */ 34, 37, 244, 37, 38, 39, 63, 33, 34, 238, + /* 230 */ 102, 37, 69, 70, 71, 107, 213, 33, 34, 216, + /* 240 */ 77, 114, 115, 25, 26, 27, 28, 102, 241, 98, + /* 250 */ 243, 33, 34, 102, 5, 37, 38, 39, 2, 98, + /* 260 */ 97, 5, 258, 7, 119, 9, 105, 104, 85, 86, + /* 270 */ 258, 88, 60, 61, 62, 92, 98, 94, 95, 125, + /* 280 */ 102, 97, 33, 34, 1, 244, 132, 124, 134, 33, + /* 290 */ 34, 97, 108, 5, 131, 7, 64, 65, 66, 67, + /* 300 */ 68, 97, 108, 59, 98, 98, 74, 123, 102, 102, + /* 310 */ 258, 5, 108, 7, 98, 102, 258, 123, 102, 239, + /* 320 */ 37, 64, 65, 66, 67, 68, 258, 123, 64, 65, + /* 330 */ 66, 67, 68, 98, 121, 98, 5, 102, 7, 102, + /* 340 */ 258, 97, 127, 128, 127, 128, 258, 5, 258, 7, + /* 350 */ 72, 73, 258, 239, 258, 258, 258, 239, 239, 103, + /* 360 */ 239, 239, 209, 240, 239, 209, 242, 265, 265, 209, + /* 370 */ 104, 209, 246, 209, 209, 209, 209, 209, 209, 209, + /* 380 */ 209, 209, 209, 209, 209, 209, 209, 59, 209, 209, + /* 390 */ 209, 209, 242, 108, 209, 261, 209, 209, 209, 209, + /* 400 */ 209, 209, 209, 261, 209, 209, 209, 209, 209, 209, + /* 410 */ 209, 209, 209, 118, 255, 210, 120, 117, 210, 210, + /* 420 */ 112, 116, 111, 110, 109, 122, 75, 84, 83, 49, + /* 430 */ 80, 82, 210, 81, 53, 210, 79, 75, 5, 210, + /* 440 */ 133, 214, 214, 5, 58, 133, 5, 133, 5, 133, + /* 450 */ 58, 210, 218, 222, 224, 217, 223, 221, 219, 211, + /* 460 */ 220, 210, 215, 252, 254, 242, 211, 253, 5, 249, + /* 470 */ 251, 250, 248, 247, 212, 58, 87, 133, 125, 105, + /* 480 */ 98, 106, 98, 1, 97, 102, 98, 97, 97, 113, + /* 490 */ 113, 72, 9, 98, 97, 102, 102, 97, 99, 97, + /* 500 */ 99, 5, 5, 5, 5, 5, 76, 15, 72, 16, + /* 510 */ 102, 5, 5, 128, 98, 97, 5, 5, 5, 5, + /* 520 */ 5, 5, 5, 5, 128, 5, 5, 5, 5, 5, + /* 530 */ 102, 76, 59, 58, 0, 269, 269, 269, 269, 269, + /* 540 */ 21, 269, 269, 269, 269, 269, 21, 269, 269, 269, + /* 550 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 560 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 570 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 580 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 590 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 600 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 610 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 620 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 630 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 640 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 650 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 660 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 670 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 680 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 690 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 700 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 710 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 720 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 730 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 740 */ 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, + /* 750 */ 269, 269, }; #define YY_SHIFT_COUNT (246) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (528) +#define YY_SHIFT_MAX (534) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 141, 74, 182, 226, 128, 128, 128, 128, 128, 128, - /* 10 */ 0, 22, 226, 260, 260, 260, 102, 128, 128, 128, - /* 20 */ 128, 128, 31, 149, 9, 9, 529, 192, 226, 226, - /* 30 */ 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, - /* 40 */ 226, 226, 226, 226, 226, 260, 260, 25, 25, 25, - /* 50 */ 25, 25, 25, 42, 25, 165, 128, 128, 135, 135, - /* 60 */ 185, 128, 128, 128, 128, 128, 128, 128, 128, 128, - /* 70 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - /* 80 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - /* 90 */ 128, 128, 128, 128, 128, 128, 128, 128, 269, 321, - /* 100 */ 321, 282, 282, 321, 281, 287, 292, 301, 298, 306, - /* 110 */ 305, 309, 297, 269, 321, 321, 344, 344, 321, 336, - /* 120 */ 338, 373, 343, 342, 372, 345, 349, 321, 354, 321, - /* 130 */ 354, 529, 529, 27, 68, 68, 68, 94, 119, 213, - /* 140 */ 213, 213, 216, 169, 169, 169, 169, 190, 208, 67, - /* 150 */ 89, 60, 60, 236, 173, 204, 205, 206, 211, 304, - /* 160 */ 308, 284, 220, 199, 53, 223, 228, 229, 327, 330, - /* 170 */ 191, 201, 266, 426, 300, 428, 302, 380, 434, 311, - /* 180 */ 435, 312, 383, 440, 316, 392, 384, 347, 365, 375, - /* 190 */ 368, 374, 377, 381, 475, 382, 385, 387, 378, 369, - /* 200 */ 379, 376, 388, 390, 391, 386, 393, 394, 418, 482, - /* 210 */ 488, 489, 490, 491, 496, 493, 494, 495, 400, 427, - /* 220 */ 487, 432, 492, 389, 395, 404, 501, 502, 412, 414, - /* 230 */ 404, 506, 507, 508, 509, 510, 512, 513, 514, 515, - /* 240 */ 516, 447, 503, 504, 467, 469, 528, + /* 0 */ 163, 75, 183, 184, 204, 79, 79, 79, 79, 79, + /* 10 */ 79, 0, 22, 204, 256, 256, 256, 46, 79, 79, + /* 20 */ 79, 79, 79, 116, 109, 109, 547, 194, 204, 204, + /* 30 */ 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, + /* 40 */ 204, 204, 204, 204, 204, 256, 256, 249, 249, 249, + /* 50 */ 249, 249, 249, 30, 249, 100, 79, 79, 127, 127, + /* 60 */ 128, 79, 79, 79, 79, 79, 79, 79, 79, 79, + /* 70 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + /* 80 */ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + /* 90 */ 79, 79, 79, 79, 79, 79, 79, 79, 266, 328, + /* 100 */ 328, 285, 285, 328, 295, 296, 300, 308, 305, 311, + /* 110 */ 313, 315, 303, 266, 328, 328, 351, 351, 328, 343, + /* 120 */ 345, 380, 350, 349, 381, 352, 357, 328, 362, 328, + /* 130 */ 362, 547, 547, 27, 69, 69, 69, 95, 120, 218, + /* 140 */ 218, 218, 232, 186, 186, 186, 186, 257, 264, 26, + /* 150 */ 154, 61, 61, 212, 161, 151, 178, 206, 207, 288, + /* 160 */ 306, 283, 244, 213, 145, 216, 235, 237, 215, 217, + /* 170 */ 331, 342, 278, 433, 307, 438, 312, 386, 441, 314, + /* 180 */ 443, 316, 392, 463, 344, 417, 389, 353, 374, 382, + /* 190 */ 375, 383, 384, 387, 482, 390, 388, 391, 393, 376, + /* 200 */ 394, 377, 395, 397, 400, 399, 402, 401, 419, 483, + /* 210 */ 496, 497, 498, 499, 500, 430, 492, 436, 493, 385, + /* 220 */ 396, 408, 506, 507, 416, 418, 408, 511, 512, 513, + /* 230 */ 514, 515, 516, 517, 518, 520, 521, 522, 523, 524, + /* 240 */ 428, 455, 519, 525, 473, 475, 534, }; #define YY_REDUCE_COUNT (132) -#define YY_REDUCE_MIN (-254) -#define YY_REDUCE_MAX (257) +#define YY_REDUCE_MIN (-255) +#define YY_REDUCE_MAX (262) static const short yy_reduce_ofst[] = { - /* 0 */ -198, -53, -254, -246, -150, -172, -192, -116, -91, -90, - /* 10 */ -207, -203, -248, -179, -162, -138, -218, -175, -19, -17, - /* 20 */ -81, -7, 3, -4, 52, 81, -13, -251, -227, -210, - /* 30 */ -143, -117, -70, -32, -24, -3, 54, 75, 80, 84, - /* 40 */ 85, 86, 87, 88, 90, 45, 103, 110, 112, 113, - /* 50 */ 114, 115, 116, 117, 120, 83, 147, 151, 93, 96, - /* 60 */ 121, 153, 154, 156, 157, 159, 160, 161, 162, 163, - /* 70 */ 164, 166, 167, 168, 170, 171, 172, 174, 175, 176, - /* 80 */ 177, 178, 179, 180, 181, 183, 184, 186, 187, 188, - /* 90 */ 189, 193, 194, 195, 196, 197, 198, 200, 136, 202, - /* 100 */ 203, 133, 138, 207, 146, 209, 158, 210, 214, 217, - /* 110 */ 212, 218, 221, 215, 219, 222, 224, 225, 227, 230, - /* 120 */ 232, 231, 233, 235, 239, 240, 242, 234, 237, 254, - /* 130 */ 238, 255, 257, + /* 0 */ -200, -53, -225, -238, -222, -151, -122, -194, -117, -92, + /* 10 */ 7, -197, -190, -236, -163, -36, -34, -138, -150, -159, + /* 20 */ -125, -9, -152, -78, -1, 23, -43, -255, -253, -223, + /* 30 */ -144, -85, -60, 4, 12, 52, 58, 68, 82, 88, + /* 40 */ 90, 94, 96, 97, 98, -22, 41, 80, 114, 118, + /* 50 */ 119, 121, 122, 123, 125, 124, 153, 156, 102, 103, + /* 60 */ 126, 160, 162, 164, 165, 166, 167, 168, 169, 170, + /* 70 */ 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, + /* 80 */ 182, 185, 187, 188, 189, 190, 191, 192, 193, 195, + /* 90 */ 196, 197, 198, 199, 200, 201, 202, 203, 150, 205, + /* 100 */ 208, 134, 142, 209, 159, 210, 214, 211, 219, 221, + /* 110 */ 220, 224, 226, 223, 222, 225, 227, 228, 229, 230, + /* 120 */ 233, 231, 234, 236, 239, 240, 238, 241, 248, 251, + /* 130 */ 255, 247, 262, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 615, 667, 823, 823, 615, 615, 615, 615, 615, 615, - /* 10 */ 753, 633, 823, 615, 615, 615, 615, 615, 615, 615, - /* 20 */ 615, 615, 669, 656, 669, 669, 748, 615, 615, 615, - /* 30 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, - /* 40 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, - /* 50 */ 615, 615, 615, 615, 615, 615, 615, 615, 772, 772, - /* 60 */ 746, 615, 615, 615, 615, 615, 615, 615, 615, 615, - /* 70 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 654, - /* 80 */ 615, 652, 615, 615, 615, 615, 615, 615, 615, 615, - /* 90 */ 615, 615, 615, 615, 615, 641, 615, 615, 615, 635, - /* 100 */ 635, 615, 615, 635, 779, 783, 777, 765, 773, 764, - /* 110 */ 760, 759, 787, 615, 635, 635, 664, 664, 635, 685, - /* 120 */ 683, 681, 673, 679, 675, 677, 671, 635, 662, 635, - /* 130 */ 662, 700, 713, 615, 788, 822, 778, 806, 805, 818, - /* 140 */ 812, 811, 615, 810, 809, 808, 807, 615, 615, 615, - /* 150 */ 615, 814, 813, 615, 615, 615, 615, 615, 615, 615, - /* 160 */ 615, 615, 790, 784, 780, 615, 615, 615, 615, 615, - /* 170 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, - /* 180 */ 615, 615, 615, 615, 615, 615, 615, 615, 745, 615, - /* 190 */ 615, 754, 615, 615, 615, 615, 615, 615, 774, 615, - /* 200 */ 766, 615, 615, 615, 615, 615, 615, 722, 615, 615, - /* 210 */ 615, 615, 615, 615, 615, 615, 615, 615, 688, 615, - /* 220 */ 615, 615, 615, 615, 615, 827, 615, 615, 615, 716, - /* 230 */ 825, 615, 615, 615, 615, 615, 615, 615, 615, 615, - /* 240 */ 615, 615, 639, 637, 615, 631, 615, + /* 0 */ 623, 675, 664, 835, 835, 623, 623, 623, 623, 623, + /* 10 */ 623, 765, 641, 835, 623, 623, 623, 623, 623, 623, + /* 20 */ 623, 623, 623, 677, 677, 677, 760, 623, 623, 623, + /* 30 */ 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, + /* 40 */ 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, + /* 50 */ 623, 623, 623, 623, 623, 623, 623, 623, 784, 784, + /* 60 */ 758, 623, 623, 623, 623, 623, 623, 623, 623, 623, + /* 70 */ 623, 623, 623, 623, 623, 623, 623, 623, 623, 662, + /* 80 */ 623, 660, 623, 623, 623, 623, 623, 623, 623, 623, + /* 90 */ 623, 623, 623, 623, 623, 649, 623, 623, 623, 643, + /* 100 */ 643, 623, 623, 643, 791, 795, 789, 777, 785, 776, + /* 110 */ 772, 771, 799, 623, 643, 643, 672, 672, 643, 693, + /* 120 */ 691, 689, 681, 687, 683, 685, 679, 643, 670, 643, + /* 130 */ 670, 708, 721, 623, 800, 834, 790, 818, 817, 830, + /* 140 */ 824, 823, 623, 822, 821, 820, 819, 623, 623, 623, + /* 150 */ 623, 826, 825, 623, 623, 623, 623, 623, 623, 623, + /* 160 */ 623, 623, 802, 796, 792, 623, 623, 623, 623, 623, + /* 170 */ 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, + /* 180 */ 623, 623, 623, 623, 623, 623, 623, 623, 757, 623, + /* 190 */ 623, 766, 623, 623, 623, 623, 623, 623, 786, 623, + /* 200 */ 778, 623, 623, 623, 623, 623, 623, 734, 623, 623, + /* 210 */ 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, + /* 220 */ 623, 839, 623, 623, 623, 728, 837, 623, 623, 623, + /* 230 */ 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, + /* 240 */ 696, 623, 647, 645, 623, 639, 623, }; /********** End of lemon-generated parsing tables *****************************/ @@ -514,14 +518,15 @@ static const YYCODETYPE yyFallback[] = { 0, /* CONNS => nothing */ 0, /* STATE => nothing */ 0, /* KEEP => nothing */ + 0, /* MAXTABLES => nothing */ 0, /* CACHE => nothing */ 0, /* REPLICA => nothing */ 0, /* DAYS => nothing */ - 0, /* ROWS => nothing */ - 0, /* ABLOCKS => nothing */ - 0, /* TBLOCKS => nothing */ + 0, /* MINROWS => nothing */ + 0, /* MAXROWS => nothing */ + 0, /* BLOCKS => nothing */ 0, /* CTIME => nothing */ - 0, /* CLOG => nothing */ + 0, /* WAL => nothing */ 0, /* COMP => nothing */ 0, /* PRECISION => nothing */ 0, /* LP => nothing */ @@ -618,6 +623,7 @@ static const YYCODETYPE yyFallback[] = { 1, /* SUM_IRATE => ID */ 1, /* AVG_RATE => ID */ 1, /* AVG_IRATE => ID */ + 1, /* TBID => ID */ 1, /* SEMI => ID */ 1, /* NONE => ID */ 1, /* PREV => ID */ @@ -803,187 +809,189 @@ static const char *const yyTokenName[] = { /* 83 */ "CONNS", /* 84 */ "STATE", /* 85 */ "KEEP", - /* 86 */ "CACHE", - /* 87 */ "REPLICA", - /* 88 */ "DAYS", - /* 89 */ "ROWS", - /* 90 */ "ABLOCKS", - /* 91 */ "TBLOCKS", - /* 92 */ "CTIME", - /* 93 */ "CLOG", - /* 94 */ "COMP", - /* 95 */ "PRECISION", - /* 96 */ "LP", - /* 97 */ "RP", - /* 98 */ "TAGS", - /* 99 */ "USING", - /* 100 */ "AS", - /* 101 */ "COMMA", - /* 102 */ "NULL", - /* 103 */ "SELECT", - /* 104 */ "UNION", - /* 105 */ "ALL", - /* 106 */ "FROM", - /* 107 */ "VARIABLE", - /* 108 */ "INTERVAL", - /* 109 */ "FILL", - /* 110 */ "SLIDING", - /* 111 */ "ORDER", - /* 112 */ "BY", - /* 113 */ "ASC", - /* 114 */ "DESC", - /* 115 */ "GROUP", - /* 116 */ "HAVING", - /* 117 */ "LIMIT", - /* 118 */ "OFFSET", - /* 119 */ "SLIMIT", - /* 120 */ "SOFFSET", - /* 121 */ "WHERE", - /* 122 */ "NOW", - /* 123 */ "RESET", - /* 124 */ "QUERY", - /* 125 */ "ADD", - /* 126 */ "COLUMN", - /* 127 */ "TAG", - /* 128 */ "CHANGE", - /* 129 */ "SET", - /* 130 */ "KILL", - /* 131 */ "CONNECTION", - /* 132 */ "COLON", - /* 133 */ "STREAM", - /* 134 */ "ABORT", - /* 135 */ "AFTER", - /* 136 */ "ATTACH", - /* 137 */ "BEFORE", - /* 138 */ "BEGIN", - /* 139 */ "CASCADE", - /* 140 */ "CLUSTER", - /* 141 */ "CONFLICT", - /* 142 */ "COPY", - /* 143 */ "DEFERRED", - /* 144 */ "DELIMITERS", - /* 145 */ "DETACH", - /* 146 */ "EACH", - /* 147 */ "END", - /* 148 */ "EXPLAIN", - /* 149 */ "FAIL", - /* 150 */ "FOR", - /* 151 */ "IGNORE", - /* 152 */ "IMMEDIATE", - /* 153 */ "INITIALLY", - /* 154 */ "INSTEAD", - /* 155 */ "MATCH", - /* 156 */ "KEY", - /* 157 */ "OF", - /* 158 */ "RAISE", - /* 159 */ "REPLACE", - /* 160 */ "RESTRICT", - /* 161 */ "ROW", - /* 162 */ "STATEMENT", - /* 163 */ "TRIGGER", - /* 164 */ "VIEW", - /* 165 */ "COUNT", - /* 166 */ "SUM", - /* 167 */ "AVG", - /* 168 */ "MIN", - /* 169 */ "MAX", - /* 170 */ "FIRST", - /* 171 */ "LAST", - /* 172 */ "TOP", - /* 173 */ "BOTTOM", - /* 174 */ "STDDEV", - /* 175 */ "PERCENTILE", - /* 176 */ "APERCENTILE", - /* 177 */ "LEASTSQUARES", - /* 178 */ "HISTOGRAM", - /* 179 */ "DIFF", - /* 180 */ "SPREAD", - /* 181 */ "TWA", - /* 182 */ "INTERP", - /* 183 */ "LAST_ROW", - /* 184 */ "RATE", - /* 185 */ "IRATE", - /* 186 */ "SUM_RATE", - /* 187 */ "SUM_IRATE", - /* 188 */ "AVG_RATE", - /* 189 */ "AVG_IRATE", - /* 190 */ "SEMI", - /* 191 */ "NONE", - /* 192 */ "PREV", - /* 193 */ "LINEAR", - /* 194 */ "IMPORT", - /* 195 */ "METRIC", - /* 196 */ "TBNAME", - /* 197 */ "JOIN", - /* 198 */ "METRICS", - /* 199 */ "STABLE", - /* 200 */ "INSERT", - /* 201 */ "INTO", - /* 202 */ "VALUES", - /* 203 */ "error", - /* 204 */ "program", - /* 205 */ "cmd", - /* 206 */ "dbPrefix", - /* 207 */ "ids", - /* 208 */ "cpxName", - /* 209 */ "ifexists", - /* 210 */ "alter_db_optr", - /* 211 */ "acct_optr", - /* 212 */ "ifnotexists", - /* 213 */ "db_optr", - /* 214 */ "pps", - /* 215 */ "tseries", - /* 216 */ "dbs", - /* 217 */ "streams", - /* 218 */ "storage", - /* 219 */ "qtime", - /* 220 */ "users", - /* 221 */ "conns", - /* 222 */ "state", - /* 223 */ "keep", - /* 224 */ "tagitemlist", - /* 225 */ "tables", - /* 226 */ "cache", - /* 227 */ "replica", - /* 228 */ "days", - /* 229 */ "rows", - /* 230 */ "ablocks", - /* 231 */ "tblocks", - /* 232 */ "ctime", - /* 233 */ "clog", - /* 234 */ "comp", - /* 235 */ "prec", - /* 236 */ "typename", - /* 237 */ "signed", - /* 238 */ "create_table_args", - /* 239 */ "columnlist", - /* 240 */ "select", - /* 241 */ "column", - /* 242 */ "tagitem", - /* 243 */ "selcollist", - /* 244 */ "from", - /* 245 */ "where_opt", - /* 246 */ "interval_opt", - /* 247 */ "fill_opt", - /* 248 */ "sliding_opt", - /* 249 */ "groupby_opt", - /* 250 */ "orderby_opt", - /* 251 */ "having_opt", - /* 252 */ "slimit_opt", - /* 253 */ "limit_opt", - /* 254 */ "union", - /* 255 */ "sclp", - /* 256 */ "expr", - /* 257 */ "as", - /* 258 */ "tablelist", - /* 259 */ "tmvar", - /* 260 */ "sortlist", - /* 261 */ "sortitem", - /* 262 */ "item", - /* 263 */ "sortorder", - /* 264 */ "grouplist", - /* 265 */ "exprlist", - /* 266 */ "expritem", + /* 86 */ "MAXTABLES", + /* 87 */ "CACHE", + /* 88 */ "REPLICA", + /* 89 */ "DAYS", + /* 90 */ "MINROWS", + /* 91 */ "MAXROWS", + /* 92 */ "BLOCKS", + /* 93 */ "CTIME", + /* 94 */ "WAL", + /* 95 */ "COMP", + /* 96 */ "PRECISION", + /* 97 */ "LP", + /* 98 */ "RP", + /* 99 */ "TAGS", + /* 100 */ "USING", + /* 101 */ "AS", + /* 102 */ "COMMA", + /* 103 */ "NULL", + /* 104 */ "SELECT", + /* 105 */ "UNION", + /* 106 */ "ALL", + /* 107 */ "FROM", + /* 108 */ "VARIABLE", + /* 109 */ "INTERVAL", + /* 110 */ "FILL", + /* 111 */ "SLIDING", + /* 112 */ "ORDER", + /* 113 */ "BY", + /* 114 */ "ASC", + /* 115 */ "DESC", + /* 116 */ "GROUP", + /* 117 */ "HAVING", + /* 118 */ "LIMIT", + /* 119 */ "OFFSET", + /* 120 */ "SLIMIT", + /* 121 */ "SOFFSET", + /* 122 */ "WHERE", + /* 123 */ "NOW", + /* 124 */ "RESET", + /* 125 */ "QUERY", + /* 126 */ "ADD", + /* 127 */ "COLUMN", + /* 128 */ "TAG", + /* 129 */ "CHANGE", + /* 130 */ "SET", + /* 131 */ "KILL", + /* 132 */ "CONNECTION", + /* 133 */ "COLON", + /* 134 */ "STREAM", + /* 135 */ "ABORT", + /* 136 */ "AFTER", + /* 137 */ "ATTACH", + /* 138 */ "BEFORE", + /* 139 */ "BEGIN", + /* 140 */ "CASCADE", + /* 141 */ "CLUSTER", + /* 142 */ "CONFLICT", + /* 143 */ "COPY", + /* 144 */ "DEFERRED", + /* 145 */ "DELIMITERS", + /* 146 */ "DETACH", + /* 147 */ "EACH", + /* 148 */ "END", + /* 149 */ "EXPLAIN", + /* 150 */ "FAIL", + /* 151 */ "FOR", + /* 152 */ "IGNORE", + /* 153 */ "IMMEDIATE", + /* 154 */ "INITIALLY", + /* 155 */ "INSTEAD", + /* 156 */ "MATCH", + /* 157 */ "KEY", + /* 158 */ "OF", + /* 159 */ "RAISE", + /* 160 */ "REPLACE", + /* 161 */ "RESTRICT", + /* 162 */ "ROW", + /* 163 */ "STATEMENT", + /* 164 */ "TRIGGER", + /* 165 */ "VIEW", + /* 166 */ "COUNT", + /* 167 */ "SUM", + /* 168 */ "AVG", + /* 169 */ "MIN", + /* 170 */ "MAX", + /* 171 */ "FIRST", + /* 172 */ "LAST", + /* 173 */ "TOP", + /* 174 */ "BOTTOM", + /* 175 */ "STDDEV", + /* 176 */ "PERCENTILE", + /* 177 */ "APERCENTILE", + /* 178 */ "LEASTSQUARES", + /* 179 */ "HISTOGRAM", + /* 180 */ "DIFF", + /* 181 */ "SPREAD", + /* 182 */ "TWA", + /* 183 */ "INTERP", + /* 184 */ "LAST_ROW", + /* 185 */ "RATE", + /* 186 */ "IRATE", + /* 187 */ "SUM_RATE", + /* 188 */ "SUM_IRATE", + /* 189 */ "AVG_RATE", + /* 190 */ "AVG_IRATE", + /* 191 */ "TBID", + /* 192 */ "SEMI", + /* 193 */ "NONE", + /* 194 */ "PREV", + /* 195 */ "LINEAR", + /* 196 */ "IMPORT", + /* 197 */ "METRIC", + /* 198 */ "TBNAME", + /* 199 */ "JOIN", + /* 200 */ "METRICS", + /* 201 */ "STABLE", + /* 202 */ "INSERT", + /* 203 */ "INTO", + /* 204 */ "VALUES", + /* 205 */ "error", + /* 206 */ "program", + /* 207 */ "cmd", + /* 208 */ "dbPrefix", + /* 209 */ "ids", + /* 210 */ "cpxName", + /* 211 */ "ifexists", + /* 212 */ "alter_db_optr", + /* 213 */ "acct_optr", + /* 214 */ "ifnotexists", + /* 215 */ "db_optr", + /* 216 */ "pps", + /* 217 */ "tseries", + /* 218 */ "dbs", + /* 219 */ "streams", + /* 220 */ "storage", + /* 221 */ "qtime", + /* 222 */ "users", + /* 223 */ "conns", + /* 224 */ "state", + /* 225 */ "keep", + /* 226 */ "tagitemlist", + /* 227 */ "tables", + /* 228 */ "cache", + /* 229 */ "replica", + /* 230 */ "days", + /* 231 */ "minrows", + /* 232 */ "maxrows", + /* 233 */ "blocks", + /* 234 */ "ctime", + /* 235 */ "wal", + /* 236 */ "comp", + /* 237 */ "prec", + /* 238 */ "typename", + /* 239 */ "signed", + /* 240 */ "create_table_args", + /* 241 */ "columnlist", + /* 242 */ "select", + /* 243 */ "column", + /* 244 */ "tagitem", + /* 245 */ "selcollist", + /* 246 */ "from", + /* 247 */ "where_opt", + /* 248 */ "interval_opt", + /* 249 */ "fill_opt", + /* 250 */ "sliding_opt", + /* 251 */ "groupby_opt", + /* 252 */ "orderby_opt", + /* 253 */ "having_opt", + /* 254 */ "slimit_opt", + /* 255 */ "limit_opt", + /* 256 */ "union", + /* 257 */ "sclp", + /* 258 */ "expr", + /* 259 */ "as", + /* 260 */ "tablelist", + /* 261 */ "tmvar", + /* 262 */ "sortlist", + /* 263 */ "sortitem", + /* 264 */ "item", + /* 265 */ "sortorder", + /* 266 */ "grouplist", + /* 267 */ "exprlist", + /* 268 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1062,15 +1070,15 @@ static const char *const yyRuleName[] = { /* 68 */ "state ::= STATE ids", /* 69 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state", /* 70 */ "keep ::= KEEP tagitemlist", - /* 71 */ "tables ::= TABLES INTEGER", + /* 71 */ "tables ::= MAXTABLES INTEGER", /* 72 */ "cache ::= CACHE INTEGER", /* 73 */ "replica ::= REPLICA INTEGER", /* 74 */ "days ::= DAYS INTEGER", - /* 75 */ "rows ::= ROWS INTEGER", - /* 76 */ "ablocks ::= ABLOCKS ID", - /* 77 */ "tblocks ::= TBLOCKS INTEGER", + /* 75 */ "minrows ::= MINROWS INTEGER", + /* 76 */ "maxrows ::= MAXROWS INTEGER", + /* 77 */ "blocks ::= BLOCKS INTEGER", /* 78 */ "ctime ::= CTIME INTEGER", - /* 79 */ "clog ::= CLOG INTEGER", + /* 79 */ "wal ::= WAL INTEGER", /* 80 */ "comp ::= COMP INTEGER", /* 81 */ "prec ::= PRECISION STRING", /* 82 */ "db_optr ::=", @@ -1078,135 +1086,139 @@ static const char *const yyRuleName[] = { /* 84 */ "db_optr ::= db_optr cache", /* 85 */ "db_optr ::= db_optr replica", /* 86 */ "db_optr ::= db_optr days", - /* 87 */ "db_optr ::= db_optr rows", - /* 88 */ "db_optr ::= db_optr ablocks", - /* 89 */ "db_optr ::= db_optr tblocks", + /* 87 */ "db_optr ::= db_optr minrows", + /* 88 */ "db_optr ::= db_optr maxrows", + /* 89 */ "db_optr ::= db_optr blocks", /* 90 */ "db_optr ::= db_optr ctime", - /* 91 */ "db_optr ::= db_optr clog", + /* 91 */ "db_optr ::= db_optr wal", /* 92 */ "db_optr ::= db_optr comp", /* 93 */ "db_optr ::= db_optr prec", /* 94 */ "db_optr ::= db_optr keep", /* 95 */ "alter_db_optr ::=", /* 96 */ "alter_db_optr ::= alter_db_optr replica", /* 97 */ "alter_db_optr ::= alter_db_optr tables", - /* 98 */ "typename ::= ids", - /* 99 */ "typename ::= ids LP signed RP", - /* 100 */ "signed ::= INTEGER", - /* 101 */ "signed ::= PLUS INTEGER", - /* 102 */ "signed ::= MINUS INTEGER", - /* 103 */ "cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args", - /* 104 */ "create_table_args ::= LP columnlist RP", - /* 105 */ "create_table_args ::= LP columnlist RP TAGS LP columnlist RP", - /* 106 */ "create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP", - /* 107 */ "create_table_args ::= AS select", - /* 108 */ "columnlist ::= columnlist COMMA column", - /* 109 */ "columnlist ::= column", - /* 110 */ "column ::= ids typename", - /* 111 */ "tagitemlist ::= tagitemlist COMMA tagitem", - /* 112 */ "tagitemlist ::= tagitem", - /* 113 */ "tagitem ::= INTEGER", - /* 114 */ "tagitem ::= FLOAT", - /* 115 */ "tagitem ::= STRING", - /* 116 */ "tagitem ::= BOOL", - /* 117 */ "tagitem ::= NULL", - /* 118 */ "tagitem ::= MINUS INTEGER", - /* 119 */ "tagitem ::= MINUS FLOAT", - /* 120 */ "tagitem ::= PLUS INTEGER", - /* 121 */ "tagitem ::= PLUS FLOAT", - /* 122 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", - /* 123 */ "union ::= select", - /* 124 */ "union ::= LP union RP", - /* 125 */ "union ::= union UNION ALL select", - /* 126 */ "union ::= union UNION ALL LP select RP", - /* 127 */ "cmd ::= union", - /* 128 */ "select ::= SELECT selcollist", - /* 129 */ "sclp ::= selcollist COMMA", - /* 130 */ "sclp ::=", - /* 131 */ "selcollist ::= sclp expr as", - /* 132 */ "selcollist ::= sclp STAR", - /* 133 */ "as ::= AS ids", - /* 134 */ "as ::= ids", - /* 135 */ "as ::=", - /* 136 */ "from ::= FROM tablelist", - /* 137 */ "tablelist ::= ids cpxName", - /* 138 */ "tablelist ::= tablelist COMMA ids cpxName", - /* 139 */ "tmvar ::= VARIABLE", - /* 140 */ "interval_opt ::= INTERVAL LP tmvar RP", - /* 141 */ "interval_opt ::=", - /* 142 */ "fill_opt ::=", - /* 143 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", - /* 144 */ "fill_opt ::= FILL LP ID RP", - /* 145 */ "sliding_opt ::= SLIDING LP tmvar RP", - /* 146 */ "sliding_opt ::=", - /* 147 */ "orderby_opt ::=", - /* 148 */ "orderby_opt ::= ORDER BY sortlist", - /* 149 */ "sortlist ::= sortlist COMMA item sortorder", - /* 150 */ "sortlist ::= item sortorder", - /* 151 */ "item ::= ids cpxName", - /* 152 */ "sortorder ::= ASC", - /* 153 */ "sortorder ::= DESC", - /* 154 */ "sortorder ::=", - /* 155 */ "groupby_opt ::=", - /* 156 */ "groupby_opt ::= GROUP BY grouplist", - /* 157 */ "grouplist ::= grouplist COMMA item", - /* 158 */ "grouplist ::= item", - /* 159 */ "having_opt ::=", - /* 160 */ "having_opt ::= HAVING expr", - /* 161 */ "limit_opt ::=", - /* 162 */ "limit_opt ::= LIMIT signed", - /* 163 */ "limit_opt ::= LIMIT signed OFFSET signed", - /* 164 */ "limit_opt ::= LIMIT signed COMMA signed", - /* 165 */ "slimit_opt ::=", - /* 166 */ "slimit_opt ::= SLIMIT signed", - /* 167 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", - /* 168 */ "slimit_opt ::= SLIMIT signed COMMA signed", - /* 169 */ "where_opt ::=", - /* 170 */ "where_opt ::= WHERE expr", - /* 171 */ "expr ::= LP expr RP", - /* 172 */ "expr ::= ID", - /* 173 */ "expr ::= ID DOT ID", - /* 174 */ "expr ::= ID DOT STAR", - /* 175 */ "expr ::= INTEGER", - /* 176 */ "expr ::= MINUS INTEGER", - /* 177 */ "expr ::= PLUS INTEGER", - /* 178 */ "expr ::= FLOAT", - /* 179 */ "expr ::= MINUS FLOAT", - /* 180 */ "expr ::= PLUS FLOAT", - /* 181 */ "expr ::= STRING", - /* 182 */ "expr ::= NOW", - /* 183 */ "expr ::= VARIABLE", - /* 184 */ "expr ::= BOOL", - /* 185 */ "expr ::= ID LP exprlist RP", - /* 186 */ "expr ::= ID LP STAR RP", - /* 187 */ "expr ::= expr AND expr", - /* 188 */ "expr ::= expr OR expr", - /* 189 */ "expr ::= expr LT expr", - /* 190 */ "expr ::= expr GT expr", - /* 191 */ "expr ::= expr LE expr", - /* 192 */ "expr ::= expr GE expr", - /* 193 */ "expr ::= expr NE expr", - /* 194 */ "expr ::= expr EQ expr", - /* 195 */ "expr ::= expr PLUS expr", - /* 196 */ "expr ::= expr MINUS expr", - /* 197 */ "expr ::= expr STAR expr", - /* 198 */ "expr ::= expr SLASH expr", - /* 199 */ "expr ::= expr REM expr", - /* 200 */ "expr ::= expr LIKE expr", - /* 201 */ "expr ::= expr IN LP exprlist RP", - /* 202 */ "exprlist ::= exprlist COMMA expritem", - /* 203 */ "exprlist ::= expritem", - /* 204 */ "expritem ::= expr", - /* 205 */ "expritem ::=", - /* 206 */ "cmd ::= RESET QUERY CACHE", - /* 207 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 208 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 209 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 210 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 211 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 212 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 213 */ "cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER", - /* 214 */ "cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER", - /* 215 */ "cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER", + /* 98 */ "alter_db_optr ::= alter_db_optr keep", + /* 99 */ "alter_db_optr ::= alter_db_optr blocks", + /* 100 */ "alter_db_optr ::= alter_db_optr comp", + /* 101 */ "alter_db_optr ::= alter_db_optr wal", + /* 102 */ "typename ::= ids", + /* 103 */ "typename ::= ids LP signed RP", + /* 104 */ "signed ::= INTEGER", + /* 105 */ "signed ::= PLUS INTEGER", + /* 106 */ "signed ::= MINUS INTEGER", + /* 107 */ "cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args", + /* 108 */ "create_table_args ::= LP columnlist RP", + /* 109 */ "create_table_args ::= LP columnlist RP TAGS LP columnlist RP", + /* 110 */ "create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP", + /* 111 */ "create_table_args ::= AS select", + /* 112 */ "columnlist ::= columnlist COMMA column", + /* 113 */ "columnlist ::= column", + /* 114 */ "column ::= ids typename", + /* 115 */ "tagitemlist ::= tagitemlist COMMA tagitem", + /* 116 */ "tagitemlist ::= tagitem", + /* 117 */ "tagitem ::= INTEGER", + /* 118 */ "tagitem ::= FLOAT", + /* 119 */ "tagitem ::= STRING", + /* 120 */ "tagitem ::= BOOL", + /* 121 */ "tagitem ::= NULL", + /* 122 */ "tagitem ::= MINUS INTEGER", + /* 123 */ "tagitem ::= MINUS FLOAT", + /* 124 */ "tagitem ::= PLUS INTEGER", + /* 125 */ "tagitem ::= PLUS FLOAT", + /* 126 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt", + /* 127 */ "union ::= select", + /* 128 */ "union ::= LP union RP", + /* 129 */ "union ::= union UNION ALL select", + /* 130 */ "union ::= union UNION ALL LP select RP", + /* 131 */ "cmd ::= union", + /* 132 */ "select ::= SELECT selcollist", + /* 133 */ "sclp ::= selcollist COMMA", + /* 134 */ "sclp ::=", + /* 135 */ "selcollist ::= sclp expr as", + /* 136 */ "selcollist ::= sclp STAR", + /* 137 */ "as ::= AS ids", + /* 138 */ "as ::= ids", + /* 139 */ "as ::=", + /* 140 */ "from ::= FROM tablelist", + /* 141 */ "tablelist ::= ids cpxName", + /* 142 */ "tablelist ::= tablelist COMMA ids cpxName", + /* 143 */ "tmvar ::= VARIABLE", + /* 144 */ "interval_opt ::= INTERVAL LP tmvar RP", + /* 145 */ "interval_opt ::=", + /* 146 */ "fill_opt ::=", + /* 147 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", + /* 148 */ "fill_opt ::= FILL LP ID RP", + /* 149 */ "sliding_opt ::= SLIDING LP tmvar RP", + /* 150 */ "sliding_opt ::=", + /* 151 */ "orderby_opt ::=", + /* 152 */ "orderby_opt ::= ORDER BY sortlist", + /* 153 */ "sortlist ::= sortlist COMMA item sortorder", + /* 154 */ "sortlist ::= item sortorder", + /* 155 */ "item ::= ids cpxName", + /* 156 */ "sortorder ::= ASC", + /* 157 */ "sortorder ::= DESC", + /* 158 */ "sortorder ::=", + /* 159 */ "groupby_opt ::=", + /* 160 */ "groupby_opt ::= GROUP BY grouplist", + /* 161 */ "grouplist ::= grouplist COMMA item", + /* 162 */ "grouplist ::= item", + /* 163 */ "having_opt ::=", + /* 164 */ "having_opt ::= HAVING expr", + /* 165 */ "limit_opt ::=", + /* 166 */ "limit_opt ::= LIMIT signed", + /* 167 */ "limit_opt ::= LIMIT signed OFFSET signed", + /* 168 */ "limit_opt ::= LIMIT signed COMMA signed", + /* 169 */ "slimit_opt ::=", + /* 170 */ "slimit_opt ::= SLIMIT signed", + /* 171 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", + /* 172 */ "slimit_opt ::= SLIMIT signed COMMA signed", + /* 173 */ "where_opt ::=", + /* 174 */ "where_opt ::= WHERE expr", + /* 175 */ "expr ::= LP expr RP", + /* 176 */ "expr ::= ID", + /* 177 */ "expr ::= ID DOT ID", + /* 178 */ "expr ::= ID DOT STAR", + /* 179 */ "expr ::= INTEGER", + /* 180 */ "expr ::= MINUS INTEGER", + /* 181 */ "expr ::= PLUS INTEGER", + /* 182 */ "expr ::= FLOAT", + /* 183 */ "expr ::= MINUS FLOAT", + /* 184 */ "expr ::= PLUS FLOAT", + /* 185 */ "expr ::= STRING", + /* 186 */ "expr ::= NOW", + /* 187 */ "expr ::= VARIABLE", + /* 188 */ "expr ::= BOOL", + /* 189 */ "expr ::= ID LP exprlist RP", + /* 190 */ "expr ::= ID LP STAR RP", + /* 191 */ "expr ::= expr AND expr", + /* 192 */ "expr ::= expr OR expr", + /* 193 */ "expr ::= expr LT expr", + /* 194 */ "expr ::= expr GT expr", + /* 195 */ "expr ::= expr LE expr", + /* 196 */ "expr ::= expr GE expr", + /* 197 */ "expr ::= expr NE expr", + /* 198 */ "expr ::= expr EQ expr", + /* 199 */ "expr ::= expr PLUS expr", + /* 200 */ "expr ::= expr MINUS expr", + /* 201 */ "expr ::= expr STAR expr", + /* 202 */ "expr ::= expr SLASH expr", + /* 203 */ "expr ::= expr REM expr", + /* 204 */ "expr ::= expr LIKE expr", + /* 205 */ "expr ::= expr IN LP exprlist RP", + /* 206 */ "exprlist ::= exprlist COMMA expritem", + /* 207 */ "exprlist ::= expritem", + /* 208 */ "expritem ::= expr", + /* 209 */ "expritem ::=", + /* 210 */ "cmd ::= RESET QUERY CACHE", + /* 211 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 212 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 213 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 214 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 215 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 216 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 217 */ "cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER", + /* 218 */ "cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER", + /* 219 */ "cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1327,50 +1339,50 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 223: /* keep */ - case 224: /* tagitemlist */ - case 247: /* fill_opt */ - case 249: /* groupby_opt */ - case 250: /* orderby_opt */ - case 260: /* sortlist */ - case 264: /* grouplist */ + case 225: /* keep */ + case 226: /* tagitemlist */ + case 249: /* fill_opt */ + case 251: /* groupby_opt */ + case 252: /* orderby_opt */ + case 262: /* sortlist */ + case 266: /* grouplist */ { -tVariantListDestroy((yypminor->yy30)); +tVariantListDestroy((yypminor->yy322)); } break; - case 239: /* columnlist */ + case 241: /* columnlist */ { -tFieldListDestroy((yypminor->yy325)); +tFieldListDestroy((yypminor->yy369)); } break; - case 240: /* select */ + case 242: /* select */ { -doDestroyQuerySql((yypminor->yy444)); +doDestroyQuerySql((yypminor->yy190)); } break; - case 243: /* selcollist */ - case 255: /* sclp */ - case 265: /* exprlist */ + case 245: /* selcollist */ + case 257: /* sclp */ + case 267: /* exprlist */ { -tSQLExprListDestroy((yypminor->yy506)); +tSQLExprListDestroy((yypminor->yy260)); } break; - case 245: /* where_opt */ - case 251: /* having_opt */ - case 256: /* expr */ - case 266: /* expritem */ + case 247: /* where_opt */ + case 253: /* having_opt */ + case 258: /* expr */ + case 268: /* expritem */ { -tSQLExprDestroy((yypminor->yy388)); +tSQLExprDestroy((yypminor->yy500)); } break; - case 254: /* union */ + case 256: /* union */ { -destroyAllSelectClause((yypminor->yy309)); +destroyAllSelectClause((yypminor->yy263)); } break; - case 261: /* sortitem */ + case 263: /* sortitem */ { -tVariantDestroy(&(yypminor->yy380)); +tVariantDestroy(&(yypminor->yy518)); } break; /********* End destructor definitions *****************************************/ @@ -1664,222 +1676,226 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 204, -1 }, /* (0) program ::= cmd */ - { 205, -2 }, /* (1) cmd ::= SHOW DATABASES */ - { 205, -2 }, /* (2) cmd ::= SHOW MNODES */ - { 205, -2 }, /* (3) cmd ::= SHOW DNODES */ - { 205, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ - { 205, -2 }, /* (5) cmd ::= SHOW USERS */ - { 205, -2 }, /* (6) cmd ::= SHOW MODULES */ - { 205, -2 }, /* (7) cmd ::= SHOW QUERIES */ - { 205, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ - { 205, -2 }, /* (9) cmd ::= SHOW STREAMS */ - { 205, -2 }, /* (10) cmd ::= SHOW CONFIGS */ - { 205, -2 }, /* (11) cmd ::= SHOW SCORES */ - { 205, -2 }, /* (12) cmd ::= SHOW GRANTS */ - { 205, -2 }, /* (13) cmd ::= SHOW VNODES */ - { 205, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - { 206, 0 }, /* (15) dbPrefix ::= */ - { 206, -2 }, /* (16) dbPrefix ::= ids DOT */ - { 208, 0 }, /* (17) cpxName ::= */ - { 208, -2 }, /* (18) cpxName ::= DOT ids */ - { 205, -3 }, /* (19) cmd ::= SHOW dbPrefix TABLES */ - { 205, -5 }, /* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - { 205, -3 }, /* (21) cmd ::= SHOW dbPrefix STABLES */ - { 205, -5 }, /* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - { 205, -3 }, /* (23) cmd ::= SHOW dbPrefix VGROUPS */ - { 205, -4 }, /* (24) cmd ::= SHOW dbPrefix VGROUPS ids */ - { 205, -5 }, /* (25) cmd ::= DROP TABLE ifexists ids cpxName */ - { 205, -4 }, /* (26) cmd ::= DROP DATABASE ifexists ids */ - { 205, -3 }, /* (27) cmd ::= DROP DNODE ids */ - { 205, -3 }, /* (28) cmd ::= DROP USER ids */ - { 205, -3 }, /* (29) cmd ::= DROP ACCOUNT ids */ - { 205, -2 }, /* (30) cmd ::= USE ids */ - { 205, -3 }, /* (31) cmd ::= DESCRIBE ids cpxName */ - { 205, -5 }, /* (32) cmd ::= ALTER USER ids PASS ids */ - { 205, -5 }, /* (33) cmd ::= ALTER USER ids PRIVILEGE ids */ - { 205, -4 }, /* (34) cmd ::= ALTER DNODE ids ids */ - { 205, -5 }, /* (35) cmd ::= ALTER DNODE ids ids ids */ - { 205, -3 }, /* (36) cmd ::= ALTER LOCAL ids */ - { 205, -4 }, /* (37) cmd ::= ALTER LOCAL ids ids */ - { 205, -4 }, /* (38) cmd ::= ALTER DATABASE ids alter_db_optr */ - { 205, -4 }, /* (39) cmd ::= ALTER ACCOUNT ids acct_optr */ - { 205, -6 }, /* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - { 207, -1 }, /* (41) ids ::= ID */ - { 207, -1 }, /* (42) ids ::= STRING */ - { 209, -2 }, /* (43) ifexists ::= IF EXISTS */ - { 209, 0 }, /* (44) ifexists ::= */ - { 212, -3 }, /* (45) ifnotexists ::= IF NOT EXISTS */ - { 212, 0 }, /* (46) ifnotexists ::= */ - { 205, -3 }, /* (47) cmd ::= CREATE DNODE ids */ - { 205, -6 }, /* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - { 205, -5 }, /* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - { 205, -5 }, /* (50) cmd ::= CREATE USER ids PASS ids */ - { 214, 0 }, /* (51) pps ::= */ - { 214, -2 }, /* (52) pps ::= PPS INTEGER */ - { 215, 0 }, /* (53) tseries ::= */ - { 215, -2 }, /* (54) tseries ::= TSERIES INTEGER */ - { 216, 0 }, /* (55) dbs ::= */ - { 216, -2 }, /* (56) dbs ::= DBS INTEGER */ - { 217, 0 }, /* (57) streams ::= */ - { 217, -2 }, /* (58) streams ::= STREAMS INTEGER */ - { 218, 0 }, /* (59) storage ::= */ - { 218, -2 }, /* (60) storage ::= STORAGE INTEGER */ - { 219, 0 }, /* (61) qtime ::= */ - { 219, -2 }, /* (62) qtime ::= QTIME INTEGER */ - { 220, 0 }, /* (63) users ::= */ - { 220, -2 }, /* (64) users ::= USERS INTEGER */ - { 221, 0 }, /* (65) conns ::= */ - { 221, -2 }, /* (66) conns ::= CONNS INTEGER */ - { 222, 0 }, /* (67) state ::= */ - { 222, -2 }, /* (68) state ::= STATE ids */ - { 211, -9 }, /* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - { 223, -2 }, /* (70) keep ::= KEEP tagitemlist */ - { 225, -2 }, /* (71) tables ::= TABLES INTEGER */ - { 226, -2 }, /* (72) cache ::= CACHE INTEGER */ - { 227, -2 }, /* (73) replica ::= REPLICA INTEGER */ - { 228, -2 }, /* (74) days ::= DAYS INTEGER */ - { 229, -2 }, /* (75) rows ::= ROWS INTEGER */ - { 230, -2 }, /* (76) ablocks ::= ABLOCKS ID */ - { 231, -2 }, /* (77) tblocks ::= TBLOCKS INTEGER */ - { 232, -2 }, /* (78) ctime ::= CTIME INTEGER */ - { 233, -2 }, /* (79) clog ::= CLOG INTEGER */ - { 234, -2 }, /* (80) comp ::= COMP INTEGER */ - { 235, -2 }, /* (81) prec ::= PRECISION STRING */ - { 213, 0 }, /* (82) db_optr ::= */ - { 213, -2 }, /* (83) db_optr ::= db_optr tables */ - { 213, -2 }, /* (84) db_optr ::= db_optr cache */ - { 213, -2 }, /* (85) db_optr ::= db_optr replica */ - { 213, -2 }, /* (86) db_optr ::= db_optr days */ - { 213, -2 }, /* (87) db_optr ::= db_optr rows */ - { 213, -2 }, /* (88) db_optr ::= db_optr ablocks */ - { 213, -2 }, /* (89) db_optr ::= db_optr tblocks */ - { 213, -2 }, /* (90) db_optr ::= db_optr ctime */ - { 213, -2 }, /* (91) db_optr ::= db_optr clog */ - { 213, -2 }, /* (92) db_optr ::= db_optr comp */ - { 213, -2 }, /* (93) db_optr ::= db_optr prec */ - { 213, -2 }, /* (94) db_optr ::= db_optr keep */ - { 210, 0 }, /* (95) alter_db_optr ::= */ - { 210, -2 }, /* (96) alter_db_optr ::= alter_db_optr replica */ - { 210, -2 }, /* (97) alter_db_optr ::= alter_db_optr tables */ - { 236, -1 }, /* (98) typename ::= ids */ - { 236, -4 }, /* (99) typename ::= ids LP signed RP */ - { 237, -1 }, /* (100) signed ::= INTEGER */ - { 237, -2 }, /* (101) signed ::= PLUS INTEGER */ - { 237, -2 }, /* (102) signed ::= MINUS INTEGER */ - { 205, -6 }, /* (103) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ - { 238, -3 }, /* (104) create_table_args ::= LP columnlist RP */ - { 238, -7 }, /* (105) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ - { 238, -7 }, /* (106) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ - { 238, -2 }, /* (107) create_table_args ::= AS select */ - { 239, -3 }, /* (108) columnlist ::= columnlist COMMA column */ - { 239, -1 }, /* (109) columnlist ::= column */ - { 241, -2 }, /* (110) column ::= ids typename */ - { 224, -3 }, /* (111) tagitemlist ::= tagitemlist COMMA tagitem */ - { 224, -1 }, /* (112) tagitemlist ::= tagitem */ - { 242, -1 }, /* (113) tagitem ::= INTEGER */ - { 242, -1 }, /* (114) tagitem ::= FLOAT */ - { 242, -1 }, /* (115) tagitem ::= STRING */ - { 242, -1 }, /* (116) tagitem ::= BOOL */ - { 242, -1 }, /* (117) tagitem ::= NULL */ - { 242, -2 }, /* (118) tagitem ::= MINUS INTEGER */ - { 242, -2 }, /* (119) tagitem ::= MINUS FLOAT */ - { 242, -2 }, /* (120) tagitem ::= PLUS INTEGER */ - { 242, -2 }, /* (121) tagitem ::= PLUS FLOAT */ - { 240, -12 }, /* (122) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - { 254, -1 }, /* (123) union ::= select */ - { 254, -3 }, /* (124) union ::= LP union RP */ - { 254, -4 }, /* (125) union ::= union UNION ALL select */ - { 254, -6 }, /* (126) union ::= union UNION ALL LP select RP */ - { 205, -1 }, /* (127) cmd ::= union */ - { 240, -2 }, /* (128) select ::= SELECT selcollist */ - { 255, -2 }, /* (129) sclp ::= selcollist COMMA */ - { 255, 0 }, /* (130) sclp ::= */ - { 243, -3 }, /* (131) selcollist ::= sclp expr as */ - { 243, -2 }, /* (132) selcollist ::= sclp STAR */ - { 257, -2 }, /* (133) as ::= AS ids */ - { 257, -1 }, /* (134) as ::= ids */ - { 257, 0 }, /* (135) as ::= */ - { 244, -2 }, /* (136) from ::= FROM tablelist */ - { 258, -2 }, /* (137) tablelist ::= ids cpxName */ - { 258, -4 }, /* (138) tablelist ::= tablelist COMMA ids cpxName */ - { 259, -1 }, /* (139) tmvar ::= VARIABLE */ - { 246, -4 }, /* (140) interval_opt ::= INTERVAL LP tmvar RP */ - { 246, 0 }, /* (141) interval_opt ::= */ - { 247, 0 }, /* (142) fill_opt ::= */ - { 247, -6 }, /* (143) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - { 247, -4 }, /* (144) fill_opt ::= FILL LP ID RP */ - { 248, -4 }, /* (145) sliding_opt ::= SLIDING LP tmvar RP */ - { 248, 0 }, /* (146) sliding_opt ::= */ - { 250, 0 }, /* (147) orderby_opt ::= */ - { 250, -3 }, /* (148) orderby_opt ::= ORDER BY sortlist */ - { 260, -4 }, /* (149) sortlist ::= sortlist COMMA item sortorder */ - { 260, -2 }, /* (150) sortlist ::= item sortorder */ - { 262, -2 }, /* (151) item ::= ids cpxName */ - { 263, -1 }, /* (152) sortorder ::= ASC */ - { 263, -1 }, /* (153) sortorder ::= DESC */ - { 263, 0 }, /* (154) sortorder ::= */ - { 249, 0 }, /* (155) groupby_opt ::= */ - { 249, -3 }, /* (156) groupby_opt ::= GROUP BY grouplist */ - { 264, -3 }, /* (157) grouplist ::= grouplist COMMA item */ - { 264, -1 }, /* (158) grouplist ::= item */ - { 251, 0 }, /* (159) having_opt ::= */ - { 251, -2 }, /* (160) having_opt ::= HAVING expr */ - { 253, 0 }, /* (161) limit_opt ::= */ - { 253, -2 }, /* (162) limit_opt ::= LIMIT signed */ - { 253, -4 }, /* (163) limit_opt ::= LIMIT signed OFFSET signed */ - { 253, -4 }, /* (164) limit_opt ::= LIMIT signed COMMA signed */ - { 252, 0 }, /* (165) slimit_opt ::= */ - { 252, -2 }, /* (166) slimit_opt ::= SLIMIT signed */ - { 252, -4 }, /* (167) slimit_opt ::= SLIMIT signed SOFFSET signed */ - { 252, -4 }, /* (168) slimit_opt ::= SLIMIT signed COMMA signed */ - { 245, 0 }, /* (169) where_opt ::= */ - { 245, -2 }, /* (170) where_opt ::= WHERE expr */ - { 256, -3 }, /* (171) expr ::= LP expr RP */ - { 256, -1 }, /* (172) expr ::= ID */ - { 256, -3 }, /* (173) expr ::= ID DOT ID */ - { 256, -3 }, /* (174) expr ::= ID DOT STAR */ - { 256, -1 }, /* (175) expr ::= INTEGER */ - { 256, -2 }, /* (176) expr ::= MINUS INTEGER */ - { 256, -2 }, /* (177) expr ::= PLUS INTEGER */ - { 256, -1 }, /* (178) expr ::= FLOAT */ - { 256, -2 }, /* (179) expr ::= MINUS FLOAT */ - { 256, -2 }, /* (180) expr ::= PLUS FLOAT */ - { 256, -1 }, /* (181) expr ::= STRING */ - { 256, -1 }, /* (182) expr ::= NOW */ - { 256, -1 }, /* (183) expr ::= VARIABLE */ - { 256, -1 }, /* (184) expr ::= BOOL */ - { 256, -4 }, /* (185) expr ::= ID LP exprlist RP */ - { 256, -4 }, /* (186) expr ::= ID LP STAR RP */ - { 256, -3 }, /* (187) expr ::= expr AND expr */ - { 256, -3 }, /* (188) expr ::= expr OR expr */ - { 256, -3 }, /* (189) expr ::= expr LT expr */ - { 256, -3 }, /* (190) expr ::= expr GT expr */ - { 256, -3 }, /* (191) expr ::= expr LE expr */ - { 256, -3 }, /* (192) expr ::= expr GE expr */ - { 256, -3 }, /* (193) expr ::= expr NE expr */ - { 256, -3 }, /* (194) expr ::= expr EQ expr */ - { 256, -3 }, /* (195) expr ::= expr PLUS expr */ - { 256, -3 }, /* (196) expr ::= expr MINUS expr */ - { 256, -3 }, /* (197) expr ::= expr STAR expr */ - { 256, -3 }, /* (198) expr ::= expr SLASH expr */ - { 256, -3 }, /* (199) expr ::= expr REM expr */ - { 256, -3 }, /* (200) expr ::= expr LIKE expr */ - { 256, -5 }, /* (201) expr ::= expr IN LP exprlist RP */ - { 265, -3 }, /* (202) exprlist ::= exprlist COMMA expritem */ - { 265, -1 }, /* (203) exprlist ::= expritem */ - { 266, -1 }, /* (204) expritem ::= expr */ - { 266, 0 }, /* (205) expritem ::= */ - { 205, -3 }, /* (206) cmd ::= RESET QUERY CACHE */ - { 205, -7 }, /* (207) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 205, -7 }, /* (208) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 205, -7 }, /* (209) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 205, -7 }, /* (210) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 205, -8 }, /* (211) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 205, -9 }, /* (212) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 205, -5 }, /* (213) cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */ - { 205, -7 }, /* (214) cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */ - { 205, -7 }, /* (215) cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */ + { 206, -1 }, /* (0) program ::= cmd */ + { 207, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 207, -2 }, /* (2) cmd ::= SHOW MNODES */ + { 207, -2 }, /* (3) cmd ::= SHOW DNODES */ + { 207, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ + { 207, -2 }, /* (5) cmd ::= SHOW USERS */ + { 207, -2 }, /* (6) cmd ::= SHOW MODULES */ + { 207, -2 }, /* (7) cmd ::= SHOW QUERIES */ + { 207, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ + { 207, -2 }, /* (9) cmd ::= SHOW STREAMS */ + { 207, -2 }, /* (10) cmd ::= SHOW CONFIGS */ + { 207, -2 }, /* (11) cmd ::= SHOW SCORES */ + { 207, -2 }, /* (12) cmd ::= SHOW GRANTS */ + { 207, -2 }, /* (13) cmd ::= SHOW VNODES */ + { 207, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ + { 208, 0 }, /* (15) dbPrefix ::= */ + { 208, -2 }, /* (16) dbPrefix ::= ids DOT */ + { 210, 0 }, /* (17) cpxName ::= */ + { 210, -2 }, /* (18) cpxName ::= DOT ids */ + { 207, -3 }, /* (19) cmd ::= SHOW dbPrefix TABLES */ + { 207, -5 }, /* (20) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 207, -3 }, /* (21) cmd ::= SHOW dbPrefix STABLES */ + { 207, -5 }, /* (22) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 207, -3 }, /* (23) cmd ::= SHOW dbPrefix VGROUPS */ + { 207, -4 }, /* (24) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 207, -5 }, /* (25) cmd ::= DROP TABLE ifexists ids cpxName */ + { 207, -4 }, /* (26) cmd ::= DROP DATABASE ifexists ids */ + { 207, -3 }, /* (27) cmd ::= DROP DNODE ids */ + { 207, -3 }, /* (28) cmd ::= DROP USER ids */ + { 207, -3 }, /* (29) cmd ::= DROP ACCOUNT ids */ + { 207, -2 }, /* (30) cmd ::= USE ids */ + { 207, -3 }, /* (31) cmd ::= DESCRIBE ids cpxName */ + { 207, -5 }, /* (32) cmd ::= ALTER USER ids PASS ids */ + { 207, -5 }, /* (33) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 207, -4 }, /* (34) cmd ::= ALTER DNODE ids ids */ + { 207, -5 }, /* (35) cmd ::= ALTER DNODE ids ids ids */ + { 207, -3 }, /* (36) cmd ::= ALTER LOCAL ids */ + { 207, -4 }, /* (37) cmd ::= ALTER LOCAL ids ids */ + { 207, -4 }, /* (38) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 207, -4 }, /* (39) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 207, -6 }, /* (40) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 209, -1 }, /* (41) ids ::= ID */ + { 209, -1 }, /* (42) ids ::= STRING */ + { 211, -2 }, /* (43) ifexists ::= IF EXISTS */ + { 211, 0 }, /* (44) ifexists ::= */ + { 214, -3 }, /* (45) ifnotexists ::= IF NOT EXISTS */ + { 214, 0 }, /* (46) ifnotexists ::= */ + { 207, -3 }, /* (47) cmd ::= CREATE DNODE ids */ + { 207, -6 }, /* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 207, -5 }, /* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 207, -5 }, /* (50) cmd ::= CREATE USER ids PASS ids */ + { 216, 0 }, /* (51) pps ::= */ + { 216, -2 }, /* (52) pps ::= PPS INTEGER */ + { 217, 0 }, /* (53) tseries ::= */ + { 217, -2 }, /* (54) tseries ::= TSERIES INTEGER */ + { 218, 0 }, /* (55) dbs ::= */ + { 218, -2 }, /* (56) dbs ::= DBS INTEGER */ + { 219, 0 }, /* (57) streams ::= */ + { 219, -2 }, /* (58) streams ::= STREAMS INTEGER */ + { 220, 0 }, /* (59) storage ::= */ + { 220, -2 }, /* (60) storage ::= STORAGE INTEGER */ + { 221, 0 }, /* (61) qtime ::= */ + { 221, -2 }, /* (62) qtime ::= QTIME INTEGER */ + { 222, 0 }, /* (63) users ::= */ + { 222, -2 }, /* (64) users ::= USERS INTEGER */ + { 223, 0 }, /* (65) conns ::= */ + { 223, -2 }, /* (66) conns ::= CONNS INTEGER */ + { 224, 0 }, /* (67) state ::= */ + { 224, -2 }, /* (68) state ::= STATE ids */ + { 213, -9 }, /* (69) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 225, -2 }, /* (70) keep ::= KEEP tagitemlist */ + { 227, -2 }, /* (71) tables ::= MAXTABLES INTEGER */ + { 228, -2 }, /* (72) cache ::= CACHE INTEGER */ + { 229, -2 }, /* (73) replica ::= REPLICA INTEGER */ + { 230, -2 }, /* (74) days ::= DAYS INTEGER */ + { 231, -2 }, /* (75) minrows ::= MINROWS INTEGER */ + { 232, -2 }, /* (76) maxrows ::= MAXROWS INTEGER */ + { 233, -2 }, /* (77) blocks ::= BLOCKS INTEGER */ + { 234, -2 }, /* (78) ctime ::= CTIME INTEGER */ + { 235, -2 }, /* (79) wal ::= WAL INTEGER */ + { 236, -2 }, /* (80) comp ::= COMP INTEGER */ + { 237, -2 }, /* (81) prec ::= PRECISION STRING */ + { 215, 0 }, /* (82) db_optr ::= */ + { 215, -2 }, /* (83) db_optr ::= db_optr tables */ + { 215, -2 }, /* (84) db_optr ::= db_optr cache */ + { 215, -2 }, /* (85) db_optr ::= db_optr replica */ + { 215, -2 }, /* (86) db_optr ::= db_optr days */ + { 215, -2 }, /* (87) db_optr ::= db_optr minrows */ + { 215, -2 }, /* (88) db_optr ::= db_optr maxrows */ + { 215, -2 }, /* (89) db_optr ::= db_optr blocks */ + { 215, -2 }, /* (90) db_optr ::= db_optr ctime */ + { 215, -2 }, /* (91) db_optr ::= db_optr wal */ + { 215, -2 }, /* (92) db_optr ::= db_optr comp */ + { 215, -2 }, /* (93) db_optr ::= db_optr prec */ + { 215, -2 }, /* (94) db_optr ::= db_optr keep */ + { 212, 0 }, /* (95) alter_db_optr ::= */ + { 212, -2 }, /* (96) alter_db_optr ::= alter_db_optr replica */ + { 212, -2 }, /* (97) alter_db_optr ::= alter_db_optr tables */ + { 212, -2 }, /* (98) alter_db_optr ::= alter_db_optr keep */ + { 212, -2 }, /* (99) alter_db_optr ::= alter_db_optr blocks */ + { 212, -2 }, /* (100) alter_db_optr ::= alter_db_optr comp */ + { 212, -2 }, /* (101) alter_db_optr ::= alter_db_optr wal */ + { 238, -1 }, /* (102) typename ::= ids */ + { 238, -4 }, /* (103) typename ::= ids LP signed RP */ + { 239, -1 }, /* (104) signed ::= INTEGER */ + { 239, -2 }, /* (105) signed ::= PLUS INTEGER */ + { 239, -2 }, /* (106) signed ::= MINUS INTEGER */ + { 207, -6 }, /* (107) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ + { 240, -3 }, /* (108) create_table_args ::= LP columnlist RP */ + { 240, -7 }, /* (109) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ + { 240, -7 }, /* (110) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ + { 240, -2 }, /* (111) create_table_args ::= AS select */ + { 241, -3 }, /* (112) columnlist ::= columnlist COMMA column */ + { 241, -1 }, /* (113) columnlist ::= column */ + { 243, -2 }, /* (114) column ::= ids typename */ + { 226, -3 }, /* (115) tagitemlist ::= tagitemlist COMMA tagitem */ + { 226, -1 }, /* (116) tagitemlist ::= tagitem */ + { 244, -1 }, /* (117) tagitem ::= INTEGER */ + { 244, -1 }, /* (118) tagitem ::= FLOAT */ + { 244, -1 }, /* (119) tagitem ::= STRING */ + { 244, -1 }, /* (120) tagitem ::= BOOL */ + { 244, -1 }, /* (121) tagitem ::= NULL */ + { 244, -2 }, /* (122) tagitem ::= MINUS INTEGER */ + { 244, -2 }, /* (123) tagitem ::= MINUS FLOAT */ + { 244, -2 }, /* (124) tagitem ::= PLUS INTEGER */ + { 244, -2 }, /* (125) tagitem ::= PLUS FLOAT */ + { 242, -12 }, /* (126) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 256, -1 }, /* (127) union ::= select */ + { 256, -3 }, /* (128) union ::= LP union RP */ + { 256, -4 }, /* (129) union ::= union UNION ALL select */ + { 256, -6 }, /* (130) union ::= union UNION ALL LP select RP */ + { 207, -1 }, /* (131) cmd ::= union */ + { 242, -2 }, /* (132) select ::= SELECT selcollist */ + { 257, -2 }, /* (133) sclp ::= selcollist COMMA */ + { 257, 0 }, /* (134) sclp ::= */ + { 245, -3 }, /* (135) selcollist ::= sclp expr as */ + { 245, -2 }, /* (136) selcollist ::= sclp STAR */ + { 259, -2 }, /* (137) as ::= AS ids */ + { 259, -1 }, /* (138) as ::= ids */ + { 259, 0 }, /* (139) as ::= */ + { 246, -2 }, /* (140) from ::= FROM tablelist */ + { 260, -2 }, /* (141) tablelist ::= ids cpxName */ + { 260, -4 }, /* (142) tablelist ::= tablelist COMMA ids cpxName */ + { 261, -1 }, /* (143) tmvar ::= VARIABLE */ + { 248, -4 }, /* (144) interval_opt ::= INTERVAL LP tmvar RP */ + { 248, 0 }, /* (145) interval_opt ::= */ + { 249, 0 }, /* (146) fill_opt ::= */ + { 249, -6 }, /* (147) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 249, -4 }, /* (148) fill_opt ::= FILL LP ID RP */ + { 250, -4 }, /* (149) sliding_opt ::= SLIDING LP tmvar RP */ + { 250, 0 }, /* (150) sliding_opt ::= */ + { 252, 0 }, /* (151) orderby_opt ::= */ + { 252, -3 }, /* (152) orderby_opt ::= ORDER BY sortlist */ + { 262, -4 }, /* (153) sortlist ::= sortlist COMMA item sortorder */ + { 262, -2 }, /* (154) sortlist ::= item sortorder */ + { 264, -2 }, /* (155) item ::= ids cpxName */ + { 265, -1 }, /* (156) sortorder ::= ASC */ + { 265, -1 }, /* (157) sortorder ::= DESC */ + { 265, 0 }, /* (158) sortorder ::= */ + { 251, 0 }, /* (159) groupby_opt ::= */ + { 251, -3 }, /* (160) groupby_opt ::= GROUP BY grouplist */ + { 266, -3 }, /* (161) grouplist ::= grouplist COMMA item */ + { 266, -1 }, /* (162) grouplist ::= item */ + { 253, 0 }, /* (163) having_opt ::= */ + { 253, -2 }, /* (164) having_opt ::= HAVING expr */ + { 255, 0 }, /* (165) limit_opt ::= */ + { 255, -2 }, /* (166) limit_opt ::= LIMIT signed */ + { 255, -4 }, /* (167) limit_opt ::= LIMIT signed OFFSET signed */ + { 255, -4 }, /* (168) limit_opt ::= LIMIT signed COMMA signed */ + { 254, 0 }, /* (169) slimit_opt ::= */ + { 254, -2 }, /* (170) slimit_opt ::= SLIMIT signed */ + { 254, -4 }, /* (171) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 254, -4 }, /* (172) slimit_opt ::= SLIMIT signed COMMA signed */ + { 247, 0 }, /* (173) where_opt ::= */ + { 247, -2 }, /* (174) where_opt ::= WHERE expr */ + { 258, -3 }, /* (175) expr ::= LP expr RP */ + { 258, -1 }, /* (176) expr ::= ID */ + { 258, -3 }, /* (177) expr ::= ID DOT ID */ + { 258, -3 }, /* (178) expr ::= ID DOT STAR */ + { 258, -1 }, /* (179) expr ::= INTEGER */ + { 258, -2 }, /* (180) expr ::= MINUS INTEGER */ + { 258, -2 }, /* (181) expr ::= PLUS INTEGER */ + { 258, -1 }, /* (182) expr ::= FLOAT */ + { 258, -2 }, /* (183) expr ::= MINUS FLOAT */ + { 258, -2 }, /* (184) expr ::= PLUS FLOAT */ + { 258, -1 }, /* (185) expr ::= STRING */ + { 258, -1 }, /* (186) expr ::= NOW */ + { 258, -1 }, /* (187) expr ::= VARIABLE */ + { 258, -1 }, /* (188) expr ::= BOOL */ + { 258, -4 }, /* (189) expr ::= ID LP exprlist RP */ + { 258, -4 }, /* (190) expr ::= ID LP STAR RP */ + { 258, -3 }, /* (191) expr ::= expr AND expr */ + { 258, -3 }, /* (192) expr ::= expr OR expr */ + { 258, -3 }, /* (193) expr ::= expr LT expr */ + { 258, -3 }, /* (194) expr ::= expr GT expr */ + { 258, -3 }, /* (195) expr ::= expr LE expr */ + { 258, -3 }, /* (196) expr ::= expr GE expr */ + { 258, -3 }, /* (197) expr ::= expr NE expr */ + { 258, -3 }, /* (198) expr ::= expr EQ expr */ + { 258, -3 }, /* (199) expr ::= expr PLUS expr */ + { 258, -3 }, /* (200) expr ::= expr MINUS expr */ + { 258, -3 }, /* (201) expr ::= expr STAR expr */ + { 258, -3 }, /* (202) expr ::= expr SLASH expr */ + { 258, -3 }, /* (203) expr ::= expr REM expr */ + { 258, -3 }, /* (204) expr ::= expr LIKE expr */ + { 258, -5 }, /* (205) expr ::= expr IN LP exprlist RP */ + { 267, -3 }, /* (206) exprlist ::= exprlist COMMA expritem */ + { 267, -1 }, /* (207) exprlist ::= expritem */ + { 268, -1 }, /* (208) expritem ::= expr */ + { 268, 0 }, /* (209) expritem ::= */ + { 207, -3 }, /* (210) cmd ::= RESET QUERY CACHE */ + { 207, -7 }, /* (211) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 207, -7 }, /* (212) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 207, -7 }, /* (213) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 207, -7 }, /* (214) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 207, -8 }, /* (215) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 207, -9 }, /* (216) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 207, -5 }, /* (217) cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */ + { 207, -7 }, /* (218) cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */ + { 207, -7 }, /* (219) cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2099,13 +2115,13 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 38: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -{ SSQLToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy532, &t);} +{ SSQLToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy374, &t);} break; case 39: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy239);} +{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy219);} break; case 40: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy239);} +{ setCreateAcctSQL(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy219);} break; case 41: /* ids ::= ID */ case 42: /* ids ::= STRING */ yytestcase(yyruleno==42); @@ -2126,10 +2142,10 @@ static void yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 48: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSQL(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy239);} +{ setCreateAcctSQL(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy219);} break; case 49: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy532, &yymsp[-2].minor.yy0);} +{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy374, &yymsp[-2].minor.yy0);} break; case 50: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSQL(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2158,508 +2174,512 @@ static void yy_reduce( break; case 69: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy239.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy239.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy239.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy239.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy239.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy239.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy239.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy239.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy239.stat = yymsp[0].minor.yy0; + yylhsminor.yy219.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy219.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy219.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy219.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy219.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy219.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy219.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy219.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy219.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy239 = yylhsminor.yy239; + yymsp[-8].minor.yy219 = yylhsminor.yy219; break; case 70: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy30 = yymsp[0].minor.yy30; } +{ yymsp[-1].minor.yy322 = yymsp[0].minor.yy322; } break; - case 71: /* tables ::= TABLES INTEGER */ + case 71: /* tables ::= MAXTABLES INTEGER */ case 72: /* cache ::= CACHE INTEGER */ yytestcase(yyruleno==72); case 73: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==73); case 74: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==74); - case 75: /* rows ::= ROWS INTEGER */ yytestcase(yyruleno==75); - case 76: /* ablocks ::= ABLOCKS ID */ yytestcase(yyruleno==76); - case 77: /* tblocks ::= TBLOCKS INTEGER */ yytestcase(yyruleno==77); + case 75: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==75); + case 76: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==76); + case 77: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==77); case 78: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==78); - case 79: /* clog ::= CLOG INTEGER */ yytestcase(yyruleno==79); + case 79: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==79); case 80: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==80); case 81: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==81); { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 82: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy532);} +{setDefaultCreateDbOption(&yymsp[1].minor.yy374);} break; case 83: /* db_optr ::= db_optr tables */ case 97: /* alter_db_optr ::= alter_db_optr tables */ yytestcase(yyruleno==97); -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.tablesPerVnode = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.maxTablesPerVnode = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 84: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 85: /* db_optr ::= db_optr replica */ case 96: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==96); -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 86: /* db_optr ::= db_optr days */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; - case 87: /* db_optr ::= db_optr rows */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.rowPerFileBlock = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; + case 87: /* db_optr ::= db_optr minrows */ +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; - case 88: /* db_optr ::= db_optr ablocks */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.numOfAvgCacheBlocks = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; + case 88: /* db_optr ::= db_optr maxrows */ +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; - case 89: /* db_optr ::= db_optr tblocks */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.numOfBlocksPerTable = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; + case 89: /* db_optr ::= db_optr blocks */ + case 99: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==99); +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 90: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; - case 91: /* db_optr ::= db_optr clog */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.commitLog = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; + case 91: /* db_optr ::= db_optr wal */ + case 101: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==101); +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 92: /* db_optr ::= db_optr comp */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy532 = yylhsminor.yy532; + case 100: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==100); +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 93: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy532 = yylhsminor.yy532; +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 94: /* db_optr ::= db_optr keep */ -{ yylhsminor.yy532 = yymsp[-1].minor.yy532; yylhsminor.yy532.keep = yymsp[0].minor.yy30; } - yymsp[-1].minor.yy532 = yylhsminor.yy532; + case 98: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==98); +{ yylhsminor.yy374 = yymsp[-1].minor.yy374; yylhsminor.yy374.keep = yymsp[0].minor.yy322; } + yymsp[-1].minor.yy374 = yylhsminor.yy374; break; case 95: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy532);} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy374);} break; - case 98: /* typename ::= ids */ -{ tSQLSetColumnType (&yylhsminor.yy505, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy505 = yylhsminor.yy505; + case 102: /* typename ::= ids */ +{ tSQLSetColumnType (&yylhsminor.yy325, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy325 = yylhsminor.yy325; break; - case 99: /* typename ::= ids LP signed RP */ + case 103: /* typename ::= ids LP signed RP */ { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy489; // negative value of name length - tSQLSetColumnType(&yylhsminor.yy505, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy279; // negative value of name length + tSQLSetColumnType(&yylhsminor.yy325, &yymsp[-3].minor.yy0); } - yymsp[-3].minor.yy505 = yylhsminor.yy505; + yymsp[-3].minor.yy325 = yylhsminor.yy325; break; - case 100: /* signed ::= INTEGER */ -{ yylhsminor.yy489 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy489 = yylhsminor.yy489; + case 104: /* signed ::= INTEGER */ +{ yylhsminor.yy279 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy279 = yylhsminor.yy279; break; - case 101: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy489 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 105: /* signed ::= PLUS INTEGER */ +{ yymsp[-1].minor.yy279 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 102: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy489 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} + case 106: /* signed ::= MINUS INTEGER */ +{ yymsp[-1].minor.yy279 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; - case 103: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ + case 107: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */ { yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; setCreatedTableName(pInfo, &yymsp[-2].minor.yy0, &yymsp[-3].minor.yy0); } break; - case 104: /* create_table_args ::= LP columnlist RP */ + case 108: /* create_table_args ::= LP columnlist RP */ { - yymsp[-2].minor.yy212 = tSetCreateSQLElems(yymsp[-1].minor.yy325, NULL, NULL, NULL, NULL, TSQL_CREATE_TABLE); - setSQLInfo(pInfo, yymsp[-2].minor.yy212, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-2].minor.yy408 = tSetCreateSQLElems(yymsp[-1].minor.yy369, NULL, NULL, NULL, NULL, TSQL_CREATE_TABLE); + setSQLInfo(pInfo, yymsp[-2].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 105: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ + case 109: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */ { - yymsp[-6].minor.yy212 = tSetCreateSQLElems(yymsp[-5].minor.yy325, yymsp[-1].minor.yy325, NULL, NULL, NULL, TSQL_CREATE_STABLE); - setSQLInfo(pInfo, yymsp[-6].minor.yy212, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-6].minor.yy408 = tSetCreateSQLElems(yymsp[-5].minor.yy369, yymsp[-1].minor.yy369, NULL, NULL, NULL, TSQL_CREATE_STABLE); + setSQLInfo(pInfo, yymsp[-6].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 106: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ + case 110: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; - yymsp[-6].minor.yy212 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy30, NULL, TSQL_CREATE_TABLE_FROM_STABLE); - setSQLInfo(pInfo, yymsp[-6].minor.yy212, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-6].minor.yy408 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy322, NULL, TSQL_CREATE_TABLE_FROM_STABLE); + setSQLInfo(pInfo, yymsp[-6].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 107: /* create_table_args ::= AS select */ + case 111: /* create_table_args ::= AS select */ { - yymsp[-1].minor.yy212 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy444, TSQL_CREATE_STREAM); - setSQLInfo(pInfo, yymsp[-1].minor.yy212, NULL, TSDB_SQL_CREATE_TABLE); + yymsp[-1].minor.yy408 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy190, TSQL_CREATE_STREAM); + setSQLInfo(pInfo, yymsp[-1].minor.yy408, NULL, TSDB_SQL_CREATE_TABLE); } break; - case 108: /* columnlist ::= columnlist COMMA column */ -{yylhsminor.yy325 = tFieldListAppend(yymsp[-2].minor.yy325, &yymsp[0].minor.yy505); } - yymsp[-2].minor.yy325 = yylhsminor.yy325; + case 112: /* columnlist ::= columnlist COMMA column */ +{yylhsminor.yy369 = tFieldListAppend(yymsp[-2].minor.yy369, &yymsp[0].minor.yy325); } + yymsp[-2].minor.yy369 = yylhsminor.yy369; break; - case 109: /* columnlist ::= column */ -{yylhsminor.yy325 = tFieldListAppend(NULL, &yymsp[0].minor.yy505);} - yymsp[0].minor.yy325 = yylhsminor.yy325; + case 113: /* columnlist ::= column */ +{yylhsminor.yy369 = tFieldListAppend(NULL, &yymsp[0].minor.yy325);} + yymsp[0].minor.yy369 = yylhsminor.yy369; break; - case 110: /* column ::= ids typename */ + case 114: /* column ::= ids typename */ { - tSQLSetColumnInfo(&yylhsminor.yy505, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy505); + tSQLSetColumnInfo(&yylhsminor.yy325, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy325); } - yymsp[-1].minor.yy505 = yylhsminor.yy505; + yymsp[-1].minor.yy325 = yylhsminor.yy325; break; - case 111: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy30 = tVariantListAppend(yymsp[-2].minor.yy30, &yymsp[0].minor.yy380, -1); } - yymsp[-2].minor.yy30 = yylhsminor.yy30; + case 115: /* tagitemlist ::= tagitemlist COMMA tagitem */ +{ yylhsminor.yy322 = tVariantListAppend(yymsp[-2].minor.yy322, &yymsp[0].minor.yy518, -1); } + yymsp[-2].minor.yy322 = yylhsminor.yy322; break; - case 112: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy30 = tVariantListAppend(NULL, &yymsp[0].minor.yy380, -1); } - yymsp[0].minor.yy30 = yylhsminor.yy30; + case 116: /* tagitemlist ::= tagitem */ +{ yylhsminor.yy322 = tVariantListAppend(NULL, &yymsp[0].minor.yy518, -1); } + yymsp[0].minor.yy322 = yylhsminor.yy322; break; - case 113: /* tagitem ::= INTEGER */ - case 114: /* tagitem ::= FLOAT */ yytestcase(yyruleno==114); - case 115: /* tagitem ::= STRING */ yytestcase(yyruleno==115); - case 116: /* tagitem ::= BOOL */ yytestcase(yyruleno==116); -{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy380, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy380 = yylhsminor.yy380; + case 117: /* tagitem ::= INTEGER */ + case 118: /* tagitem ::= FLOAT */ yytestcase(yyruleno==118); + case 119: /* tagitem ::= STRING */ yytestcase(yyruleno==119); + case 120: /* tagitem ::= BOOL */ yytestcase(yyruleno==120); +{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy518, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy518 = yylhsminor.yy518; break; - case 117: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy380, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy380 = yylhsminor.yy380; + case 121: /* tagitem ::= NULL */ +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy518, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy518 = yylhsminor.yy518; break; - case 118: /* tagitem ::= MINUS INTEGER */ - case 119: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==119); - case 120: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==120); - case 121: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==121); + case 122: /* tagitem ::= MINUS INTEGER */ + case 123: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==123); + case 124: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==124); + case 125: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==125); { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy380, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy518, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy380 = yylhsminor.yy380; + yymsp[-1].minor.yy518 = yylhsminor.yy518; break; - case 122: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + case 126: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy444 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy506, yymsp[-9].minor.yy30, yymsp[-8].minor.yy388, yymsp[-4].minor.yy30, yymsp[-3].minor.yy30, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy30, &yymsp[0].minor.yy150, &yymsp[-1].minor.yy150); + yylhsminor.yy190 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy260, yymsp[-9].minor.yy322, yymsp[-8].minor.yy500, yymsp[-4].minor.yy322, yymsp[-3].minor.yy322, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy322, &yymsp[0].minor.yy284, &yymsp[-1].minor.yy284); } - yymsp[-11].minor.yy444 = yylhsminor.yy444; + yymsp[-11].minor.yy190 = yylhsminor.yy190; break; - case 123: /* union ::= select */ -{ yylhsminor.yy309 = setSubclause(NULL, yymsp[0].minor.yy444); } - yymsp[0].minor.yy309 = yylhsminor.yy309; + case 127: /* union ::= select */ +{ yylhsminor.yy263 = setSubclause(NULL, yymsp[0].minor.yy190); } + yymsp[0].minor.yy263 = yylhsminor.yy263; break; - case 124: /* union ::= LP union RP */ -{ yymsp[-2].minor.yy309 = yymsp[-1].minor.yy309; } + case 128: /* union ::= LP union RP */ +{ yymsp[-2].minor.yy263 = yymsp[-1].minor.yy263; } break; - case 125: /* union ::= union UNION ALL select */ -{ yylhsminor.yy309 = appendSelectClause(yymsp[-3].minor.yy309, yymsp[0].minor.yy444); } - yymsp[-3].minor.yy309 = yylhsminor.yy309; + case 129: /* union ::= union UNION ALL select */ +{ yylhsminor.yy263 = appendSelectClause(yymsp[-3].minor.yy263, yymsp[0].minor.yy190); } + yymsp[-3].minor.yy263 = yylhsminor.yy263; break; - case 126: /* union ::= union UNION ALL LP select RP */ -{ yylhsminor.yy309 = appendSelectClause(yymsp[-5].minor.yy309, yymsp[-1].minor.yy444); } - yymsp[-5].minor.yy309 = yylhsminor.yy309; + case 130: /* union ::= union UNION ALL LP select RP */ +{ yylhsminor.yy263 = appendSelectClause(yymsp[-5].minor.yy263, yymsp[-1].minor.yy190); } + yymsp[-5].minor.yy263 = yylhsminor.yy263; break; - case 127: /* cmd ::= union */ -{ setSQLInfo(pInfo, yymsp[0].minor.yy309, NULL, TSDB_SQL_SELECT); } + case 131: /* cmd ::= union */ +{ setSQLInfo(pInfo, yymsp[0].minor.yy263, NULL, TSDB_SQL_SELECT); } break; - case 128: /* select ::= SELECT selcollist */ + case 132: /* select ::= SELECT selcollist */ { - yylhsminor.yy444 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy506, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy190 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy260, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy444 = yylhsminor.yy444; + yymsp[-1].minor.yy190 = yylhsminor.yy190; break; - case 129: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy506 = yymsp[-1].minor.yy506;} - yymsp[-1].minor.yy506 = yylhsminor.yy506; + case 133: /* sclp ::= selcollist COMMA */ +{yylhsminor.yy260 = yymsp[-1].minor.yy260;} + yymsp[-1].minor.yy260 = yylhsminor.yy260; break; - case 130: /* sclp ::= */ -{yymsp[1].minor.yy506 = 0;} + case 134: /* sclp ::= */ +{yymsp[1].minor.yy260 = 0;} break; - case 131: /* selcollist ::= sclp expr as */ + case 135: /* selcollist ::= sclp expr as */ { - yylhsminor.yy506 = tSQLExprListAppend(yymsp[-2].minor.yy506, yymsp[-1].minor.yy388, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy260 = tSQLExprListAppend(yymsp[-2].minor.yy260, yymsp[-1].minor.yy500, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-2].minor.yy506 = yylhsminor.yy506; + yymsp[-2].minor.yy260 = yylhsminor.yy260; break; - case 132: /* selcollist ::= sclp STAR */ + case 136: /* selcollist ::= sclp STAR */ { tSQLExpr *pNode = tSQLExprIdValueCreate(NULL, TK_ALL); - yylhsminor.yy506 = tSQLExprListAppend(yymsp[-1].minor.yy506, pNode, 0); + yylhsminor.yy260 = tSQLExprListAppend(yymsp[-1].minor.yy260, pNode, 0); } - yymsp[-1].minor.yy506 = yylhsminor.yy506; + yymsp[-1].minor.yy260 = yylhsminor.yy260; break; - case 133: /* as ::= AS ids */ + case 137: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; - case 134: /* as ::= ids */ + case 138: /* as ::= ids */ { yylhsminor.yy0 = yymsp[0].minor.yy0; } yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 135: /* as ::= */ + case 139: /* as ::= */ { yymsp[1].minor.yy0.n = 0; } break; - case 136: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy30 = yymsp[0].minor.yy30;} + case 140: /* from ::= FROM tablelist */ +{yymsp[-1].minor.yy322 = yymsp[0].minor.yy322;} break; - case 137: /* tablelist ::= ids cpxName */ -{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy30 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);} - yymsp[-1].minor.yy30 = yylhsminor.yy30; + case 141: /* tablelist ::= ids cpxName */ +{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy322 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);} + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; - case 138: /* tablelist ::= tablelist COMMA ids cpxName */ -{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy30 = tVariantListAppendToken(yymsp[-3].minor.yy30, &yymsp[-1].minor.yy0, -1); } - yymsp[-3].minor.yy30 = yylhsminor.yy30; + case 142: /* tablelist ::= tablelist COMMA ids cpxName */ +{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy322 = tVariantListAppendToken(yymsp[-3].minor.yy322, &yymsp[-1].minor.yy0, -1); } + yymsp[-3].minor.yy322 = yylhsminor.yy322; break; - case 139: /* tmvar ::= VARIABLE */ + case 143: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; - case 140: /* interval_opt ::= INTERVAL LP tmvar RP */ - case 145: /* sliding_opt ::= SLIDING LP tmvar RP */ yytestcase(yyruleno==145); + case 144: /* interval_opt ::= INTERVAL LP tmvar RP */ + case 149: /* sliding_opt ::= SLIDING LP tmvar RP */ yytestcase(yyruleno==149); {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } break; - case 141: /* interval_opt ::= */ - case 146: /* sliding_opt ::= */ yytestcase(yyruleno==146); + case 145: /* interval_opt ::= */ + case 150: /* sliding_opt ::= */ yytestcase(yyruleno==150); {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; - case 142: /* fill_opt ::= */ -{yymsp[1].minor.yy30 = 0; } + case 146: /* fill_opt ::= */ +{yymsp[1].minor.yy322 = 0; } break; - case 143: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + case 147: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { tVariant A = {0}; toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy30, &A, -1, 0); - yymsp[-5].minor.yy30 = yymsp[-1].minor.yy30; + tVariantListInsert(yymsp[-1].minor.yy322, &A, -1, 0); + yymsp[-5].minor.yy322 = yymsp[-1].minor.yy322; } break; - case 144: /* fill_opt ::= FILL LP ID RP */ + case 148: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy30 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy322 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; - case 147: /* orderby_opt ::= */ - case 155: /* groupby_opt ::= */ yytestcase(yyruleno==155); -{yymsp[1].minor.yy30 = 0;} + case 151: /* orderby_opt ::= */ + case 159: /* groupby_opt ::= */ yytestcase(yyruleno==159); +{yymsp[1].minor.yy322 = 0;} break; - case 148: /* orderby_opt ::= ORDER BY sortlist */ - case 156: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==156); -{yymsp[-2].minor.yy30 = yymsp[0].minor.yy30;} + case 152: /* orderby_opt ::= ORDER BY sortlist */ + case 160: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==160); +{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;} break; - case 149: /* sortlist ::= sortlist COMMA item sortorder */ + case 153: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy30 = tVariantListAppend(yymsp[-3].minor.yy30, &yymsp[-1].minor.yy380, yymsp[0].minor.yy250); + yylhsminor.yy322 = tVariantListAppend(yymsp[-3].minor.yy322, &yymsp[-1].minor.yy518, yymsp[0].minor.yy150); } - yymsp[-3].minor.yy30 = yylhsminor.yy30; + yymsp[-3].minor.yy322 = yylhsminor.yy322; break; - case 150: /* sortlist ::= item sortorder */ + case 154: /* sortlist ::= item sortorder */ { - yylhsminor.yy30 = tVariantListAppend(NULL, &yymsp[-1].minor.yy380, yymsp[0].minor.yy250); + yylhsminor.yy322 = tVariantListAppend(NULL, &yymsp[-1].minor.yy518, yymsp[0].minor.yy150); } - yymsp[-1].minor.yy30 = yylhsminor.yy30; + yymsp[-1].minor.yy322 = yylhsminor.yy322; break; - case 151: /* item ::= ids cpxName */ + case 155: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy380, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy518, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy380 = yylhsminor.yy380; + yymsp[-1].minor.yy518 = yylhsminor.yy518; break; - case 152: /* sortorder ::= ASC */ -{yymsp[0].minor.yy250 = TSDB_ORDER_ASC; } + case 156: /* sortorder ::= ASC */ +{yymsp[0].minor.yy150 = TSDB_ORDER_ASC; } break; - case 153: /* sortorder ::= DESC */ -{yymsp[0].minor.yy250 = TSDB_ORDER_DESC;} + case 157: /* sortorder ::= DESC */ +{yymsp[0].minor.yy150 = TSDB_ORDER_DESC;} break; - case 154: /* sortorder ::= */ -{yymsp[1].minor.yy250 = TSDB_ORDER_ASC;} + case 158: /* sortorder ::= */ +{yymsp[1].minor.yy150 = TSDB_ORDER_ASC;} break; - case 157: /* grouplist ::= grouplist COMMA item */ + case 161: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy30 = tVariantListAppend(yymsp[-2].minor.yy30, &yymsp[0].minor.yy380, -1); + yylhsminor.yy322 = tVariantListAppend(yymsp[-2].minor.yy322, &yymsp[0].minor.yy518, -1); } - yymsp[-2].minor.yy30 = yylhsminor.yy30; + yymsp[-2].minor.yy322 = yylhsminor.yy322; break; - case 158: /* grouplist ::= item */ + case 162: /* grouplist ::= item */ { - yylhsminor.yy30 = tVariantListAppend(NULL, &yymsp[0].minor.yy380, -1); + yylhsminor.yy322 = tVariantListAppend(NULL, &yymsp[0].minor.yy518, -1); } - yymsp[0].minor.yy30 = yylhsminor.yy30; + yymsp[0].minor.yy322 = yylhsminor.yy322; break; - case 159: /* having_opt ::= */ - case 169: /* where_opt ::= */ yytestcase(yyruleno==169); - case 205: /* expritem ::= */ yytestcase(yyruleno==205); -{yymsp[1].minor.yy388 = 0;} + case 163: /* having_opt ::= */ + case 173: /* where_opt ::= */ yytestcase(yyruleno==173); + case 209: /* expritem ::= */ yytestcase(yyruleno==209); +{yymsp[1].minor.yy500 = 0;} break; - case 160: /* having_opt ::= HAVING expr */ - case 170: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==170); -{yymsp[-1].minor.yy388 = yymsp[0].minor.yy388;} + case 164: /* having_opt ::= HAVING expr */ + case 174: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==174); +{yymsp[-1].minor.yy500 = yymsp[0].minor.yy500;} break; - case 161: /* limit_opt ::= */ - case 165: /* slimit_opt ::= */ yytestcase(yyruleno==165); -{yymsp[1].minor.yy150.limit = -1; yymsp[1].minor.yy150.offset = 0;} + case 165: /* limit_opt ::= */ + case 169: /* slimit_opt ::= */ yytestcase(yyruleno==169); +{yymsp[1].minor.yy284.limit = -1; yymsp[1].minor.yy284.offset = 0;} break; - case 162: /* limit_opt ::= LIMIT signed */ - case 166: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==166); -{yymsp[-1].minor.yy150.limit = yymsp[0].minor.yy489; yymsp[-1].minor.yy150.offset = 0;} + case 166: /* limit_opt ::= LIMIT signed */ + case 170: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==170); +{yymsp[-1].minor.yy284.limit = yymsp[0].minor.yy279; yymsp[-1].minor.yy284.offset = 0;} break; - case 163: /* limit_opt ::= LIMIT signed OFFSET signed */ - case 167: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==167); -{yymsp[-3].minor.yy150.limit = yymsp[-2].minor.yy489; yymsp[-3].minor.yy150.offset = yymsp[0].minor.yy489;} + case 167: /* limit_opt ::= LIMIT signed OFFSET signed */ + case 171: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==171); +{yymsp[-3].minor.yy284.limit = yymsp[-2].minor.yy279; yymsp[-3].minor.yy284.offset = yymsp[0].minor.yy279;} break; - case 164: /* limit_opt ::= LIMIT signed COMMA signed */ - case 168: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==168); -{yymsp[-3].minor.yy150.limit = yymsp[0].minor.yy489; yymsp[-3].minor.yy150.offset = yymsp[-2].minor.yy489;} + case 168: /* limit_opt ::= LIMIT signed COMMA signed */ + case 172: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==172); +{yymsp[-3].minor.yy284.limit = yymsp[0].minor.yy279; yymsp[-3].minor.yy284.offset = yymsp[-2].minor.yy279;} break; - case 171: /* expr ::= LP expr RP */ -{yymsp[-2].minor.yy388 = yymsp[-1].minor.yy388; } + case 175: /* expr ::= LP expr RP */ +{yymsp[-2].minor.yy500 = yymsp[-1].minor.yy500; } break; - case 172: /* expr ::= ID */ -{yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 176: /* expr ::= ID */ +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 173: /* expr ::= ID DOT ID */ -{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 177: /* expr ::= ID DOT ID */ +{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 174: /* expr ::= ID DOT STAR */ -{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 178: /* expr ::= ID DOT STAR */ +{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 175: /* expr ::= INTEGER */ -{yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 179: /* expr ::= INTEGER */ +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 176: /* expr ::= MINUS INTEGER */ - case 177: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==177); -{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy388 = yylhsminor.yy388; + case 180: /* expr ::= MINUS INTEGER */ + case 181: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==181); +{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy500 = yylhsminor.yy500; break; - case 178: /* expr ::= FLOAT */ -{yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 182: /* expr ::= FLOAT */ +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 179: /* expr ::= MINUS FLOAT */ - case 180: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==180); -{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy388 = yylhsminor.yy388; + case 183: /* expr ::= MINUS FLOAT */ + case 184: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==184); +{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy500 = yylhsminor.yy500; break; - case 181: /* expr ::= STRING */ -{yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 185: /* expr ::= STRING */ +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 182: /* expr ::= NOW */ -{yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 186: /* expr ::= NOW */ +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 183: /* expr ::= VARIABLE */ -{yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 187: /* expr ::= VARIABLE */ +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 184: /* expr ::= BOOL */ -{yylhsminor.yy388 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 188: /* expr ::= BOOL */ +{yylhsminor.yy500 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 185: /* expr ::= ID LP exprlist RP */ + case 189: /* expr ::= ID LP exprlist RP */ { - yylhsminor.yy388 = tSQLExprCreateFunction(yymsp[-1].minor.yy506, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); + yylhsminor.yy500 = tSQLExprCreateFunction(yymsp[-1].minor.yy260, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy388 = yylhsminor.yy388; + yymsp[-3].minor.yy500 = yylhsminor.yy500; break; - case 186: /* expr ::= ID LP STAR RP */ + case 190: /* expr ::= ID LP STAR RP */ { - yylhsminor.yy388 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); + yylhsminor.yy500 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy388 = yylhsminor.yy388; + yymsp[-3].minor.yy500 = yylhsminor.yy500; break; - case 187: /* expr ::= expr AND expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_AND);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 191: /* expr ::= expr AND expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_AND);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 188: /* expr ::= expr OR expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_OR); } - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 192: /* expr ::= expr OR expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_OR); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 189: /* expr ::= expr LT expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_LT);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 193: /* expr ::= expr LT expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_LT);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 190: /* expr ::= expr GT expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_GT);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 194: /* expr ::= expr GT expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_GT);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 191: /* expr ::= expr LE expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_LE);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 195: /* expr ::= expr LE expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_LE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 192: /* expr ::= expr GE expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_GE);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 196: /* expr ::= expr GE expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_GE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 193: /* expr ::= expr NE expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_NE);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 197: /* expr ::= expr NE expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_NE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 194: /* expr ::= expr EQ expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_EQ);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 198: /* expr ::= expr EQ expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_EQ);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 195: /* expr ::= expr PLUS expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_PLUS); } - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 199: /* expr ::= expr PLUS expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_PLUS); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 196: /* expr ::= expr MINUS expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_MINUS); } - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 200: /* expr ::= expr MINUS expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_MINUS); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 197: /* expr ::= expr STAR expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_STAR); } - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 201: /* expr ::= expr STAR expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_STAR); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 198: /* expr ::= expr SLASH expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_DIVIDE);} - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 202: /* expr ::= expr SLASH expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_DIVIDE);} + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 199: /* expr ::= expr REM expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_REM); } - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 203: /* expr ::= expr REM expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_REM); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 200: /* expr ::= expr LIKE expr */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-2].minor.yy388, yymsp[0].minor.yy388, TK_LIKE); } - yymsp[-2].minor.yy388 = yylhsminor.yy388; + case 204: /* expr ::= expr LIKE expr */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-2].minor.yy500, yymsp[0].minor.yy500, TK_LIKE); } + yymsp[-2].minor.yy500 = yylhsminor.yy500; break; - case 201: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy388 = tSQLExprCreate(yymsp[-4].minor.yy388, (tSQLExpr*)yymsp[-1].minor.yy506, TK_IN); } - yymsp[-4].minor.yy388 = yylhsminor.yy388; + case 205: /* expr ::= expr IN LP exprlist RP */ +{yylhsminor.yy500 = tSQLExprCreate(yymsp[-4].minor.yy500, (tSQLExpr*)yymsp[-1].minor.yy260, TK_IN); } + yymsp[-4].minor.yy500 = yylhsminor.yy500; break; - case 202: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy506 = tSQLExprListAppend(yymsp[-2].minor.yy506,yymsp[0].minor.yy388,0);} - yymsp[-2].minor.yy506 = yylhsminor.yy506; + case 206: /* exprlist ::= exprlist COMMA expritem */ +{yylhsminor.yy260 = tSQLExprListAppend(yymsp[-2].minor.yy260,yymsp[0].minor.yy500,0);} + yymsp[-2].minor.yy260 = yylhsminor.yy260; break; - case 203: /* exprlist ::= expritem */ -{yylhsminor.yy506 = tSQLExprListAppend(0,yymsp[0].minor.yy388,0);} - yymsp[0].minor.yy506 = yylhsminor.yy506; + case 207: /* exprlist ::= expritem */ +{yylhsminor.yy260 = tSQLExprListAppend(0,yymsp[0].minor.yy500,0);} + yymsp[0].minor.yy260 = yylhsminor.yy260; break; - case 204: /* expritem ::= expr */ -{yylhsminor.yy388 = yymsp[0].minor.yy388;} - yymsp[0].minor.yy388 = yylhsminor.yy388; + case 208: /* expritem ::= expr */ +{yylhsminor.yy500 = yymsp[0].minor.yy500;} + yymsp[0].minor.yy500 = yylhsminor.yy500; break; - case 206: /* cmd ::= RESET QUERY CACHE */ + case 210: /* cmd ::= RESET QUERY CACHE */ { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 207: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 211: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy325, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy369, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 208: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 212: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2670,14 +2690,14 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 209: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 213: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy325, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); + SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy369, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 210: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 214: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2688,7 +2708,7 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 211: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 215: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -2702,25 +2722,25 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 212: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 216: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; toTSDBType(yymsp[-2].minor.yy0.type); tVariantList* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy380, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy518, -1); SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 213: /* cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */ + case 217: /* cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSQL(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[-2].minor.yy0);} break; - case 214: /* cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */ + case 218: /* cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */ {yymsp[-4].minor.yy0.n += (yymsp[-3].minor.yy0.n + yymsp[-2].minor.yy0.n + yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSQL(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-4].minor.yy0);} break; - case 215: /* cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */ + case 219: /* cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */ {yymsp[-4].minor.yy0.n += (yymsp[-3].minor.yy0.n + yymsp[-2].minor.yy0.n + yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSQL(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-4].minor.yy0);} break; default: diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 3e4e05cd11..a2333566f1 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -226,17 +226,6 @@ void *rpcOpen(const SRpcInit *pInit) { pRpc->cfp = pInit->cfp; pRpc->afp = pInit->afp; - pRpc->tcphandle = (*taosInitConn[pRpc->connType|RPC_CONN_TCP])(0, pRpc->localPort, pRpc->label, - pRpc->numOfThreads, rpcProcessMsgFromPeer, pRpc); - pRpc->udphandle = (*taosInitConn[pRpc->connType])(0, pRpc->localPort, pRpc->label, - pRpc->numOfThreads, rpcProcessMsgFromPeer, pRpc); - - if (pRpc->tcphandle == NULL || pRpc->udphandle == NULL) { - tError("%s failed to init network, port:%d", pRpc->label, pRpc->localPort); - rpcClose(pRpc); - return NULL; - } - size_t size = sizeof(SRpcConn) * pRpc->sessions; pRpc->connList = (SRpcConn *)calloc(1, size); if (pRpc->connList == NULL) { @@ -277,6 +266,17 @@ void *rpcOpen(const SRpcInit *pInit) { pthread_mutex_init(&pRpc->mutex, NULL); + pRpc->tcphandle = (*taosInitConn[pRpc->connType|RPC_CONN_TCP])(0, pRpc->localPort, pRpc->label, + pRpc->numOfThreads, rpcProcessMsgFromPeer, pRpc); + pRpc->udphandle = (*taosInitConn[pRpc->connType])(0, pRpc->localPort, pRpc->label, + pRpc->numOfThreads, rpcProcessMsgFromPeer, pRpc); + + if (pRpc->tcphandle == NULL || pRpc->udphandle == NULL) { + tError("%s failed to init network, port:%d", pRpc->label, pRpc->localPort); + rpcClose(pRpc); + return NULL; + } + tTrace("%s RPC is openned, numOfThreads:%d", pRpc->label, pRpc->numOfThreads); return pRpc; @@ -363,7 +363,7 @@ void rpcSendRequest(void *shandle, const SRpcIpSet *pIpSet, const SRpcMsg *pMsg) // connection type is application specific. // for TDengine, all the query, show commands shall have TCP connection char type = pMsg->msgType; - if (type == TSDB_MSG_TYPE_QUERY || type == TSDB_MSG_TYPE_RETRIEVE || + if (type == TSDB_MSG_TYPE_QUERY || type == TSDB_MSG_TYPE_CM_RETRIEVE || type == TSDB_MSG_TYPE_FETCH || type == TSDB_MSG_TYPE_CM_STABLE_VGROUP || type == TSDB_MSG_TYPE_CM_TABLES_META || type == TSDB_MSG_TYPE_CM_SHOW ) pContext->connType = RPC_CONN_TCPC; @@ -793,7 +793,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) { pConn->chandle = pRecv->chandle; pConn->peerIp = pRecv->ip; - if (pConn->peerPort == 0) pConn->peerPort = pRecv->port; + pConn->peerPort = pRecv->port; if (pHead->port) pConn->peerPort = htons(pHead->port); terrno = rpcCheckAuthentication(pConn, (char *)pHead, pRecv->msgLen); @@ -802,7 +802,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) { pHead->code = htonl(pHead->code); if (terrno == 0) { - if (pHead->msgType != TSDB_MSG_TYPE_REG && pHead->encrypt) { + if (pHead->encrypt) { // decrypt here } @@ -869,9 +869,9 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) { pConn = rpcProcessMsgHead(pRpc, pRecv); if (pHead->msgType < TSDB_MSG_TYPE_CM_HEARTBEAT || (rpcDebugFlag & 16)) { - tTrace("%s %p, %s received from 0x%x:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d", + tTrace("%s %p, %s received from 0x%x:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d code:0x%x", pRpc->label, pConn, taosMsg[pHead->msgType], pRecv->ip, pRecv->port, terrno, - pRecv->msgLen, pHead->sourceId, pHead->destId, pHead->tranId, pHead->port); + pRecv->msgLen, pHead->sourceId, pHead->destId, pHead->tranId, pHead->code); } int32_t code = terrno; @@ -934,11 +934,20 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) { // for UDP, port may be changed by server, the port in ipSet shall be used for cache rpcAddConnIntoCache(pRpc->pCache, pConn, pConn->peerFqdn, pContext->ipSet.port[pContext->ipSet.inUse], pConn->connType); + if (pHead->code == TSDB_CODE_REDIRECT) { + pContext->redirect++; + if (pContext->redirect > TSDB_MAX_REPLICA) { + pHead->code = TSDB_CODE_NETWORK_UNAVAIL; + tWarn("%s %p, too many redirects, quit", pRpc->label, pConn); + } + } + if (pHead->code == TSDB_CODE_REDIRECT) { - pContext->redirect = 1; pContext->numOfTry = 0; memcpy(&pContext->ipSet, pHead->content, sizeof(pContext->ipSet)); tTrace("%s %p, redirect is received, numOfIps:%d", pRpc->label, pConn, pContext->ipSet.numOfIps); + for (int i=0; iipSet.numOfIps; ++i) + pContext->ipSet.port[i] = htons(pContext->ipSet.port[i]); rpcSendReqToServer(pRpc, pContext); } else if (pHead->code == TSDB_CODE_NOT_READY) { pContext->code = pHead->code; @@ -1083,9 +1092,10 @@ static void rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) { pRpc->label, pConn, taosMsg[pHead->msgType], pConn->peerFqdn, pConn->peerPort, msgLen, pHead->sourceId, pHead->destId, pHead->tranId); } else { + if (pHead->code == 0) pConn->secured = 1; // for success response, set link as secured if (pHead->msgType < TSDB_MSG_TYPE_CM_HEARTBEAT || (rpcDebugFlag & 16)) - tTrace( "%s %p, %s is sent to %s:%hu, code:0x%x len:%d sig:0x%08x:0x%08x:%d", - pRpc->label, pConn, taosMsg[pHead->msgType], pConn->peerFqdn, pConn->peerPort, + tTrace( "%s %p, %s is sent to 0x%x:%hu, code:0x%x len:%d sig:0x%08x:0x%08x:%d", + pRpc->label, pConn, taosMsg[pHead->msgType], pConn->peerIp, pConn->peerPort, htonl(pHead->code), msgLen, pHead->sourceId, pHead->destId, pHead->tranId); } diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 1260a34512..38458c71d2 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -188,7 +188,7 @@ static void taosAcceptTcpConnection(void *arg) { sockFd = taosOpenTcpServerSocket(pServerObj->ip, pServerObj->port); if (sockFd < 0) return; - tTrace("%s TCP server is ready, ip:%s:%hu", pServerObj->label, pServerObj->ip, pServerObj->port); + tTrace("%s TCP server is ready, ip:0x%x:%hu", pServerObj->label, pServerObj->ip, pServerObj->port); while (1) { socklen_t addrlen = sizeof(caddr); diff --git a/src/rpc/test/rserver.c b/src/rpc/test/rserver.c index 0569a163d1..9f781ef276 100644 --- a/src/rpc/test/rserver.c +++ b/src/rpc/test/rserver.c @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) { commit = atoi(argv[++i]); } else if (strcmp(argv[i], "-d")==0 && i < argc-1) { rpcDebugFlag = atoi(argv[++i]); - ddebugFlag = rpcDebugFlag; + dDebugFlag = rpcDebugFlag; uDebugFlag = rpcDebugFlag; } else { printf("\nusage: %s [options] \n", argv[0]); diff --git a/src/tsdb/inc/tsdbMain.h b/src/tsdb/inc/tsdbMain.h index e056a10bba..278463f0d2 100644 --- a/src/tsdb/inc/tsdbMain.h +++ b/src/tsdb/inc/tsdbMain.h @@ -21,6 +21,7 @@ #include "tskiplist.h" #include "tutil.h" #include "tlog.h" +#include "tcoding.h" #ifdef __cplusplus extern "C" { @@ -94,6 +95,7 @@ typedef struct STable { void * streamHandler; // TODO TSKEY lastKey; // lastkey inserted in this table, initialized as 0, TODO: make a structure struct STable *next; // TODO: remove the next + struct STable *prev; } STable; #define TSDB_GET_TABLE_LAST_KEY(pTable) ((pTable)->lastKey) diff --git a/src/tsdb/src/tsdbFile.c b/src/tsdb/src/tsdbFile.c index 0c1b9e314e..ad98bb7b20 100644 --- a/src/tsdb/src/tsdbFile.c +++ b/src/tsdb/src/tsdbFile.c @@ -178,9 +178,9 @@ void tsdbFitRetention(STsdbRepo *pRepo) { SFileGroup *pGroup = pFileH->fGroup; int mfid = - tsdbGetKeyFileId(taosGetTimestamp(pRepo->config.precision), pRepo->config.daysPerFile, pRepo->config.precision); + tsdbGetKeyFileId(taosGetTimestamp(pRepo->config.precision), pRepo->config.daysPerFile, pRepo->config.precision) - pFileH->maxFGroups + 3; - while (pGroup[0].fileId < mfid) { + while (pFileH->numOfFGroups > 0 && pGroup[0].fileId < mfid) { tsdbRemoveFileGroup(pFileH, pGroup[0].fileId); } } diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 3f41a3c5fe..8d570911a9 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -90,6 +90,7 @@ void tsdbFreeCfg(STsdbCfg *pCfg) { int32_t tsdbCreateRepo(char *rootDir, STsdbCfg *pCfg, void *limiter /* TODO */) { if (mkdir(rootDir, 0755) != 0) { + tsdbError("id %d: failed to create rootDir! rootDir %s, reason %s", pCfg->tsdbId, rootDir, strerror(errno)); if (errno == EACCES) { return TSDB_CODE_NO_DISK_PERMISSIONS; } else if (errno == ENOSPC) { @@ -611,14 +612,20 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) { if (pCfg->precision == -1) { pCfg->precision = TSDB_DEFAULT_PRECISION; } else { - if (!IS_VALID_PRECISION(pCfg->precision)) return -1; + if (!IS_VALID_PRECISION(pCfg->precision)) { + tsdbError("id %d: invalid precision configuration! precision %d", pCfg->tsdbId, pCfg->precision); + return -1; + } } // Check compression if (pCfg->compression == -1) { pCfg->compression = TSDB_DEFAULT_COMPRESSION; } else { - if (!IS_VALID_COMPRESSION(pCfg->compression)) return -1; + if (!IS_VALID_COMPRESSION(pCfg->compression)) { + tsdbError("id %d: invalid compression configuration! compression %d", pCfg->tsdbId, pCfg->precision); + return -1; + } } // Check tsdbId @@ -628,29 +635,49 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) { if (pCfg->maxTables == -1) { pCfg->maxTables = TSDB_DEFAULT_TABLES; } else { - if (pCfg->maxTables < TSDB_MIN_TABLES || pCfg->maxTables > TSDB_MAX_TABLES) return -1; + if (pCfg->maxTables < TSDB_MIN_TABLES || pCfg->maxTables > TSDB_MAX_TABLES) { + tsdbError("id %d: invalid maxTables configuration! maxTables %d TSDB_MIN_TABLES %d TSDB_MAX_TABLES %d", + pCfg->tsdbId, pCfg->maxTables, TSDB_MIN_TABLES, TSDB_MAX_TABLES); + return -1; + } } // Check daysPerFile if (pCfg->daysPerFile == -1) { pCfg->daysPerFile = TSDB_DEFAULT_DAYS_PER_FILE; } else { - if (pCfg->daysPerFile < TSDB_MIN_DAYS_PER_FILE || pCfg->daysPerFile > TSDB_MAX_DAYS_PER_FILE) return -1; + if (pCfg->daysPerFile < TSDB_MIN_DAYS_PER_FILE || pCfg->daysPerFile > TSDB_MAX_DAYS_PER_FILE) { + tsdbError( + "id %d: invalid daysPerFile configuration! daysPerFile %d TSDB_MIN_DAYS_PER_FILE %d TSDB_MAX_DAYS_PER_FILE " + "%d", + pCfg->tsdbId, pCfg->daysPerFile, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); + return -1; + } } // Check minRowsPerFileBlock and maxRowsPerFileBlock if (pCfg->minRowsPerFileBlock == -1) { pCfg->minRowsPerFileBlock = TSDB_DEFAULT_MIN_ROW_FBLOCK; } else { - if (pCfg->minRowsPerFileBlock < TSDB_MIN_MIN_ROW_FBLOCK || pCfg->minRowsPerFileBlock > TSDB_MAX_MIN_ROW_FBLOCK) + if (pCfg->minRowsPerFileBlock < TSDB_MIN_MIN_ROW_FBLOCK || pCfg->minRowsPerFileBlock > TSDB_MAX_MIN_ROW_FBLOCK) { + tsdbError( + "id %d: invalid minRowsPerFileBlock configuration! minRowsPerFileBlock %d TSDB_MIN_MIN_ROW_FBLOCK %d " + "TSDB_MAX_MIN_ROW_FBLOCK %d", + pCfg->tsdbId, pCfg->minRowsPerFileBlock, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); return -1; + } } if (pCfg->maxRowsPerFileBlock == -1) { pCfg->maxRowsPerFileBlock = TSDB_DEFAULT_MAX_ROW_FBLOCK; } else { - if (pCfg->maxRowsPerFileBlock < TSDB_MIN_MAX_ROW_FBLOCK || pCfg->maxRowsPerFileBlock > TSDB_MAX_MAX_ROW_FBLOCK) + if (pCfg->maxRowsPerFileBlock < TSDB_MIN_MAX_ROW_FBLOCK || pCfg->maxRowsPerFileBlock > TSDB_MAX_MAX_ROW_FBLOCK) { + tsdbError( + "id %d: invalid maxRowsPerFileBlock configuration! maxRowsPerFileBlock %d TSDB_MIN_MAX_ROW_FBLOCK %d " + "TSDB_MAX_MAX_ROW_FBLOCK %d", + pCfg->tsdbId, pCfg->maxRowsPerFileBlock, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); return -1; + } } if (pCfg->minRowsPerFileBlock > pCfg->maxRowsPerFileBlock) return -1; @@ -659,7 +686,13 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) { if (pCfg->keep == -1) { pCfg->keep = TSDB_DEFAULT_KEEP; } else { - if (pCfg->keep < TSDB_MIN_KEEP || pCfg->keep > TSDB_MAX_KEEP) return -1; + if (pCfg->keep < TSDB_MIN_KEEP || pCfg->keep > TSDB_MAX_KEEP) { + tsdbError( + "id %d: invalid keep configuration! keep %d TSDB_MIN_KEEP %d " + "TSDB_MAX_KEEP %d", + pCfg->tsdbId, pCfg->keep, TSDB_MIN_KEEP, TSDB_MAX_KEEP); + return -1; + } } return 0; @@ -716,15 +749,22 @@ static int32_t tsdbGetDataDirName(STsdbRepo *pRepo, char *fname) { } static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) { + STsdbCfg *pCfg = &pRepo->config; if (tsdbSaveConfig(pRepo) < 0) return -1; char dirName[128] = "\0"; if (tsdbGetDataDirName(pRepo, dirName) < 0) return -1; if (mkdir(dirName, 0755) < 0) { + tsdbError("id %d: failed to create repository directory! reason %s", pRepo->config.tsdbId, strerror(errno)); return -1; } + tsdbError( + "id %d: set up tsdb environment succeed! cacheBlockSize %d, totalBlocks %d, maxTables %d, daysPerFile %d, keep " + "%d, minRowsPerFileBlock %d, maxRowsPerFileBlock %d, precision %d, compression%d", + pRepo->config.tsdbId, pCfg->cacheBlockSize, pCfg->totalBlocks, pCfg->maxTables, pCfg->daysPerFile, pCfg->keep, + pCfg->minRowsPerFileBlock, pCfg->maxRowsPerFileBlock, pCfg->precision, pCfg->compression); return 0; } @@ -811,7 +851,8 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY STableId tableId = {.uid = pBlock->uid, .tid = pBlock->tid}; STable *pTable = tsdbIsValidTableToInsert(pRepo->tsdbMeta, tableId); if (pTable == NULL) { - tsdbError("failed to get table for insert, uid:%" PRIu64 ", tid:%d", tableId.uid, tableId.tid); + tsdbError("id %d: failed to get table for insert, uid:%" PRIu64 ", tid:%d", pRepo->config.tsdbId, pBlock->uid, + pBlock->tid); return TSDB_CODE_INVALID_TABLE_ID; } diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index ec4fb2a33f..0828db7f00 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -13,10 +13,10 @@ static int tsdbFreeTable(STable *pTable); static int32_t tsdbCheckTableCfg(STableCfg *pCfg); static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx); -static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable); static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable); static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable); static int tsdbEstimateTableEncodeSize(STable *pTable); +static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable); /** * Encode a TSDB table object as a binary content @@ -375,21 +375,9 @@ int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId) { STable *pTable = tsdbGetTableByUid(pMeta, tableId.uid); if (pTable == NULL) return -1; - if (pTable->type == TSDB_SUPER_TABLE) { - // TODO: implement drop super table - return -1; - } else { - pMeta->tables[pTable->tableId.tid] = NULL; - pMeta->nTables--; - assert(pMeta->nTables >= 0); - if (pTable->type == TSDB_CHILD_TABLE) { - tsdbRemoveTableFromIndex(pMeta, pTable); - } - - tsdbFreeTable(pTable); - } - + if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1; return 0; + } // int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable) { @@ -445,10 +433,12 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx) { if (pMeta->superList == NULL) { pMeta->superList = pTable; pTable->next = NULL; + pTable->prev = NULL; } else { - STable *pTemp = pMeta->superList; + pTable->next = pMeta->superList; + pTable->prev = NULL; + pTable->next->prev = pTable; pMeta->superList = pTable; - pTable->next = pTemp; } } else { // add non-super table to the array @@ -467,22 +457,50 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx) { if (bytes > pMeta->maxRowBytes) pMeta->maxRowBytes = bytes; } - return tsdbAddTableIntoMap(pMeta, pTable); -} - -// static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) { -// // TODO -// return 0; -// } - -static int tsdbAddTableIntoMap(STsdbMeta *pMeta, STable *pTable) { - // TODO: add the table to the map - int64_t uid = pTable->tableId.uid; - if (taosHashPut(pMeta->map, (char *)(&uid), sizeof(uid), (void *)(&pTable), sizeof(pTable)) < 0) { + if (taosHashPut(pMeta->map, (char *)(&pTable->tableId.uid), sizeof(pTable->tableId.uid), (void *)(&pTable), sizeof(pTable)) < 0) { return -1; } return 0; } + +static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) { + if (pTable->type == TSDB_SUPER_TABLE) { + SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex); + while (tSkipListIterNext(pIter)) { + STable *tTable = *(STable **)SL_GET_NODE_DATA(tSkipListIterGet(pIter)); + ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE); + + pMeta->tables[tTable->tableId.tid] = NULL; + taosHashRemove(pMeta->map, (char *)(&(pTable->tableId.uid)), sizeof(pTable->tableId.uid)); + pMeta->nTables--; + tsdbFreeTable(tTable); + } + + tSkipListDestroyIter(pIter); + + // TODO: Remove the table from the list + if (pTable->prev != NULL) { + pTable->prev->next = pTable->next; + if (pTable->next != NULL) { + pTable->next->prev = pTable->prev; + } + } else { + pMeta->superList = pTable->next; + } + } else { + pMeta->tables[pTable->tableId.tid] = NULL; + if (pTable->type == TSDB_CHILD_TABLE) { + tsdbRemoveTableFromIndex(pMeta, pTable); + } + + pMeta->nTables--; + } + + tsdbFreeTable(pTable); + taosHashRemove(pMeta->map, (char *)(&(pTable->tableId.uid)), sizeof(pTable->tableId.uid)); + return 0; +} + static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable) { assert(pTable->type == TSDB_CHILD_TABLE && pTable != NULL); STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid); @@ -502,13 +520,19 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable) { memcpy(SL_GET_NODE_DATA(pNode), &pTable, POINTER_BYTES); tSkipListPut(list, pNode); - return 0; } static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) { - assert(pTable->type == TSDB_CHILD_TABLE); - // TODO + assert(pTable->type == TSDB_CHILD_TABLE && pTable != NULL); + + STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid); + assert(pSTable != NULL); + + char* key = dataRowTuple(pTable->tagVal); // key + bool ret = tSkipListRemove(pSTable->pIndex, key); + + assert(ret); return 0; } @@ -535,5 +559,5 @@ static int tsdbEstimateTableEncodeSize(STable *pTable) { char *getTupleKey(const void * data) { SDataRow row = (SDataRow)data; - return POINTER_DRIFT(row, TD_DATA_ROW_HEAD_SIZE); + return POINTER_SHIFT(row, TD_DATA_ROW_HEAD_SIZE); } \ No newline at end of file diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 6d571bd035..008ad223ed 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -335,11 +335,7 @@ static int32_t getFileCompInfo(STsdbQueryHandle* pQueryHandle, int32_t* numOfBlo pCheckInfo->compSize = compIndex->len; } - // tsdbLoadCompBlocks(fileGroup, compIndex, pCheckInfo->pCompInfo); - STable* pTable = tsdbGetTableByUid(tsdbGetMeta(pQueryHandle->pTsdb), pCheckInfo->tableId.uid); - assert(pTable != NULL); - - tsdbSetHelperTable(&pQueryHandle->rhelper, pTable, pQueryHandle->pTsdb); + tsdbSetHelperTable(&pQueryHandle->rhelper, pCheckInfo->pTableObj, pQueryHandle->pTsdb); tsdbLoadCompInfo(&(pQueryHandle->rhelper), (void *)(pCheckInfo->pCompInfo)); SCompInfo* pCompInfo = pCheckInfo->pCompInfo; @@ -472,6 +468,7 @@ static bool loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock filterDataInDataBlock(pQueryHandle, pCheckInfo, pBlock, sa); } else { // the whole block is loaded in to buffer pQueryHandle->realNumOfRows = pBlock->numOfPoints; + cur->pos = 0; } } else { // query ended in current block @@ -491,6 +488,7 @@ static bool loadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock filterDataInDataBlock(pQueryHandle, pCheckInfo, pBlock, sa); } else { pQueryHandle->realNumOfRows = pBlock->numOfPoints; + cur->pos = pBlock->numOfPoints - 1; } } @@ -568,7 +566,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf SDataBlockInfo blockInfo = getTrueDataBlockInfo(pCheckInfo, pBlock); SDataCols* pCols = pQueryHandle->rhelper.pDataCols[0]; - + int32_t endPos = cur->pos; if (ASCENDING_ORDER_TRAVERSE(pQueryHandle->order) && pQueryHandle->window.ekey > blockInfo.window.ekey) { endPos = blockInfo.rows - 1; @@ -612,7 +610,6 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf int32_t reqCols = taosArrayGetSize(pQueryHandle->pColumns); for (int32_t i = 0; i < reqCols; ++i) { -// int16_t colId = *(int16_t*)taosArrayGet(sa, i); SColumnInfoData* pCol = taosArrayGet(pQueryHandle->pColumns, i); int32_t bytes = pCol->info.bytes; @@ -1236,12 +1233,6 @@ static int32_t getAllTableIdList(STable* pSuperTable, SArray* list) { return TSDB_CODE_SUCCESS; } -typedef struct SExprTreeSupporter { - SSchema* pTagSchema; - int32_t numOfTags; - int32_t optr; -} SExprTreeSupporter; - /** * convert the result pointer to table id instead of table object pointer * @param pRes @@ -1252,7 +1243,7 @@ static void convertQueryResult(SArray* pRes, SArray* pTableList) { } size_t size = taosArrayGetSize(pTableList); - for (int32_t i = 0; i < size; ++i) { + for (int32_t i = 0; i < size; ++i) { // todo speedup by using reserve space. STable* pTable = taosArrayGetP(pTableList, i); taosArrayPush(pRes, &pTable->tableId); } @@ -1273,16 +1264,15 @@ static void destroyHelper(void* param) { free(param); } -static int32_t getTagColumnInfo(SExprTreeSupporter* pSupporter, SSchema* pSchema) { +static int32_t getTagColumnIndex(STSchema* pTSchema, SSchema* pSchema) { // filter on table name(TBNAME) if (strcasecmp(pSchema->name, TSQL_TBNAME_L) == 0) { return TSDB_TBNAME_COLUMN_INDEX; } - - for(int32_t i = 0; i < pSupporter->numOfTags; ++i) { - if (pSupporter->pTagSchema[i].bytes == pSchema->bytes && - pSupporter->pTagSchema[i].type == pSchema->type && - pSupporter->pTagSchema[i].colId == pSchema->colId) { + + for(int32_t i = 0; i < schemaNCols(pTSchema); ++i) { + STColumn* pColumn = &pTSchema->columns[i]; + if (pColumn->bytes == pSchema->bytes && pColumn->type == pSchema->type && pColumn->colId == pSchema->colId) { return i; } } @@ -1298,21 +1288,22 @@ void filterPrepare(void* expr, void* param) { int32_t i = 0; pExpr->_node.info = calloc(1, sizeof(tQueryInfo)); - - SExprTreeSupporter* pSupporter = (SExprTreeSupporter*)param; + + STSchema* pTSSchema = (STSchema*) param; tQueryInfo* pInfo = pExpr->_node.info; 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 - int32_t index = getTagColumnInfo(pSupporter, pSchema); + int32_t index = getTagColumnIndex(pTSSchema, pSchema); assert((index >= 0 && i < TSDB_MAX_TAGS) || (index == TSDB_TBNAME_COLUMN_INDEX)); pInfo->sch = *pSchema; pInfo->colIndex = index; pInfo->optr = pExpr->_node.optr; pInfo->compare = getComparFunc(pSchema->type, pInfo->optr); + pInfo->param = pTSSchema; if (pInfo->optr == TSDB_RELATION_IN) { pInfo->q = (char*) pCond->arr; @@ -1436,7 +1427,7 @@ SArray* createTableGroup(SArray* pTableList, STSchema* pTagSchema, SColIndex* pC } bool tSkipListNodeFilterCallback(const void* pNode, void* param) { - tQueryInfo* pInfo = (tQueryInfo*)param; + tQueryInfo* pInfo = (tQueryInfo*) param; STable* pTable = *(STable**)(SL_GET_NODE_DATA((SSkipListNode*)pNode)); @@ -1447,7 +1438,14 @@ bool tSkipListNodeFilterCallback(const void* pNode, void* param) { val = pTable->name; type = TSDB_DATA_TYPE_BINARY; } else { - val = dataRowTuple(pTable->tagVal); // todo not only the first column + STSchema* pTSchema = (STSchema*) pInfo->param; // todo table schema is identical to stable schema?? + + int32_t offset = pTSchema->columns[pInfo->colIndex].offset; + if (pInfo->sch.type == TSDB_DATA_TYPE_BINARY || pInfo->sch.type == TSDB_DATA_TYPE_NCHAR) { + val = tdGetRowDataOfCol(pTable->tagVal, pInfo->sch.type, TD_DATA_ROW_HEAD_SIZE + offset); + } else { + val = dataRowTuple(pTable->tagVal) + offset; + } } int32_t ret = 0; @@ -1497,19 +1495,11 @@ bool tSkipListNodeFilterCallback(const void* pNode, void* param) { } static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr) { - // query according to the binary expression - STSchema* pSchema = pSTable->tagSchema; - SSchema* schema = calloc(schemaNCols(pSchema), sizeof(SSchema)); - for (int32_t i = 0; i < schemaNCols(pSchema); ++i) { - schema[i].colId = schemaColAt(pSchema, i)->colId; - schema[i].type = schemaColAt(pSchema, i)->type; - schema[i].bytes = schemaColAt(pSchema, i)->bytes; - } - - SExprTreeSupporter s = {.pTagSchema = schema, .numOfTags = schemaNCols(pSTable->tagSchema)}; - - SBinaryFilterSupp supp = { - .fp = (__result_filter_fn_t)tSkipListNodeFilterCallback, .setupInfoFn = filterPrepare, .pExtInfo = &s, + // query according to the expression tree + SExprTraverseSupp supp = { + .fp = (__result_filter_fn_t) tSkipListNodeFilterCallback, + .setupInfoFn = filterPrepare, + .pExtInfo = pSTable->tagSchema, }; SArray* pTableList = taosArrayInit(8, POINTER_BYTES); @@ -1519,7 +1509,6 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr) convertQueryResult(pRes, pTableList); taosArrayDestroy(pTableList); - free(schema); return TSDB_CODE_SUCCESS; } @@ -1527,10 +1516,17 @@ int32_t tsdbQuerySTableByTagCond(TsdbRepoT *tsdb, int64_t uid, const char *pTagC const char* tbnameCond, STableGroupInfo *pGroupInfo, SColIndex *pColIndex, int32_t numOfCols) { STable* pTable = tsdbGetTableByUid(tsdbGetMeta(tsdb), uid); if (pTable == NULL) { - uError("failed to get stable, uid:%, %p" PRIu64, uid); + uError("%p failed to get stable, uid:%" PRIu64, tsdb, uid); return TSDB_CODE_INVALID_TABLE_ID; } + if (pTable->type != TSDB_SUPER_TABLE) { + uError("%p query normal tag not allowed, uid:%, tid:%d, name:%s" PRIu64, + tsdb, uid, pTable->tableId.tid, pTable->name); + + return TSDB_CODE_OPS_NOT_SUPPORT; //basically, this error is caused by invalid sql issued by client + } + SArray* res = taosArrayInit(8, sizeof(STableId)); STSchema* pTagSchema = tsdbGetTableTagSchema(tsdbGetMeta(tsdb), pTable); diff --git a/src/util/inc/tcoding.h b/src/util/inc/tcoding.h index f3e7a52942..9f64f127e1 100644 --- a/src/util/inc/tcoding.h +++ b/src/util/inc/tcoding.h @@ -24,98 +24,188 @@ extern "C" { #include "tutil.h" -const int TNUMBER = 1; -#define IS_LITTLE_ENDIAN() (*(char *)(&TNUMBER) != 0) +// TODO: move this to a platform file +#define ENCODE_LIMIT (((uint8_t)1) << 7) +static const int32_t TNUMBER = 1; +#define IS_LITTLE_ENDIAN() (*(uint8_t *)(&TNUMBER) != 0) static FORCE_INLINE void *taosEncodeFixed16(void *buf, uint16_t value) { if (IS_LITTLE_ENDIAN()) { memcpy(buf, &value, sizeof(value)); } else { - ((char *)buf)[0] = value & 0xff; - ((char *)buf)[1] = (value >> 8) & 0xff; + ((uint8_t *)buf)[0] = value & 0xff; + ((uint8_t *)buf)[1] = (value >> 8) & 0xff; } - return POINTER_DRIFT(buf, sizeof(value)); + return POINTER_SHIFT(buf, sizeof(value)); } static FORCE_INLINE void *taosEncodeFixed32(void *buf, uint32_t value) { if (IS_LITTLE_ENDIAN()) { memcpy(buf, &value, sizeof(value)); } else { - ((char *)buf)[0] = value & 0xff; - ((char *)buf)[1] = (value >> 8) & 0xff; - ((char *)buf)[2] = (value >> 16) & 0xff; - ((char *)buf)[3] = (value >> 24) & 0xff; + ((uint8_t *)buf)[0] = value & 0xff; + ((uint8_t *)buf)[1] = (value >> 8) & 0xff; + ((uint8_t *)buf)[2] = (value >> 16) & 0xff; + ((uint8_t *)buf)[3] = (value >> 24) & 0xff; } - return POINTER_DRIFT(buf, sizeof(value)); + return POINTER_SHIFT(buf, sizeof(value)); } static FORCE_INLINE void *taosEncodeFixed64(void *buf, uint64_t value) { if (IS_LITTLE_ENDIAN()) { memcpy(buf, &value, sizeof(value)); } else { - ((char *)buf)[0] = value & 0xff; - ((char *)buf)[1] = (value >> 8) & 0xff; - ((char *)buf)[2] = (value >> 16) & 0xff; - ((char *)buf)[3] = (value >> 24) & 0xff; - ((char *)buf)[4] = (value >> 32) & 0xff; - ((char *)buf)[5] = (value >> 40) & 0xff; - ((char *)buf)[6] = (value >> 48) & 0xff; - ((char *)buf)[7] = (value >> 56) & 0xff; + ((uint8_t *)buf)[0] = value & 0xff; + ((uint8_t *)buf)[1] = (value >> 8) & 0xff; + ((uint8_t *)buf)[2] = (value >> 16) & 0xff; + ((uint8_t *)buf)[3] = (value >> 24) & 0xff; + ((uint8_t *)buf)[4] = (value >> 32) & 0xff; + ((uint8_t *)buf)[5] = (value >> 40) & 0xff; + ((uint8_t *)buf)[6] = (value >> 48) & 0xff; + ((uint8_t *)buf)[7] = (value >> 56) & 0xff; } - return POINTER_DRIFT(buf, sizeof(value)); + return POINTER_SHIFT(buf, sizeof(value)); } static FORCE_INLINE void *taosDecodeFixed16(void *buf, uint16_t *value) { if (IS_LITTLE_ENDIAN()) { memcpy(value, buf, sizeof(*value)); } else { - ((char *)value)[1] = ((char *)buf)[0]; - ((char *)value)[0] = ((char *)buf)[1]; + ((uint8_t *)value)[1] = ((uint8_t *)buf)[0]; + ((uint8_t *)value)[0] = ((uint8_t *)buf)[1]; } - return POINTER_DRIFT(buf, sizeof(*value)); + return POINTER_SHIFT(buf, sizeof(*value)); } static FORCE_INLINE void *taosDecodeFixed32(void *buf, uint32_t *value) { if (IS_LITTLE_ENDIAN()) { memcpy(value, buf, sizeof(*value)); } else { - ((char *)value)[3] = ((char *)buf)[0]; - ((char *)value)[2] = ((char *)buf)[1]; - ((char *)value)[1] = ((char *)buf)[2]; - ((char *)value)[0] = ((char *)buf)[3]; + ((uint8_t *)value)[3] = ((uint8_t *)buf)[0]; + ((uint8_t *)value)[2] = ((uint8_t *)buf)[1]; + ((uint8_t *)value)[1] = ((uint8_t *)buf)[2]; + ((uint8_t *)value)[0] = ((uint8_t *)buf)[3]; } - return POINTER_DRIFT(buf, sizeof(*value)); + return POINTER_SHIFT(buf, sizeof(*value)); } static FORCE_INLINE void *taosDecodeFixed64(void *buf, uint64_t *value) { if (IS_LITTLE_ENDIAN()) { memcpy(value, buf, sizeof(*value)); } else { - ((char *)value)[7] = ((char *)buf)[0]; - ((char *)value)[6] = ((char *)buf)[1]; - ((char *)value)[5] = ((char *)buf)[2]; - ((char *)value)[4] = ((char *)buf)[3]; - ((char *)value)[3] = ((char *)buf)[4]; - ((char *)value)[2] = ((char *)buf)[5]; - ((char *)value)[1] = ((char *)buf)[6]; - ((char *)value)[0] = ((char *)buf)[7]; + ((uint8_t *)value)[7] = ((uint8_t *)buf)[0]; + ((uint8_t *)value)[6] = ((uint8_t *)buf)[1]; + ((uint8_t *)value)[5] = ((uint8_t *)buf)[2]; + ((uint8_t *)value)[4] = ((uint8_t *)buf)[3]; + ((uint8_t *)value)[3] = ((uint8_t *)buf)[4]; + ((uint8_t *)value)[2] = ((uint8_t *)buf)[5]; + ((uint8_t *)value)[1] = ((uint8_t *)buf)[6]; + ((uint8_t *)value)[0] = ((uint8_t *)buf)[7]; } - return POINTER_DRIFT(buf, sizeof(*value)); + return POINTER_SHIFT(buf, sizeof(*value)); } -// TODO -static FORCE_INLINE void *taosEncodeVariant16(void *buf, uint16_t value) {} -static FORCE_INLINE void *taosEncodeVariant32(void *buf, uint32_t value) {} -static FORCE_INLINE void *taosEncodeVariant64(void *buf, uint64_t value) {} -static FORCE_INLINE void *taosDecodeVariant16(void *buf, uint16_t *value) {} -static FORCE_INLINE void *taosDecodeVariant32(void *buf, uint32_t *value) {} -static FORCE_INLINE void *taosDecodeVariant64(void *buf, uint64_t *value) {} +static FORCE_INLINE void *taosEncodeVariant16(void *buf, uint16_t value) { + int i = 0; + while (value >= ENCODE_LIMIT) { + ((uint8_t *)buf)[i] = (value | ENCODE_LIMIT); + value >>= 7; + i++; + ASSERT(i < 3); + } + + ((uint8_t *)buf)[i] = value; + + return POINTER_SHIFT(buf, i+1); +} + +static FORCE_INLINE void *taosEncodeVariant32(void *buf, uint32_t value) { + int i = 0; + while (value >= ENCODE_LIMIT) { + ((uint8_t *)buf)[i] = (value | ENCODE_LIMIT); + value >>= 7; + i++; + ASSERT(i < 5); + } + + ((uint8_t *)buf)[i] = value; + + return POINTER_SHIFT(buf, i + 1); +} + +static FORCE_INLINE void *taosEncodeVariant64(void *buf, uint64_t value) { + int i = 0; + while (value >= ENCODE_LIMIT) { + ((uint8_t *)buf)[i] = (value | ENCODE_LIMIT); + value >>= 7; + i++; + ASSERT(i < 10); + } + + ((uint8_t *)buf)[i] = value; + + return POINTER_SHIFT(buf, i + 1); +} + +static FORCE_INLINE void *taosDecodeVariant16(void *buf, uint16_t *value) { + int i = 0; + uint16_t tval = 0; + *value = 0; + while (i < 3) { + tval = (uint16_t)(((uint8_t *)buf)[i]); + if (tval < ENCODE_LIMIT) { + (*value) |= (tval << (7 * i)); + return POINTER_SHIFT(buf, i + 1); + } else { + (*value) |= ((tval & (ENCODE_LIMIT - 1)) << (7 * i)); + i++; + } + } + + return NULL; // error happened +} + +static FORCE_INLINE void *taosDecodeVariant32(void *buf, uint32_t *value) { + int i = 0; + uint32_t tval = 0; + *value = 0; + while (i < 5) { + tval = (uint32_t)(((uint8_t *)buf)[i]); + if (tval < ENCODE_LIMIT) { + (*value) |= (tval << (7 * i)); + return POINTER_SHIFT(buf, i + 1); + } else { + (*value) |= ((tval & (ENCODE_LIMIT - 1)) << (7 * i)); + i++; + } + } + + return NULL; // error happened +} + +static FORCE_INLINE void *taosDecodeVariant64(void *buf, uint64_t *value) { + int i = 0; + uint64_t tval = 0; + *value = 0; + while (i < 10) { + tval = (uint64_t)(((uint8_t *)buf)[i]); + if (tval < ENCODE_LIMIT) { + (*value) |= (tval << (7 * i)); + return POINTER_SHIFT(buf, i + 1); + } else { + (*value) |= ((tval & (ENCODE_LIMIT - 1)) << (7 * i)); + i++; + } + } + + return NULL; // error happened +} #ifdef __cplusplus } diff --git a/src/util/inc/tskiplist.h b/src/util/inc/tskiplist.h index 4634c14881..759ecbb7ed 100644 --- a/src/util/inc/tskiplist.h +++ b/src/util/inc/tskiplist.h @@ -178,10 +178,9 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode); * * @param pSkipList * @param pKey - * @param keyType * @return */ -SArray *tSkipListGet(SSkipList *pSkipList, SSkipListKey pKey, int16_t keyType); +SArray *tSkipListGet(SSkipList *pSkipList, SSkipListKey pKey); /** * get the size of skip list @@ -242,7 +241,7 @@ void *tSkipListDestroyIter(SSkipListIterator *iter); * true: one node has been removed * false: no node has been removed */ -bool tSkipListRemove(SSkipList *pSkipList, SSkipListKey *pKey); +bool tSkipListRemove(SSkipList *pSkipList, SSkipListKey key); /* * remove the specified node in parameters diff --git a/src/util/inc/ttimer.h b/src/util/inc/ttimer.h index 9422312856..3649a8d2f1 100644 --- a/src/util/inc/ttimer.h +++ b/src/util/inc/ttimer.h @@ -40,6 +40,10 @@ bool taosTmrReset(TAOS_TMR_CALLBACK fp, int mseconds, void *param, void *handle, void taosTmrCleanUp(void *handle); +int32_t taosInitTimer(void (*callback)(int), int32_t ms); + +void taosUninitTimer(); + #ifdef __cplusplus } #endif diff --git a/src/util/inc/tutil.h b/src/util/inc/tutil.h index b03e0a1c5b..3a0a1920af 100644 --- a/src/util/inc/tutil.h +++ b/src/util/inc/tutil.h @@ -45,7 +45,7 @@ extern "C" { #define tclose(x) taosCloseSocket(x) // Pointer p drift right by b bytes -#define POINTER_DRIFT(p, b) ((void *)((char *)(p) + (b))) +#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b))) #ifndef NDEBUG #define ASSERT(x) assert(x) @@ -141,10 +141,7 @@ int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstP */ void getTmpfilePath(const char *fileNamePattern, char *dstPath); -int32_t taosInitTimer(void (*callback)(int), int32_t ms); -void taosUninitTimer(); - -bool taosMbsToUcs4(char *mbs, int32_t mbs_len, char *ucs4, int32_t ucs4_max_len, int32_t* len); +bool taosMbsToUcs4(char *mbs, size_t mbs_len, char *ucs4, int32_t ucs4_max_len, size_t* len); int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes); diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 63fe124de2..02a5b93141 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -304,9 +304,9 @@ static FORCE_INLINE SCacheDataNode *taosAddToCacheImpl(SCacheObj *pCacheObj, con static void doCleanupDataCache(SCacheObj *pCacheObj) { __cache_wr_lock(pCacheObj); - if (taosHashGetSize(pCacheObj->pHashTable) > 0) { - taosHashCleanup(pCacheObj->pHashTable); - } + //if (taosHashGetSize(pCacheObj->pHashTable) > 0) { + taosHashCleanup(pCacheObj->pHashTable); + //} __cache_unlock(pCacheObj); diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 13a5a8580e..2d6ae13f97 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -231,7 +231,6 @@ static UNUSED_FUNC int32_t compareWStrPatternComp(const void* pLeft, const void* return (ret == TSDB_PATTERN_MATCH) ? 0 : 1; } -// todo promote the type definition before the comparsion __compar_fn_t getComparFunc(int32_t type, int32_t optr) { __compar_fn_t comparFn = NULL; diff --git a/src/util/src/tconfig.c b/src/util/src/tconfig.c index dfbdc5e35d..61ae647bf4 100644 --- a/src/util/src/tconfig.c +++ b/src/util/src/tconfig.c @@ -236,7 +236,7 @@ void taosReadGlobalLogCfg() { int olen, vlen; char fileName[PATH_MAX] = {0}; - mdebugFlag = 135; + mDebugFlag = 135; sdbDebugFlag = 135; wordexp_t full_path; diff --git a/src/util/src/tqueue.c b/src/util/src/tqueue.c index a458cefc9c..8a203ed917 100644 --- a/src/util/src/tqueue.c +++ b/src/util/src/tqueue.c @@ -94,8 +94,6 @@ void *taosAllocateQitem(int size) { void taosFreeQitem(void *param) { if (param == NULL) return; - uTrace("item:%p is freed", param); - char *temp = (char *)param; temp -= sizeof(STaosQnode); free(temp); @@ -144,7 +142,7 @@ int taosReadQitem(taos_queue param, int *type, void **pitem) { queue->numOfItems--; if (queue->qset) atomic_sub_fetch_32(&queue->qset->numOfItems, 1); code = 1; - //uTrace("item:%p is read out from queue, items:%d", *pitem, queue->numOfItems); + uTrace("item:%p is read out from queue, items:%d", *pitem, queue->numOfItems); } pthread_mutex_unlock(&queue->mutex); @@ -309,13 +307,12 @@ int taosReadQitemFromQset(taos_qset param, int *type, void **pitem, void **phand pthread_mutex_lock(&qset->mutex); for(int i=0; inumOfQueues; ++i) { - //pthread_mutex_lock(&qset->mutex); if (qset->current == NULL) qset->current = qset->head; STaosQueue *queue = qset->current; if (queue) qset->current = queue->next; - //pthread_mutex_unlock(&qset->mutex); if (queue == NULL) break; + if (queue->head == NULL) continue; pthread_mutex_lock(&queue->mutex); @@ -351,13 +348,12 @@ int taosReadAllQitemsFromQset(taos_qset param, taos_qall p2, void **phandle) { pthread_mutex_lock(&qset->mutex); for(int i=0; inumOfQueues; ++i) { - // pthread_mutex_lock(&qset->mutex); if (qset->current == NULL) qset->current = qset->head; queue = qset->current; if (queue) qset->current = queue->next; - // pthread_mutex_unlock(&qset->mutex); if (queue == NULL) break; + if (queue->head == NULL) continue; pthread_mutex_lock(&queue->mutex); diff --git a/src/util/src/tskiplist.c b/src/util/src/tskiplist.c index 4149449e6c..25ea49b60d 100644 --- a/src/util/src/tskiplist.c +++ b/src/util/src/tskiplist.c @@ -74,6 +74,7 @@ static void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSk static SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode); static SSkipListNode* tSkipListPushFront(SSkipList* pSkipList, SSkipListNode *pNode); static SSkipListIterator* doCreateSkipListIterator(SSkipList *pSkipList, int32_t order); +static SSkipListNode* tSkipListDoGet(SSkipList *pSkipList, SSkipListKey key); static bool initForwardBackwardPtr(SSkipList* pSkipList) { uint32_t maxLevel = pSkipList->maxLevel; @@ -97,6 +98,7 @@ static bool initForwardBackwardPtr(SSkipList* pSkipList) { return true; } + SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint8_t keyLen, uint8_t dupKey, uint8_t lock, uint8_t freeNode, __sl_key_fn_t fn) { SSkipList *pSkipList = (SSkipList *)calloc(1, sizeof(SSkipList)); @@ -139,25 +141,6 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint8_t keyLen, ui return pSkipList; } -// static void doRemove(SSkipList *pSkipList, SSkipListNode *pNode, SSkipListNode *forward[]) { -// int32_t level = pNode->level; -// for (int32_t j = level - 1; j >= 0; --j) { -// if ((forward[j]->pForward[j] != NULL) && (forward[j]->pForward[j]->pForward[j])) { -// forward[j]->pForward[j]->pForward[j]->pBackward[j] = forward[j]; -// } -// -// if (forward[j]->pForward[j] != NULL) { -// forward[j]->pForward[j] = forward[j]->pForward[j]->pForward[j]; -// } -// } -// -// pSkipList->state.nTotalMemSize -= (sizeof(SSkipListNode) + POINTER_BYTES * pNode->level * 2); -// removeNodeEachLevel(pSkipList, pNode->level); -// -// tfree(pNode); -// --pSkipList->size; -//} - void *tSkipListDestroy(SSkipList *pSkipList) { if (pSkipList == NULL) { return NULL; @@ -257,105 +240,10 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode) { return pNode; } -void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSkipListNode *pNode) { - DO_MEMSET_PTR_AREA(pNode); - - for (int32_t i = 0; i < pNode->level; ++i) { - SSkipListNode *x = forward[i]; - SL_GET_BACKWARD_POINTER(pNode, i) = x; - - SSkipListNode *next = SL_GET_FORWARD_POINTER(x, i); - SL_GET_BACKWARD_POINTER(next, i) = pNode; - - SL_GET_FORWARD_POINTER(pNode, i) = next; - SL_GET_FORWARD_POINTER(x, i) = pNode; - } - - atomic_add_fetch_32(&pSkipList->size, 1); - if (pSkipList->lock) { - pthread_rwlock_unlock(pSkipList->lock); - } -} - -SSkipListNode* tSkipListPushFront(SSkipList* pSkipList, SSkipListNode *pNode) { - SSkipListNode* forward[MAX_SKIP_LIST_LEVEL] = {0}; - for(int32_t i = 0; i < pSkipList->level; ++i) { - forward[i] = pSkipList->pHead; - } - - tSkipListDoInsert(pSkipList, forward, pNode); - return pNode; -} - -SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode) { - // do clear pointer area - DO_MEMSET_PTR_AREA(pNode); - - for(int32_t i = 0; i < pNode->level; ++i) { - SSkipListNode* prev = SL_GET_BACKWARD_POINTER(pSkipList->pTail, i); - SL_GET_FORWARD_POINTER(prev, i) = pNode; - SL_GET_FORWARD_POINTER(pNode, i) = pSkipList->pTail; - - SL_GET_BACKWARD_POINTER(pNode, i) = prev; - SL_GET_BACKWARD_POINTER(pSkipList->pTail, i) = pNode; - } - - pSkipList->lastKey = SL_GET_NODE_KEY(pSkipList, pNode); - - atomic_add_fetch_32(&pSkipList->size, 1); - if (pSkipList->lock) { - pthread_rwlock_unlock(pSkipList->lock); - } - - return pNode; -} - -SArray* tSkipListGet(SSkipList *pSkipList, SSkipListKey pKey, int16_t keyType) { - int32_t sLevel = pSkipList->level - 1; - - // result list +SArray* tSkipListGet(SSkipList *pSkipList, SSkipListKey key) { SArray* sa = taosArrayInit(1, POINTER_BYTES); - SSkipListNode *pNode = pSkipList->pHead; - - if (pSkipList->lock) { - pthread_rwlock_rdlock(pSkipList->lock); - } - -#if SKIP_LIST_RECORD_PERFORMANCE - pSkipList->state.queryCount++; -#endif - - __compar_fn_t filterComparFn = getComparFunc(pSkipList->keyInfo.type, 0); - int32_t ret = -1; - for (int32_t i = sLevel; i >= 0; --i) { - SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, i); - while (p != pSkipList->pTail) { - char *key = SL_GET_NODE_KEY(pSkipList, p); - - if ((ret = filterComparFn(key, pKey)) < 0) { - pNode = p; - p = SL_GET_FORWARD_POINTER(p, i); - } else { - break; - } - } - - // find the qualified key - if (ret == 0) { - SSkipListNode* pResult = SL_GET_FORWARD_POINTER(pNode, i); - taosArrayPush(sa, &pResult); - - // skip list does not allowed duplicated key, abort further retrieve data - if (!pSkipList->keyInfo.dupKey) { - break; - } - } - } - - if (pSkipList->lock) { - pthread_rwlock_unlock(pSkipList->lock); - } - + SSkipListNode* pNode = tSkipListDoGet(pSkipList, key); + taosArrayPush(sa, &pNode); return sa; } @@ -367,114 +255,6 @@ size_t tSkipListGetSize(const SSkipList* pSkipList) { return pSkipList->size; } -SSkipListIterator* tSkipListCreateIter(SSkipList *pSkipList) { - if (pSkipList == NULL) { - return NULL; - } - - return doCreateSkipListIterator(pSkipList, TSDB_ORDER_ASC); -} - -SSkipListIterator *tSkipListCreateIterFromVal(SSkipList* pSkipList, const char* val, int32_t type, int32_t order) { - if (pSkipList == NULL) { - return NULL; - } - - assert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); - - if (val == NULL) { - return doCreateSkipListIterator(pSkipList, order); - } else { - - SSkipListNode *forward[MAX_SKIP_LIST_LEVEL] = {0}; - - int32_t ret = -1; - __compar_fn_t filterComparFn = getKeyComparFunc(pSkipList->keyInfo.type); - SSkipListNode* pNode = pSkipList->pHead; - - for (int32_t i = pSkipList->level - 1; i >= 0; --i) { - SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, i); - while (p != pSkipList->pTail) { - char *key = SL_GET_NODE_KEY(pSkipList, p); - - if ((ret = filterComparFn(key, val)) < 0) { - pNode = p; - p = SL_GET_FORWARD_POINTER(p, i); - } else { - break; - } - } - - forward[i] = pNode; - } - - SSkipListIterator* iter = doCreateSkipListIterator(pSkipList, order); - - // set the initial position - if (order == TSDB_ORDER_ASC) { - iter->cur = forward[0]; // greater equals than the value - } else { - iter->cur = SL_GET_FORWARD_POINTER(forward[0], 0); - - if (ret == 0) { - assert(iter->cur != pSkipList->pTail); - iter->cur = SL_GET_FORWARD_POINTER(iter->cur, 0); - } - } - - return iter; - } -} - -bool tSkipListIterNext(SSkipListIterator *iter) { - if (iter->pSkipList == NULL) { - return false; - } - - SSkipList *pSkipList = iter->pSkipList; - - if (pSkipList->lock) { - pthread_rwlock_rdlock(pSkipList->lock); - } - - if (iter->order == TSDB_ORDER_ASC) { // ascending order iterate - if (iter->cur == NULL) { - iter->cur = SL_GET_FORWARD_POINTER(pSkipList->pHead, 0); - } else { - iter->cur = SL_GET_FORWARD_POINTER(iter->cur, 0); - } - } else { // descending order iterate - if (iter->cur == NULL) { - iter->cur = SL_GET_BACKWARD_POINTER(pSkipList->pTail, 0); - } else { - iter->cur = SL_GET_BACKWARD_POINTER(iter->cur, 0); - } - } - - if (pSkipList->lock) { - pthread_rwlock_unlock(pSkipList->lock); - } - - return (iter->order == TSDB_ORDER_ASC)? (iter->cur != pSkipList->pTail) : (iter->cur != pSkipList->pHead); -} - -SSkipListNode *tSkipListIterGet(SSkipListIterator *iter) { - if (iter == NULL || iter->cur == iter->pSkipList->pTail || iter->cur == iter->pSkipList->pHead) { - return NULL; - } else { - return iter->cur; - } -} - -void* tSkipListDestroyIter(SSkipListIterator* iter) { - if (iter == NULL) { - return NULL; - } - - tfree(iter); - return NULL; -} - // static int32_t tSkipListEndParQuery(SSkipList *pSkipList, SSkipListNode *pStartNode, SSkipListKey *pEndKey, // int32_t cond, SSkipListNode ***pRes) { // pthread_rwlock_rdlock(&pSkipList->lock); @@ -588,25 +368,162 @@ void* tSkipListDestroyIter(SSkipListIterator* iter) { // } // // // compress the minimum level of skip list -// while (pSkipList->level > 0 && pSkipList->pHead.pForward[pSkipList->level - 1] == NULL) { +// while (pSkipList->level > 0 && SL_GET_FORWARD_POINTER(pSkipList->pHead, pSkipList->level - 1) == NULL) { // pSkipList->level -= 1; // } // // return true; //} -// -// void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNode) { -// SSkipListNode *forward[MAX_SKIP_LIST_LEVEL] = {0}; -// -// pthread_rwlock_rdlock(&pSkipList->lock); -// for (int32_t i = 0; i < pNode->level; ++i) { -// forward[i] = pNode->pBackward[i]; -// } -// -// removeSupport(pSkipList, forward, &pNode->key); -// pthread_rwlock_unlock(&pSkipList->lock); -//} -// + +bool tSkipListRemove(SSkipList *pSkipList, SSkipListKey key) { + SSkipListNode* pNode = tSkipListDoGet(pSkipList, key); + if (pNode != NULL) { + tSkipListRemoveNode(pSkipList, pNode); + return true; + } + + return false; +} + +void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNode) { + int32_t level = pNode->level; + + if (pSkipList->lock) { + pthread_rwlock_wrlock(pSkipList->lock); + } + + for (int32_t j = level - 1; j >= 0; --j) { + SSkipListNode* prev = SL_GET_BACKWARD_POINTER(pNode, j); + SSkipListNode* next = SL_GET_FORWARD_POINTER(pNode, j); + + SL_GET_FORWARD_POINTER(prev, j) = next; + SL_GET_BACKWARD_POINTER(next, j) = prev; + } + + if (pSkipList->keyInfo.freeNode) { + tfree(pNode); + } + + atomic_sub_fetch_32(&pSkipList->size, 1); + + // compress the minimum level of skip list + while (pSkipList->level > 0 && SL_GET_FORWARD_POINTER(pSkipList->pHead, pSkipList->level - 1) == NULL) { + pSkipList->level -= 1; + } + + if (pSkipList->lock) { + pthread_rwlock_unlock(pSkipList->lock); + } +} + +SSkipListIterator* tSkipListCreateIter(SSkipList *pSkipList) { + if (pSkipList == NULL) { + return NULL; + } + + return doCreateSkipListIterator(pSkipList, TSDB_ORDER_ASC); +} + +SSkipListIterator *tSkipListCreateIterFromVal(SSkipList* pSkipList, const char* val, int32_t type, int32_t order) { + if (pSkipList == NULL) { + return NULL; + } + + assert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); + + if (val == NULL) { + return doCreateSkipListIterator(pSkipList, order); + } else { + + SSkipListNode *forward[MAX_SKIP_LIST_LEVEL] = {0}; + + int32_t ret = -1; + __compar_fn_t filterComparFn = getKeyComparFunc(pSkipList->keyInfo.type); + SSkipListNode* pNode = pSkipList->pHead; + + for (int32_t i = pSkipList->level - 1; i >= 0; --i) { + SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, i); + while (p != pSkipList->pTail) { + char *key = SL_GET_NODE_KEY(pSkipList, p); + + if ((ret = filterComparFn(key, val)) < 0) { + pNode = p; + p = SL_GET_FORWARD_POINTER(p, i); + } else { + break; + } + } + + forward[i] = pNode; + } + + SSkipListIterator* iter = doCreateSkipListIterator(pSkipList, order); + + // set the initial position + if (order == TSDB_ORDER_ASC) { + iter->cur = forward[0]; // greater equals than the value + } else { + iter->cur = SL_GET_FORWARD_POINTER(forward[0], 0); + + if (ret == 0) { + assert(iter->cur != pSkipList->pTail); + iter->cur = SL_GET_FORWARD_POINTER(iter->cur, 0); + } + } + + return iter; + } +} + +bool tSkipListIterNext(SSkipListIterator *iter) { + if (iter->pSkipList == NULL) { + return false; + } + + SSkipList *pSkipList = iter->pSkipList; + + if (pSkipList->lock) { + pthread_rwlock_rdlock(pSkipList->lock); + } + + if (iter->order == TSDB_ORDER_ASC) { // ascending order iterate + if (iter->cur == NULL) { + iter->cur = SL_GET_FORWARD_POINTER(pSkipList->pHead, 0); + } else { + iter->cur = SL_GET_FORWARD_POINTER(iter->cur, 0); + } + } else { // descending order iterate + if (iter->cur == NULL) { + iter->cur = SL_GET_BACKWARD_POINTER(pSkipList->pTail, 0); + } else { + iter->cur = SL_GET_BACKWARD_POINTER(iter->cur, 0); + } + } + + if (pSkipList->lock) { + pthread_rwlock_unlock(pSkipList->lock); + } + + return (iter->order == TSDB_ORDER_ASC)? (iter->cur != pSkipList->pTail) : (iter->cur != pSkipList->pHead); +} + +SSkipListNode *tSkipListIterGet(SSkipListIterator *iter) { + if (iter == NULL || iter->cur == iter->pSkipList->pTail || iter->cur == iter->pSkipList->pHead) { + return NULL; + } else { + return iter->cur; + } +} + +void* tSkipListDestroyIter(SSkipListIterator* iter) { + if (iter == NULL) { + return NULL; + } + + tfree(iter); + return NULL; +} + // bool tSkipListRemove(SSkipList *pSkipList, SSkipListKey *pKey) { // SSkipListNode *forward[MAX_SKIP_LIST_LEVEL] = {0}; // __compar_fn_t filterComparFn = getComparFunc(pSkipList, pKey->nType); @@ -668,6 +585,105 @@ void tSkipListPrint(SSkipList *pSkipList, int16_t nlevel) { } } +void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSkipListNode *pNode) { + DO_MEMSET_PTR_AREA(pNode); + + for (int32_t i = 0; i < pNode->level; ++i) { + SSkipListNode *x = forward[i]; + SL_GET_BACKWARD_POINTER(pNode, i) = x; + + SSkipListNode *next = SL_GET_FORWARD_POINTER(x, i); + SL_GET_BACKWARD_POINTER(next, i) = pNode; + + SL_GET_FORWARD_POINTER(pNode, i) = next; + SL_GET_FORWARD_POINTER(x, i) = pNode; + } + + atomic_add_fetch_32(&pSkipList->size, 1); + if (pSkipList->lock) { + pthread_rwlock_unlock(pSkipList->lock); + } +} + +SSkipListNode* tSkipListPushFront(SSkipList* pSkipList, SSkipListNode *pNode) { + SSkipListNode* forward[MAX_SKIP_LIST_LEVEL] = {0}; + for(int32_t i = 0; i < pSkipList->level; ++i) { + forward[i] = pSkipList->pHead; + } + + tSkipListDoInsert(pSkipList, forward, pNode); + return pNode; +} + +SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode) { + // do clear pointer area + DO_MEMSET_PTR_AREA(pNode); + + for(int32_t i = 0; i < pNode->level; ++i) { + SSkipListNode* prev = SL_GET_BACKWARD_POINTER(pSkipList->pTail, i); + SL_GET_FORWARD_POINTER(prev, i) = pNode; + SL_GET_FORWARD_POINTER(pNode, i) = pSkipList->pTail; + + SL_GET_BACKWARD_POINTER(pNode, i) = prev; + SL_GET_BACKWARD_POINTER(pSkipList->pTail, i) = pNode; + } + + pSkipList->lastKey = SL_GET_NODE_KEY(pSkipList, pNode); + + atomic_add_fetch_32(&pSkipList->size, 1); + if (pSkipList->lock) { + pthread_rwlock_unlock(pSkipList->lock); + } + + return pNode; +} + +SSkipListNode* tSkipListDoGet(SSkipList *pSkipList, SSkipListKey skey) { + SSkipListNode *pNode = pSkipList->pHead; + SSkipListNode *pRes = NULL; + + if (pSkipList->lock) { + pthread_rwlock_rdlock(pSkipList->lock); + } + +#if SKIP_LIST_RECORD_PERFORMANCE + pSkipList->state.queryCount++; +#endif + + __compar_fn_t cmparFn = getComparFunc(pSkipList->keyInfo.type, 0); + + int32_t ret = -1; + for (int32_t i = pSkipList->level - 1; i >= 0; --i) { + SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, i); + while (p != pSkipList->pTail) { + char *key = SL_GET_NODE_KEY(pSkipList, p); + + if ((ret = cmparFn(key, skey)) < 0) { + pNode = p; + p = SL_GET_FORWARD_POINTER(p, i); + } else { + break; + } + } + + // find the qualified key + if (ret == 0) { + pRes = SL_GET_FORWARD_POINTER(pNode, i); + break; + // skip list does not allowed duplicated key, abort further retrieve data +// if (!pSkipList->keyInfo.dupKey) { +// break; +// } + } + } + + if (pSkipList->lock) { + pthread_rwlock_unlock(pSkipList->lock); + } + + return pRes; +} + SSkipListIterator* doCreateSkipListIterator(SSkipList *pSkipList, int32_t order) { SSkipListIterator* iter = calloc(1, sizeof(SSkipListIterator)); @@ -675,4 +691,4 @@ SSkipListIterator* doCreateSkipListIterator(SSkipList *pSkipList, int32_t order) iter->order = order; return iter; -} +} \ No newline at end of file diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index 396f6f1ef8..52f70bdf5e 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -490,25 +490,26 @@ bool taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs) { #endif } -bool taosMbsToUcs4(char *mbs, int32_t mbs_len, char *ucs4, int32_t ucs4_max_len, int32_t* len) { +bool taosMbsToUcs4(char *mbs, size_t mbsLength, char *ucs4, int32_t ucs4_max_len, size_t* len) { memset(ucs4, 0, ucs4_max_len); #ifdef USE_LIBICONV iconv_t cd = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); - size_t ucs4_input_len = mbs_len; - size_t outLen = ucs4_max_len; - if (iconv(cd, &mbs, &ucs4_input_len, &ucs4, &outLen) == -1) { + size_t ucs4_input_len = mbsLength; + size_t outLeft = ucs4_max_len; + if (iconv(cd, &mbs, &ucs4_input_len, &ucs4, &outLeft) == -1) { iconv_close(cd); return false; } + iconv_close(cd); if (len != NULL) { - *len = outLen; + *len = ucs4_max_len - outLeft; } return true; #else mbstate_t state = {0}; - int32_t len = mbsnrtowcs((wchar_t *) ucs4, (const char **) &mbs, mbs_len, ucs4_max_len / 4, &state); + int32_t len = mbsnrtowcs((wchar_t *) ucs4, (const char **) &mbs, mbsLength, ucs4_max_len / 4, &state); return len >= 0; #endif } diff --git a/src/util/tests/codingTests.cpp b/src/util/tests/codingTests.cpp new file mode 100644 index 0000000000..a72c7ef291 --- /dev/null +++ b/src/util/tests/codingTests.cpp @@ -0,0 +1,116 @@ +#include +#include +#include +#include + +#include "tcoding.h" + +static bool test_fixed_uint16(uint16_t value) { + char buf[20] = "\0"; + uint16_t value_check = 0; + + void *ptr1 = taosEncodeFixed16(static_cast(buf), value); + void *ptr2 = taosDecodeFixed16(static_cast(buf), &value_check); + + return ((ptr2 != NULL) && (value == value_check) && (ptr1 == ptr2)); +} + +static bool test_fixed_uint32(uint32_t value) { + char buf[20] = "\0"; + uint32_t value_check = 0; + + void *ptr1 = taosEncodeFixed32(static_cast(buf), value); + void *ptr2 = taosDecodeFixed32(static_cast(buf), &value_check); + + return ((ptr2 != NULL) && (value == value_check) && (ptr1 == ptr2)); +} + +static bool test_fixed_uint64(uint64_t value) { + char buf[20] = "\0"; + uint64_t value_check = 0; + + void *ptr1 = taosEncodeFixed64(static_cast(buf), value); + void *ptr2 = taosDecodeFixed64(static_cast(buf), &value_check); + + return ((ptr2 != NULL) && (value == value_check) && (ptr1 == ptr2)); +} + +static bool test_variant_uint16(uint16_t value) { + char buf[20] = "\0"; + uint16_t value_check = 0; + + void *ptr1 = taosEncodeVariant16(static_cast(buf), value); + void *ptr2 = taosDecodeVariant16(static_cast(buf), &value_check); + + return ((ptr2 != NULL) && (value == value_check) && (ptr1 == ptr2)); +} + +static bool test_variant_uint32(uint32_t value) { + char buf[20] = "\0"; + uint32_t value_check = 0; + + void *ptr1 = taosEncodeVariant32(static_cast(buf), value); + void *ptr2 = taosDecodeVariant32(static_cast(buf), &value_check); + + return ((ptr2 != NULL) && (value == value_check) && (ptr1 == ptr2)); +} + +static bool test_variant_uint64(uint64_t value) { + char buf[20] = "\0"; + uint64_t value_check = 0; + + void *ptr1 = taosEncodeVariant64(static_cast(buf), value); + void *ptr2 = taosDecodeVariant64(static_cast(buf), &value_check); + + return ((ptr2 != NULL) && (value == value_check) && (ptr1 == ptr2)); +} + +TEST(codingTest, fixed_encode_decode) { + srand(time(0)); + + for (uint16_t value = 0; value <= UINT16_MAX; value++) { + ASSERT_TRUE(test_fixed_uint16(value)); + if (value == UINT16_MAX) break; + } + + ASSERT_TRUE(test_fixed_uint32(0)); + ASSERT_TRUE(test_fixed_uint32(UINT32_MAX)); + + for (int i = 0; i < 1000000; i++) { + ASSERT_TRUE(test_fixed_uint32(rand())); + } + + std::mt19937_64 gen (std::random_device{}()); + + ASSERT_TRUE(test_fixed_uint64(0)); + ASSERT_TRUE(test_fixed_uint64(UINT64_MAX)); + for (int i = 0; i < 1000000; i++) { + ASSERT_TRUE(test_fixed_uint64(gen())); + } +} + +TEST(codingTest, variant_encode_decode) { + srand(time(0)); + + for (uint16_t value = 0; value <= UINT16_MAX; value++) { + ASSERT_TRUE(test_variant_uint16(value)); + if (value == UINT16_MAX) break; + } + + ASSERT_TRUE(test_variant_uint32(0)); + ASSERT_TRUE(test_variant_uint32(UINT32_MAX)); + + for (int i = 0; i < 5000000; i++) { + ASSERT_TRUE(test_variant_uint32(rand())); + } + + std::mt19937_64 gen (std::random_device{}()); + + ASSERT_TRUE(test_variant_uint64(0)); + ASSERT_TRUE(test_variant_uint64(UINT64_MAX)); + for (int i = 0; i < 5000000; i++) { + uint64_t value = gen(); + // printf("%ull\n", value); + ASSERT_TRUE(test_variant_uint64(value)); + } +} \ No newline at end of file diff --git a/src/vnode/inc/vnodeInt.h b/src/vnode/inc/vnodeInt.h index d99cb1c96c..d4842fdf7f 100644 --- a/src/vnode/inc/vnodeInt.h +++ b/src/vnode/inc/vnodeInt.h @@ -20,8 +20,17 @@ extern "C" { #endif +#include "tlog.h" #include "tsync.h" #include "twal.h" +#include "tcq.h" + +extern int32_t vDebugFlag; + +#define vError(...) if (vDebugFlag & DEBUG_ERROR) {taosPrintLog("ERROR VND ", 255, __VA_ARGS__); } +#define vWarn(...) if (vDebugFlag & DEBUG_WARN) {taosPrintLog("WARN VND ", vDebugFlag, __VA_ARGS__); } +#define vTrace(...) if (vDebugFlag & DEBUG_TRACE) {taosPrintLog("VND ", vDebugFlag, __VA_ARGS__); } +#define vPrint(...) {taosPrintLog("VND ", 255, __VA_ARGS__); } typedef struct { int32_t vgId; // global vnode group ID diff --git a/src/vnode/inc/vnodeLog.h b/src/vnode/inc/vnodeLog.h index 450220e17f..bd8daae0b6 100644 --- a/src/vnode/inc/vnodeLog.h +++ b/src/vnode/inc/vnodeLog.h @@ -22,19 +22,19 @@ extern "C" { #include "tlog.h" -extern int32_t ddebugFlag; +extern int32_t dDebugFlag; #define dError(...) \ - if (ddebugFlag & DEBUG_ERROR) { \ + if (dDebugFlag & DEBUG_ERROR) { \ taosPrintLog("ERROR DND ", 255, __VA_ARGS__); \ } #define dWarn(...) \ - if (ddebugFlag & DEBUG_WARN) { \ - taosPrintLog("WARN DND ", ddebugFlag, __VA_ARGS__); \ + if (dDebugFlag & DEBUG_WARN) { \ + taosPrintLog("WARN DND ", dDebugFlag, __VA_ARGS__); \ } #define dTrace(...) \ - if (ddebugFlag & DEBUG_TRACE) { \ - taosPrintLog("DND ", ddebugFlag, __VA_ARGS__); \ + if (dDebugFlag & DEBUG_TRACE) { \ + taosPrintLog("DND ", dDebugFlag, __VA_ARGS__); \ } #define dPrint(...) \ { taosPrintLog("DND ", 255, __VA_ARGS__); } diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 2c914de20f..d3e9751738 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -24,14 +24,10 @@ #include "ttime.h" #include "ttimer.h" #include "cJSON.h" -#include "twal.h" #include "tglobal.h" #include "dnode.h" #include "vnode.h" #include "vnodeInt.h" -#include "vnodeLog.h" -#include "tcq.h" -//#include "tsync.h" static int32_t tsOpennedVnodes; static void *tsDnodeVnodesHash; @@ -46,6 +42,7 @@ static int vnodeWalCallback(void *arg); static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size); static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index); static void vnodeNotifyRole(void *ahandle, int8_t role); +static void vnodeNotifyFileSynced(void *ahandle); static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT; @@ -64,7 +61,7 @@ static void vnodeInit() { tsDnodeVnodesHash = taosInitIntHash(TSDB_MAX_VNODES, sizeof(SVnodeObj *), taosHashInt); if (tsDnodeVnodesHash == NULL) { - dError("failed to init vnode list"); + vError("failed to init vnode list"); } } @@ -74,7 +71,7 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { SVnodeObj *pTemp = (SVnodeObj *)taosGetIntHashData(tsDnodeVnodesHash, pVnodeCfg->cfg.vgId); if (pTemp != NULL) { - dPrint("vgId:%d, vnode already exist, pVnode:%p", pVnodeCfg->cfg.vgId, pTemp); + vPrint("vgId:%d, vnode already exist, pVnode:%p", pVnodeCfg->cfg.vgId, pTemp); return TSDB_CODE_SUCCESS; } @@ -93,7 +90,7 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { code = vnodeSaveCfg(pVnodeCfg); if (code != TSDB_CODE_SUCCESS) { - dError("vgId:%d, failed to save vnode cfg, reason:%s", pVnodeCfg->cfg.vgId, tstrerror(code)); + vError("vgId:%d, failed to save vnode cfg, reason:%s", pVnodeCfg->cfg.vgId, tstrerror(code)); return code; } @@ -113,11 +110,11 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { sprintf(tsdbDir, "%s/vnode%d/tsdb", tsVnodeDir, pVnodeCfg->cfg.vgId); code = tsdbCreateRepo(tsdbDir, &tsdbCfg, NULL); if (code != TSDB_CODE_SUCCESS) { - dError("vgId:%d, failed to create tsdb in vnode, reason:%s", pVnodeCfg->cfg.vgId, tstrerror(code)); + vError("vgId:%d, failed to create tsdb in vnode, reason:%s", pVnodeCfg->cfg.vgId, tstrerror(code)); return TSDB_CODE_VG_INIT_FAILED; } - dPrint("vgId:%d, vnode is created, clog:%d", pVnodeCfg->cfg.vgId, pVnodeCfg->cfg.commitLog); + vPrint("vgId:%d, vnode is created, clog:%d", pVnodeCfg->cfg.vgId, pVnodeCfg->cfg.walLevel); code = vnodeOpen(pVnodeCfg->cfg.vgId, rootDir); return code; @@ -126,12 +123,12 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { int32_t vnodeDrop(int32_t vgId) { SVnodeObj **ppVnode = (SVnodeObj **)taosGetIntHashData(tsDnodeVnodesHash, vgId); if (ppVnode == NULL || *ppVnode == NULL) { - dTrace("vgId:%d, failed to drop, vgId not exist", vgId); + vTrace("vgId:%d, failed to drop, vgId not exist", vgId); return TSDB_CODE_INVALID_VGROUP_ID; } SVnodeObj *pVnode = *ppVnode; - dTrace("pVnode:%p vgId:%d, vnode will be dropped", pVnode, pVnode->vgId); + vTrace("vgId:%d, vnode will be dropped", pVnode->vgId); pVnode->status = TAOS_VN_STATUS_DELETING; vnodeCleanUp(pVnode); @@ -144,34 +141,34 @@ int32_t vnodeAlter(void *param, SMDCreateVnodeMsg *pVnodeCfg) { int32_t code = vnodeSaveCfg(pVnodeCfg); if (code != TSDB_CODE_SUCCESS) { - dError("vgId:%d, failed to save vnode cfg, reason:%s", pVnodeCfg->cfg.vgId, tstrerror(code)); + vError("vgId:%d, failed to save vnode cfg, reason:%s", pVnodeCfg->cfg.vgId, tstrerror(code)); return code; } code = vnodeReadCfg(pVnode); if (code != TSDB_CODE_SUCCESS) { - dError("pVnode:%p vgId:%d, failed to read cfg file", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read cfg file", pVnode->vgId); taosDeleteIntHash(tsDnodeVnodesHash, pVnode->vgId); return code; } code = syncReconfig(pVnode->sync, &pVnode->syncCfg); if (code != TSDB_CODE_SUCCESS) { - dTrace("pVnode:%p vgId:%d, failed to alter vnode, canot reconfig sync, result:%s", pVnode, pVnode->vgId, + vTrace("vgId:%d, failed to alter vnode, canot reconfig sync, result:%s", pVnode->vgId, tstrerror(code)); return code; } code = tsdbConfigRepo(pVnode->tsdb, &pVnode->tsdbCfg); if (code != TSDB_CODE_SUCCESS) { - dTrace("pVnode:%p vgId:%d, failed to alter vnode, canot reconfig tsdb, result:%s", pVnode, pVnode->vgId, + vTrace("vgId:%d, failed to alter vnode, canot reconfig tsdb, result:%s", pVnode->vgId, tstrerror(code)); return code; } pVnode->status = TAOS_VN_STATUS_READY; - dTrace("pVnode:%p vgId:%d, vnode is altered", pVnode, pVnode->vgId); + vTrace("vgId:%d, vnode is altered", pVnode->vgId); return TSDB_CODE_SUCCESS; } @@ -189,7 +186,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { int32_t code = vnodeReadCfg(pVnode); if (code != TSDB_CODE_SUCCESS) { - dError("pVnode:%p vgId:%d, failed to read cfg file", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read cfg file", pVnode->vgId); taosDeleteIntHash(tsDnodeVnodesHash, pVnode->vgId); return code; } @@ -214,7 +211,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { sprintf(temp, "%s/tsdb", rootDir); pVnode->tsdb = tsdbOpenRepo(temp, &appH); if (pVnode->tsdb == NULL) { - dError("pVnode:%p vgId:%d, failed to open tsdb at %s(%s)", pVnode, pVnode->vgId, temp, tstrerror(terrno)); + vError("vgId:%d, failed to open tsdb at %s(%s)", pVnode->vgId, temp, tstrerror(terrno)); taosDeleteIntHash(tsDnodeVnodesHash, pVnode->vgId); return terrno; } @@ -234,6 +231,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { syncInfo.writeToCache = vnodeWriteToQueue; syncInfo.confirmForward = dnodeSendRpcWriteRsp; syncInfo.notifyRole = vnodeNotifyRole; + syncInfo.notifyFileSynced = vnodeNotifyFileSynced; pVnode->sync = syncStart(&syncInfo); // start continuous query @@ -243,7 +241,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { pVnode->events = NULL; pVnode->status = TAOS_VN_STATUS_READY; - dTrace("pVnode:%p vgId:%d, vnode is opened in %s", pVnode, pVnode->vgId, rootDir); + vTrace("vgId:%d, vnode is opened in %s, pVnode:%p", pVnode->vgId, rootDir, pVnode); atomic_add_fetch_32(&tsOpennedVnodes, 1); return TSDB_CODE_SUCCESS; @@ -254,7 +252,7 @@ int32_t vnodeClose(int32_t vgId) { if (ppVnode == NULL || *ppVnode == NULL) return 0; SVnodeObj *pVnode = *ppVnode; - dTrace("pVnode:%p vgId:%d, vnode will be closed", pVnode, pVnode->vgId); + vTrace("vgId:%d, vnode will be closed", pVnode->vgId); pVnode->status = TAOS_VN_STATUS_CLOSING; vnodeCleanUp(pVnode); @@ -269,7 +267,7 @@ void vnodeRelease(void *pVnodeRaw) { assert(refCount >= 0); if (refCount > 0) { - dTrace("pVnode:%p vgId:%d, release vnode, refCount:%d", pVnode, vgId, refCount); + vTrace("vgId:%d, release vnode, refCount:%d", vgId, refCount); return; } @@ -290,7 +288,7 @@ void vnodeRelease(void *pVnodeRaw) { free(pVnode); int32_t count = atomic_sub_fetch_32(&tsOpennedVnodes, 1); - dTrace("pVnode:%p vgId:%d, vnode is released, vnodes:%d", pVnode, vgId, count); + vTrace("vgId:%d, vnode is released, vnodes:%d", pVnode, vgId, count); if (count <= 0) { taosCleanUpIntHash(tsDnodeVnodesHash); @@ -303,7 +301,7 @@ void *vnodeGetVnode(int32_t vgId) { SVnodeObj **ppVnode = (SVnodeObj **)taosGetIntHashData(tsDnodeVnodesHash, vgId); if (ppVnode == NULL || *ppVnode == NULL) { terrno = TSDB_CODE_INVALID_VGROUP_ID; - dPrint("vgId:%d not exist", vgId); + vPrint("vgId:%d, not exist", vgId); return NULL; } @@ -315,7 +313,7 @@ void *vnodeAccquireVnode(int32_t vgId) { if (pVnode == NULL) return pVnode; atomic_add_fetch_32(&pVnode->refCount, 1); - dTrace("pVnode:%p vgId:%d, get vnode, refCount:%d", pVnode, pVnode->vgId, pVnode->refCount); + vTrace("vgId:%d, get vnode, refCount:%d", pVnode->vgId, pVnode->refCount); return pVnode; } @@ -405,12 +403,19 @@ static void vnodeNotifyRole(void *ahandle, int8_t role) { cqStop(pVnode->cq); } +static void vnodeNotifyFileSynced(void *ahandle) { + SVnodeObj *pVnode = ahandle; + vTrace("pVnode:%p vgId:%d, data file is synced", pVnode, pVnode->vgId); + + // clsoe tsdb, then open tsdb +} + static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { char cfgFile[TSDB_FILENAME_LEN + 30] = {0}; sprintf(cfgFile, "%s/vnode%d/config.json", tsVnodeDir, pVnodeCfg->cfg.vgId); FILE *fp = fopen(cfgFile, "w"); if (!fp) { - dError("vgId:%d, failed to open vnode cfg file for write, file:%s error:%s", pVnodeCfg->cfg.vgId, cfgFile, + vError("vgId:%d, failed to open vnode cfg file for write, file:%s error:%s", pVnodeCfg->cfg.vgId, cfgFile, strerror(errno)); return errno; } @@ -434,7 +439,7 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { len += snprintf(content + len, maxLen - len, " \"commitTime\": %d,\n", pVnodeCfg->cfg.commitTime); len += snprintf(content + len, maxLen - len, " \"precision\": %d,\n", pVnodeCfg->cfg.precision); len += snprintf(content + len, maxLen - len, " \"compression\": %d,\n", pVnodeCfg->cfg.compression); - len += snprintf(content + len, maxLen - len, " \"commitLog\": %d,\n", pVnodeCfg->cfg.commitLog); + len += snprintf(content + len, maxLen - len, " \"walLevel\": %d,\n", pVnodeCfg->cfg.walLevel); len += snprintf(content + len, maxLen - len, " \"replica\": %d,\n", pVnodeCfg->cfg.replications); len += snprintf(content + len, maxLen - len, " \"wals\": %d,\n", pVnodeCfg->cfg.wals); len += snprintf(content + len, maxLen - len, " \"quorum\": %d,\n", pVnodeCfg->cfg.quorum); @@ -456,7 +461,7 @@ static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { fclose(fp); free(content); - dPrint("vgId:%d, save vnode cfg successed", pVnodeCfg->cfg.vgId); + vPrint("vgId:%d, save vnode cfg successed", pVnodeCfg->cfg.vgId); return 0; } @@ -466,7 +471,7 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { sprintf(cfgFile, "%s/vnode%d/config.json", tsVnodeDir, pVnode->vgId); FILE *fp = fopen(cfgFile, "r"); if (!fp) { - dError("pVnode:%p vgId:%d, failed to open vnode cfg file for read, file:%s, error:%s", pVnode, pVnode->vgId, + vError("vgId:%d, failed to open vnode cfg file for read, file:%s, error:%s", pVnode->vgId, cfgFile, strerror(errno)); return errno; } @@ -478,117 +483,117 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { if (len <= 0) { free(content); fclose(fp); - dError("pVnode:%p vgId:%d, failed to read vnode cfg, content is null", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, content is null", pVnode->vgId); return false; } cJSON *root = cJSON_Parse(content); if (root == NULL) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, invalid json format", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, invalid json format", pVnode->vgId); goto PARSE_OVER; } cJSON *cfgVersion = cJSON_GetObjectItem(root, "cfgVersion"); if (!cfgVersion || cfgVersion->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, cfgVersion not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, cfgVersion not found", pVnode->vgId); goto PARSE_OVER; } pVnode->cfgVersion = cfgVersion->valueint; cJSON *cacheBlockSize = cJSON_GetObjectItem(root, "cacheBlockSize"); if (!cacheBlockSize || cacheBlockSize->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, cacheBlockSize not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, cacheBlockSize not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.cacheBlockSize = cacheBlockSize->valueint; cJSON *totalBlocks = cJSON_GetObjectItem(root, "totalBlocks"); if (!totalBlocks || totalBlocks->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, totalBlocks not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, totalBlocks not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.totalBlocks = totalBlocks->valueint; cJSON *maxTables = cJSON_GetObjectItem(root, "maxTables"); if (!maxTables || maxTables->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, maxTables not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, maxTables not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.maxTables = maxTables->valueint; cJSON *daysPerFile = cJSON_GetObjectItem(root, "daysPerFile"); if (!daysPerFile || daysPerFile->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, daysPerFile not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, daysPerFile not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.daysPerFile = daysPerFile->valueint; cJSON *daysToKeep = cJSON_GetObjectItem(root, "daysToKeep"); if (!daysToKeep || daysToKeep->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, daysToKeep not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, daysToKeep not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.keep = daysToKeep->valueint; cJSON *daysToKeep1 = cJSON_GetObjectItem(root, "daysToKeep1"); if (!daysToKeep1 || daysToKeep1->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, daysToKeep1 not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, daysToKeep1 not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.keep1 = daysToKeep1->valueint; cJSON *daysToKeep2 = cJSON_GetObjectItem(root, "daysToKeep2"); if (!daysToKeep2 || daysToKeep2->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, daysToKeep2 not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, daysToKeep2 not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.keep2 = daysToKeep2->valueint; cJSON *minRowsPerFileBlock = cJSON_GetObjectItem(root, "minRowsPerFileBlock"); if (!minRowsPerFileBlock || minRowsPerFileBlock->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, minRowsPerFileBlock not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, minRowsPerFileBlock not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.minRowsPerFileBlock = minRowsPerFileBlock->valueint; cJSON *maxRowsPerFileBlock = cJSON_GetObjectItem(root, "maxRowsPerFileBlock"); if (!maxRowsPerFileBlock || maxRowsPerFileBlock->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, maxRowsPerFileBlock not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, maxRowsPerFileBlock not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.maxRowsPerFileBlock = maxRowsPerFileBlock->valueint; cJSON *commitTime = cJSON_GetObjectItem(root, "commitTime"); if (!commitTime || commitTime->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, commitTime not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, commitTime not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.commitTime = (int8_t)commitTime->valueint; cJSON *precision = cJSON_GetObjectItem(root, "precision"); if (!precision || precision->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, precision not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, precision not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.precision = (int8_t)precision->valueint; cJSON *compression = cJSON_GetObjectItem(root, "compression"); if (!compression || compression->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, compression not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, compression not found", pVnode->vgId); goto PARSE_OVER; } pVnode->tsdbCfg.compression = (int8_t)compression->valueint; - cJSON *commitLog = cJSON_GetObjectItem(root, "commitLog"); - if (!commitLog || commitLog->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, commitLog not found", pVnode, pVnode->vgId); + cJSON *walLevel = cJSON_GetObjectItem(root, "walLevel"); + if (!walLevel || walLevel->type != cJSON_Number) { + vError("vgId:%d, failed to read vnode cfg, walLevel not found", pVnode->vgId); goto PARSE_OVER; } - pVnode->walCfg.commitLog = (int8_t)commitLog->valueint; + pVnode->walCfg.walLevel = (int8_t) walLevel->valueint; cJSON *wals = cJSON_GetObjectItem(root, "wals"); if (!wals || wals->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, wals not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, wals not found", pVnode->vgId); goto PARSE_OVER; } pVnode->walCfg.wals = (int8_t)wals->valueint; @@ -596,27 +601,27 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { cJSON *replica = cJSON_GetObjectItem(root, "replica"); if (!replica || replica->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, replica not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, replica not found", pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.replica = (int8_t)replica->valueint; cJSON *quorum = cJSON_GetObjectItem(root, "quorum"); if (!quorum || quorum->type != cJSON_Number) { - dError("failed to read vnode cfg, quorum not found", pVnode, pVnode->vgId); + vError("failed to read vnode cfg, quorum not found", pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.quorum = (int8_t)quorum->valueint; cJSON *nodeInfos = cJSON_GetObjectItem(root, "nodeInfos"); if (!nodeInfos || nodeInfos->type != cJSON_Array) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeInfos not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, nodeInfos not found", pVnode->vgId); goto PARSE_OVER; } int size = cJSON_GetArraySize(nodeInfos); if (size != pVnode->syncCfg.replica) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeInfos size not matched", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, nodeInfos size not matched", pVnode->vgId); goto PARSE_OVER; } @@ -626,14 +631,14 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { cJSON *nodeId = cJSON_GetObjectItem(nodeInfo, "nodeId"); if (!nodeId || nodeId->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeId not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, nodeId not found", pVnode->vgId); goto PARSE_OVER; } pVnode->syncCfg.nodeInfo[i].nodeId = nodeId->valueint; cJSON *nodeEp = cJSON_GetObjectItem(nodeInfo, "nodeEp"); if (!nodeEp || nodeEp->type != cJSON_String || nodeEp->valuestring == NULL) { - dError("pVnode:%p vgId:%d, failed to read vnode cfg, nodeFqdn not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode cfg, nodeFqdn not found", pVnode->vgId); goto PARSE_OVER; } @@ -643,9 +648,9 @@ static int32_t vnodeReadCfg(SVnodeObj *pVnode) { ret = 0; - dPrint("pVnode:%p vgId:%d, read vnode cfg successed, replcia:%d", pVnode, pVnode->vgId, pVnode->syncCfg.replica); + vPrint("vgId:%d, read vnode cfg successed, replcia:%d", pVnode->vgId, pVnode->syncCfg.replica); for (int32_t i = 0; i < pVnode->syncCfg.replica; i++) { - dPrint("pVnode:%p vgId:%d, dnode:%d, %s:%d", pVnode, pVnode->vgId, pVnode->syncCfg.nodeInfo[i].nodeId, + vPrint("vgId:%d, dnode:%d, %s:%d", pVnode->vgId, pVnode->syncCfg.nodeInfo[i].nodeId, pVnode->syncCfg.nodeInfo[i].nodeFqdn, pVnode->syncCfg.nodeInfo[i].nodePort); } @@ -661,7 +666,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) { sprintf(versionFile, "%s/vnode%d/version.json", tsVnodeDir, pVnode->vgId); FILE *fp = fopen(versionFile, "w"); if (!fp) { - dError("pVnode:%p vgId:%d, failed to open vnode version file for write, file:%s error:%s", pVnode, pVnode->vgId, + vError("vgId:%d, failed to open vnode version file for write, file:%s error:%s", pVnode->vgId, versionFile, strerror(errno)); return errno; } @@ -678,7 +683,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) { fclose(fp); free(content); - dPrint("pVnode:%p vgId:%d, save vnode version:%" PRId64 " successed", pVnode, pVnode->vgId, pVnode->version); + vPrint("vgId:%d, save vnode version:%" PRId64 " successed", pVnode->vgId, pVnode->version); return 0; } @@ -688,8 +693,9 @@ static bool vnodeReadVersion(SVnodeObj *pVnode) { sprintf(versionFile, "%s/vnode%d/version.json", tsVnodeDir, pVnode->vgId); FILE *fp = fopen(versionFile, "r"); if (!fp) { - dTrace("pVnode:%p vgId:%d, failed to open version file:%s error:%s", pVnode, pVnode->vgId, - versionFile, strerror(errno)); + if (errno != ENOENT) { + vError("vgId:%d, failed to open version file:%s error:%s", pVnode->vgId, versionFile, strerror(errno)); + } return false; } @@ -700,26 +706,26 @@ static bool vnodeReadVersion(SVnodeObj *pVnode) { if (len <= 0) { free(content); fclose(fp); - dPrint("pVnode:%p vgId:%d, failed to read vnode version, content is null", pVnode, pVnode->vgId); + vPrint("vgId:%d, failed to read vnode version, content is null", pVnode->vgId); return false; } cJSON *root = cJSON_Parse(content); if (root == NULL) { - dError("pVnode:%p vgId:%d, failed to read vnode version, invalid json format", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode version, invalid json format", pVnode->vgId); goto PARSE_OVER; } cJSON *version = cJSON_GetObjectItem(root, "version"); if (!version || version->type != cJSON_Number) { - dError("pVnode:%p vgId:%d, failed to read vnode version, version not found", pVnode, pVnode->vgId); + vError("vgId:%d, failed to read vnode version, version not found", pVnode->vgId); goto PARSE_OVER; } pVnode->version = version->valueint; ret = true; - dPrint("pVnode:%p vgId:%d, read vnode version successed, version:%%" PRId64, pVnode, pVnode->vgId, pVnode->version); + vPrint("vgId:%d, read vnode version successed, version:%%" PRId64, pVnode->vgId, pVnode->version); PARSE_OVER: free(content); diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index b111f56e39..d2dd1811cf 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -29,11 +29,11 @@ static int32_t (*vnodeProcessReadMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *pCont, int32_t contLen, SRspRet *pRet); static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t contLen, SRspRet *pRet); -static int32_t vnodeProcessRetrieveMsg(SVnodeObj *pVnode, void *pCont, int32_t contLen, SRspRet *pRet); +static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t contLen, SRspRet *pRet); void vnodeInitReadFp(void) { - vnodeProcessReadMsgFp[TSDB_MSG_TYPE_QUERY] = vnodeProcessQueryMsg; - vnodeProcessReadMsgFp[TSDB_MSG_TYPE_RETRIEVE] = vnodeProcessRetrieveMsg; + vnodeProcessReadMsgFp[TSDB_MSG_TYPE_QUERY] = vnodeProcessQueryMsg; + vnodeProcessReadMsgFp[TSDB_MSG_TYPE_FETCH] = vnodeProcessFetchMsg; } int32_t vnodeProcessRead(void *param, int msgType, void *pCont, int32_t contLen, SRspRet *ret) { @@ -65,7 +65,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont pRet->len = sizeof(SQueryTableRsp); pRet->rsp = pRsp; - dTrace("pVnode:%p vgId:%d QInfo:%p, dnode query msg disposed", pVnode, pVnode->vgId, pQInfo); + vTrace("vgId:%d QInfo:%p, dnode query msg disposed", pVnode->vgId, pQInfo); } else { pQInfo = pCont; code = TSDB_CODE_ACTION_IN_PROGRESS; @@ -76,14 +76,14 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont return code; } -static int32_t vnodeProcessRetrieveMsg(SVnodeObj *pVnode, void *pCont, int32_t contLen, SRspRet *pRet) { +static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t contLen, SRspRet *pRet) { SRetrieveTableMsg *pRetrieve = pCont; void *pQInfo = (void*) htobe64(pRetrieve->qhandle); memset(pRet, 0, sizeof(SRspRet)); int32_t code = TSDB_CODE_SUCCESS; - dTrace("pVnode:%p vgId:%d QInfo:%p, retrieve msg is received", pVnode, pVnode->vgId, pQInfo); + vTrace("vgId:%d QInfo:%p, retrieve msg is received", pVnode->vgId, pQInfo); pRet->code = qRetrieveQueryResultInfo(pQInfo); if (pRet->code != TSDB_CODE_SUCCESS) { @@ -104,6 +104,6 @@ static int32_t vnodeProcessRetrieveMsg(SVnodeObj *pVnode, void *pCont, int32_t c } } - dTrace("pVnode:%p vgId:%d QInfo:%p, retrieve msg is disposed", pVnode, pVnode->vgId, pQInfo); + vTrace("vgId:%d QInfo:%p, retrieve msg is disposed", pVnode->vgId, pQInfo); return code; } diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 3541fc15b6..3fc079ca13 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -51,7 +51,7 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { if (vnodeProcessWriteMsgFp[pHead->msgType] == NULL) return TSDB_CODE_MSG_NOT_PROCESSED; - if (pVnode->status != TAOS_VN_STATUS_READY) + if (pVnode->status != TAOS_VN_STATUS_READY && qtype == TAOS_QTYPE_RPC) return TSDB_CODE_NOT_ACTIVE_VNODE; if (pHead->version == 0) { // from client @@ -91,7 +91,7 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR // save insert result into item - dTrace("pVnode:%p vgId:%d, submit msg is processed", pVnode, pVnode->vgId); + vTrace("vgId:%d, submit msg is processed", pVnode->vgId); code = tsdbInsertData(pVnode->tsdb, pCont); pRet->len = sizeof(SShellSubmitRspMsg); @@ -110,7 +110,7 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe SMDCreateTableMsg *pTable = pCont; int32_t code = 0; - dTrace("pVnode:%p vgId:%d, table:%s, start to create", pVnode, pVnode->vgId, pTable->tableId); + vTrace("vgId:%d, table:%s, start to create", pVnode->vgId, pTable->tableId); int16_t numOfColumns = htons(pTable->numOfColumns); int16_t numOfTags = htons(pTable->numOfTags); int32_t sid = htonl(pTable->sid); @@ -157,7 +157,7 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe tfree(pDestTagSchema); tfree(pDestSchema); - dTrace("pVnode:%p vgId:%d, table:%s is created, result:%x", pVnode, pVnode->vgId, pTable->tableId, code); + vTrace("vgId:%d, table:%s is created, result:%x", pVnode->vgId, pTable->tableId, code); return code; } @@ -165,7 +165,7 @@ static int32_t vnodeProcessDropTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet SMDDropTableMsg *pTable = pCont; int32_t code = 0; - dTrace("pVnode:%p vgId:%d, table:%s, start to drop", pVnode, pVnode->vgId, pTable->tableId); + vTrace("vgId:%d, table:%s, start to drop", pVnode->vgId, pTable->tableId); STableId tableId = { .uid = htobe64(pTable->uid), .tid = htonl(pTable->sid) @@ -180,11 +180,11 @@ static int32_t vnodeProcessAlterTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet SMDCreateTableMsg *pTable = pCont; int32_t code = 0; - dTrace("pVnode:%p vgId:%d, table:%s, start to alter", pVnode, pVnode->vgId, pTable->tableId); + vTrace("vgId:%d, table:%s, start to alter", pVnode->vgId, pTable->tableId); int16_t numOfColumns = htons(pTable->numOfColumns); int16_t numOfTags = htons(pTable->numOfTags); int32_t sid = htonl(pTable->sid); - uint64_t uid = htobe64(pTable->uid); + uint64_t uid = htobe64(pTable->uid); SSchema *pSchema = (SSchema *) pTable->data; int32_t totalCols = numOfColumns + numOfTags; @@ -221,7 +221,7 @@ static int32_t vnodeProcessAlterTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet tfree(pDestSchema); - dTrace("pVnode:%p vgId:%d, table:%s, alter table result:%d", pVnode, pVnode->vgId, pTable->tableId, code); + vTrace("vgId:%d, table:%s, alter table result:%d", pVnode->vgId, pTable->tableId, code); return code; } @@ -230,14 +230,16 @@ static int32_t vnodeProcessDropStableMsg(SVnodeObj *pVnode, void *pCont, SRspRet SMDDropSTableMsg *pTable = pCont; int32_t code = 0; - dTrace("pVnode:%p vgId:%d, stable:%s, start to drop", pVnode, pVnode->vgId, pTable->tableId); - // TODO: drop stable in vvnode - //int64_t uid = htobe64(pTable->uid); - //void *pTsdb = dnodeGetVnodeTsdb(pMsg->pVnode); - //rpcRsp.code = tsdbDropTable(pTsdb, pTable->uid); + vTrace("vgId:%d, stable:%s, start to drop", pVnode->vgId, pTable->tableId); + + STableId stableId = { + .uid = htobe64(pTable->uid), + .tid = -1 + }; - code = TSDB_CODE_SUCCESS; - dTrace("pVnode:%p vgId:%d, stable:%s, drop stable result:%x", pVnode, pTable->tableId, code); + code = tsdbDropTable(pVnode->tsdb, stableId); + + vTrace("vgId:%d, stable:%s, drop stable result:%s", pVnode->vgId, pTable->tableId, tstrerror(code)); return code; } diff --git a/src/wal/src/walMain.c b/src/wal/src/walMain.c index ad33391b98..8d92fac926 100644 --- a/src/wal/src/walMain.c +++ b/src/wal/src/walMain.c @@ -62,7 +62,7 @@ void *walOpen(const char *path, const SWalCfg *pCfg) { pWal->max = pCfg->wals; pWal->id = 0; pWal->num = 0; - pWal->level = pCfg->commitLog; + pWal->level = pCfg->walLevel; pWal->keep = pCfg->keep; strcpy(pWal->path, path); pthread_mutex_init(&pWal->mutex, NULL); @@ -79,7 +79,9 @@ void *walOpen(const char *path, const SWalCfg *pCfg) { pthread_mutex_destroy(&pWal->mutex); free(pWal); pWal = NULL; - } + } else { + wTrace("wal:%s, it is open, level:%d", path, pWal->level); + } return pWal; } @@ -177,8 +179,11 @@ void walFsync(void *handle) { SWal *pWal = handle; - if (pWal->level == TAOS_WAL_FSYNC) - fsync(pWal->fd); + if (pWal->level == TAOS_WAL_FSYNC && pWal->fd >=0) { + if (fsync(pWal->fd) < 0) { + wError("wal:%s, fsync failed(%s)", pWal->name, strerror(errno)); + } + } } int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int)) { diff --git a/src/wal/test/waltest.c b/src/wal/test/waltest.c index 6bab8e0b23..cf9bf9542e 100644 --- a/src/wal/test/waltest.c +++ b/src/wal/test/waltest.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { } else if (strcmp(argv[i], "-v")==0 && i < argc-1) { ver = atoll(argv[++i]); } else if (strcmp(argv[i], "-d")==0 && i < argc-1) { - ddebugFlag = atoi(argv[++i]); + dDebugFlag = atoi(argv[++i]); } else { printf("\nusage: %s [options] \n", argv[0]); printf(" [-p path]: wal file path default is:%s\n", path); @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) { printf(" [-r rows]: rows of records per wal file, default is:%d\n", rows); printf(" [-k keep]: keep the wal after closing, default is:%d\n", keep); printf(" [-v version]: initial version, default is:%ld\n", ver); - printf(" [-d debugFlag]: debug flag, default:%d\n", ddebugFlag); + printf(" [-d debugFlag]: debug flag, default:%d\n", dDebugFlag); printf(" [-h help]: print out this help\n\n"); exit(0); } @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) { taosInitLog("wal.log", 100000, 10); SWalCfg walCfg; - walCfg.commitLog = level; + walCfg.walLevel = level; walCfg.wals = max; walCfg.keep = keep; diff --git a/tests/examples/JDBC/springbootdemo/readme.md b/tests/examples/JDBC/springbootdemo/readme.md index 64aabedcdc..ac3bb44ef9 100644 --- a/tests/examples/JDBC/springbootdemo/readme.md +++ b/tests/examples/JDBC/springbootdemo/readme.md @@ -14,7 +14,7 @@ spring.datasource.druid.max-active=5 # max wait time for get connection, ms spring.datasource.druid.max-wait=60000 -spring.datasource.druid.validation-query=describe log.dn +spring.datasource.druid.validation-query=select server_status(); spring.datasource.druid.validation-query-timeout=5000 spring.datasource.druid.test-on-borrow=false spring.datasource.druid.test-on-return=false diff --git a/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties b/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties index dc77e144f0..926559a90c 100644 --- a/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties +++ b/tests/examples/JDBC/springbootdemo/src/main/resources/application.properties @@ -10,7 +10,7 @@ spring.datasource.druid.max-active=5 # max wait time for get connection, ms spring.datasource.druid.max-wait=60000 -spring.datasource.druid.validation-query=describe log.dn +spring.datasource.druid.validation-query=select server_status(); spring.datasource.druid.validation-query-timeout=5000 spring.datasource.druid.test-on-borrow=false spring.datasource.druid.test-on-return=false @@ -23,4 +23,4 @@ spring.datasource.druid.max-evictable-idle-time-millis=900000 #mybatis mybatis.mapper-locations=classpath:mapper/*.xml -logging.level.com.taosdata.jdbc.springbootdemo.dao=debug \ No newline at end of file +logging.level.com.taosdata.jdbc.springbootdemo.dao=debug diff --git a/tests/examples/c/demo.c b/tests/examples/c/demo.c index a2073b09b3..70b1b2067f 100644 --- a/tests/examples/c/demo.c +++ b/tests/examples/c/demo.c @@ -74,8 +74,9 @@ int main(int argc, char *argv[]) { printf("success to connect to server\n"); doQuery(taos, "create database if not exists test"); - doQuery(taos, "use test"); - doQuery(taos, "select * from t1 order by ts desc"); + doQuery(taos, "create database if not exists test"); +// doQuery(taos, "use test"); +// doQuery(taos, "select sum(k)*max(k), sum(k), max(k) from tm99"); // doQuery(taos, "create table t1(ts timestamp, k binary(12), f nchar(2))"); // for(int32_t i = 0; i< 100000; ++i) { diff --git a/tests/pytest/account/__init__.py b/tests/pytest/account/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/pytest/account/account_create.py b/tests/pytest/account/account_create.py new file mode 100644 index 0000000000..24bcc8df2f --- /dev/null +++ b/tests/pytest/account/account_create.py @@ -0,0 +1,41 @@ +################################################################### +# 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): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + try: + tdSql.execute("create account a&cc PASS 'pass123'") + except Exception as e: + print("create account a&cc PASS 'pass123'") + return + + tdLog.exit("drop built-in user is error.") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/account/account_del.py b/tests/pytest/account/account_del.py new file mode 100644 index 0000000000..43690c6e37 --- /dev/null +++ b/tests/pytest/account/account_del.py @@ -0,0 +1,52 @@ +################################################################### +# 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): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + print("==========step1") + print("drop built-in account") + try: + tdSql.execute("drop account root") + except Exception as e: + if len(e.args) > 0 and 'no rights' != e.args[0]: + tdLog.exit(e) + + print("==========step2") + print("drop built-in user") + try: + tdSql.execute("drop user root") + except Exception as e: + if len(e.args) > 0 and 'no rights' != e.args[0]: + tdLog.exit(e) + return + + tdLog.exit("drop built-in user is error.") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index ec06eb38ef..6aec67f9ce 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -9,6 +9,12 @@ 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 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 import_merge/importBlock1HO.py python3 ./test.py $1 -f import_merge/importBlock1HPO.py python3 ./test.py $1 -f import_merge/importBlock1H.py @@ -75,3 +81,7 @@ 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 + +# user +python3 ./test.py $1 -f user/user_create.py +python3 ./test.py $1 -f user/pass_len.py \ No newline at end of file diff --git a/tests/pytest/import_merge/importDataH2.py b/tests/pytest/import_merge/importDataH2.py index d49abff374..73a412fb80 100644 --- a/tests/pytest/import_merge/importDataH2.py +++ b/tests/pytest/import_merge/importDataH2.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -43,19 +43,19 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") - tdLog.info("import %d sequential data" % (self.rows / 2)) + tdLog.info("import %d sequential data" % (self.maxrows / 2)) startTime = self.startTime sqlcmd = ['import into tb1 values'] - for rid in range(1, self.rows / 2 + 1): + for rid in range(1, self.maxrows / 2 + 1): sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) tdSql.execute(" ".join(sqlcmd)) tdLog.info("================= step3") tdSql.query('select * from tb1') - tdSql.checkRows(self.rows / 2) + tdSql.checkRows(self.maxrows / 2) tdLog.info("================= step4") tdDnodes.stop(1) @@ -70,7 +70,7 @@ class TDTestCase: tdLog.info("================= step7") tdSql.execute('reset query cache') tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rows / 2 + 1) + tdSql.checkRows(self.maxrows / 2 + 1) tdLog.info("================= step8") tdLog.info("import 10 data in batch before") @@ -83,7 +83,7 @@ class TDTestCase: tdLog.info("================= step9") tdSql.execute('reset query cache') tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rows / 2 + 11) + tdSql.checkRows(self.maxrows / 2 + 11) def stop(self): tdSql.close() diff --git a/tests/pytest/import_merge/importDataHO.py b/tests/pytest/import_merge/importDataHO.py index 0483e6844c..0fe6ab71d5 100644 --- a/tests/pytest/import_merge/importDataHO.py +++ b/tests/pytest/import_merge/importDataHO.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxwrows = 200 self.rowsPerTable = 20 tdDnodes.stop(1) @@ -36,7 +36,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -44,7 +44,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") tdLog.info("import %d sequential data" % self.rowsPerTable) diff --git a/tests/pytest/import_merge/importDataHO2.py b/tests/pytest/import_merge/importDataHO2.py index ab7044d2a7..6246b55b32 100644 --- a/tests/pytest/import_merge/importDataHO2.py +++ b/tests/pytest/import_merge/importDataHO2.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 self.rowsPerTable = 100 tdDnodes.stop(1) @@ -36,7 +36,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -44,7 +44,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") tdLog.info("import %d sequential data" % self.rowsPerTable) diff --git a/tests/pytest/import_merge/importDataHPO.py b/tests/pytest/import_merge/importDataHPO.py index f165bd7b5a..c749dbd113 100644 --- a/tests/pytest/import_merge/importDataHPO.py +++ b/tests/pytest/import_merge/importDataHPO.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 self.rowsPerTable = 20 tdDnodes.stop(1) @@ -36,7 +36,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -44,7 +44,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") tdLog.info("import %d sequential data" % self.rowsPerTable) diff --git a/tests/pytest/import_merge/importDataLastH.py b/tests/pytest/import_merge/importDataLastH.py index 319fd40677..830711a420 100644 --- a/tests/pytest/import_merge/importDataLastH.py +++ b/tests/pytest/import_merge/importDataLastH.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -43,7 +43,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataLastHO.py b/tests/pytest/import_merge/importDataLastHO.py index 5a71c5db65..037c81f087 100644 --- a/tests/pytest/import_merge/importDataLastHO.py +++ b/tests/pytest/import_merge/importDataLastHO.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -43,7 +43,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataLastHPO.py b/tests/pytest/import_merge/importDataLastHPO.py index f2c95cbd4d..46a7e5909d 100644 --- a/tests/pytest/import_merge/importDataLastHPO.py +++ b/tests/pytest/import_merge/importDataLastHPO.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -43,7 +43,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataLastS.py b/tests/pytest/import_merge/importDataLastS.py index 929e02dd1e..2dd7cdb744 100644 --- a/tests/pytest/import_merge/importDataLastS.py +++ b/tests/pytest/import_merge/importDataLastS.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -43,7 +43,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataLastSub.py b/tests/pytest/import_merge/importDataLastSub.py index 158fa0fb3c..bb9953057e 100644 --- a/tests/pytest/import_merge/importDataLastSub.py +++ b/tests/pytest/import_merge/importDataLastSub.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -43,7 +43,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataLastT.py b/tests/pytest/import_merge/importDataLastT.py index 9bc90a8275..29f0afaf1a 100644 --- a/tests/pytest/import_merge/importDataLastT.py +++ b/tests/pytest/import_merge/importDataLastT.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -39,7 +39,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataLastTO.py b/tests/pytest/import_merge/importDataLastTO.py index 0c93ac430b..47639130b5 100644 --- a/tests/pytest/import_merge/importDataLastTO.py +++ b/tests/pytest/import_merge/importDataLastTO.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -39,7 +39,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataLastTPO.py b/tests/pytest/import_merge/importDataLastTPO.py index 188e93e0db..4190836505 100644 --- a/tests/pytest/import_merge/importDataLastTPO.py +++ b/tests/pytest/import_merge/importDataLastTPO.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -39,7 +39,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than %d rows less than %d rows will go to data and last file" % - (self.rows, 10 + self.rows)) + (self.maxrows, 10 + self.maxrows)) tdLog.info("================= step2") tdLog.info("import 205 sequential data") diff --git a/tests/pytest/import_merge/importDataS.py b/tests/pytest/import_merge/importDataS.py index 65d4087c3d..daa4b2e025 100644 --- a/tests/pytest/import_merge/importDataS.py +++ b/tests/pytest/import_merge/importDataS.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -39,7 +39,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") tdLog.info("import 20 sequential data") diff --git a/tests/pytest/import_merge/importDataSub.py b/tests/pytest/import_merge/importDataSub.py index 4bf85f2bdd..2359ca214f 100644 --- a/tests/pytest/import_merge/importDataSub.py +++ b/tests/pytest/import_merge/importDataSub.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -43,19 +43,19 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") - tdLog.info("import %d sequential data" % (self.rows / 2)) + tdLog.info("import %d sequential data" % (self.maxrows / 2)) startTime = self.startTime sqlcmd = ['import into tb1 values'] - for rid in range(1, self.rows / 2 + 1): + for rid in range(1, self.maxrows / 2 + 1): sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) tdSql.execute(" ".join(sqlcmd)) tdLog.info("================= step3") tdSql.query('select * from tb1') - tdSql.checkRows(self.rows / 2) + tdSql.checkRows(self.maxrows / 2) tdLog.info("================= step4") tdDnodes.stop(1) @@ -73,7 +73,7 @@ class TDTestCase: tdLog.info("================= step9") tdSql.execute('reset query cache') tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rows / 2) + tdSql.checkRows(self.maxrows / 2) def stop(self): tdSql.close() diff --git a/tests/pytest/import_merge/importDataT.py b/tests/pytest/import_merge/importDataT.py index 66016c5555..abb5e312ef 100644 --- a/tests/pytest/import_merge/importDataT.py +++ b/tests/pytest/import_merge/importDataT.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -39,7 +39,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") tdLog.info("import 20 sequential data") diff --git a/tests/pytest/import_merge/importDataTO.py b/tests/pytest/import_merge/importDataTO.py index a3c17b2846..2a6d9e272b 100644 --- a/tests/pytest/import_merge/importDataTO.py +++ b/tests/pytest/import_merge/importDataTO.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -39,7 +39,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") tdLog.info("import 20 sequential data") diff --git a/tests/pytest/import_merge/importDataTPO.py b/tests/pytest/import_merge/importDataTPO.py index 20eb41cc08..06d5cf3c1a 100644 --- a/tests/pytest/import_merge/importDataTPO.py +++ b/tests/pytest/import_merge/importDataTPO.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") @@ -39,7 +39,7 @@ class TDTestCase: tdSql.execute('create table tb1 (ts timestamp, speed int)') tdLog.info( "More than 10 rows less than %d rows will go to data file" % - self.rows) + self.maxrows) tdLog.info("================= step2") tdLog.info("import 20 sequential data") diff --git a/tests/pytest/import_merge/importLastH.py b/tests/pytest/import_merge/importLastH.py index c69f453971..a6f9fa087c 100644 --- a/tests/pytest/import_merge/importLastH.py +++ b/tests/pytest/import_merge/importLastH.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importLastHO.py b/tests/pytest/import_merge/importLastHO.py index ec930d1807..e6468b243e 100644 --- a/tests/pytest/import_merge/importLastHO.py +++ b/tests/pytest/import_merge/importLastHO.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importLastHPO.py b/tests/pytest/import_merge/importLastHPO.py index 9603a7b852..4a299ed823 100644 --- a/tests/pytest/import_merge/importLastHPO.py +++ b/tests/pytest/import_merge/importLastHPO.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importLastS.py b/tests/pytest/import_merge/importLastS.py index 7dbe74e2ca..2a5de46eb2 100644 --- a/tests/pytest/import_merge/importLastS.py +++ b/tests/pytest/import_merge/importLastS.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importLastSub.py b/tests/pytest/import_merge/importLastSub.py index f028ba5fd7..fa1b2387f3 100644 --- a/tests/pytest/import_merge/importLastSub.py +++ b/tests/pytest/import_merge/importLastSub.py @@ -27,11 +27,11 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importLastT.py b/tests/pytest/import_merge/importLastT.py index 3fe4e0006c..b7a1e58bc5 100644 --- a/tests/pytest/import_merge/importLastT.py +++ b/tests/pytest/import_merge/importLastT.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importLastTO.py b/tests/pytest/import_merge/importLastTO.py index 76e5016bdb..541cbd29ca 100644 --- a/tests/pytest/import_merge/importLastTO.py +++ b/tests/pytest/import_merge/importLastTO.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/import_merge/importLastTPO.py b/tests/pytest/import_merge/importLastTPO.py index 08f4168063..6ec21d0c79 100644 --- a/tests/pytest/import_merge/importLastTPO.py +++ b/tests/pytest/import_merge/importLastTPO.py @@ -27,7 +27,7 @@ class TDTestCase: def run(self): self.ntables = 1 self.startTime = 1520000010000 - self.rows = 200 + self.maxrows = 200 tdDnodes.stop(1) tdDnodes.deploy(1) @@ -35,7 +35,7 @@ class TDTestCase: tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('create database db maxrows %d' % self.maxrows) tdSql.execute('use db') tdLog.info("================= step1") diff --git a/tests/pytest/insert/binary.py b/tests/pytest/insert/binary.py index e254fb1438..677ae4bf29 100644 --- a/tests/pytest/insert/binary.py +++ b/tests/pytest/insert/binary.py @@ -14,7 +14,6 @@ class TDTestCase: def run(self): tdSql.prepare() - tdLog.info('=============== step1') tdLog.info('create table tb (ts timestamp, speed binary(5))') tdSql.execute('create table tb (ts timestamp, speed binary(5))') diff --git a/tests/pytest/insert/date.py b/tests/pytest/insert/date.py index 716d799cb0..fb7f1816c4 100644 --- a/tests/pytest/insert/date.py +++ b/tests/pytest/insert/date.py @@ -18,7 +18,7 @@ class TDTestCase: # TSIM: # TSIM: system sh/ip.sh -i 1 -s up # TSIM: system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1 - # TSIM: system sh/cfg.sh -n dnode1 -c commitLog -v 0 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 # TSIM: system sh/exec.sh -n dnode1 -s start # TSIM: # TSIM: sleep 3000 diff --git a/tests/pytest/insert/nchar.py b/tests/pytest/insert/nchar.py new file mode 100644 index 0000000000..d61a44844d --- /dev/null +++ b/tests/pytest/insert/nchar.py @@ -0,0 +1,44 @@ +################################################################### +# 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 * + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + tdSql.execute('create table tb (ts timestamp, col nchar(10))') + tdSql.execute("insert into tb values (now, 'taosdata')") + tdSql.query("select * from tb") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 'taosdata') + tdSql.execute("insert into tb values (now, '涛思数据')") + tdSql.query("select * from tb") + tdSql.checkRows(2) + tdSql.checkData(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/smoketest.sh b/tests/pytest/smoketest.sh index 7dbefa9402..e51e8792ec 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -1,66 +1,116 @@ #!/bin/bash python3 ./test.py $1 -f insert/basic.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/int.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/float.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/bigint.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/bool.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/double.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/smallint.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f insert/tinyint.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/binary.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/date.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/nchar.py +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f table/column_name.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f table/column_num.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f table/db_table.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -s && sleep 1 -#python3 ./test.py $1 -f import_merge/importDataLastTO.py -#python3 ./test.py -s $1 -#sleep 1 -#python3 ./test.py $1 -f import_merge/importDataLastT.py -#python3 ./test.py -s $1 -#sleep 1 -python3 ./test.py $1 -f import_merge/importDataTO.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f import_merge/importDataT.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f import_merge/importHeadOverlap.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f import_merge/importHORestart.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f import_merge/importHPORestart.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f import_merge/importHRestart.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f import_merge/importLastSub.py -python3 ./test.py -s $1 -sleep 1 +python3 ./test.py $1 -f import_merge/importDataLastTO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importDataLastT.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importDataTO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importDataT.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importHeadOverlap.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importHORestart.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importHPORestart.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importHRestart.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importLastSub.py +python3 ./test.py $1 -s && sleep 1 + +python3 ./test.py $1 -f import_merge/importBlock1HO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1HPO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1H.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1S.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1Sub.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1TO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1TPO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock1T.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2HO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2HPO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2H.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2S.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2Sub.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2TO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2TPO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlock2T.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importBlockbetween.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importCacheFileSub.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importCacheFileTO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importCacheFileT.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importDataLastSub.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importHead.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importLastTO.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importLastT.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importSpan.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importSRestart.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importSubRestart.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importTailOverlap.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importTail.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importTORestart.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importTPORestart.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importTRestart.py +python3 ./test.py $1 -s && sleep 1 diff --git a/tests/pytest/table/column_name.py b/tests/pytest/table/column_name.py index 6c945646d5..bb1f587a65 100644 --- a/tests/pytest/table/column_name.py +++ b/tests/pytest/table/column_name.py @@ -18,7 +18,7 @@ class TDTestCase: # TSIM: # TSIM: system sh/ip.sh -i 1 -s up # TSIM: system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1 - # TSIM: system sh/cfg.sh -n dnode1 -c commitLog -v 0 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 # TSIM: system sh/exec.sh -n dnode1 -s start # TSIM: # TSIM: sleep 3000 diff --git a/tests/pytest/table/column_num.py b/tests/pytest/table/column_num.py index fca5b01ac2..87299827cc 100644 --- a/tests/pytest/table/column_num.py +++ b/tests/pytest/table/column_num.py @@ -18,7 +18,7 @@ class TDTestCase: # TSIM: # TSIM: system sh/ip.sh -i 1 -s up # TSIM: system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1 - # TSIM: system sh/cfg.sh -n dnode1 -c commitLog -v 0 + # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0 # TSIM: system sh/exec.sh -n dnode1 -s start # TSIM: # TSIM: sleep 3000 diff --git a/tests/pytest/test.py b/tests/pytest/test.py index 9bf1660634..a4129be34c 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -92,23 +92,23 @@ if __name__ == "__main__": tdDnodes.start(1) if masterIp == "": - host='127.0.0.1' + host = '127.0.0.1' else: - host=masterIp + host = masterIp - tdLog.notice("Procedures for tdengine deployed in %s" % (host)) + tdLog.info("Procedures for tdengine deployed in %s" % (host)) if testCluster: - tdLog.notice("Procedures for testing cluster") + tdLog.info("Procedures for testing cluster") if fileName == "all": tdCases.runAllCluster() else: tdCases.runOneCluster(fileName) else: - tdLog.notice("Procedures for testing self-deployment") + tdLog.info("Procedures for testing self-deployment") conn = taos.connect( - host, - config=tdDnodes.getSimCfgPath()) + host, + config=tdDnodes.getSimCfgPath()) if fileName == "all": tdCases.runAllLinux(conn) else: diff --git a/tests/pytest/user/__init__.py b/tests/pytest/user/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/pytest/user/pass_len.py b/tests/pytest/user/pass_len.py new file mode 100644 index 0000000000..40bd1ca5fc --- /dev/null +++ b/tests/pytest/user/pass_len.py @@ -0,0 +1,63 @@ +################################################################### +# 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): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + print("==============step1") + try: + tdSql.execute("create user abc pass '123456'") + except Exception as e: + tdLog.exit(e) + print("create user abc pass '123456'") + + print("==============step2") + try: + tdSql.execute("alter user abc pass 'taosdata'") + except Exception as e: + tdLog.exit(e) + print("alter user abc pass 'taosdata'") + + print("==============step3") + try: + tdSql.execute("alter user abc pass ''") + except Exception as e: + print("alter user abc pass ''") + else: + tdLog.exit("Error: alert user abc pass''") + + print("==============step4") + try: + tdSql.execute("alter user abc pass null") + except Exception as e: + print("alter user abc pass null") + else: + tdLog.exit("Error: alter user abc pass null") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/user/user_create.py b/tests/pytest/user/user_create.py new file mode 100644 index 0000000000..f8ac5c6799 --- /dev/null +++ b/tests/pytest/user/user_create.py @@ -0,0 +1,54 @@ +################################################################### +# 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): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + print("==============step1") + try: + tdSql.execute("create user &abc PASS 'pass123'") + except Exception as e: + print(e) + + print("==============step2") + try: + tdSql.execute("create user a&bc PASS 'pass123'") + except Exception as e: + print(e) + + print("==============step3") + try: + tdSql.execute("create user '涛思' PASS 'pass123'") + except Exception as e: + print(e) + return + + tdLog.exit("create user with special character.") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 51eed3d25a..e492a35c20 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -69,7 +69,7 @@ class TDSimClient: self.cfg("numOfLogLines", "100000000") self.cfg("numOfThreadsPerCore", "2.0") self.cfg("locale", "en_US.UTF-8") - self.cfg("charset", "GBK") + self.cfg("charset", "UTF-8") self.cfg("asyncLog", "0") self.cfg("anyIp", "0") self.cfg("sdbDebugFlag", "135") @@ -205,24 +205,47 @@ class TDDnode: time.sleep(2) def stop(self): + if self.valgrind == 0: + toBeKilled = "taosd" + else: + toBeKilled = "valgrind.bin" + if self.running != 0: - cmd = "ps -ef|grep -w taosd | grep '%s' | grep -v grep | awk '{print $2}' && pkill -sigint taosd" % ( - self.cfgDir) - if os.system(cmd) != 0: - tdLog.exit(cmd) - tdLog.debug("dnode:%d is stopped by kill -SIGINT" % (self.index)) + killCmd = "ps -ef|grep -w %s| grep '%s' | grep -v grep | awk '{print $2}' | xargs kill -INT" % ( + toBeKilled, self.cfgDir) + + psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled + processID = subprocess.check_output(psCmd, shell=True) + + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdLog.debug("dnode:%d is stopped by kill -INT" % (self.index)) tdLog.debug( "wait 2 seconds for the dnode:%d to stop." % (self.index)) time.sleep(2) def forcestop(self): + if self.valgrind == 0: + toBeKilled = "taosd" + else: + toBeKilled = "valgrind.bin" + if self.running != 0: - cmd = "ps -ef|grep -w taosd | grep '%s' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd" % ( - self.cfgDir) - if os.system(cmd) != 0: - tdLog.exit(cmd) - tdLog.debug("dnode:%d is stopped by kill -9" % (self.index)) + killCmd = "ps -ef|grep -w %s| grep '%s' | grep -v grep | awk '{print $2}' | xargs kill -KILL" % ( + toBeKilled, self.cfgDir) + psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled + processID = subprocess.check_output(psCmd, shell=True) + + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + tdLog.debug("dnode:%d is stopped by kill -KILL" % (self.index)) tdLog.debug( "wait 2 seconds for the dnode:%d to stop." % (self.index)) @@ -268,8 +291,21 @@ class TDDnodes: self.dnodes.append(TDDnode(10)) def init(self, path): - cmd = "ps -ef|grep -w taosd | grep 'taosd' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd" - os.system(cmd) + killCmd = "ps -ef|grep -w taosd | grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + killCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) binPath = os.path.dirname(os.path.realpath(__file__)) binPath = binPath + "/../../../debug/" @@ -361,8 +397,22 @@ class TDDnodes: os.system(cmd) # if os.system(cmd) != 0 : # tdLog.exit(cmd) - cmd = "ps -ef | grep -w taosd | grep 'dnode' | grep -v grep | awk '{print $2}' && pkill -sigkill taosd" - os.system(cmd) + killCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w taosd| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + + killCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}' | xargs kill -KILL" + psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'" + processID = subprocess.check_output(psCmd, shell=True) + while(processID): + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + # if os.system(cmd) != 0 : # tdLog.exit(cmd) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index 73d99e2b6d..aa0fbf65b7 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -1,28 +1,26 @@ ################################# -run general/db/basic1.sim -run general/db/basic2.sim -run general/db/basic3.sim +run general/cache/new_metrics.sim +run general/compress/compress.sim +run general/compute/avg.sim +run general/compute/bottom.sim +run general/compute/count.sim +run general/db/len.sim run general/db/basic4.sim -run general/db/basic5.sim - -run general/table/basic1.sim -run general/table/basic2.sim +run general/http/restful_insert.sim +run general/import/basic.sim +run general/import/commit.sim +run general/insert/basic.sim +run general/insert/query_file_memory.sim +run general/parser/binary_escapeCharacter.sim +run general/parser/columnValue_bigint.sim +run general/parser/select_from_cache_disk.sim +run general/table/autocreate.sim run general/table/basic3.sim -run general/table/column_num.sim run general/table/column_name.sim -run general/table/bigint.sim -run general/table/bool.sim -run general/table/double.sim -run general/table/float.sim run general/table/int.sim -run general/table/smallint.sim -run general/table/tinyint.sim -run general/table/db.table.sim - +run general/table/vgroup.sim run general/user/basic1.sim -#run general/user/pass_alter.sim -run general/user/pass_len.sim -run general/user/user_create.sim +run general/user/pass_alter.sim run general/user/user_len.sim - +run general/vector/single.sim ################################## diff --git a/tests/script/general/agg/testSuite.sim b/tests/script/general/agg/testSuite.sim deleted file mode 100644 index 9aac0d7026..0000000000 --- a/tests/script/general/agg/testSuite.sim +++ /dev/null @@ -1,2 +0,0 @@ -run general/agg/fill.sim -run general/agg/stream.sim \ No newline at end of file diff --git a/tests/script/general/alter/cached_schema_after_alter.sim b/tests/script/general/alter/cached_schema_after_alter.sim index 52507b1992..921cfee3d1 100644 --- a/tests/script/general/alter/cached_schema_after_alter.sim +++ b/tests/script/general/alter/cached_schema_after_alter.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -117,3 +117,5 @@ endi if $data12 != 2 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/alter/count.sim b/tests/script/general/alter/count.sim index 1b77f997ac..a42fde74b7 100644 --- a/tests/script/general/alter/count.sim +++ b/tests/script/general/alter/count.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 @@ -264,3 +264,4 @@ if $data00 != 31 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/alter/import.sim b/tests/script/general/alter/import.sim index 7348cc919e..6129765513 100644 --- a/tests/script/general/alter/import.sim +++ b/tests/script/general/alter/import.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 @@ -47,3 +47,5 @@ sql select count(b) from tb if $data00 != 5 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/alter/insert1.sim b/tests/script/general/alter/insert1.sim index 0daa9c6432..4246bdc18e 100644 --- a/tests/script/general/alter/insert1.sim +++ b/tests/script/general/alter/insert1.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -20,25 +20,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi @@ -61,25 +61,25 @@ endi if $data02 != 0 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi @@ -95,25 +95,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -25 then @@ -122,22 +122,22 @@ endi if $data12 != 0 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != -22 then @@ -149,19 +149,19 @@ endi if $data23 != 0 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi @@ -177,25 +177,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -25 then @@ -204,22 +204,22 @@ endi if $data12 != 0 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != -22 then @@ -231,19 +231,19 @@ endi if $data23 != 0 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != -19 then @@ -258,16 +258,16 @@ endi if $data34 != 0 then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi @@ -291,25 +291,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -25 then @@ -318,22 +318,22 @@ endi if $data12 != 0 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != -22 then @@ -345,19 +345,19 @@ endi if $data23 != 0 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != -19 then @@ -372,16 +372,16 @@ endi if $data34 != 0 then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi if $data41 != -16 then @@ -399,13 +399,13 @@ endi if $data45 != 3 then return -1 endi -if $data46 != null then +if $data46 != NULL then return -1 endi -if $data47 != null then +if $data47 != NULL then return -1 endi -if $data48 != null then +if $data48 != NULL then return -1 endi @@ -421,25 +421,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -25 then @@ -448,22 +448,22 @@ endi if $data12 != 0 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != -22 then @@ -475,19 +475,19 @@ endi if $data23 != 0 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != -19 then @@ -502,16 +502,16 @@ endi if $data34 != 0 then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi if $data41 != -16 then @@ -529,13 +529,13 @@ endi if $data45 != 3 then return -1 endi -if $data46 != null then +if $data46 != NULL then return -1 endi -if $data47 != null then +if $data47 != NULL then return -1 endi -if $data48 != null then +if $data48 != NULL then return -1 endi if $data51 != -13 then @@ -556,10 +556,10 @@ endi if $data56 != 8.00000 then return -1 endi -if $data57 != null then +if $data57 != NULL then return -1 endi -if $data58 != null then +if $data58 != NULL then return -1 endi @@ -575,25 +575,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -25 then @@ -602,22 +602,22 @@ endi if $data12 != 0 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != -22 then @@ -629,19 +629,19 @@ endi if $data23 != 0 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != -19 then @@ -656,16 +656,16 @@ endi if $data34 != 0 then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi if $data41 != -16 then @@ -683,13 +683,13 @@ endi if $data45 != 3 then return -1 endi -if $data46 != null then +if $data46 != NULL then return -1 endi -if $data47 != null then +if $data47 != NULL then return -1 endi -if $data48 != null then +if $data48 != NULL then return -1 endi if $data51 != -13 then @@ -710,10 +710,10 @@ endi if $data56 != 8.00000 then return -1 endi -if $data57 != null then +if $data57 != NULL then return -1 endi -if $data58 != null then +if $data58 != NULL then return -1 endi if $data61 != -10 then @@ -737,7 +737,7 @@ endi if $data67 != 10.000000000 then return -1 endi -if $data68 != null then +if $data68 != NULL then return -1 endi @@ -753,25 +753,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -25 then @@ -780,22 +780,22 @@ endi if $data12 != 0 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != -22 then @@ -807,19 +807,19 @@ endi if $data23 != 0 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != -19 then @@ -834,16 +834,16 @@ endi if $data34 != 0 then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi if $data41 != -16 then @@ -861,13 +861,13 @@ endi if $data45 != 3 then return -1 endi -if $data46 != null then +if $data46 != NULL then return -1 endi -if $data47 != null then +if $data47 != NULL then return -1 endi -if $data48 != null then +if $data48 != NULL then return -1 endi if $data51 != -13 then @@ -888,10 +888,10 @@ endi if $data56 != 8.00000 then return -1 endi -if $data57 != null then +if $data57 != NULL then return -1 endi -if $data58 != null then +if $data58 != NULL then return -1 endi if $data61 != -10 then @@ -915,7 +915,7 @@ endi if $data67 != 10.000000000 then return -1 endi -if $data68 != null then +if $data68 != NULL then return -1 endi if $data71 != -7 then @@ -942,7 +942,7 @@ endi if $data78 != 11 then return -1 endi -if $data79 != null then +if $data79 != NULL then return -1 endi @@ -959,25 +959,25 @@ endi if $data01 != -28 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -25 then @@ -986,22 +986,22 @@ endi if $data12 != 0 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != -22 then @@ -1013,19 +1013,19 @@ endi if $data23 != 0 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != -19 then @@ -1040,16 +1040,16 @@ endi if $data34 != 0 then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi if $data41 != -16 then @@ -1067,13 +1067,13 @@ endi if $data45 != 3 then return -1 endi -if $data46 != null then +if $data46 != NULL then return -1 endi -if $data47 != null then +if $data47 != NULL then return -1 endi -if $data48 != null then +if $data48 != NULL then return -1 endi if $data51 != -13 then @@ -1094,10 +1094,10 @@ endi if $data56 != 8.00000 then return -1 endi -if $data57 != null then +if $data57 != NULL then return -1 endi -if $data58 != null then +if $data58 != NULL then return -1 endi if $data61 != -10 then @@ -1121,7 +1121,7 @@ endi if $data67 != 10.000000000 then return -1 endi -if $data68 != null then +if $data68 != NULL then return -1 endi if $data71 != -7 then @@ -1148,3 +1148,5 @@ endi if $data78 != 11 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/alter/insert2.sim b/tests/script/general/alter/insert2.sim index 34f935a04b..007060b7f0 100644 --- a/tests/script/general/alter/insert2.sim +++ b/tests/script/general/alter/insert2.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -74,7 +74,7 @@ endi if $data07 != 8 then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != 1 then @@ -98,7 +98,7 @@ endi if $data17 != 8 then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi @@ -129,10 +129,10 @@ endi if $data06 != 8 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != 2 then @@ -153,10 +153,10 @@ endi if $data16 != 8 then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != 1 then @@ -177,10 +177,10 @@ endi if $data26 != 8 then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi @@ -206,16 +206,16 @@ endi if $data04 != 0 then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != 3 then @@ -230,16 +230,16 @@ endi if $data14 != 8 then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != 2 then @@ -254,16 +254,16 @@ endi if $data24 != 8 then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != 1 then @@ -278,16 +278,16 @@ endi if $data34 != 8 then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi @@ -313,19 +313,19 @@ endi if $data03 != 5 then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data11 != -19 then @@ -337,19 +337,19 @@ endi if $data13 != 0 then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data21 != 3 then @@ -361,19 +361,19 @@ endi if $data23 != 8 then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != 2 then @@ -385,19 +385,19 @@ endi if $data33 != 8 then return -1 endi -if $data34 != null then +if $data34 != NULL then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi if $data41 != 1 then @@ -409,19 +409,19 @@ endi if $data43 != 8 then return -1 endi -if $data44 != null then +if $data44 != NULL then return -1 endi -if $data45 != null then +if $data45 != NULL then return -1 endi -if $data46 != null then +if $data46 != NULL then return -1 endi -if $data47 != null then +if $data47 != NULL then return -1 endi -if $data48 != null then +if $data48 != NULL then return -1 endi @@ -443,22 +443,22 @@ endi if $data12 != 5 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi -if $data08 != null then +if $data08 != NULL then return -1 endi if $data21 != -19 then @@ -467,22 +467,22 @@ endi if $data22 != 0 then return -1 endi -if $data23 != null then +if $data23 != NULL then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi if $data31 != 3 then @@ -491,22 +491,22 @@ endi if $data32 != 8 then return -1 endi -if $data33 != null then +if $data33 != NULL then return -1 endi -if $data34 != null then +if $data34 != NULL then return -1 endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data37 != null then +if $data37 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi if $data41 != 2 then @@ -515,22 +515,22 @@ endi if $data42 != 8 then return -1 endi -if $data43 != null then +if $data43 != NULL then return -1 endi -if $data44 != null then +if $data44 != NULL then return -1 endi -if $data45 != null then +if $data45 != NULL then return -1 endi -if $data46 != null then +if $data46 != NULL then return -1 endi -if $data47 != null then +if $data47 != NULL then return -1 endi -if $data48 != null then +if $data48 != NULL then return -1 endi if $data51 != 1 then @@ -539,19 +539,19 @@ endi if $data52 != 8 then return -1 endi -if $data53 != null then +if $data53 != NULL then return -1 endi -if $data54 != null then +if $data54 != NULL then return -1 endi -if $data55 != null then +if $data55 != NULL then return -1 endi -if $data57 != null then +if $data57 != NULL then return -1 endi -if $data58 != null then +if $data58 != NULL then return -1 endi @@ -568,52 +568,52 @@ print data01 = $data01 if $data01 != -10 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi if $data11 != -13 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi if $data21 != -16 then return -1 endi -if $data22 != null then +if $data22 != NULL then return -1 endi if $data31 != -19 then return -1 endi -if $data32 != null then +if $data32 != NULL then return -1 endi -if $data33 != null then +if $data33 != NULL then return -1 endi if $data41 != 3 then return -1 endi -if $data42 != null then +if $data42 != NULL then return -1 endi if $data51 != 2 then return -1 endi -if $data52 != null then +if $data52 != NULL then return -1 endi -if $data53 != null then +if $data53 != NULL then return -1 endi if $data61 != 1 then return -1 endi -if $data62 != null then +if $data62 != NULL then return -1 endi @@ -632,52 +632,53 @@ endi if $data01 != -10 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi if $data11 != -13 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi if $data21 != -16 then return -1 endi -if $data22 != null then +if $data22 != NULL then return -1 endi if $data31 != -19 then return -1 endi -if $data32 != null then +if $data32 != NULL then return -1 endi -if $data33 != null then +if $data33 != NULL then return -1 endi if $data41 != 3 then return -1 endi -if $data42 != null then +if $data42 != NULL then return -1 endi if $data51 != 2 then return -1 endi -if $data52 != null then +if $data52 != NULL then return -1 endi -if $data53 != null then +if $data53 != NULL then return -1 endi if $data61 != 1 then return -1 endi -if $data62 != null then +if $data62 != NULL 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/alter/metrics.sim b/tests/script/general/alter/metrics.sim index defe8d0fc1..b346b3b2c0 100644 --- a/tests/script/general/alter/metrics.sim +++ b/tests/script/general/alter/metrics.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -770,7 +770,7 @@ endi if $data21 != INT then return -1 endi -if $data30 != null then +if $data30 != NULL then return -1 endi @@ -781,3 +781,4 @@ if $rows != 0 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/alter/table.sim b/tests/script/general/alter/table.sim index 34630f4805..c6402b45f7 100644 --- a/tests/script/general/alter/table.sim +++ b/tests/script/general/alter/table.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -673,7 +673,7 @@ endi if $data11 != INT then return -1 endi -if $data20 != null then +if $data20 != NULL then return -1 endi @@ -684,3 +684,4 @@ if $rows != 0 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/alter/testSuite.sim b/tests/script/general/alter/testSuite.sim index 33a926f7b2..cfac68144c 100644 --- a/tests/script/general/alter/testSuite.sim +++ b/tests/script/general/alter/testSuite.sim @@ -1,5 +1,5 @@ -run general/alter/count.sim run general/alter/cached_schema_after_alter.sim +run general/alter/count.sim run general/alter/import.sim run general/alter/insert1.sim run general/alter/insert2.sim diff --git a/tests/script/general/cache/new_metrics.sim b/tests/script/general/cache/new_metrics.sim index 18335b6095..64170ec67e 100644 --- a/tests/script/general/cache/new_metrics.sim +++ b/tests/script/general/cache/new_metrics.sim @@ -2,9 +2,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 10 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 10 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -141,6 +140,4 @@ if $data04 != 10 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/cache/restart_metrics.sim b/tests/script/general/cache/restart_metrics.sim index 67d02722e2..dbd15b945f 100644 --- a/tests/script/general/cache/restart_metrics.sim +++ b/tests/script/general/cache/restart_metrics.sim @@ -2,9 +2,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 10 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 10 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -48,9 +47,8 @@ endi print =============== step2 system sh/exec.sh -n dnode1 -s stop system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 10 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 10 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 system sh/exec.sh -n dnode1 -s start print =============== step3 @@ -85,3 +83,4 @@ if $data02 != 3 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/cache/restart_table.sim b/tests/script/general/cache/restart_table.sim index c973293fdc..4e8bc92c10 100644 --- a/tests/script/general/cache/restart_table.sim +++ b/tests/script/general/cache/restart_table.sim @@ -2,9 +2,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 10 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 10 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -36,9 +35,8 @@ endi print =============== step2 system sh/exec.sh -n dnode1 -s stop system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 10 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 10 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 system sh/exec.sh -n dnode1 -s start print =============== step3 @@ -58,4 +56,4 @@ if $data01 != 1 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/cache/testSuite.sim b/tests/script/general/cache/testSuite.sim index 1265a1060e..f09ece89b6 100644 --- a/tests/script/general/cache/testSuite.sim +++ b/tests/script/general/cache/testSuite.sim @@ -1,5 +1,3 @@ +run general/cache/new_metrics.sim run general/cache/restart_table.sim run general/cache/restart_metrics.sim -run general/cache/restart_stream.sim -run general/cache/new_metrics.sim -run general/cache/new_stream.sim diff --git a/tests/script/general/column/commit.sim b/tests/script/general/column/commit.sim index 3a46cc73e8..7bc62619f3 100644 --- a/tests/script/general/column/commit.sim +++ b/tests/script/general/column/commit.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -151,4 +151,6 @@ if $data08 != 10 then endi if $data09 != 10 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/column/metrics.sim b/tests/script/general/column/metrics.sim index 119ab0108c..401a4ae54e 100644 --- a/tests/script/general/column/metrics.sim +++ b/tests/script/general/column/metrics.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -215,3 +215,5 @@ endi if $data09 != 20 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/column/table.sim b/tests/script/general/column/table.sim index e4f3bea466..8e9c44fc46 100644 --- a/tests/script/general/column/table.sim +++ b/tests/script/general/column/table.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -211,3 +211,5 @@ endi if $data07 != 2.872281323 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/column/testSuite.sim b/tests/script/general/column/testSuite.sim index 64eba8cc7e..f60d197e95 100644 --- a/tests/script/general/column/testSuite.sim +++ b/tests/script/general/column/testSuite.sim @@ -1,4 +1,3 @@ -run lite/column/table.sim -run lite/column/metrics.sim -run lite/column/stream.sim -run lite/column/commit.sim +run general/column/commit.sim +run general/column/metrics.sim +run general/column/table.sim diff --git a/tests/script/general/compress/commitlog.sim b/tests/script/general/compress/commitlog.sim index fdadfdac73..2c69b809d1 100644 --- a/tests/script/general/compress/commitlog.sim +++ b/tests/script/general/compress/commitlog.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 1 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 1024 -system sh/cfg.sh -n dnode1 -c compression -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c comp -v 1 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -89,9 +87,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 20000 +sleep 5000 system sh/exec.sh -n dnode1 -s start -sleep 10000 +sleep 3000 print =============== step5 @@ -125,4 +123,4 @@ if $rows != $N 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/compress/compress.sim b/tests/script/general/compress/compress.sim index 2d222ecbbe..bc56227c74 100644 --- a/tests/script/general/compress/compress.sim +++ b/tests/script/general/compress/compress.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 1024 -system sh/cfg.sh -n dnode1 -c compression -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c comp -v 1 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -84,9 +82,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 10000 +sleep 5000 system sh/exec.sh -n dnode1 -s start -sleep 10000 +sleep 3000 print =============== step5 @@ -120,4 +118,4 @@ if $rows != $N 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/compress/compress2.sim b/tests/script/general/compress/compress2.sim index 096875176e..c3b445c04c 100644 --- a/tests/script/general/compress/compress2.sim +++ b/tests/script/general/compress/compress2.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 1024 -system sh/cfg.sh -n dnode1 -c compression -v 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c comp -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -84,9 +82,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 10000 +sleep 5000 system sh/exec.sh -n dnode1 -s start -sleep 10000 +sleep 3000 print =============== step5 @@ -120,4 +118,4 @@ if $rows != $N 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/compress/testSuite.sim b/tests/script/general/compress/testSuite.sim index 97c76aec15..3573985c8a 100644 --- a/tests/script/general/compress/testSuite.sim +++ b/tests/script/general/compress/testSuite.sim @@ -1,4 +1,4 @@ -run general/compress/compress.sim -run general/compress/uncompress.sim run general/compress/commitlog.sim run general/compress/compress2.sim +run general/compress/compress.sim +run general/compress/uncompress.sim diff --git a/tests/script/general/compress/uncompress.sim b/tests/script/general/compress/uncompress.sim index a26627d5e3..8dde7fae34 100644 --- a/tests/script/general/compress/uncompress.sim +++ b/tests/script/general/compress/uncompress.sim @@ -1,10 +1,7 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 1024 -system sh/cfg.sh -n dnode1 -c compression -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c comp -v 1 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -84,9 +81,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 10000 +sleep 5000 system sh/exec.sh -n dnode1 -s start -sleep 10000 +sleep 3000 print =============== step5 @@ -120,4 +117,4 @@ if $rows != $N 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/compute/avg.sim b/tests/script/general/compute/avg.sim index ccc996dccb..9a37363a60 100644 --- a/tests/script/general/compute/avg.sim +++ b/tests/script/general/compute/avg.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -153,4 +153,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/bottom.sim b/tests/script/general/compute/bottom.sim index 988ce74a03..592f87651e 100644 --- a/tests/script/general/compute/bottom.sim +++ b/tests/script/general/compute/bottom.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -94,4 +94,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/count.sim b/tests/script/general/compute/count.sim index e2c352ffd4..aef30c8b6c 100644 --- a/tests/script/general/compute/count.sim +++ b/tests/script/general/compute/count.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -169,4 +169,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/diff.sim b/tests/script/general/compute/diff.sim index bc5799db18..8a60cd00bc 100644 --- a/tests/script/general/compute/diff.sim +++ b/tests/script/general/compute/diff.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -86,4 +86,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/diff2.sim b/tests/script/general/compute/diff2.sim index ecd0666198..53b508ca6f 100644 --- a/tests/script/general/compute/diff2.sim +++ b/tests/script/general/compute/diff2.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -153,3 +153,5 @@ print =============== clear #if $rows != 0 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/compute/first.sim b/tests/script/general/compute/first.sim index 947fcf5444..80f4f53cdb 100644 --- a/tests/script/general/compute/first.sim +++ b/tests/script/general/compute/first.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -155,4 +155,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/interval.sim b/tests/script/general/compute/interval.sim index d4052a47a1..26f40eda5a 100644 --- a/tests/script/general/compute/interval.sim +++ b/tests/script/general/compute/interval.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -171,4 +171,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/last.sim b/tests/script/general/compute/last.sim index ffd4368949..0e92bb6d45 100644 --- a/tests/script/general/compute/last.sim +++ b/tests/script/general/compute/last.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -154,4 +154,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/leastsquare.sim b/tests/script/general/compute/leastsquare.sim index ccd6be0109..bbadd849cb 100644 --- a/tests/script/general/compute/leastsquare.sim +++ b/tests/script/general/compute/leastsquare.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -96,3 +96,5 @@ sql show databases if $rows != 0 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/compute/max.sim b/tests/script/general/compute/max.sim index d7f80bfef0..4fc760d66d 100644 --- a/tests/script/general/compute/max.sim +++ b/tests/script/general/compute/max.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -154,4 +154,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/min.sim b/tests/script/general/compute/min.sim index 3c123ca967..82a22b642e 100644 --- a/tests/script/general/compute/min.sim +++ b/tests/script/general/compute/min.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -155,4 +155,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/null.sim b/tests/script/general/compute/null.sim index 784f9ba094..cde95ca77f 100644 --- a/tests/script/general/compute/null.sim +++ b/tests/script/general/compute/null.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -51,7 +51,7 @@ $tb = $tbPrefix . $i sql select * from $tb print $data00 $data01 $data02 -if $data01 != null then +if $data01 != NULL then return -1 endi if $data02 != 0 then @@ -165,7 +165,7 @@ sql select * from t2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -173,7 +173,7 @@ sql select * from t3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -181,7 +181,7 @@ sql select * from t4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -189,7 +189,7 @@ sql select * from t5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -197,7 +197,7 @@ sql select * from t6 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -205,7 +205,7 @@ sql select * from t7 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -213,7 +213,7 @@ endi #if $rows != 1 then # return -1 #endi -#if $data01 != null then +#if $data01 != NULL then # return -1 #endi @@ -222,4 +222,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/percentile.sim b/tests/script/general/compute/percentile.sim index 8a4086dd24..dd309c3789 100644 --- a/tests/script/general/compute/percentile.sim +++ b/tests/script/general/compute/percentile.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -112,3 +112,5 @@ sql show databases if $rows != 0 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/compute/stddev.sim b/tests/script/general/compute/stddev.sim index 53a1b9bc01..7cea8726a9 100644 --- a/tests/script/general/compute/stddev.sim +++ b/tests/script/general/compute/stddev.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -93,4 +93,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/sum.sim b/tests/script/general/compute/sum.sim index 4e4e75bfe4..d05fe8930e 100644 --- a/tests/script/general/compute/sum.sim +++ b/tests/script/general/compute/sum.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -154,4 +154,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/compute/testSuite.sim b/tests/script/general/compute/testSuite.sim index 5539e08a9d..6cd6badaee 100644 --- a/tests/script/general/compute/testSuite.sim +++ b/tests/script/general/compute/testSuite.sim @@ -1,16 +1,16 @@ -run general/compute/count.sim run general/compute/avg.sim -run general/compute/sum.sim -run general/compute/min.sim -run general/compute/max.sim -run general/compute/first.sim -run general/compute/last.sim -run general/compute/stddev.sim -run general/compute/leastsquare.sim -run general/compute/top.sim run general/compute/bottom.sim -run general/compute/percentile.sim +run general/compute/count.sim run general/compute/diff.sim -run general/compute/interval.sim -run general/compute/null.sim run general/compute/diff2.sim +run general/compute/first.sim +run general/compute/interval.sim +run general/compute/last.sim +run general/compute/leastsquare.sim +run general/compute/max.sim +run general/compute/min.sim +run general/compute/null.sim +run general/compute/percentile.sim +run general/compute/stddev.sim +run general/compute/sum.sim +run general/compute/top.sim diff --git a/tests/script/general/compute/top.sim b/tests/script/general/compute/top.sim index 54d7699f27..14b3b328a0 100644 --- a/tests/script/general/compute/top.sim +++ b/tests/script/general/compute/top.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -94,4 +94,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/back_insert.sim b/tests/script/general/db/back_insert.sim index 43831cca95..642df63ff2 100644 --- a/tests/script/general/db/back_insert.sim +++ b/tests/script/general/db/back_insert.sim @@ -1,6 +1,8 @@ sql connect $x = 1 begin: + sql reset query cache + sleep 1000 sql insert into db.tb values(now, $x ) -x begin #print ===> insert successed $x $x = $x + 1 diff --git a/tests/script/general/db/backup/keep.sim b/tests/script/general/db/backup/keep.sim index fed45ead92..4899acdd21 100644 --- a/tests/script/general/db/backup/keep.sim +++ b/tests/script/general/db/backup/keep.sim @@ -6,9 +6,9 @@ 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 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 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 dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 diff --git a/tests/script/general/db/basic.sim b/tests/script/general/db/basic.sim index 9d56e1c5fb..43b18abd32 100644 --- a/tests/script/general/db/basic.sim +++ b/tests/script/general/db/basic.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +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 tables -v 1000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 system sh/exec.sh -n dnode1 -s start @@ -202,3 +200,5 @@ sql show databases if $rows != 0 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/basic1.sim b/tests/script/general/db/basic1.sim index 1fa6678ef8..302c5ac409 100644 --- a/tests/script/general/db/basic1.sim +++ b/tests/script/general/db/basic1.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database @@ -56,4 +57,6 @@ endi if $data03 != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/basic2.sim b/tests/script/general/db/basic2.sim index 945481d9bf..afe5ee5d95 100644 --- a/tests/script/general/db/basic2.sim +++ b/tests/script/general/db/basic2.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database d1 @@ -49,3 +50,5 @@ sql show tables if $rows != 3 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/basic3.sim b/tests/script/general/db/basic3.sim index 00e3e9d106..88f5bf6460 100644 --- a/tests/script/general/db/basic3.sim +++ b/tests/script/general/db/basic3.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database d1 @@ -47,3 +48,5 @@ sql show d2.tables if $rows != 3 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/basic4.sim b/tests/script/general/db/basic4.sim index 9f8d463a7d..8494b0358a 100644 --- a/tests/script/general/db/basic4.sim +++ b/tests/script/general/db/basic4.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database d1 @@ -116,3 +117,5 @@ sql show d1.vgroups if $rows != 0 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/basic5.sim b/tests/script/general/db/basic5.sim index 09ace39bf4..3c59144387 100644 --- a/tests/script/general/db/basic5.sim +++ b/tests/script/general/db/basic5.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database d1 @@ -55,3 +56,5 @@ if $rows != 0 then endi sql_error show d1.vgroups + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/delete_reuse1.sim b/tests/script/general/db/delete_reuse1.sim index 6e21aabb3c..1e4baeb576 100644 --- a/tests/script/general/db/delete_reuse1.sim +++ b/tests/script/general/db/delete_reuse1.sim @@ -1,18 +1,14 @@ system sh/stop_dnodes.sh - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c 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 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 numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -78,6 +74,8 @@ sql insert into d1.t1 values(now, 2) -x step2 step2: print ========= step3 +sql reset query cache +sleep 1000 sql create database d1 replica 1 sql create table d1.t1 (ts timestamp, i int) sql insert into d1.t1 values(now, 2) @@ -97,6 +95,8 @@ while $x < 20 step4: sql create database d1 replica 1 + sql reset query cache + sleep 1000 sql create table d1.t1 (ts timestamp, i int) sql insert into d1.t1 values(now, $x ) sql select * from d1.t1 @@ -108,3 +108,5 @@ while $x < 20 print ===> loop times: $x endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/delete_reuse2.sim b/tests/script/general/db/delete_reuse2.sim index 95aa3f9526..0117d87104 100644 --- a/tests/script/general/db/delete_reuse2.sim +++ b/tests/script/general/db/delete_reuse2.sim @@ -1,18 +1,14 @@ system sh/stop_dnodes.sh - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c 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 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 numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -79,6 +75,8 @@ step2: print ========= step3 sql create database db1 replica 1 +sql reset query cache +sleep 1000 sql create table db1.tb1 (ts timestamp, i int) sql insert into db1.tb1 values(now, 2) sql select * from db1.tb1 @@ -104,6 +102,9 @@ while $x < 20 $db = db . $x $tb = tb . $x + sql reset query cache + sleep 1000 + sql create database $db replica 1 sql use $db sql create table $tb (ts timestamp, i int) @@ -115,3 +116,5 @@ while $x < 20 print ===> loop times: $x endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/delete_reusevnode.sim b/tests/script/general/db/delete_reusevnode.sim index 2204e7434f..c76a2e8bc7 100644 --- a/tests/script/general/db/delete_reusevnode.sim +++ b/tests/script/general/db/delete_reusevnode.sim @@ -5,19 +5,17 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 10 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode2 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode3 -c cacheBlockSize -v 200 print ========= start dnodes system sh/exec.sh -n dnode1 -s start sleep 3000 +sql connect print ======== step1 $tbPrefix = t $i = 0 -while $i < 1000 +while $i < 30 $db = db . $i sql create database $db sql use $db @@ -37,38 +35,32 @@ endw print ======== step2 sleep 1000 -sql drop database $db sql show databases if $rows != 0 then return -1 endi - system sh/stop_dnodes.sh +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 - system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 10 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode2 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode3 -c cacheBlockSize -v 200 - print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sql connect print ======== step1 $tbPrefix = t $i = 0 -while $i < 1000 +while $i < 10 $db = db . $i - sql create database $db tables 4 + sql create database $db maxTables 4 sql use $db - sql create table st (ts timesetamp, i int) tags(j int); + sql create table st (ts timestamp, i int) tags(j int); $tb = $tbPrefix . $i $tb = $tb . a @@ -114,8 +106,9 @@ endw print ======== step2 sleep 1000 -sql drop database $db sql show databases if $rows != 0 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/delete_reusevnode2.sim b/tests/script/general/db/delete_reusevnode2.sim index dcf74a287d..ff9361260c 100644 --- a/tests/script/general/db/delete_reusevnode2.sim +++ b/tests/script/general/db/delete_reusevnode2.sim @@ -1,30 +1,22 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 - system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 10 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode2 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode3 -c cacheBlockSize -v 200 print ========= start dnodes system sh/exec.sh -n dnode1 -s start - sleep 3000 +sql connect print ======== step1 - -sql create database db tables 4; +sql create database db maxTables 4; sql use db - $tbPrefix = t $i = 0 -while $i < 1000 - +while $i < 10 sql create table st (ts timestamp, i int) tags(j int); $tb = $tbPrefix . $i @@ -42,7 +34,7 @@ while $i < 1000 sql create table $tb1 using st tags(1) sql insert into $tb1 values(now, 1); - $tb1 = $tb . 5 + $tb1 = $tb . 4 sql create table $tb1 using st tags(1) sql insert into $tb1 values(now, 1); @@ -64,7 +56,7 @@ while $i < 1000 sql drop table st - sleep 1000 + sleep 2000 print times $i $i = $i + 1 @@ -77,3 +69,5 @@ sql show databases if $rows != 0 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/delete_writing1.sim b/tests/script/general/db/delete_writing1.sim index a4be57782e..58fe68dd5f 100644 --- a/tests/script/general/db/delete_writing1.sim +++ b/tests/script/general/db/delete_writing1.sim @@ -1,18 +1,14 @@ system sh/stop_dnodes.sh - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c 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 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 numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -39,7 +35,7 @@ sql create table db.tb (ts timestamp, i int) sql insert into db.tb values(now, 1) print ======== start back -run_back lite/db/back_insert.sim +run_back general/db/back_insert.sim sleep 1000 print ======== step1 @@ -57,3 +53,5 @@ while $x < 20 $x = $x + 1 endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/delete_writing2.sim b/tests/script/general/db/delete_writing2.sim index 75603dcdd8..00383d1341 100644 --- a/tests/script/general/db/delete_writing2.sim +++ b/tests/script/general/db/delete_writing2.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 print ========= start dnodes @@ -27,7 +26,7 @@ sql create table db4.tb4 (ts timestamp, i int) sql insert into db4.tb4 values(now, 1) print ======== start back -run_back lite/db/back_insert.sim +run_back general/db/back_insert.sim sleep 1000 print ======== step1 @@ -45,3 +44,5 @@ while $x < 10 $x = $x + 1 endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/len.sim b/tests/script/general/db/len.sim index 1cee902c1a..8add486658 100644 --- a/tests/script/general/db/len.sim +++ b/tests/script/general/db/len.sim @@ -2,9 +2,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +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 sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -91,4 +91,6 @@ step8: sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/repeat.sim b/tests/script/general/db/repeat.sim index 7afa42f0c4..ca68e6d883 100644 --- a/tests/script/general/db/repeat.sim +++ b/tests/script/general/db/repeat.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +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 tables -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start @@ -69,3 +67,5 @@ sql drop database d9 sql drop database d10 sql drop database d11 sql drop database d12 + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/tables.sim b/tests/script/general/db/tables.sim index afa11d6542..bf714dbf56 100644 --- a/tests/script/general/db/tables.sim +++ b/tests/script/general/db/tables.sim @@ -1,17 +1,16 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +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 sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print =============== step2 -sql create database db tables 2 +sql create database db maxtables 4 sql show databases print $rows $data07 @@ -19,7 +18,7 @@ if $rows != 1 then return -1 endi -if $data07 != 2 then +if $data07 != 4 then return -1 endi @@ -30,9 +29,17 @@ sql create table t2 (ts timestamp, i int) sql create table t3 (ts timestamp, i int) sql create table t4 (ts timestamp, i int) sql create table t11 (ts timestamp, i int) +sql create table t12 (ts timestamp, i int) +sql create table t13 (ts timestamp, i int) +sql create table t14 (ts timestamp, i int) +sql create table t21 (ts timestamp, i int) sql create table t22 (ts timestamp, i int) +sql create table t23 (ts timestamp, i int) +sql create table t24 (ts timestamp, i int) +sql create table t31 (ts timestamp, i int) +sql create table t32 (ts timestamp, i int) sql create table t33 (ts timestamp, i int) -sql create table t44 (ts timestamp, i int) +sql create table t34 (ts timestamp, i int) print =============== step4 sql insert into t1 values(now, 1) @@ -42,7 +49,7 @@ sql insert into t4 values(now, 4) sql insert into t11 values(now, 1) sql insert into t22 values(now, 2) sql insert into t33 values(now, 3) -sql insert into t44 values(now, 4) +sql insert into t34 values(now, 4) print =============== step5 sql select * from t1 @@ -68,10 +75,10 @@ endi print =============== step6 sql drop database db sql reset query cache -sleep 20000 +sleep 4000 print =============== step7 -sql create database db tables 2 +sql create database db maxtables 4 sql show databases print $rows $data07 @@ -79,7 +86,7 @@ if $rows != 1 then return -1 endi -if $data07 != 2 then +if $data07 != 4 then return -1 endi @@ -90,9 +97,17 @@ sql create table t2 (ts timestamp, i int) sql create table t3 (ts timestamp, i int) sql create table t4 (ts timestamp, i int) sql create table t11 (ts timestamp, i int) +sql create table t12 (ts timestamp, i int) +sql create table t13 (ts timestamp, i int) +sql create table t14 (ts timestamp, i int) +sql create table t21 (ts timestamp, i int) sql create table t22 (ts timestamp, i int) +sql create table t23 (ts timestamp, i int) +sql create table t24 (ts timestamp, i int) +sql create table t31 (ts timestamp, i int) +sql create table t32 (ts timestamp, i int) sql create table t33 (ts timestamp, i int) -sql create table t44 (ts timestamp, i int) +sql create table t34 (ts timestamp, i int) print =============== step9 sql insert into t1 values(now, 1) @@ -102,7 +117,7 @@ sql insert into t4 values(now, 4) sql insert into t11 values(now, 1) sql insert into t22 values(now, 2) sql insert into t33 values(now, 3) -sql insert into t44 values(now, 4) +sql insert into t34 values(now, 4) print =============== step10 sql select * from t1 @@ -123,4 +138,6 @@ endi sql select * from t4 if $data01 != 4 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/db/testSuite.sim b/tests/script/general/db/testSuite.sim index 3c63864e6f..2cac8b8fa8 100644 --- a/tests/script/general/db/testSuite.sim +++ b/tests/script/general/db/testSuite.sim @@ -1,12 +1,15 @@ +run general//db/basic.sim run general/db/basic1.sim run general/db/basic2.sim run general/db/basic3.sim run general/db/basic4.sim run general/db/basic5.sim -#run general//db/tables.sim -#run general//db/basic.sim -#run general//db/len.sim -#run general//db/delete_reuse1.sim -#run general//db/delete_reuse2.sim -#run general//db/delete_writing1.sim -#run general//db/delete_writing2.sim +run general/db/delete_reuse1.sim +run general/db/delete_reuse2.sim +run general/db/delete_reusevnode.sim +run general/db/delete_reusevnode2.sim +run general/db/delete_writing1.sim +run general/db/delete_writing2.sim +run general/db/len.sim +run general/db/repeat.sim +run general/db/tables.sim diff --git a/tests/script/general/field/2.sim b/tests/script/general/field/2.sim index d5a002932e..28506b7cb8 100644 --- a/tests/script/general/field/2.sim +++ b/tests/script/general/field/2.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_bt_db -$tbPrefix = fi_bt_tb -$mtPrefix = fi_bt_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -233,6 +231,8 @@ if $data00 != 100 then return -1 endi +print sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 + sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol2 = 1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 if $data00 != 100 then @@ -292,4 +292,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/3.sim b/tests/script/general/field/3.sim index ed4df854ad..453f4968bf 100644 --- a/tests/script/general/field/3.sim +++ b/tests/script/general/field/3.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_3_db -$tbPrefix = fi_3_tb -$mtPrefix = fi_3_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = mt $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -518,4 +516,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/4.sim b/tests/script/general/field/4.sim index 465df43f04..243424724f 100644 --- a/tests/script/general/field/4.sim +++ b/tests/script/general/field/4.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_4_db -$tbPrefix = fi_4_tb -$mtPrefix = fi_4_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -708,4 +706,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/5.sim b/tests/script/general/field/5.sim index e1e3d9a54a..ca1543b54b 100644 --- a/tests/script/general/field/5.sim +++ b/tests/script/general/field/5.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_5_db -$tbPrefix = fi_5_tb -$mtPrefix = fi_5_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -831,4 +829,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/6.sim b/tests/script/general/field/6.sim index 72e4b5bf4c..23223e5c15 100644 --- a/tests/script/general/field/6.sim +++ b/tests/script/general/field/6.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_6_db -$tbPrefix = fi_6_tb -$mtPrefix = fi_6_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -986,4 +984,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/bigint.sim b/tests/script/general/field/bigint.sim index 2adde6cd3d..5cca73595c 100644 --- a/tests/script/general/field/bigint.sim +++ b/tests/script/general/field/bigint.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_bi_db -$tbPrefix = fi_bi_tb -$mtPrefix = fi_bi_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -157,4 +155,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/binary.sim b/tests/script/general/field/binary.sim index 1e1a3682b1..8bf1c84b93 100644 --- a/tests/script/general/field/binary.sim +++ b/tests/script/general/field/binary.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_by_db -$tbPrefix = fi_by_tb -$mtPrefix = fi_by_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -81,4 +79,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/bool.sim b/tests/script/general/field/bool.sim index 41770a399d..4528f79bc7 100644 --- a/tests/script/general/field/bool.sim +++ b/tests/script/general/field/bool.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_bo_db -$tbPrefix = fi_bo_tb -$mtPrefix = fi_bo_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -158,4 +156,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/double.sim b/tests/script/general/field/double.sim index bf3aa923fd..40650cb9bd 100644 --- a/tests/script/general/field/double.sim +++ b/tests/script/general/field/double.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_do_db -$tbPrefix = fi_do_tb -$mtPrefix = fi_do_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -157,4 +155,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/float.sim b/tests/script/general/field/float.sim index 8e8c3740a8..0ead9fb48a 100644 --- a/tests/script/general/field/float.sim +++ b/tests/script/general/field/float.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_fl_db -$tbPrefix = fi_fl_tb -$mtPrefix = fi_fl_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -157,4 +155,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/int.sim b/tests/script/general/field/int.sim index a4778279a1..a095dc2176 100644 --- a/tests/script/general/field/int.sim +++ b/tests/script/general/field/int.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_in_db -$tbPrefix = fi_in_tb -$mtPrefix = fi_in_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -157,4 +155,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/single.sim b/tests/script/general/field/single.sim index 17492123ed..8540608e96 100644 --- a/tests/script/general/field/single.sim +++ b/tests/script/general/field/single.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_si_db -$tbPrefix = fi_si_tb -$mtPrefix = fi_si_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $rowNum = 20 print =============== step1 @@ -215,4 +213,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/smallint.sim b/tests/script/general/field/smallint.sim index 7b6ea2ce79..578de4ea44 100644 --- a/tests/script/general/field/smallint.sim +++ b/tests/script/general/field/smallint.sim @@ -1,17 +1,15 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect print ======================== dnode1 start -$dbPrefix = fi_sm_db -$tbPrefix = fi_sm_tb -$mtPrefix = fi_sm_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -157,4 +155,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/field/testSuite.sim b/tests/script/general/field/testSuite.sim index 9b58c77e92..d12f0ebbd4 100644 --- a/tests/script/general/field/testSuite.sim +++ b/tests/script/general/field/testSuite.sim @@ -1,4 +1,4 @@ -run general/field/single.sim +# run general/field/single.sim run general/field/bool.sim run general/field/smallint.sim run general/field/tinyint.sim @@ -6,9 +6,9 @@ run general/field/int.sim run general/field/bigint.sim run general/field/float.sim run general/field/double.sim -run general/field/binary.sim -run general/field/2.sim -run general/field/3.sim -run general/field/4.sim -run general/field/5.sim -run general/field/6.sim \ No newline at end of file +# run general/field/binary.sim +# run general/field/2.sim +# run general/field/3.sim +# run general/field/4.sim +# run general/field/5.sim +# run general/field/6.sim diff --git a/tests/script/general/field/tinyint.sim b/tests/script/general/field/tinyint.sim index fe6e14f04a..f132b42702 100644 --- a/tests/script/general/field/tinyint.sim +++ b/tests/script/general/field/tinyint.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -10,9 +8,9 @@ sql connect print ======================== dnode1 start -$dbPrefix = fi_ti_db -$tbPrefix = fi_ti_tb -$mtPrefix = fi_ti_mt +$dbPrefix = db +$tbPrefix = tb +$mtPrefix = st $tbNum = 10 $rowNum = 20 $totalNum = 200 @@ -158,4 +156,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/grafana.sim b/tests/script/general/http/grafana.sim index 4f83accf2d..a5cc7b3237 100644 --- a/tests/script/general/http/grafana.sim +++ b/tests/script/general/http/grafana.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 #system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec.sh -n dnode1 -s start @@ -54,50 +52,50 @@ sql insert into t3 values('2017-12-25 21:27:41', 3) print =============== step2 - login -system_content curl 192.168.0.1:6020/grafana/ +system_content curl 127.0.0.1:6020/grafana/ print 1-> $system_content if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 192.168.0.1:6020/grafana/xx +system_content curl 127.0.0.1:6020/grafana/xx print 2-> $system_content if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then return -1 endi -system_content curl 192.168.0.1:6020/grafana/login/xx/xx/ +system_content curl 127.0.0.1:6020/grafana/login/xx/xx/ print 3-> $system_content -if $system_content != @{"status":"error","code":35,"desc":"invalid user name"}@ then +if $system_content != @{"status":"error","code":1000,"desc":"invalid user"}@ then return -1 endi -system_content curl 192.168.0.1:6020/grafana/root/1/123/1/1/3 +system_content curl 127.0.0.1:6020/grafana/root/1/123/1/1/3 print 4-> $system_content if $system_content != @{"status":"error","code":1011,"desc":"no auth info input"}@ then return -1 endi -system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 192.168.0.1:6020/grafana/login/1/root/1/ +system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/grafana/login/1/root/1/ print 5-> $system_content -if $system_content != @{"status":"error","code":35,"desc":"invalid user name"}@ then +if $system_content != @{"status":"error","code":1000,"desc":"invalid user"}@ then return -1 endi -system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 192.168.0.1:6020/grafana/root/1/login +system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login print 6-> $system_content if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then return -1 endi -system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 192.168.0.1:6020/grafana/root/1/login +system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login print 7-> $system_content if $system_content != @{"status":"error","code":1010,"desc":"invalid type of Authorization"}@ then return -1 endi sleep 3000 -system_content curl 192.168.0.1:6020/grafana/login/root/taosdata +system_content curl 127.0.0.1:6020/grafana/login/root/taosdata print 8-> $system_content if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then return -1 @@ -180,3 +178,5 @@ print 19-> $system_content if $system_content != @[{"refId":"A","target":"3","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"15.299999714","datapoints":[[3,"-"]]}]@ 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/http/grafana_bug.sim b/tests/script/general/http/grafana_bug.sim index ac6de5cb31..708af23cfc 100644 --- a/tests/script/general/http/grafana_bug.sim +++ b/tests/script/general/http/grafana_bug.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 2000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 #system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec.sh -n dnode1 -s start @@ -37,7 +35,7 @@ print =============== step1 - one query, 1 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"A","datapoints":[["-",1577980800000],["-",1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 endi @@ -53,32 +51,32 @@ print =============== step3 - one query, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step3.1-> $system_content -if $system_content != @[{"refId":"A","target":"13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb "} ]' 127.0.0.1:6020/grafana/query print step3.2-> $system_content -if $system_content != @[{"refId":"A","target":"11","datapoints":[[1,1577808000000]]},{"refId":"A","target":"12","datapoints":[[1,1577894400000]]},{"refId":"A","target":"13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:11,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query print step3.3-> $system_content -if $system_content != @[{"refId":"A","target":"1","datapoints":[[11,1577808000000],[12,1577894400000]]},{"refId":"A","target":"2","datapoints":[[13,1577980800000],[14,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val:1,}","datapoints":[[11,1577808000000],[12,1577894400000]]},{"refId":"A","target":"{val:2,}","datapoints":[[13,1577980800000],[14,1578067200000]]}]@ then return -1 endi print =============== step4 - one query, 4 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val2,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query print step4.1-> $system_content -if $system_content != @[{"refId":"A","target":"1","datapoints":[[21,1577808000000],[22,1577894400000]]},{"refId":"A","target":"2","datapoints":[[23,1577980800000],[24,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:11,, val:1,}","datapoints":[[21,1577808000000]]},{"refId":"A","target":"{val1:12,, val:1,}","datapoints":[[22,1577894400000]]},{"refId":"A","target":"{val1:13,, val:2,}","datapoints":[[23,1577980800000]]},{"refId":"A","target":"{val1:14,, val:2,}","datapoints":[[24,1578067200000]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1,val2 from db.tb "} ]' 127.0.0.1:6020/grafana/query print step4.2-> $system_content -if $system_content != @[{"refId":"A","target":"21","datapoints":[[1,1577808000000]]},{"refId":"A","target":"22","datapoints":[[1,1577894400000]]},{"refId":"A","target":"23","datapoints":[[2,1577980800000]]},{"refId":"A","target":"24","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"A","target":"{val1:11,, val2:21,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,, val2:22,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,, val2:23,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,, val2:24,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi @@ -92,20 +90,20 @@ endi print =============== step6 - one query, 2 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"23","datapoints":[[13,"-"]]},{"refId":"A","target":"24","datapoints":[[14,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{val2:23,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,}","datapoints":[[14,"-"]]}]@ then return -1 endi print =============== step7 - one query, 3 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"2","datapoints":[[13,"-"],[14,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then return -1 endi system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb"} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"A","target":"1","datapoints":[[11,"-"],[12,"-"]]},{"refId":"A","target":"2","datapoints":[[13,"-"],[14,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{val2:21,, val:1,}","datapoints":[[11,"-"]]},{"refId":"A","target":"{val2:22,, val:1,}","datapoints":[[12,"-"]]},{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then return -1 endi @@ -134,7 +132,7 @@ print =============== step11 - two query, 1 column, with timestamp, 1 column, w system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[["-",1577980800000],["-",1578067200000]]},{"refId":"A","target":"A","datapoints":[["-",1577980800000],["-",1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 endi @@ -142,14 +140,14 @@ print =============== step12 - two query, 1 column, with timestamp, 2 column, w system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[["-",1577980800000],["-",1578067200000]]},{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 endi print =============== step13 - two query, 1 column, with timestamp, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[["-",1577980800000],["-",1578067200000]]},{"refId":"A","target":"13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi @@ -163,14 +161,14 @@ endi print =============== step15 - two query, 2 column, with timestamp, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB213","datapoints":[[223,1577980800000]]},{"refId":"B","target":"BB214","datapoints":[[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val1:213,}","datapoints":[[223,1577980800000]]},{"refId":"B","target":"BB{val1:214,}","datapoints":[[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then return -1 endi print =============== step16 - two query, 3 column, with timestamp, 4 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val, val1, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB213","datapoints":[[22,1577980800000]]},{"refId":"B","target":"BB214","datapoints":[[22,1578067200000]]},{"refId":"A","target":"AA13","datapoints":[[2,1577980800000]]},{"refId":"A","target":"AA14","datapoints":[[2,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val1:213,, val2:223,, val1:213,}","datapoints":[[22,1577980800000]]},{"refId":"B","target":"BB{val1:214,, val2:224,, val1:214,}","datapoints":[[22,1578067200000]]},{"refId":"A","target":"AA{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"AA{val1:14,}","datapoints":[[2,1578067200000]]}]@ then return -1 endi @@ -198,7 +196,7 @@ endi print =============== step20 - two query, 1 column, no timestamp, 1 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[["-",1577980800000],["-",1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then return -1 endi @@ -212,28 +210,29 @@ endi print =============== step22 - two query, 1 column, no timestamp, 3 column, with timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val1, val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA223","datapoints":[[213,1577980800000]]},{"refId":"A","target":"AA224","datapoints":[[214,1578067200000]]}]@ then +if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA{val2:223,}","datapoints":[[213,1577980800000]]},{"refId":"A","target":"AA{val2:224,}","datapoints":[[214,1578067200000]]}]@ then return -1 endi print =============== step23 - two query, 2 column, no timestamp, 1 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB223","datapoints":[[213,"-"]]},{"refId":"B","target":"BB224","datapoints":[[214,"-"]]},{"refId":"A","target":"AA","datapoints":[[213,"-"],[214,"-"]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA","datapoints":[[213,"-"],[214,"-"]]}]@ then return -1 endi print =============== step24 - two query, 2 column, no timestamp, 2 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB223","datapoints":[[213,"-"]]},{"refId":"B","target":"BB224","datapoints":[[214,"-"]]},{"refId":"A","target":"AA213","datapoints":[[22,"-"]]},{"refId":"A","target":"AA214","datapoints":[[22,"-"]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,}","datapoints":[[22,"-"]]}]@ then return -1 endi print =============== step25 - two query, 2 column, no timestamp, 3 column, no timestamp system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query print step1-> $system_content -if $system_content != @[{"refId":"B","target":"BB223","datapoints":[[213,"-"]]},{"refId":"B","target":"BB224","datapoints":[[214,"-"]]},{"refId":"A","target":"AA223","datapoints":[[22,"-"]]},{"refId":"A","target":"AA224","datapoints":[[22,"-"]]}]@ then +if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,, val2:223,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,, val2:224,}","datapoints":[[22,"-"]]}]@ 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/http/prepare.sim b/tests/script/general/http/prepare.sim index 11834e1223..d5b8920190 100644 --- a/tests/script/general/http/prepare.sim +++ b/tests/script/general/http/prepare.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -52,3 +50,5 @@ print curl 127.0.0.1:6020/rest/sql/d1 -----> $system_content if $system_content != @{"status":"succ","head":["ts","i","b"],"data":[["2017-12-25 21:28:54.022",14,"44\\\\\"\"44"],["2017-12-25 21:28:53.022",13,"33\\\\\"33"],["2017-12-25 21:28:52.022",12,"22\\\\11"],["2017-12-25 21:28:51.022",11,"11\\\\11"],["2017-12-25 21:28:49.022",9,"99\\99"],["2017-12-25 21:28:48.022",8,"88\"\"88"],["2017-12-25 21:28:47.022",7,"77\"7\""],["2017-12-25 21:28:46.022",6,"66'6'"],["2017-12-25 21:28:45.022",5,"55'"],["2017-12-25 21:28:44.022",4,"44\""],["2017-12-25 21:28:43.022",3,"33"],["2017-12-25 21:28:42.022",2,"22"],["2017-12-25 21:28:41.022",1,"11"]],"rows":13}@ 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/http/restful.sim b/tests/script/general/http/restful.sim index c50273107f..5ee8bde46f 100644 --- a/tests/script/general/http/restful.sim +++ b/tests/script/general/http/restful.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh -sleep 5000 +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/exec.sh -n dnode1 -s start @@ -80,3 +80,5 @@ print curl 127.0.0.1:6020/rest/login/u2/abcd_1234 -----> $system_content if $system_content != @{"status":"error","code":1000,"desc":"auth failure"}@ 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/http/restful_full.sim b/tests/script/general/http/restful_full.sim index d125ccb56d..a5defb5914 100644 --- a/tests/script/general/http/restful_full.sim +++ b/tests/script/general/http/restful_full.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh -sleep 5000 +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/exec.sh -n dnode1 -s start @@ -81,7 +81,7 @@ print =============== step2 - no db #11 system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/sql print 11-> $system_content -if $system_content != @{"status":"succ","head":["name","create time","ntables","vgroups","replica","days","keep1,keep2,keep(D)","tables","cache(MB)","blocks","minrows","maxrows","ctime(s)","clog","comp","precision","status"],"data":[],"rows":0}@ then +if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","days","keep1,keep2,keep(D)","maxtables","cache(MB)","blocks","minrows","maxrows","ctime(Sec.)","wallevel","comp","precision","status"],"data":[],"rows":0}@ then return -1 endi @@ -93,7 +93,7 @@ endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6020/rest/sql print 13-> $system_content -if $system_content != @{"status":"error","code":1000,"desc":"DB already there"}@ then +if $system_content != @{"status":"error","code":1000,"desc":"database aleady exist"}@ then return -1 endi @@ -230,3 +230,4 @@ if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12- 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/http/restful_insert.sim b/tests/script/general/http/restful_insert.sim index 5a032b0dbe..7b1e88a25f 100644 --- a/tests/script/general/http/restful_insert.sim +++ b/tests/script/general/http/restful_insert.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/exec.sh -n dnode1 -s start @@ -51,3 +49,5 @@ print =============== step5 - query data system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest1' 127.0.0.1:6020/rest/sql print curl 127.0.0.1:6020/rest/sql -----> $system_content + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/restful_limit.sim b/tests/script/general/http/restful_limit.sim index 190d63f4db..8ee12f1c37 100644 --- a/tests/script/general/http/restful_limit.sim +++ b/tests/script/general/http/restful_limit.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -43,3 +42,5 @@ print curl 127.0.0.1:6020/rest/sql -----> $system_content #system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d "select * from db0.st0 where tbname in ('tb0', 'tb1') limit 1000" 127.0.0.1:6020/rest/sql #print curl 127.0.0.1:6020/rest/sql -----> $system_content + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/http/telegraf.sim b/tests/script/general/http/telegraf.sim index 16bea1ac4b..d9f3340f06 100644 --- a/tests/script/general/http/telegraf.sim +++ b/tests/script/general/http/telegraf.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - -sleep 5000 - - +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/cfg.sh -n dnode1 -c telegrafUseFieldNum -v 0 system sh/exec.sh -n dnode1 -s start @@ -254,17 +252,17 @@ system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Perce print $system_content -if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_windows_1_Processor","timestamp":"1564641722000","affected_rows":0,"status":"succ"}]}@ then - return -1 -endi +#if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table":"win_cpu_windows_1_Processor","timestamp":"1564641722000","affected_rows":1,"status":"succ"}]}@ then +# return -1 +#endi system_content curl -u root:taosdata -d 'select * from db.win_cpu_windows_1_Processor' 127.0.0.1:6020/rest/sql/ print $system_content -if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 14:42:02.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then - return -1 -endi +#if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 06:42:02.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then +# return -1 +#endi print =============== step3 - multi-query data system_content curl -u root:taosdata -d '{"metrics": [{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window1","instance":"1","objectname":"Processor"},"timestamp":1564641723000},{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window2","instance":"1","objectname":"Processor"},"timestamp":1564641723000}]}' 127.0.0.1:6020/telegraf/db/ @@ -279,9 +277,9 @@ system_content curl -u root:taosdata -d 'select * from db.win_cpu_window1_1_Pro print $system_content -if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 14:42:03.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then - return -1 -endi +#if $system_content != @{"status":"succ","head":["ts","f_percent_dpc_time","f_percent_idle_time","f_percent_interrupt_time","f_percent_privileged_time","f_percent_processor_time","f_percent_user_time"],"data":[["2019-08-01 14:42:03.000",0.000000000,95.598305000,0.000000000,0.000000000,0.000000000,0.000000000]],"rows":1}@ then +# return -1 +#endi system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0.0.1:6020/rest/sql/ @@ -291,3 +289,4 @@ if $system_content != @{"status":"succ","head":["count(*)"],"data":[[3]],"rows": 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/http/testSuite.sim b/tests/script/general/http/testSuite.sim index 336d606a37..d91e9f452d 100644 --- a/tests/script/general/http/testSuite.sim +++ b/tests/script/general/http/testSuite.sim @@ -1,8 +1,8 @@ run general/http/restful.sim run general/http/restful_insert.sim -#run general/http/restful_limit.sim -#run general/http/restful_full.sim -#run general/http/prepare.sim -#run general/http/telegraf.sim -#run general/http/grafana_bug.sim -#run general/http/grafana.sim +run general/http/restful_limit.sim +run general/http/restful_full.sim +run general/http/prepare.sim +run general/http/telegraf.sim +run general/http/grafana_bug.sim +run general/http/grafana.sim diff --git a/tests/script/general/import/basic.sim b/tests/script/general/import/basic.sim index 5037014728..2b72d55cda 100644 --- a/tests/script/general/import/basic.sim +++ b/tests/script/general/import/basic.sim @@ -1,10 +1,4 @@ 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 @@ -20,15 +14,15 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode1 -c 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 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 print ========= start dnode1 system sh/exec.sh -n dnode1 -s start @@ -50,14 +44,14 @@ endi print ================= step2 sql insert into tb values(1564641708000, 8000) sql select * from tb; -if $rows != 1 then +if $rows != 2 then return -1 endi print ================= step3 sql insert into tb values(1564641720000, 20000) sql select * from tb; -if $rows != 2 then +if $rows != 3 then return -1 endi @@ -76,7 +70,7 @@ sql insert into tb values(1564641714000, 14000) sql insert into tb values(1564641725000, 25000) sql insert into tb values(1564641740000, 40000) sql select * from tb; -if $rows != 6 then +if $rows != 8 then return -1 endi @@ -87,7 +81,7 @@ sql import into tb values(1564641723000, 23000) sql import into tb values(1564641734000, 34000) sql import into tb values(1564641750000, 50000) sql select * from tb; -if $rows != 11 then +if $rows != 13 then return -1 endi @@ -98,7 +92,7 @@ sql import into tb values(1564641723001, 23001) sql import into tb values(1564641734001, 34001) sql import into tb values(1564641750001, 50001) sql select * from tb; -if $rows != 16 then +if $rows != 18 then return -1 endi @@ -108,28 +102,28 @@ sql insert into tb values(1564641714002, 14002) sql insert into tb values(1564641725002, 25002) sql insert into tb values(1564641900000, 200000) sql select * from tb; -if $rows != 17 then +if $rows != 22 then return -1 endi print ================= step9 only insert last one sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 700000) sql select * from tb; -if $rows != 20 then +if $rows != 25 then return -1 endi print ================= step10 sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 70000) sql select * from tb; -if $rows != 20 then +if $rows != 25 then return -1 endi print ================= step11 sql import into tb values(1564642400000, 700000) sql select * from tb; -if $rows != 20 then +if $rows != 25 then return -1 endi @@ -137,7 +131,7 @@ print ================= step12 sql import into tb values(1564641709527, 9527)(1564641709527, 9528) sql select * from tb; print rows=> $rows -if $rows != 21 then +if $rows != 26 then return -1 endi @@ -145,7 +139,8 @@ print ================= step13 sql import into tb values(1564641709898, 9898)(1564641709897, 9897) sql select * from tb; print rows=> $rows -if $rows != 23 then +if $rows != 28 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/import/commit.sim b/tests/script/general/import/commit.sim index 2197c1d39d..64833fcd61 100644 --- a/tests/script/general/import/commit.sim +++ b/tests/script/general/import/commit.sim @@ -1,10 +1,4 @@ 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 @@ -20,15 +14,15 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode1 -c 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 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 print ========= start dnode1 system sh/exec.sh -n dnode1 -s start @@ -93,6 +87,4 @@ if $rows != 12 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/import/large.sim b/tests/script/general/import/large.sim index 77a47a1049..6f6889a226 100644 --- a/tests/script/general/import/large.sim +++ b/tests/script/general/import/large.sim @@ -1,10 +1,4 @@ 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 @@ -20,15 +14,15 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode1 -c 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 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 print ========= start dnode1 system sh/exec.sh -n dnode1 -s start @@ -99,4 +93,6 @@ while $i < 1000 $i = $i + 1 endw -print ================= step2 \ No newline at end of file +print ================= step2 + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/import/replica1.sim b/tests/script/general/import/replica1.sim index 193082097c..b2b7291623 100644 --- a/tests/script/general/import/replica1.sim +++ b/tests/script/general/import/replica1.sim @@ -1,10 +1,5 @@ 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 @@ -20,15 +15,15 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 -system sh/cfg.sh -n dnode1 -c 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.sh -n dnode1 -s start @@ -40,53 +35,59 @@ sql use ir1db sql create table tb(ts timestamp, i int) print ================= step1 -sql import into tb values(now+10000a, 10000) +sql import into tb values(1520000010000, 10000) sql select * from tb; +print $rows if $rows != 1 then return -1 endi print ================= step2 -sql insert into tb values(now+8000a, 8000) -sql select * from tb; -if $rows != 1 then - return -1 -endi - -print ================= step3 -sql insert into tb values(now+20000a, 20000) +sql insert into tb values(1520000008000, 8000) +print $rows sql select * from tb; if $rows != 2 then return -1 endi -print ================= step4 -sql import into tb values(now+8000a, 9000) -sql import into tb values(now+15000a, 15000) -sql import into tb values(now+30000a, 30000) +print ================= step3 +sql insert into tb values(1520000020000, 20000) sql select * from tb; -if $rows != 5 then +print $rows +if $rows != 3 then return -1 endi -print ================= step5 -sql insert into tb values(now+8000a, 8000) -sql insert into tb values(now+14000a, 14000) -sql insert into tb values(now+25000a, 25000) -sql insert into tb values(now+40000a, 40000) +print ================= step4 +sql import into tb values(1520000009000, 9000) +sql import into tb values(1520000015000, 15000) +sql import into tb values(1520000030000, 30000) sql select * from tb; +print $rows if $rows != 6 then return -1 endi -print ================= step6 -sql import into tb values(now+7000a, 7000) -sql import into tb values(now+12000a, 12000) -sql import into tb values(now+23000a, 23000) -sql import into tb values(now+34000a, 34000) -sql import into tb values(now+50000a, 50000) +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 select * from tb; -if $rows != 11 then +print $rows +if $rows != 9 then + return -1 +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 select * from tb; +print $rows +if $rows != 14 then return -1 endi @@ -98,46 +99,63 @@ sleep 5000 sql use ir1db sql select * from tb; -if $rows != 11 then +if $rows != 14 then return -1 endi print ================= step7 -sql import into tb values(now+7001a, 7001) -sql import into tb values(now+12001a, 12001) -sql import into tb values(now+23001a, 23001) -sql import into tb values(now+34001a, 34001) -sql import into tb values(now+50001a, 50001) +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 select * from tb; -if $rows != 16 then +print $rows +if $rows != 19 then return -1 endi print ================= step8 -sql insert into tb values(now+8002a, 8002) -sql insert into tb values(now+14002a, 14002) -sql insert into tb values(now+25002a, 25002) -sql insert into tb values(now+200000a, 60000) +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 select * from tb; -if $rows != 17 then +print $rows +if $rows != 24 then return -1 endi print ================= step9 -sql import into tb values(now-30d, 7003) -sql import into tb values(now-20d, 34003) -sql import into tb values(now-10d, 34003) -sql import into tb values(now-5d, 34003) -sql import into tb values(now+1m, 50001) -sql import into tb values(now+2m, 50001) -sql import into tb values(now+3m, 50001) -sql import into tb values(now+4m, 50002) -sql import into tb values(now+5m, 50003) -sql import into tb values(now+6m, 50004) -sql import into tb values(now+7m, 50001) -sql import into tb values(now+8m, 500051) +#1520000000000 +#sql import into tb values(now-30d, 7003) +#sql import into tb values(now-20d, 34003) +#sql import into tb values(now-10d, 34003) +#sql import into tb values(now-5d, 34003) +#sql import into tb values(now+1d, 50001) +#sql import into tb values(now+2d, 50001) +#sql import into tb values(now+6d, 50001) +#sql import into tb values(now+8d, 50002) +#sql import into tb values(now+10d, 50003) +#sql import into tb values(now+12d, 50004) +#sql import into tb values(now+14d, 50001) +#sql import into tb values(now+16d, 500051) + +sql import into tb values(1517408000000, 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 select * from tb; -if $rows != 29 then +print $rows +if $rows != 36 then return -1 endi @@ -149,23 +167,44 @@ sleep 5000 sql use ir1db sql select * from tb; -if $rows != 29 then +print $rows +if $rows != 36 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(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 select * from tb; -if $rows != 34 then +if $rows != 41 then return -1 endi -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) +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 select * from tb; -if $rows != 43 then +print $rows +if $rows != 50 then return -1 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(1515852800001, 34003) +sql import into tb values(1516716800000, 50001) +sql import into tb values(1517580800000, 50001) +sql select * from tb; +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/import/testSuite.sim b/tests/script/general/import/testSuite.sim index d340d90d66..9157410ea5 100644 --- a/tests/script/general/import/testSuite.sim +++ b/tests/script/general/import/testSuite.sim @@ -1,4 +1,4 @@ run general/import/basic.sim -#run general/import/commit.sim +run general/import/commit.sim run general/import/large.sim run general/import/replica1.sim diff --git a/tests/script/general/insert/basic.sim b/tests/script/general/insert/basic.sim index 9136f1e66f..ba8cff83fa 100644 --- a/tests/script/general/insert/basic.sim +++ b/tests/script/general/insert/basic.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -29,21 +28,23 @@ while $x < 10 endw print =============== step 2 -sql insert into $tb values (now - 5m , 10) -x error_insert -sql insert into $tb values (now - 6m , 10) -x error_insert -sql insert into $tb values (now - 7m , 10) -x error_insert -sql insert into $tb values (now - 8m , 10) -x error_insert -error_insert: +sql insert into $tb values (now - 5m , 10) +sql insert into $tb values (now - 6m , 10) +sql insert into $tb values (now - 7m , 10) +sql insert into $tb values (now - 8m , 10) sql select * from $tb print $rows points data are retrieved -if $rows != 10 then +if $rows != 14 then return -1 endi sql drop database $db +sleep 1000 sql show databases if $rows != 0 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/insert/insert_drop.sim b/tests/script/general/insert/insert_drop.sim index 89aad81229..5655576e20 100644 --- a/tests/script/general/insert/insert_drop.sim +++ b/tests/script/general/insert/insert_drop.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -19,7 +19,7 @@ $stb = stb sql drop database $db -x step1 step1: -sql create database $db tables 10 ctime 30 +sql create database $db maxtables 10 ctime 30 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int) tags(t1 int) @@ -46,8 +46,9 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sql connect -sleep 3000 + +sql reset query cache +sleep 1000 sql use $db sql drop table tb5 @@ -71,13 +72,17 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sql connect -sleep 3000 + +sql reset query cache +sleep 1000 sql use $db + sql create table tb5 using $stb tags(5) sql select * from tb5 +print $rows should be 0 if $rows != 0 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/insert/query_block1_file.sim b/tests/script/general/insert/query_block1_file.sim index d13fb9841d..6d6daca7b5 100644 --- a/tests/script/general/insert/query_block1_file.sim +++ b/tests/script/general/insert/query_block1_file.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -193,3 +193,5 @@ sql show databases if $rows != 0 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/insert/query_block1_memory.sim b/tests/script/general/insert/query_block1_memory.sim index c20613e192..83509ad5b0 100644 --- a/tests/script/general/insert/query_block1_memory.sim +++ b/tests/script/general/insert/query_block1_memory.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -175,3 +175,4 @@ if $rows != 0 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/insert/query_block2_file.sim b/tests/script/general/insert/query_block2_file.sim index 18a3f407bb..34da170a9e 100644 --- a/tests/script/general/insert/query_block2_file.sim +++ b/tests/script/general/insert/query_block2_file.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -208,3 +208,4 @@ if $rows != 0 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/insert/query_block2_memory.sim b/tests/script/general/insert/query_block2_memory.sim index 409e84269d..3f2c97a098 100644 --- a/tests/script/general/insert/query_block2_memory.sim +++ b/tests/script/general/insert/query_block2_memory.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -170,3 +170,5 @@ sql show databases if $rows != 0 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/insert/query_file_memory.sim b/tests/script/general/insert/query_file_memory.sim index b6e1bf4e55..f923ebed13 100644 --- a/tests/script/general/insert/query_file_memory.sim +++ b/tests/script/general/insert/query_file_memory.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -206,4 +206,4 @@ if $rows != 0 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/insert/query_multi_file.sim b/tests/script/general/insert/query_multi_file.sim index 901b6409fc..8622fa6f9b 100644 --- a/tests/script/general/insert/query_multi_file.sim +++ b/tests/script/general/insert/query_multi_file.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -53,3 +53,4 @@ if $rows != 0 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/insert/tcp.sim b/tests/script/general/insert/tcp.sim index c2782ac1e1..6f9752087d 100644 --- a/tests/script/general/insert/tcp.sim +++ b/tests/script/general/insert/tcp.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -20,7 +19,6 @@ sql create database db sql use db sql create table tb (ts timestamp, test binary(1000)) - $x = 0 while $x < 10000 $ms = $x . s @@ -30,11 +28,4 @@ endw sql select * from tb - -return - -sql drop database $db -sql show databases -if $rows != 0 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/insert/testSuite.sim b/tests/script/general/insert/testSuite.sim index 582351a218..da44167be5 100644 --- a/tests/script/general/insert/testSuite.sim +++ b/tests/script/general/insert/testSuite.sim @@ -1,8 +1,9 @@ -#run general/insert/basic.sim -#run general/insert/insert_drop.sim -#run general/insert/query_block1_memory.sim -#run general/insert/query_block2_memory.sim -#run general/insert/query_block1_file.sim -#run general/insert/query_block2_file.sim -#run general/insert/query_file_memory.sim -#run general/insert/query_multi_file.sim +run general/insert/basic.sim +run general/insert/insert_drop.sim +run general/insert/query_block1_memory.sim +run general/insert/query_block2_memory.sim +run general/insert/query_block1_file.sim +run general/insert/query_block2_file.sim +run general/insert/query_file_memory.sim +run general/insert/query_multi_file.sim +run general/insert/tcp.sim diff --git a/tests/script/general/metrics/testSuite.sim b/tests/script/general/metrics/testSuite.sim deleted file mode 100644 index 55300034b6..0000000000 --- a/tests/script/general/metrics/testSuite.sim +++ /dev/null @@ -1,4 +0,0 @@ -run general/metrics/disk.sim -run general/metrics/metrics.sim -run general/metrics/values.sim -run general/metrics/vnode3.sim diff --git a/tests/script/general/parser/alter.sim b/tests/script/general/parser/alter.sim index 07b7f71fa4..f97581c5f5 100644 --- a/tests/script/general/parser/alter.sim +++ b/tests/script/general/parser/alter.sim @@ -1,9 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 3 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 3 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 3 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -39,7 +38,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi sql alter table tb add column c3 nchar(4) @@ -47,7 +46,7 @@ sql select * from tb order by ts desc if $rows != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi sql insert into tb values (now, 2, 2, 'taos') @@ -73,13 +72,13 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi sql alter table mt add column c3 nchar(4) sql select * from tb order by ts desc -if $data03 != null then +if $data03 != NULL then return -1 endi sql insert into tb values (now, 2, 2, 'taos') @@ -90,7 +89,7 @@ endi if $data03 != taos then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi sql drop table tb @@ -170,7 +169,7 @@ endi if $data01 != 2 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi sql alter table mt add column c2 int @@ -201,7 +200,7 @@ if $data02 != insert then endi sql alter table mt add column c3 nchar(4) sql select * from tb order by ts desc -if $data03 != null then +if $data03 != NULL then return -1 endi # the query below should be deleted after bug fix diff --git a/tests/script/general/parser/alter1.sim b/tests/script/general/parser/alter1.sim index 058977f784..7c4609a87d 100644 --- a/tests/script/general/parser/alter1.sim +++ b/tests/script/general/parser/alter1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -36,16 +36,16 @@ print rows = $rows if $rows != 4 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data23 != null then +if $data23 != NULL then return -1 endi -if $data33 != null then +if $data33 != NULL then return -1 endi @@ -53,10 +53,10 @@ sql select c1 from stb if $rows != 4 then return -1 endi -if $data00 != null then +if $data00 != NULL then return -1 endi -if $data30 != null then +if $data30 != NULL then return -1 endi @@ -69,10 +69,10 @@ sql select c1+speed from car1 if $rows != 2 then return -1 endi -if $data00 != null then +if $data00 != NULL then return -1 endi -if $data10 != null then +if $data10 != NULL then return -1 endi @@ -80,10 +80,10 @@ sql select * from car1 if $rows != 2 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi diff --git a/tests/script/general/parser/alter_stable.sim b/tests/script/general/parser/alter_stable.sim index c0614ec00a..6715c44b96 100644 --- a/tests/script/general/parser/alter_stable.sim +++ b/tests/script/general/parser/alter_stable.sim @@ -1,9 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 3 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 3 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 3 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/auto_create_tb.sim b/tests/script/general/parser/auto_create_tb.sim index f9db56d15c..8fb0ddae54 100644 --- a/tests/script/general/parser/auto_create_tb.sim +++ b/tests/script/general/parser/auto_create_tb.sim @@ -2,8 +2,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/parser/auto_create_tb_drop_tb.sim b/tests/script/general/parser/auto_create_tb_drop_tb.sim index bb27c3e440..aa14d2fdfb 100644 --- a/tests/script/general/parser/auto_create_tb_drop_tb.sim +++ b/tests/script/general/parser/auto_create_tb_drop_tb.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -22,7 +22,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db rows 200 cache 2048 tables 4 +sql create database $db maxrows 200 cache 2048 maxTables 4 print ====== create tables sql use $db diff --git a/tests/script/general/parser/binary_escapeCharacter.sim b/tests/script/general/parser/binary_escapeCharacter.sim index 7342a96f4f..5f7d98a75a 100644 --- a/tests/script/general/parser/binary_escapeCharacter.sim +++ b/tests/script/general/parser/binary_escapeCharacter.sim @@ -1,9 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 3 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 3 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 3 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/bug.sim b/tests/script/general/parser/bug.sim index 7e7d7e536e..0233b2ee04 100644 --- a/tests/script/general/parser/bug.sim +++ b/tests/script/general/parser/bug.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c dDebugFlag -v 135 system sh/cfg.sh -n dnode1 -c mDebugFlag -v 135 diff --git a/tests/script/general/parser/col_arithmetic_operation.sim b/tests/script/general/parser/col_arithmetic_operation.sim index b4ffeadc23..9ea8492907 100644 --- a/tests/script/general/parser/col_arithmetic_operation.sim +++ b/tests/script/general/parser/col_arithmetic_operation.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -89,5 +89,4 @@ endi #### illegal operations sql_error select max(c2*2) from $tb -sql_error select 2*min(c1) from $tb sql_error select max(c1-c2) from $tb diff --git a/tests/script/general/parser/columnValue.sim b/tests/script/general/parser/columnValue.sim index ead480cad8..aa5c5f72c8 100644 --- a/tests/script/general/parser/columnValue.sim +++ b/tests/script/general/parser/columnValue.sim @@ -2,9 +2,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 3 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 3 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 3 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -15,13 +14,13 @@ sql drop database if exists db sql create database db sql use db -run lite/parser/columnValue_bool.sim -run lite/parser/columnValue_tinyint.sim -run lite/parser/columnValue_smallint.sim -run lite/parser/columnValue_int.sim -run lite/parser/columnValue_bigint.sim -run lite/parser/columnValue_float.sim -run lite/parser/columnValue_double.sim +run general/parser/columnValue_bool.sim +run general/parser/columnValue_tinyint.sim +run general/parser/columnValue_smallint.sim +run general/parser/columnValue_int.sim +run general/parser/columnValue_bigint.sim +run general/parser/columnValue_float.sim +run general/parser/columnValue_double.sim diff --git a/tests/script/general/parser/columnValue_bigint.sim b/tests/script/general/parser/columnValue_bigint.sim index 5a9e3d900a..e6839b2fb6 100644 --- a/tests/script/general/parser/columnValue_bigint.sim +++ b/tests/script/general/parser/columnValue_bigint.sim @@ -10,89 +10,89 @@ print ========== bigint sql create table mt_bigint (ts timestamp, c bigint) tags (tagname bigint) ## case 00: static create table for test tag values -sql create table st_bigint_0 using mt_bigint tags (null) -sql describe st_bigint_0 -if $data23 != NULL then +sql create table st_bigint_0 using mt_bigint tags (NULL) +sql select tagname from st_bigint_0 +if $data00 != NULL then return -1 endi sql create table st_bigint_1 using mt_bigint tags (NULL) -sql describe st_bigint_1 -if $data23 != NULL then +sql select tagname from st_bigint_1 +if $data00 != NULL then return -1 endi -sql create table st_bigint_2 using mt_bigint tags ('null') -sql describe st_bigint_2 -if $data23 != NULL then +sql create table st_bigint_2 using mt_bigint tags ('NULL') +sql select tagname from st_bigint_2 +if $data00 != NULL then return -1 endi sql create table st_bigint_3 using mt_bigint tags ('NULL') -sql describe st_bigint_3 -if $data23 != NULL then +sql select tagname from st_bigint_3 +if $data00 != NULL then return -1 endi -sql create table st_bigint_4 using mt_bigint tags ("null") -sql describe st_bigint_4 -if $data23 != NULL then +sql create table st_bigint_4 using mt_bigint tags ("NULL") +sql select tagname from st_bigint_4 +if $data00 != NULL then return -1 endi sql create table st_bigint_5 using mt_bigint tags ("NULL") -sql describe st_bigint_5 -if $data23 != NULL then +sql select tagname from st_bigint_5 +if $data00 != NULL then return -1 endi sql create table st_bigint_6 using mt_bigint tags (-9223372036854775807) -sql describe st_bigint_6 -if $data23 != -9223372036854775807 then +sql select tagname from st_bigint_6 +if $data00 != -9223372036854775807 then return -1 endi sql create table st_bigint_7 using mt_bigint tags (9223372036854775807) -sql describe st_bigint_7 -if $data23 != 9223372036854775807 then +sql select tagname from st_bigint_7 +if $data00 != 9223372036854775807 then return -1 endi sql create table st_bigint_8 using mt_bigint tags (37) -sql describe st_bigint_8 -if $data23 != 37 then +sql select tagname from st_bigint_8 +if $data00 != 37 then return -1 endi sql create table st_bigint_9 using mt_bigint tags (-100) -sql describe st_bigint_9 -if $data23 != -100 then +sql select tagname from st_bigint_9 +if $data00 != -100 then return -1 endi sql create table st_bigint_10 using mt_bigint tags (+113) -sql describe st_bigint_10 -if $data23 != 113 then +sql select tagname from st_bigint_10 +if $data00 != 113 then return -1 endi sql create table st_bigint_11 using mt_bigint tags ('-100') -sql describe st_bigint_11 -if $data23 != -100 then +sql select tagname from st_bigint_11 +if $data00 != -100 then return -1 endi sql create table st_bigint_12 using mt_bigint tags ("+78") -sql describe st_bigint_12 -if $data23 != 78 then +sql select tagname from st_bigint_12 +if $data00 != 78 then return -1 endi sql create table st_bigint_13 using mt_bigint tags (+0078) -sql describe st_bigint_13 -if $data23 != 78 then +sql select tagname from st_bigint_13 +if $data00 != 78 then return -1 endi sql create table st_bigint_14 using mt_bigint tags (-00078) -sql describe st_bigint_14 -if $data23 != -78 then +sql select tagname from st_bigint_14 +if $data00 != -78 then return -1 endi ## case 01: insert values for test column values -sql insert into st_bigint_0 values (now, null) +sql insert into st_bigint_0 values (now, NULL) sql select * from st_bigint_0 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_1 values (now, NULL) @@ -100,15 +100,15 @@ sql select * from st_bigint_1 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_bigint_2 values (now, 'null') +sql insert into st_bigint_2 values (now, 'NULL') sql select * from st_bigint_2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_3 values (now, 'NULL') @@ -116,15 +116,15 @@ sql select * from st_bigint_3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_bigint_4 values (now, "null") +sql insert into st_bigint_4 values (now, "NULL") sql select * from st_bigint_4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_5 values (now, "NULL") @@ -132,7 +132,7 @@ sql select * from st_bigint_5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_6 values (now, 9223372036854775807) @@ -211,64 +211,64 @@ if $data01 != -56 then endi ## case 02: dynamic create table for test tag values -sql insert into st_bigint_16 using mt_bigint tags (null) values (now, null) -sql describe st_bigint_16 -if $data23 != NULL then +sql insert into st_bigint_16 using mt_bigint tags (NULL) values (now, NULL) +sql select tagname from st_bigint_16 +if $data00 != NULL then return -1 endi sql select * from st_bigint_16 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_17 using mt_bigint tags (NULL) values (now, NULL) -sql describe st_bigint_17 -if $data23 != NULL then +sql select tagname from st_bigint_17 +if $data00 != NULL then return -1 endi sql select * from st_bigint_17 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_bigint_18 using mt_bigint tags ('null') values (now, 'null') -sql describe st_bigint_18 -if $data23 != NULL then +sql insert into st_bigint_18 using mt_bigint tags ('NULL') values (now, 'NULL') +sql select tagname from st_bigint_18 +if $data00 != NULL then return -1 endi sql select * from st_bigint_18 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_19 using mt_bigint tags ('NULL') values (now, 'NULL') -sql describe st_bigint_19 -if $data23 != NULL then +sql select tagname from st_bigint_19 +if $data00 != NULL then return -1 endi sql select * from st_bigint_19 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_bigint_20 using mt_bigint tags ("null") values (now, "null") -sql describe st_bigint_20 -if $data23 != NULL then +sql insert into st_bigint_20 using mt_bigint tags ("NULL") values (now, "NULL") +sql select tagname from st_bigint_20 +if $data00 != NULL then return -1 endi sql select * from st_bigint_20 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_21 using mt_bigint tags ("NULL") values (now, "NULL") -sql describe st_bigint_21 -if $data23 != NULL then +sql select tagname from st_bigint_21 +if $data00 != NULL then return -1 endi sql select * from st_bigint_21 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_bigint_22 using mt_bigint tags (9223372036854775807) values (now, 9223372036854775807) -sql describe st_bigint_22 -if $data23 != 9223372036854775807 then +sql select tagname from st_bigint_22 +if $data00 != 9223372036854775807 then return -1 endi sql select * from st_bigint_22 @@ -276,8 +276,8 @@ if $data01 != 9223372036854775807 then return -1 endi sql insert into st_bigint_23 using mt_bigint tags (-9223372036854775807) values (now, -9223372036854775807) -sql describe st_bigint_23 -if $data23 != -9223372036854775807 then +sql select tagname from st_bigint_23 +if $data00 != -9223372036854775807 then return -1 endi sql select * from st_bigint_23 @@ -285,8 +285,8 @@ if $data01 != -9223372036854775807 then return -1 endi sql insert into st_bigint_24 using mt_bigint tags (10) values (now, 10) -sql describe st_bigint_24 -if $data23 != 10 then +sql select tagname from st_bigint_24 +if $data00 != 10 then return -1 endi sql select * from st_bigint_24 @@ -294,8 +294,8 @@ if $data01 != 10 then return -1 endi sql insert into st_bigint_25 using mt_bigint tags ("-0") values (now, "-0") -sql describe st_bigint_25 -if $data23 != 0 then +sql select tagname from st_bigint_25 +if $data00 != 0 then return -1 endi sql select * from st_bigint_25 @@ -303,8 +303,8 @@ if $data01 != 0 then return -1 endi sql insert into st_bigint_26 using mt_bigint tags ('123') values (now, '123') -sql describe st_bigint_26 -if $data23 != 123 then +sql select tagname from st_bigint_26 +if $data00 != 123 then return -1 endi sql select * from st_bigint_26 @@ -312,8 +312,8 @@ if $data01 != 123 then return -1 endi sql insert into st_bigint_27 using mt_bigint tags (+056) values (now, +00056) -sql describe st_bigint_27 -if $data23 != 56 then +sql select tagname from st_bigint_27 +if $data00 != 56 then return -1 endi sql select * from st_bigint_27 @@ -321,8 +321,8 @@ if $data01 != 56 then return -1 endi sql insert into st_bigint_28 using mt_bigint tags (-056) values (now, -0056) -sql describe st_bigint_28 -if $data23 != -56 then +sql select tagname from st_bigint_28 +if $data00 != -56 then return -1 endi sql select * from st_bigint_28 @@ -330,47 +330,47 @@ if $data01 != -56 then return -1 endi -## case 03: alter tag values -sql alter table st_bigint_0 set tag tagname=9223372036854775807 -sql describe st_bigint_0 -if $data23 != 9223372036854775807 then - return -1 -endi -sql alter table st_bigint_0 set tag tagname=-9223372036854775807 -sql describe st_bigint_0 -if $data23 != -9223372036854775807 then - return -1 -endi -sql alter table st_bigint_0 set tag tagname=+100 -sql describe st_bigint_0 -if $data23 != 100 then - return -1 -endi -sql alter table st_bigint_0 set tag tagname=-33 -sql describe st_bigint_0 -if $data23 != -33 then - return -1 -endi -sql alter table st_bigint_0 set tag tagname='+98' -sql describe st_bigint_0 -if $data23 != 98 then - return -1 -endi -sql alter table st_bigint_0 set tag tagname='-076' -sql describe st_bigint_0 -if $data23 != -76 then - return -1 -endi -sql alter table st_bigint_0 set tag tagname=+0012 -sql describe st_bigint_0 -if $data23 != 12 then - return -1 -endi -sql alter table st_bigint_0 set tag tagname=-00063 -sql describe st_bigint_0 -if $data23 != -63 then - return -1 -endi +### case 03: alter tag values +#sql alter table st_bigint_0 set tag tagname=9223372036854775807 +#sql select tagname from st_bigint_0 +#if $data00 != 9223372036854775807 then +# return -1 +#endi +#sql alter table st_bigint_0 set tag tagname=-9223372036854775807 +#sql select tagname from st_bigint_0 +#if $data00 != -9223372036854775807 then +# return -1 +#endi +#sql alter table st_bigint_0 set tag tagname=+100 +#sql select tagname from st_bigint_0 +#if $data00 != 100 then +# return -1 +#endi +#sql alter table st_bigint_0 set tag tagname=-33 +#sql select tagname from st_bigint_0 +#if $data00 != -33 then +# return -1 +#endi +#sql alter table st_bigint_0 set tag tagname='+98' +#sql select tagname from st_bigint_0 +#if $data00 != 98 then +# return -1 +#endi +#sql alter table st_bigint_0 set tag tagname='-076' +#sql select tagname from st_bigint_0 +#if $data00 != -76 then +# return -1 +#endi +#sql alter table st_bigint_0 set tag tagname=+0012 +#sql select tagname from st_bigint_0 +#if $data00 != 12 then +# return -1 +#endi +#sql alter table st_bigint_0 set tag tagname=-00063 +#sql select tagname from st_bigint_0 +#if $data00 != -63 then +# return -1 +#endi ## case 04: illegal input ################## when overflow, auto set max @@ -454,13 +454,13 @@ sql insert into st_bigint_e23 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e24 using mt_bigint tags (033) values (now, 00062) sql insert into st_bigint_e25 using mt_bigint tags (033) values (now, 00062) -sql alter table st_bigint_e13 set tag tagname=9223372036854775808 -sql_error alter table st_bigint_e14 set tag tagname=-9223372036854775808 -sql alter table st_bigint_e15 set tag tagname=92233720368547758080 -sql_error alter table st_bigint_e16 set tag tagname=-92233720368547758080 -sql_error alter table st_bigint_e19 set tag tagname=123abc -sql_error alter table st_bigint_e20 set tag tagname="123abc" -sql_error alter table st_bigint_e22 set tag tagname=abc -sql_error alter table st_bigint_e23 set tag tagname="abc" -sql_error alter table st_bigint_e24 set tag tagname=" " -sql_error alter table st_bigint_e25 set tag tagname='' +#sql alter table st_bigint_e13 set tag tagname=9223372036854775808 +#sql_error alter table st_bigint_e14 set tag tagname=-9223372036854775808 +#sql alter table st_bigint_e15 set tag tagname=92233720368547758080 +#sql_error alter table st_bigint_e16 set tag tagname=-92233720368547758080 +#sql_error alter table st_bigint_e19 set tag tagname=123abc +#sql_error alter table st_bigint_e20 set tag tagname="123abc" +#sql_error alter table st_bigint_e22 set tag tagname=abc +#sql_error alter table st_bigint_e23 set tag tagname="abc" +#sql_error alter table st_bigint_e24 set tag tagname=" " +#sql_error alter table st_bigint_e25 set tag tagname='' diff --git a/tests/script/general/parser/columnValue_bool.sim b/tests/script/general/parser/columnValue_bool.sim index 2c896308fd..7f3a6c3d6a 100644 --- a/tests/script/general/parser/columnValue_bool.sim +++ b/tests/script/general/parser/columnValue_bool.sim @@ -10,122 +10,122 @@ print ========== bool sql create table mt_bool (ts timestamp, c bool) tags (tagname bool) ## case 00: static create table for test tag values -sql create table st_bool_0 using mt_bool tags (null) -sql describe st_bool_0 -if $data23 != NULL then - print ==1== expect: NULL, actually: $data23 +sql create table st_bool_0 using mt_bool tags (NULL) +sql select tagname from st_bool_0 +if $data00 != NULL then + print ==1== expect: NULL, actually: $data00 return -1 endi sql create table st_bool_1 using mt_bool tags (NULL) -sql describe st_bool_1 -if $data23 != NULL then - print ==2== expect: NULL, actually: $data23 +sql select tagname from st_bool_1 +if $data00 != NULL then + print ==2== expect: NULL, actually: $data00 return -1 endi -sql create table st_bool_2 using mt_bool tags ('null') -sql describe st_bool_2 -if $data23 != NULL then - print ==3== expect: NULL, actually: $data23 +sql create table st_bool_2 using mt_bool tags ('NULL') +sql select tagname from st_bool_2 +if $data00 != NULL then + print ==3== expect: NULL, actually: $data00 return -1 endi sql create table st_bool_3 using mt_bool tags ('NULL') -sql describe st_bool_3 -if $data23 != NULL then - print ==4== expect: NULL, actually: $data23 +sql select tagname from st_bool_3 +if $data00 != NULL then + print ==4== expect: NULL, actually: $data00 return -1 endi -sql create table st_bool_4 using mt_bool tags ("null") -sql describe st_bool_4 -if $data23 != NULL then - print ==5== expect: NULL, actually: $data23 +sql create table st_bool_4 using mt_bool tags ("NULL") +sql select tagname from st_bool_4 +if $data00 != NULL then + print ==5== expect: NULL, actually: $data00 return -1 endi sql create table st_bool_5 using mt_bool tags ("NULL") -sql describe st_bool_5 -if $data23 != NULL then - print ==6== expect: NULL, actually: $data23 +sql select tagname from st_bool_5 +if $data00 != NULL then + print ==6== expect: NULL, actually: $data00 return -1 endi sql create table st_bool_6 using mt_bool tags ("true") -sql describe st_bool_6 -if $data23 != true then - print ==7== expect: true, actually: $data23 +sql select tagname from st_bool_6 +if $data00 != 1 then + print ==7== expect: 1, actually: $data00 return -1 endi sql create table st_bool_7 using mt_bool tags ('true') -sql describe st_bool_7 -if $data23 != true then - print ==8== expect: true, actually: $data23 +sql select tagname from st_bool_7 +if $data00 != 1 then + print ==8== expect: 1, actually: $data00 return -1 endi sql create table st_bool_8 using mt_bool tags (true) -sql describe st_bool_8 -if $data23 != true then - print ==9== expect: true, actually: $data23 +sql select tagname from st_bool_8 +if $data00 != 1 then + print ==9== expect: 1, actually: $data00 return -1 endi sql create table st_bool_9 using mt_bool tags ("false") -sql describe st_bool_9 -if $data23 != false then - print ==10== expect: false, actually: $data23 +sql select tagname from st_bool_9 +if $data00 != 0 then + print ==10== expect: 0, actually: $data00 return -1 endi sql create table st_bool_10 using mt_bool tags ('false') -sql describe st_bool_10 -if $data23 != false then - print ==11== expect: false, actually: $data23 +sql select tagname from st_bool_10 +if $data00 != 0 then + print ==11== expect: 0, actually: $data00 return -1 endi sql create table st_bool_11 using mt_bool tags (false) -sql describe st_bool_11 -if $data23 != false then - print ==12== expect: false, actually: $data23 +sql select tagname from st_bool_11 +if $data00 != 0 then + print ==12== expect: 0, actually: $data00 return -1 endi sql create table st_bool_12 using mt_bool tags (0) -sql describe st_bool_12 -if $data23 != false then - print ==13== expect: false, actually: $data23 +sql select tagname from st_bool_12 +if $data00 != 0 then + print ==13== expect: 0, actually: $data00 return -1 endi sql create table st_bool_13 using mt_bool tags (1) -sql describe st_bool_13 -if $data23 != true then - print ==14== expect: true, actually: $data23 +sql select tagname from st_bool_13 +if $data00 != 1 then + print ==14== expect: 1, actually: $data00 return -1 endi sql create table st_bool_14 using mt_bool tags (6.9) -sql describe st_bool_14 -if $data23 != true then - print ==15== expect: true, actually: $data23 +sql select tagname from st_bool_14 +if $data00 != 1 then + print ==15== expect: 1, actually: $data00 return -1 endi sql create table st_bool_15 using mt_bool tags (-3) -sql describe st_bool_15 -if $data23 != true then - print ==16== expect: true, actually: $data23 +sql select tagname from st_bool_15 +if $data00 != 1 then + print ==16== expect: 1, actually: $data00 return -1 endi sql create table st_bool_15_0 using mt_bool tags (+300) -sql describe st_bool_15_0 -if $data23 != true then - print ==16== expect: true, actually: $data23 +sql select tagname from st_bool_15_0 +if $data00 != 1 then + print ==16== expect: 1, actually: $data00 return -1 endi sql create table st_bool_15_1 using mt_bool tags (-8.03) -sql describe st_bool_15_1 -if $data23 != true then - print ==16== expect: true, actually: $data23 +sql select tagname from st_bool_15_1 +if $data00 != 1 then + print ==16== expect: 1, actually: $data00 return -1 endi ## case 01: insert values for test column values -sql insert into st_bool_0 values (now, null) +sql insert into st_bool_0 values (now, NULL) sql select * from st_bool_0 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then print ==17== expect: NULL, actually: $data01 return -1 endi @@ -134,16 +134,16 @@ sql select * from st_bool_1 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then print ==18== expect: NULL, actually: $data01 return -1 endi -sql insert into st_bool_2 values (now, 'null') +sql insert into st_bool_2 values (now, 'NULL') sql select * from st_bool_2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then print ==19== expect: NULL, actually: $data01 return -1 endi @@ -152,16 +152,16 @@ sql select * from st_bool_3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then print ==20== expect: NULL, actually: $data01 return -1 endi -sql insert into st_bool_4 values (now, "null") +sql insert into st_bool_4 values (now, "NULL") sql select * from st_bool_4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then print ==21== expect: NULL, actually: $data01 return -1 endi @@ -170,7 +170,7 @@ sql select * from st_bool_5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then print ==22== expect: NULL, actually: $data01 return -1 endi @@ -180,7 +180,7 @@ if $rows != 1 then return -1 endi if $data01 != 1 then - print ==23== expect: true, actually: $data01 + print ==23== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_7 values (now, 'true') @@ -189,7 +189,7 @@ if $rows != 1 then return -1 endi if $data01 != 1 then - print ==24== expect: true, actually: $data01 + print ==24== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_8 values (now, true) @@ -198,7 +198,7 @@ if $rows != 1 then return -1 endi if $data01 != 1 then - print ==25== expect: true, actually: $data01 + print ==25== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_9 values (now, "false") @@ -243,7 +243,7 @@ if $rows != 1 then return -1 endi if $data01 != 1 then - print ==30== expect: true, actually: $data01 + print ==30== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_14 values (now, 6.9) @@ -252,7 +252,7 @@ if $rows != 1 then return -1 endi if $data01 != 1 then - print ==31== expect: true, actually: $data01 + print ==31== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_15 values (now, -3) @@ -284,203 +284,203 @@ if $data01 != 1 then endi ## case 02: dynamic create table for test tag values -sql insert into st_bool_16 using mt_bool tags (null) values (now, null) -sql describe st_bool_16 -if $data23 != NULL then - print ==33== expect: NULL, actually: $data23 +sql insert into st_bool_16 using mt_bool tags (NULL) values (now, NULL) +sql select tagname from st_bool_16 +if $data00 != NULL then + print ==33== expect: NULL, actually: $data00 return -1 endi sql select * from st_bool_16 -if $data01 != null then +if $data01 != NULL then print ==34== expect: NULL, actually: $data01 return -1 endi sql insert into st_bool_17 using mt_bool tags (NULL) values (now, NULL) -sql describe st_bool_17 -if $data23 != NULL then - print ==35== expect: NULL, actually: $data23 +sql select tagname from st_bool_17 +if $data00 != NULL then + print ==35== expect: NULL, actually: $data00 return -1 endi sql select * from st_bool_17 -if $data01 != null then +if $data01 != NULL then print ==36== expect: NULL, actually: $data01 return -1 endi -sql insert into st_bool_18 using mt_bool tags ('null') values (now, 'null') -sql describe st_bool_18 -if $data23 != NULL then - print ==37== expect: NULL, actually: $data23 +sql insert into st_bool_18 using mt_bool tags ('NULL') values (now, 'NULL') +sql select tagname from st_bool_18 +if $data00 != NULL then + print ==37== expect: NULL, actually: $data00 return -1 endi sql select * from st_bool_18 -if $data01 != null then +if $data01 != NULL then print ==38== expect: NULL, actually: $data01 return -1 endi sql insert into st_bool_19 using mt_bool tags ('NULL') values (now, 'NULL') -sql describe st_bool_19 -if $data23 != NULL then - print ==39== expect: NULL, actually: $data23 +sql select tagname from st_bool_19 +if $data00 != NULL then + print ==39== expect: NULL, actually: $data00 return -1 endi sql select * from st_bool_19 -if $data01 != null then +if $data01 != NULL then print ==40== expect: NULL, actually: $data01 return -1 endi -sql insert into st_bool_20 using mt_bool tags ("null") values (now, "null") -sql describe st_bool_20 -if $data23 != NULL then - print ==41== expect: NULL, actually: $data23 +sql insert into st_bool_20 using mt_bool tags ("NULL") values (now, "NULL") +sql select tagname from st_bool_20 +if $data00 != NULL then + print ==41== expect: NULL, actually: $data00 return -1 endi sql select * from st_bool_20 -if $data01 != null then +if $data01 != NULL then print ==42== expect: NULL, actually: $data01 return -1 endi sql insert into st_bool_21 using mt_bool tags ("NULL") values (now, "NULL") -sql describe st_bool_21 -if $data23 != NULL then - print ==43== expect: NULL, actually: $data23 +sql select tagname from st_bool_21 +if $data00 != NULL then + print ==43== expect: NULL, actually: $data00 return -1 endi sql select * from st_bool_21 -if $data01 != null then +if $data01 != NULL then print ==44== expect: NULL, actually: $data01 return -1 endi sql insert into st_bool_22 using mt_bool tags ("true") values (now, "true") -sql describe st_bool_22 -if $data23 != true then - print ==45== expect: true, actually: $data23 +sql select tagname from st_bool_22 +if $data00 != 1 then + print ==45== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_22 if $data01 != 1 then - print ==46== expect: true, actually: $data01 + print ==46== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_23 using mt_bool tags ('true') values (now, 'true') -sql describe st_bool_23 -if $data23 != true then - print ==47== expect: true, actually: $data23 +sql select tagname from st_bool_23 +if $data00 != 1 then + print ==47== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_23 if $data01 != 1 then - print ==48== expect: true, actually: $data01 + print ==48== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_24 using mt_bool tags (true) values (now, true) -sql describe st_bool_24 -if $data23 != true then - print ==49== expect: true, actually: $data23 +sql select tagname from st_bool_24 +if $data00 != 1 then + print ==49== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_24 if $data01 != 1 then - print ==50== expect: true, actually: $data01 + print ==50== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_25 using mt_bool tags ("false") values (now, "false") -sql describe st_bool_25 -if $data23 != false then - print ==51== expect: false, actually: $data23 +sql select tagname from st_bool_25 +if $data00 != 0 then + print ==51== expect: 0, actually: $data00 return -1 endi sql select * from st_bool_25 if $data01 != 0 then - print ==52== expect: false, actually: $data01 + print ==52== expect: 0, actually: $data01 return -1 endi sql insert into st_bool_26 using mt_bool tags ('false') values (now, 'false') -sql describe st_bool_26 -if $data23 != false then - print ==53== expect: false, actually: $data23 +sql select tagname from st_bool_26 +if $data00 != 0 then + print ==53== expect: 0, actually: $data00 return -1 endi sql select * from st_bool_26 if $data01 != 0 then - print ==54== expect: false, actually: $data01 + print ==54== expect: 0, actually: $data01 return -1 endi sql insert into st_bool_27 using mt_bool tags (false) values (now, false) -sql describe st_bool_27 -if $data23 != false then - print ==55== expect: false, actually: $data23 +sql select tagname from st_bool_27 +if $data00 != 0 then + print ==55== expect: 0, actually: $data00 return -1 endi sql select * from st_bool_27 if $data01 != 0 then - print ==56== expect: false, actually: $data01 + print ==56== expect: 0, actually: $data01 return -1 endi sql insert into st_bool_28 using mt_bool tags (0) values (now, 0) -sql describe st_bool_28 -if $data23 != false then - print ==57== expect: false, actually: $data23 +sql select tagname from st_bool_28 +if $data00 != 0 then + print ==57== expect: 0, actually: $data00 return -1 endi sql select * from st_bool_28 if $data01 != 0 then - print ==58== expect: false, actually: $data01 + print ==58== expect: 0, actually: $data01 return -1 endi sql insert into st_bool_29 using mt_bool tags (1) values (now, 1) -sql describe st_bool_29 -if $data23 != true then - print ==59== expect: true, actually: $data23 +sql select tagname from st_bool_29 +if $data00 != 1 then + print ==59== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_29 if $data01 != 1 then - print ==60== expect: true, actually: $data01 + print ==60== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_30 using mt_bool tags (6.9) values (now, 6.9) -sql describe st_bool_30 -if $data23 != true then - print ==61== expect: true, actually: $data23 +sql select tagname from st_bool_30 +if $data00 != 1 then + print ==61== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_30 if $data01 != 1 then - print ==62== expect: true, actually: $data01 + print ==62== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_31 using mt_bool tags (-3) values (now, -3) -sql describe st_bool_31 -if $data23 != true then - print ==63== expect: true, actually: $data23 +sql select tagname from st_bool_31 +if $data00 != 1 then + print ==63== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_31 if $data01 != 1 then - print ==64== expect: true, actually: $data01 + print ==64== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_32 using mt_bool tags (+300) values (now, +300) -sql describe st_bool_32 -if $data23 != true then - print ==63== expect: true, actually: $data23 +sql select tagname from st_bool_32 +if $data00 != 1 then + print ==63== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_32 if $data01 != 1 then - print ==64== expect: true, actually: $data01 + print ==64== expect: 1, actually: $data01 return -1 endi sql insert into st_bool_33 using mt_bool tags (+30.890) values (now, +30.890) -sql describe st_bool_33 -if $data23 != true then - print ==63== expect: true, actually: $data23 +sql select tagname from st_bool_33 +if $data00 != 1 then + print ==63== expect: 1, actually: $data00 return -1 endi sql select * from st_bool_33 if $data01 != 1 then - print ==64== expect: true, actually: $data01 + print ==64== expect: 1, actually: $data01 return -1 endi @@ -490,86 +490,86 @@ endi ## case 03: alter tag values -sql alter table st_bool_0 set tag tagname=true -sql describe st_bool_0 -if $data23 != true then - return -1 -endi -sql alter table st_bool_0 set tag tagname=NULL -sql describe st_bool_0 -if $data23 != NULL then - return -1 -endi -sql alter table st_bool_0 set tag tagname=false -sql describe st_bool_0 -if $data23 != false then - return -1 -endi -sql alter table st_bool_0 set tag tagname=null -sql describe st_bool_0 -if $data23 != NULL then - return -1 -endi -sql alter table st_bool_0 set tag tagname='true' -sql describe st_bool_0 -if $data23 != true then - return -1 -endi -sql alter table st_bool_0 set tag tagname='null' -sql describe st_bool_0 -if $data23 != NULL then - return -1 -endi -sql alter table st_bool_0 set tag tagname='false' -sql describe st_bool_0 -if $data23 != false then - return -1 -endi -sql alter table st_bool_0 set tag tagname='NULL' -sql describe st_bool_0 -if $data23 != NULL then - return -1 -endi -sql alter table st_bool_0 set tag tagname="true" -sql describe st_bool_0 -if $data23 != true then - return -1 -endi -sql alter table st_bool_0 set tag tagname="null" -sql describe st_bool_0 -if $data23 != NULL then - return -1 -endi -sql alter table st_bool_0 set tag tagname="false" -sql describe st_bool_0 -if $data23 != false then - return -1 -endi -sql alter table st_bool_0 set tag tagname="NULL" -sql describe st_bool_0 -if $data23 != NULL then - return -1 -endi -sql alter table st_bool_0 set tag tagname=1 -sql describe st_bool_0 -if $data23 != true then - return -1 -endi -sql alter table st_bool_0 set tag tagname=0 -sql describe st_bool_0 -if $data23 != false then - return -1 -endi -sql alter table st_bool_0 set tag tagname=6.9 -sql describe st_bool_0 -if $data23 != true then - return -1 -endi -sql alter table st_bool_0 set tag tagname=-3 -sql describe st_bool_0 -if $data23 != true then - return -1 -endi +#sql alter table st_bool_0 set tag tagname=true +#sql select tagname from st_bool_0 +#if $data00 != true then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname=NULL +#sql select tagname from st_bool_0 +#if $data00 != NULL then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname=false +#sql select tagname from st_bool_0 +#if $data00 != false then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname=NULL +#sql select tagname from st_bool_0 +#if $data00 != NULL then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname='true' +#sql select tagname from st_bool_0 +#if $data00 != true then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname='NULL' +#sql select tagname from st_bool_0 +#if $data00 != NULL then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname='false' +#sql select tagname from st_bool_0 +#if $data00 != false then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname='NULL' +#sql select tagname from st_bool_0 +#if $data00 != NULL then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname="true" +#sql select tagname from st_bool_0 +#if $data00 != true then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname="NULL" +#sql select tagname from st_bool_0 +#if $data00 != NULL then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname="false" +#sql select tagname from st_bool_0 +#if $data00 != false then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname="NULL" +#sql select tagname from st_bool_0 +#if $data00 != NULL then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname=1 +#sql select tagname from st_bool_0 +#if $data00 != true then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname=0 +#sql select tagname from st_bool_0 +#if $data00 != false then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname=6.9 +#sql select tagname from st_bool_0 +#if $data00 != true then +# return -1 +#endi +#sql alter table st_bool_0 set tag tagname=-3 +#sql select tagname from st_bool_0 +#if $data00 != true then +# return -1 +#endi # case 04: illegal input sql_error create table st_bool_e0 using mt_bool tags (123abc) diff --git a/tests/script/general/parser/columnValue_double.sim b/tests/script/general/parser/columnValue_double.sim index 1c79ec4ff7..733fc52285 100644 --- a/tests/script/general/parser/columnValue_double.sim +++ b/tests/script/general/parser/columnValue_double.sim @@ -11,145 +11,146 @@ print ========== double sql create table mt_double (ts timestamp, c double) tags (tagname double) ## case 00: static create table for test tag values -sql create table st_double_0 using mt_double tags (null) -sql describe st_double_0 -if $data23 != NULL then +sql create table st_double_0 using mt_double tags (NULL ) +sql select tagname from st_double_0 +if $data00 != NULL then return -1 endi sql create table st_double_1 using mt_double tags (NULL) -sql describe st_double_1 -if $data23 != NULL then +sql select tagname from st_double_1 +if $data00 != NULL then return -1 endi -sql create table st_double_2 using mt_double tags ('null') -sql describe st_double_2 -if $data23 != NULL then +sql create table st_double_2 using mt_double tags ('NULL') +sql select tagname from st_double_2 +if $data00 != NULL then return -1 endi sql create table st_double_3 using mt_double tags ('NULL') -sql describe st_double_3 -if $data23 != NULL then +sql select tagname from st_double_3 +if $data00 != NULL then return -1 endi -sql create table st_double_4 using mt_double tags ("null") -sql describe st_double_4 -if $data23 != NULL then +sql create table st_double_4 using mt_double tags ("NULL") +sql select tagname from st_double_4 +if $data00 != NULL then return -1 endi sql create table st_double_5 using mt_double tags ("NULL") -sql describe st_double_5 -if $data23 != NULL then +sql select tagname from st_double_5 +if $data00 != NULL then return -1 endi sql create table st_double_6 using mt_double tags (-123.321) -sql describe st_double_6 -if $data23 != -123.321000 then +sql select tagname from st_double_6 +if $data00 != -123.321000000 then + print expect -123.321000000, actual: $data00 return -1 endi sql create table st_double_7 using mt_double tags (+1.567) -sql describe st_double_7 -if $data23 != 1.567000 then +sql select tagname from st_double_7 +if $data00 != 1.567000000 then return -1 endi sql create table st_double_8 using mt_double tags (379.001) -sql describe st_double_8 -if $data23 != 379.001000 then +sql select tagname from st_double_8 +if $data00 != 379.001000000 then return -1 endi sql create table st_double_9 using mt_double tags (1.5e+3) -sql describe st_double_9 -if $data23 != 1500.000000 then +sql select tagname from st_double_9 +if $data00 != 1500.000000000 then return -1 endi sql create table st_double_10 using mt_double tags (-1.5e-3) -sql describe st_double_10 -if $data23 != -0.001500 then +sql select tagname from st_double_10 +if $data00 != -0.001500000 then return -1 endi sql create table st_double_11 using mt_double tags (+1.5e+3) -sql describe st_double_11 -if $data23 != 1500.000000 then +sql select tagname from st_double_11 +if $data00 != 1500.000000000 then return -1 endi sql create table st_double_12 using mt_double tags (-1.5e+3) -sql describe st_double_12 -if $data23 != -1500.000000 then +sql select tagname from st_double_12 +if $data00 != -1500.000000000 then return -1 endi sql create table st_double_13 using mt_double tags (1.5e-3) -sql describe st_double_13 -if $data23 != 0.001500 then +sql select tagname from st_double_13 +if $data00 != 0.001500000 then return -1 endi sql create table st_double_14 using mt_double tags (1.5E-3) -sql describe st_double_14 -if $data23 != 0.001500 then +sql select tagname from st_double_14 +if $data00 != 0.001500000 then return -1 endi sql create table st_double_6_0 using mt_double tags ('-123.321') -sql describe st_double_6_0 -if $data23 != -123.321000 then +sql select tagname from st_double_6_0 +if $data00 != -123.321000000 then return -1 endi sql create table st_double_7_0 using mt_double tags ('+1.567') -sql describe st_double_7_0 -if $data23 != 1.567000 then +sql select tagname from st_double_7_0 +if $data00 != 1.567000000 then return -1 endi sql create table st_double_8_0 using mt_double tags ('379.001') -sql describe st_double_8_0 -if $data23 != 379.001000 then +sql select tagname from st_double_8_0 +if $data00 != 379.001000000 then return -1 endi sql create table st_double_9_0 using mt_double tags ('1.5e+3') -sql describe st_double_9_0 -if $data23 != 1500.000000 then +sql select tagname from st_double_9_0 +if $data00 != 1500.000000000 then return -1 endi sql create table st_double_10_0 using mt_double tags ('-1.5e-3') -sql describe st_double_10_0 -if $data23 != -0.001500 then +sql select tagname from st_double_10_0 +if $data00 != -0.001500000 then return -1 endi sql create table st_double_11_0 using mt_double tags ('+1.5e+3') -sql describe st_double_11_0 -if $data23 != 1500.000000 then +sql select tagname from st_double_11_0 +if $data00 != 1500.000000000 then return -1 endi sql create table st_double_12_0 using mt_double tags ('-1.5e+3') -sql describe st_double_12_0 -if $data23 != -1500.000000 then +sql select tagname from st_double_12_0 +if $data00 != -1500.000000000 then return -1 endi sql create table st_double_13_0 using mt_double tags ('1.5e-3') -sql describe st_double_13_0 -if $data23 != 0.001500 then +sql select tagname from st_double_13_0 +if $data00 != 0.001500000 then return -1 endi sql create table st_double_14_0 using mt_double tags ('1.5E-3') -sql describe st_double_14_0 -if $data23 != 0.001500 then +sql select tagname from st_double_14_0 +if $data00 != 0.001500000 then return -1 endi sql create table st_double_15_0 using mt_double tags (1.7976931348623157e+308) -sql describe st_double_15_0 -#if $data23 != 0.001500 then +sql select tagname from st_double_15_0 +#if $data00 != 0.001500000 then # return -1 #endi sql create table st_double_16_0 using mt_double tags (-1.7976931348623157e+308) -sql describe st_double_16_0 -#if $data23 != 0.001500 then +sql select tagname from st_double_16_0 +#if $data00 != 0.001500000 then # return -1 #endi ## case 01: insert values for test column values -sql insert into st_double_0 values (now, null) +sql insert into st_double_0 values (now, NULL ) sql select * from st_double_0 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_double_1 values (now, NULL) @@ -157,15 +158,15 @@ sql select * from st_double_1 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_double_2 values (now, 'null') +sql insert into st_double_2 values (now, 'NULL') sql select * from st_double_2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_double_3 values (now, 'NULL') @@ -173,15 +174,15 @@ sql select * from st_double_3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_double_4 values (now, "null") +sql insert into st_double_4 values (now, "NULL") sql select * from st_double_4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_double_5 values (now, "NULL") @@ -189,7 +190,7 @@ sql select * from st_double_5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -215,7 +216,7 @@ sql select * from st_double_8 if $rows != 1 then return -1 endi -#if $data01 != 100.89000 then +#if $data01 != 100.89000000 then # return -1 #endi sql insert into st_double_9 values (now, "-0.98") @@ -223,7 +224,7 @@ sql select * from st_double_9 if $rows != 1 then return -1 endi -#if $data01 != -0.980000 then +#if $data01 != -0.980000000 then # return -1 #endi sql insert into st_double_10 values (now, '0') @@ -231,7 +232,7 @@ sql select * from st_double_10 if $rows != 1 then return -1 endi -#if $data01 != 0.00000 then # tsim only print 4 bits after dot +#if $data01 != 0.00000000 then # tsim only print 4 bits after dot # return -1 #endi sql insert into st_double_11 values (now, -0) @@ -239,7 +240,7 @@ sql select * from st_double_11 if $rows != 1 then return -1 endi -#if $data01 != 0.00000 then +#if $data01 != 0.000000000 then # return -1 #endi sql insert into st_double_12 values (now, "+056") @@ -256,7 +257,7 @@ sql select * from st_double_13 if $rows != 1 then return -1 endi -#if $data01 != 56.000000 then +#if $data01 != 56.000000000 then # return -1 #endi @@ -270,64 +271,64 @@ endi #endi ## case 02: dynamic create table for test tag values -sql insert into st_double_16 using mt_double tags (null) values (now, null) -sql describe st_double_16 -if $data23 != NULL then +sql insert into st_double_16 using mt_double tags (NULL ) values (now, NULL ) +sql select tagname from st_double_16 +if $data00 != NULL then return -1 endi sql select * from st_double_16 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_double_17 using mt_double tags (NULL) values (now, NULL) -sql describe st_double_17 -if $data23 != NULL then +sql select tagname from st_double_17 +if $data00 != NULL then return -1 endi sql select * from st_double_17 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_double_18 using mt_double tags ('null') values (now, 'null') -sql describe st_double_18 -if $data23 != NULL then +sql insert into st_double_18 using mt_double tags ('NULL') values (now, 'NULL') +sql select tagname from st_double_18 +if $data00 != NULL then return -1 endi sql select * from st_double_18 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_double_19 using mt_double tags ('NULL') values (now, 'NULL') -sql describe st_double_19 -if $data23 != NULL then +sql select tagname from st_double_19 +if $data00 != NULL then return -1 endi sql select * from st_double_19 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_double_20 using mt_double tags ("null") values (now, "null") -sql describe st_double_20 -if $data23 != NULL then +sql insert into st_double_20 using mt_double tags ("NULL") values (now, "NULL") +sql select tagname from st_double_20 +if $data00 != NULL then return -1 endi sql select * from st_double_20 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_double_21 using mt_double tags ("NULL") values (now, "NULL") -sql describe st_double_21 -if $data23 != NULL then +sql select tagname from st_double_21 +if $data00 != NULL then return -1 endi sql select * from st_double_21 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_double_22 using mt_double tags (127) values (now, 1.7976931348623157e+308) -sql describe st_double_22 -#if $data23 != 127 then +sql select tagname from st_double_22 +#if $data00 != 127 then # return -1 #endi sql select * from st_double_22 @@ -335,8 +336,8 @@ sql select * from st_double_22 # return -1 #endi sql insert into st_double_23 using mt_double tags (-127) values (now, -1.7976931348623157e+308) -sql describe st_double_23 -#if $data23 != -127 then +sql select tagname from st_double_23 +#if $data00 != -127 then # return -1 #endi sql select * from st_double_23 @@ -344,8 +345,8 @@ sql select * from st_double_23 # return -1 #endi sql insert into st_double_24 using mt_double tags (10) values (now, 10) -sql describe st_double_24 -#if $data23 != 10 then +sql select tagname from st_double_24 +#if $data00 != 10 then # return -1 #endi sql select * from st_double_24 @@ -353,8 +354,8 @@ sql select * from st_double_24 # return -1 #endi sql insert into st_double_25 using mt_double tags ("-0") values (now, "-0") -sql describe st_double_25 -#if $data23 != 0 then +sql select tagname from st_double_25 +#if $data00 != 0 then # return -1 #endi sql select * from st_double_25 @@ -362,8 +363,8 @@ sql select * from st_double_25 # return -1 #endi sql insert into st_double_26 using mt_double tags ('123') values (now, '12.3') -sql describe st_double_26 -#if $data23 != 123 then +sql select tagname from st_double_26 +#if $data00 != 123 then # return -1 #endi sql select * from st_double_26 @@ -371,8 +372,8 @@ sql select * from st_double_26 # return -1 #endi sql insert into st_double_27 using mt_double tags (+056) values (now, +0005.6) -sql describe st_double_27 -#if $data23 != 56 then +sql select tagname from st_double_27 +#if $data00 != 56 then # return -1 #endi sql select * from st_double_27 @@ -380,8 +381,8 @@ sql select * from st_double_27 # return -1 #endi sql insert into st_double_28 using mt_double tags (-056) values (now, -005.6) -sql describe st_double_28 -#if $data23 != -56 then +sql select tagname from st_double_28 +#if $data00 != -56 then # return -1 #endi sql select * from st_double_28 @@ -389,47 +390,47 @@ sql select * from st_double_28 # return -1 #endi -## case 03: alter tag values -sql alter table st_double_0 set tag tagname=1.7976931348623157e+308 -sql describe st_double_0 -#if $data23 != 127 then -# return -1 -#endi -sql alter table st_double_0 set tag tagname=-1.7976931348623157e+308 -sql describe st_double_0 -#if $data23 != -127 then -# return -1 -#endi -sql alter table st_double_0 set tag tagname=+10.340 -sql describe st_double_0 -#if $data23 != 100 then -# return -1 -#endi -sql alter table st_double_0 set tag tagname=-33.87 -sql describe st_double_0 -#if $data23 != -33 then -# return -1 -#endi -sql alter table st_double_0 set tag tagname='+9.8' -sql describe st_double_0 -#if $data23 != 98 then -# return -1 -#endi -sql alter table st_double_0 set tag tagname='-07.6' -sql describe st_double_0 -#if $data23 != -76 then -# return -1 -#endi -sql alter table st_double_0 set tag tagname=+0012.871 -sql describe st_double_0 -#if $data23 != 12 then -# return -1 -#endi -sql alter table st_double_0 set tag tagname=-00063.582 -sql describe st_double_0 -#if $data23 != -63 then -# return -1 -#endi +### case 03: alter tag values +#sql alter table st_double_0 set tag tagname=1.7976931348623157e+308 +#sql select tagname from st_double_0 +##if $data00 != 127 then +## return -1 +##endi +#sql alter table st_double_0 set tag tagname=-1.7976931348623157e+308 +#sql select tagname from st_double_0 +##if $data00 != -127 then +## return -1 +##endi +#sql alter table st_double_0 set tag tagname=+10.340 +#sql select tagname from st_double_0 +##if $data00 != 100 then +## return -1 +##endi +#sql alter table st_double_0 set tag tagname=-33.87 +#sql select tagname from st_double_0 +##if $data00 != -33 then +## return -1 +##endi +#sql alter table st_double_0 set tag tagname='+9.8' +#sql select tagname from st_double_0 +##if $data00 != 98 then +## return -1 +##endi +#sql alter table st_double_0 set tag tagname='-07.6' +#sql select tagname from st_double_0 +##if $data00 != -76 then +## return -1 +##endi +#sql alter table st_double_0 set tag tagname=+0012.871 +#sql select tagname from st_double_0 +##if $data00 != 12 then +## return -1 +##endi +#sql alter table st_double_0 set tag tagname=-00063.582 +#sql select tagname from st_double_0 +##if $data00 != -63 then +## return -1 +##endi ## case 04: illegal input sql_error create table st_double_e0 using mt_double tags (1.8976931348623157e+308) diff --git a/tests/script/general/parser/columnValue_float.sim b/tests/script/general/parser/columnValue_float.sim index 58e413a50f..c71b4b40ee 100644 --- a/tests/script/general/parser/columnValue_float.sim +++ b/tests/script/general/parser/columnValue_float.sim @@ -11,145 +11,163 @@ print ========== float sql create table mt_float (ts timestamp, c float) tags (tagname float) ## case 00: static create table for test tag values -sql create table st_float_0 using mt_float tags (null) -sql describe st_float_0 -if $data23 != NULL then +sql create table st_float_0 using mt_float tags (NULL) +sql select tagname from st_float_0 +if $data00 != NULL then return -1 endi sql create table st_float_1 using mt_float tags (NULL) -sql describe st_float_1 -if $data23 != NULL then +sql select tagname from st_float_1 +if $data00 != NULL then return -1 endi -sql create table st_float_2 using mt_float tags ('null') -sql describe st_float_2 -if $data23 != NULL then +sql create table st_float_2 using mt_float tags ('NULL') +sql select tagname from st_float_2 +if $data00 != NULL then return -1 endi sql create table st_float_3 using mt_float tags ('NULL') -sql describe st_float_3 -if $data23 != NULL then +sql select tagname from st_float_3 +if $data00 != NULL then return -1 endi -sql create table st_float_4 using mt_float tags ("null") -sql describe st_float_4 -if $data23 != NULL then +sql create table st_float_4 using mt_float tags ("NULL") +sql select tagname from st_float_4 +if $data00 != NULL then return -1 endi sql create table st_float_5 using mt_float tags ("NULL") -sql describe st_float_5 -if $data23 != NULL then +sql select tagname from st_float_5 +if $data00 != NULL then return -1 endi sql create table st_float_6 using mt_float tags (-123.321) -sql describe st_float_6 -if $data23 != -123.320999 then +sql select tagname from st_float_6 +if $data00 != -123.32100 then + print expect -123.32100, actual: $data00 return -1 endi sql create table st_float_7 using mt_float tags (+1.567) -sql describe st_float_7 -if $data23 != 1.567000 then +sql select tagname from st_float_7 +if $data00 != 1.56700 then + print expect 1.56700, actual: $data00 return -1 endi sql create table st_float_8 using mt_float tags (379.001) -sql describe st_float_8 -if $data23 != 379.001007 then +sql select tagname from st_float_8 +if $data00 != 379.00101 then + print expect 379.00101, actual: $data00 return -1 endi sql create table st_float_9 using mt_float tags (1.5e+3) -sql describe st_float_9 -if $data23 != 1500.000000 then +sql select tagname from st_float_9 +if $data00 != 1500.00000 then + print expect 1500.00000, actual: $data00 return -1 endi sql create table st_float_10 using mt_float tags (-1.5e-3) -sql describe st_float_10 -if $data23 != -0.001500 then +sql select tagname from st_float_10 +if $data00 != -0.00150 then + print expect -0.00150, actual: $data00 return -1 endi sql create table st_float_11 using mt_float tags (+1.5e+3) -sql describe st_float_11 -if $data23 != 1500.000000 then +sql select tagname from st_float_11 +if $data00 != 1500.00000 then + print expect 1500.00000, actual: $data00 return -1 endi sql create table st_float_12 using mt_float tags (-1.5e+3) -sql describe st_float_12 -if $data23 != -1500.000000 then +sql select tagname from st_float_12 +if $data00 != -1500.00000 then + print expect -1500.00000, actual: $data00 return -1 endi sql create table st_float_13 using mt_float tags (1.5e-3) -sql describe st_float_13 -if $data23 != 0.001500 then +sql select tagname from st_float_13 +if $data00 != 0.00150 then + print expect 0.00150, actual: $data00 return -1 endi sql create table st_float_14 using mt_float tags (1.5E-3) -sql describe st_float_14 -if $data23 != 0.001500 then +sql select tagname from st_float_14 +if $data00 != 0.00150 then + print expect 0.00150, actual: $data00 return -1 endi sql create table st_float_6_0 using mt_float tags ('-123.321') -sql describe st_float_6_0 -if $data23 != -123.320999 then +sql select tagname from st_float_6_0 +if $data00 != -123.32100 then + print expect -123.32100, actual: $data00 return -1 endi sql create table st_float_7_0 using mt_float tags ('+1.567') -sql describe st_float_7_0 -if $data23 != 1.567000 then +sql select tagname from st_float_7_0 +if $data00 != 1.56700 then + print expect 1.56700, actual: $data00 return -1 endi sql create table st_float_8_0 using mt_float tags ('379.001') -sql describe st_float_8_0 -if $data23 != 379.001007 then +sql select tagname from st_float_8_0 +if $data00 != 379.00101 then + print expect 379.00101, actual: $data00 return -1 endi sql create table st_float_9_0 using mt_float tags ('1.5e+3') -sql describe st_float_9_0 -if $data23 != 1500.000000 then +sql select tagname from st_float_9_0 +if $data00 != 1500.00000 then + print expect 1500.00000, actual: $data00 return -1 endi sql create table st_float_10_0 using mt_float tags ('-1.5e-3') -sql describe st_float_10_0 -if $data23 != -0.001500 then +sql select tagname from st_float_10_0 +if $data00 != -0.00150 then + print expect -0.00150, actual: $data00 return -1 endi sql create table st_float_11_0 using mt_float tags ('+1.5e+3') -sql describe st_float_11_0 -if $data23 != 1500.000000 then +sql select tagname from st_float_11_0 +if $data00 != 1500.00000 then + print expect 1500.00000, actual: $data00 return -1 endi sql create table st_float_12_0 using mt_float tags ('-1.5e+3') -sql describe st_float_12_0 -if $data23 != -1500.000000 then +sql select tagname from st_float_12_0 +if $data00 != -1500.00000 then + print expect -1500.00000, actual: $data00 return -1 endi sql create table st_float_13_0 using mt_float tags ('1.5e-3') -sql describe st_float_13_0 -if $data23 != 0.001500 then +sql select tagname from st_float_13_0 +if $data00 != 0.00150 then + print expect 0.00150, actual: $data00 return -1 endi sql create table st_float_14_0 using mt_float tags ('1.5E-3') -sql describe st_float_14_0 -if $data23 != 0.001500 then +sql select tagname from st_float_14_0 +if $data00 != 0.00150 then + print expect 0.00150, actual: $data00 return -1 endi sql create table st_float_15_0 using mt_float tags (3.40282347e+38) -sql describe st_float_15_0 -#if $data23 != 0.001500 then +sql select tagname from st_float_15_0 +#if $data00 != 0.001500 then # return -1 #endi sql create table st_float_16_0 using mt_float tags (-3.40282347e+38) -sql describe st_float_16_0 -#if $data23 != 0.001500 then +sql select tagname from st_float_16_0 +#if $data00 != 0.001500 then # return -1 #endi ## case 01: insert values for test column values -sql insert into st_float_0 values (now, null) +sql insert into st_float_0 values (now, NULL) sql select * from st_float_0 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_float_1 values (now, NULL) @@ -157,15 +175,15 @@ sql select * from st_float_1 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_float_2 values (now, 'null') +sql insert into st_float_2 values (now, 'NULL') sql select * from st_float_2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_float_3 values (now, 'NULL') @@ -173,15 +191,15 @@ sql select * from st_float_3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_float_4 values (now, "null") +sql insert into st_float_4 values (now, "NULL") sql select * from st_float_4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_float_5 values (now, "NULL") @@ -189,7 +207,7 @@ sql select * from st_float_5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -270,64 +288,64 @@ endi #endi ## case 02: dynamic create table for test tag values -sql insert into st_float_16 using mt_float tags (null) values (now, null) -sql describe st_float_16 -if $data23 != NULL then +sql insert into st_float_16 using mt_float tags (NULL) values (now, NULL) +sql select tagname from st_float_16 +if $data00 != NULL then return -1 endi sql select * from st_float_16 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_float_17 using mt_float tags (NULL) values (now, NULL) -sql describe st_float_17 -if $data23 != NULL then +sql select tagname from st_float_17 +if $data00 != NULL then return -1 endi sql select * from st_float_17 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_float_18 using mt_float tags ('null') values (now, 'null') -sql describe st_float_18 -if $data23 != NULL then +sql insert into st_float_18 using mt_float tags ('NULL') values (now, 'NULL') +sql select tagname from st_float_18 +if $data00 != NULL then return -1 endi sql select * from st_float_18 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_float_19 using mt_float tags ('NULL') values (now, 'NULL') -sql describe st_float_19 -if $data23 != NULL then +sql select tagname from st_float_19 +if $data00 != NULL then return -1 endi sql select * from st_float_19 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_float_20 using mt_float tags ("null") values (now, "null") -sql describe st_float_20 -if $data23 != NULL then +sql insert into st_float_20 using mt_float tags ("NULL") values (now, "NULL") +sql select tagname from st_float_20 +if $data00 != NULL then return -1 endi sql select * from st_float_20 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_float_21 using mt_float tags ("NULL") values (now, "NULL") -sql describe st_float_21 -if $data23 != NULL then +sql select tagname from st_float_21 +if $data00 != NULL then return -1 endi sql select * from st_float_21 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_float_22 using mt_float tags (127) values (now, 3.40282347e+38) -sql describe st_float_22 -#if $data23 != 127 then +sql select tagname from st_float_22 +#if $data00 != 127 then # return -1 #endi sql select * from st_float_22 @@ -335,8 +353,8 @@ sql select * from st_float_22 # return -1 #endi sql insert into st_float_23 using mt_float tags (-127) values (now, -3.40282347e+38) -sql describe st_float_23 -#if $data23 != -127 then +sql select tagname from st_float_23 +#if $data00 != -127 then # return -1 #endi sql select * from st_float_23 @@ -344,8 +362,8 @@ sql select * from st_float_23 # return -1 #endi sql insert into st_float_24 using mt_float tags (10) values (now, 10) -sql describe st_float_24 -#if $data23 != 10 then +sql select tagname from st_float_24 +#if $data00 != 10 then # return -1 #endi sql select * from st_float_24 @@ -353,8 +371,8 @@ sql select * from st_float_24 # return -1 #endi sql insert into st_float_25 using mt_float tags ("-0") values (now, "-0") -sql describe st_float_25 -#if $data23 != 0 then +sql select tagname from st_float_25 +#if $data00 != 0 then # return -1 #endi sql select * from st_float_25 @@ -362,8 +380,8 @@ sql select * from st_float_25 # return -1 #endi sql insert into st_float_26 using mt_float tags ('123') values (now, '12.3') -sql describe st_float_26 -#if $data23 != 123 then +sql select tagname from st_float_26 +#if $data00 != 123 then # return -1 #endi sql select * from st_float_26 @@ -371,8 +389,8 @@ sql select * from st_float_26 # return -1 #endi sql insert into st_float_27 using mt_float tags (+056) values (now, +0005.6) -sql describe st_float_27 -#if $data23 != 56 then +sql select tagname from st_float_27 +#if $data00 != 56 then # return -1 #endi sql select * from st_float_27 @@ -380,8 +398,8 @@ sql select * from st_float_27 # return -1 #endi sql insert into st_float_28 using mt_float tags (-056) values (now, -005.6) -sql describe st_float_28 -#if $data23 != -56 then +sql select tagname from st_float_28 +#if $data00 != -56 then # return -1 #endi sql select * from st_float_28 @@ -389,47 +407,47 @@ sql select * from st_float_28 # return -1 #endi -## case 03: alter tag values -sql alter table st_float_0 set tag tagname=3.40282347e+38 -sql describe st_float_0 -#if $data23 != 127 then -# return -1 -#endi -sql alter table st_float_0 set tag tagname=-3.40282347e+38 -sql describe st_float_0 -#if $data23 != -127 then -# return -1 -#endi -sql alter table st_float_0 set tag tagname=+10.340 -sql describe st_float_0 -#if $data23 != 100 then -# return -1 -#endi -sql alter table st_float_0 set tag tagname=-33.87 -sql describe st_float_0 -#if $data23 != -33 then -# return -1 -#endi -sql alter table st_float_0 set tag tagname='+9.8' -sql describe st_float_0 -#if $data23 != 98 then -# return -1 -#endi -sql alter table st_float_0 set tag tagname='-07.6' -sql describe st_float_0 -#if $data23 != -76 then -# return -1 -#endi -sql alter table st_float_0 set tag tagname=+0012.871 -sql describe st_float_0 -#if $data23 != 12 then -# return -1 -#endi -sql alter table st_float_0 set tag tagname=-00063.582 -sql describe st_float_0 -#if $data23 != -63 then -# return -1 -#endi +### case 03: alter tag values +#sql alter table st_float_0 set tag tagname=3.40282347e+38 +#sql select tagname from st_float_0 +##if $data00 != 127 then +## return -1 +##endi +#sql alter table st_float_0 set tag tagname=-3.40282347e+38 +#sql select tagname from st_float_0 +##if $data00 != -127 then +## return -1 +##endi +#sql alter table st_float_0 set tag tagname=+10.340 +#sql select tagname from st_float_0 +##if $data00 != 100 then +## return -1 +##endi +#sql alter table st_float_0 set tag tagname=-33.87 +#sql select tagname from st_float_0 +##if $data00 != -33 then +## return -1 +##endi +#sql alter table st_float_0 set tag tagname='+9.8' +#sql select tagname from st_float_0 +##if $data00 != 98 then +## return -1 +##endi +#sql alter table st_float_0 set tag tagname='-07.6' +#sql select tagname from st_float_0 +##if $data00 != -76 then +## return -1 +##endi +#sql alter table st_float_0 set tag tagname=+0012.871 +#sql select tagname from st_float_0 +##if $data00 != 12 then +## return -1 +##endi +#sql alter table st_float_0 set tag tagname=-00063.582 +#sql select tagname from st_float_0 +##if $data00 != -63 then +## return -1 +##endi ## case 04: illegal input sql_error create table st_float_e0 using mt_float tags (3.50282347e+38) diff --git a/tests/script/general/parser/columnValue_int.sim b/tests/script/general/parser/columnValue_int.sim index da3df4969b..2a909ebf3c 100644 --- a/tests/script/general/parser/columnValue_int.sim +++ b/tests/script/general/parser/columnValue_int.sim @@ -10,89 +10,89 @@ print ========== int sql create table mt_int (ts timestamp, c int) tags (tagname int) ## case 00: static create table for test tag values -sql create table st_int_0 using mt_int tags (null) -sql describe st_int_0 -if $data23 != NULL then +sql create table st_int_0 using mt_int tags (NULL) +sql select tagname from st_int_0 +if $data00 != NULL then return -1 endi sql create table st_int_1 using mt_int tags (NULL) -sql describe st_int_1 -if $data23 != NULL then +sql select tagname from st_int_1 +if $data00 != NULL then return -1 endi -sql create table st_int_2 using mt_int tags ('null') -sql describe st_int_2 -if $data23 != NULL then +sql create table st_int_2 using mt_int tags ('NULL') +sql select tagname from st_int_2 +if $data00 != NULL then return -1 endi sql create table st_int_3 using mt_int tags ('NULL') -sql describe st_int_3 -if $data23 != NULL then +sql select tagname from st_int_3 +if $data00 != NULL then return -1 endi -sql create table st_int_4 using mt_int tags ("null") -sql describe st_int_4 -if $data23 != NULL then +sql create table st_int_4 using mt_int tags ("NULL") +sql select tagname from st_int_4 +if $data00 != NULL then return -1 endi sql create table st_int_5 using mt_int tags ("NULL") -sql describe st_int_5 -if $data23 != NULL then +sql select tagname from st_int_5 +if $data00 != NULL then return -1 endi sql create table st_int_6 using mt_int tags (-2147483647) -sql describe st_int_6 -if $data23 != -2147483647 then +sql select tagname from st_int_6 +if $data00 != -2147483647 then return -1 endi sql create table st_int_7 using mt_int tags (2147483647) -sql describe st_int_7 -if $data23 != 2147483647 then +sql select tagname from st_int_7 +if $data00 != 2147483647 then return -1 endi sql create table st_int_8 using mt_int tags (37) -sql describe st_int_8 -if $data23 != 37 then +sql select tagname from st_int_8 +if $data00 != 37 then return -1 endi sql create table st_int_9 using mt_int tags (-100) -sql describe st_int_9 -if $data23 != -100 then +sql select tagname from st_int_9 +if $data00 != -100 then return -1 endi sql create table st_int_10 using mt_int tags (+113) -sql describe st_int_10 -if $data23 != 113 then +sql select tagname from st_int_10 +if $data00 != 113 then return -1 endi sql create table st_int_11 using mt_int tags ('-100') -sql describe st_int_11 -if $data23 != -100 then +sql select tagname from st_int_11 +if $data00 != -100 then return -1 endi sql create table st_int_12 using mt_int tags ("+78") -sql describe st_int_12 -if $data23 != 78 then +sql select tagname from st_int_12 +if $data00 != 78 then return -1 endi sql create table st_int_13 using mt_int tags (+0078) -sql describe st_int_13 -if $data23 != 78 then +sql select tagname from st_int_13 +if $data00 != 78 then return -1 endi sql create table st_int_14 using mt_int tags (-00078) -sql describe st_int_14 -if $data23 != -78 then +sql select tagname from st_int_14 +if $data00 != -78 then return -1 endi ## case 01: insert values for test column values -sql insert into st_int_0 values (now, null) +sql insert into st_int_0 values (now, NULL) sql select * from st_int_0 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_1 values (now, NULL) @@ -100,15 +100,15 @@ sql select * from st_int_1 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_int_2 values (now, 'null') +sql insert into st_int_2 values (now, 'NULL') sql select * from st_int_2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_3 values (now, 'NULL') @@ -116,15 +116,15 @@ sql select * from st_int_3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_int_4 values (now, "null") +sql insert into st_int_4 values (now, "NULL") sql select * from st_int_4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_5 values (now, "NULL") @@ -132,7 +132,7 @@ sql select * from st_int_5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_6 values (now, 2147483647) @@ -211,64 +211,64 @@ if $data01 != -56 then endi ## case 02: dynamic create table for test tag values -sql insert into st_int_16 using mt_int tags (null) values (now, null) -sql describe st_int_16 -if $data23 != NULL then +sql insert into st_int_16 using mt_int tags (NULL) values (now, NULL) +sql select tagname from st_int_16 +if $data00 != NULL then return -1 endi sql select * from st_int_16 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_17 using mt_int tags (NULL) values (now, NULL) -sql describe st_int_17 -if $data23 != NULL then +sql select tagname from st_int_17 +if $data00 != NULL then return -1 endi sql select * from st_int_17 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_int_18 using mt_int tags ('null') values (now, 'null') -sql describe st_int_18 -if $data23 != NULL then +sql insert into st_int_18 using mt_int tags ('NULL') values (now, 'NULL') +sql select tagname from st_int_18 +if $data00 != NULL then return -1 endi sql select * from st_int_18 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_19 using mt_int tags ('NULL') values (now, 'NULL') -sql describe st_int_19 -if $data23 != NULL then +sql select tagname from st_int_19 +if $data00 != NULL then return -1 endi sql select * from st_int_19 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_int_20 using mt_int tags ("null") values (now, "null") -sql describe st_int_20 -if $data23 != NULL then +sql insert into st_int_20 using mt_int tags ("NULL") values (now, "NULL") +sql select tagname from st_int_20 +if $data00 != NULL then return -1 endi sql select * from st_int_20 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_21 using mt_int tags ("NULL") values (now, "NULL") -sql describe st_int_21 -if $data23 != NULL then +sql select tagname from st_int_21 +if $data00 != NULL then return -1 endi sql select * from st_int_21 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_int_22 using mt_int tags (2147483647) values (now, 2147483647) -sql describe st_int_22 -if $data23 != 2147483647 then +sql select tagname from st_int_22 +if $data00 != 2147483647 then return -1 endi sql select * from st_int_22 @@ -276,8 +276,8 @@ if $data01 != 2147483647 then return -1 endi sql insert into st_int_23 using mt_int tags (-2147483647) values (now, -2147483647) -sql describe st_int_23 -if $data23 != -2147483647 then +sql select tagname from st_int_23 +if $data00 != -2147483647 then return -1 endi sql select * from st_int_23 @@ -285,8 +285,8 @@ if $data01 != -2147483647 then return -1 endi sql insert into st_int_24 using mt_int tags (10) values (now, 10) -sql describe st_int_24 -if $data23 != 10 then +sql select tagname from st_int_24 +if $data00 != 10 then return -1 endi sql select * from st_int_24 @@ -294,8 +294,8 @@ if $data01 != 10 then return -1 endi sql insert into st_int_25 using mt_int tags ("-0") values (now, "-0") -sql describe st_int_25 -if $data23 != 0 then +sql select tagname from st_int_25 +if $data00 != 0 then return -1 endi sql select * from st_int_25 @@ -303,8 +303,8 @@ if $data01 != 0 then return -1 endi sql insert into st_int_26 using mt_int tags ('123') values (now, '123') -sql describe st_int_26 -if $data23 != 123 then +sql select tagname from st_int_26 +if $data00 != 123 then return -1 endi sql select * from st_int_26 @@ -312,8 +312,8 @@ if $data01 != 123 then return -1 endi sql insert into st_int_27 using mt_int tags (+056) values (now, +00056) -sql describe st_int_27 -if $data23 != 56 then +sql select tagname from st_int_27 +if $data00 != 56 then return -1 endi sql select * from st_int_27 @@ -321,8 +321,8 @@ if $data01 != 56 then return -1 endi sql insert into st_int_28 using mt_int tags (-056) values (now, -0056) -sql describe st_int_28 -if $data23 != -56 then +sql select tagname from st_int_28 +if $data00 != -56 then return -1 endi sql select * from st_int_28 @@ -330,47 +330,47 @@ if $data01 != -56 then return -1 endi -## case 03: alter tag values -sql alter table st_int_0 set tag tagname=2147483647 -sql describe st_int_0 -if $data23 != 2147483647 then - return -1 -endi -sql alter table st_int_0 set tag tagname=-2147483647 -sql describe st_int_0 -if $data23 != -2147483647 then - return -1 -endi -sql alter table st_int_0 set tag tagname=+100 -sql describe st_int_0 -if $data23 != 100 then - return -1 -endi -sql alter table st_int_0 set tag tagname=-33 -sql describe st_int_0 -if $data23 != -33 then - return -1 -endi -sql alter table st_int_0 set tag tagname='+98' -sql describe st_int_0 -if $data23 != 98 then - return -1 -endi -sql alter table st_int_0 set tag tagname='-076' -sql describe st_int_0 -if $data23 != -76 then - return -1 -endi -sql alter table st_int_0 set tag tagname=+0012 -sql describe st_int_0 -if $data23 != 12 then - return -1 -endi -sql alter table st_int_0 set tag tagname=-00063 -sql describe st_int_0 -if $data23 != -63 then - return -1 -endi +### case 03: alter tag values +#sql alter table st_int_0 set tag tagname=2147483647 +#sql select tagname from st_int_0 +#if $data00 != 2147483647 then +# return -1 +#endi +#sql alter table st_int_0 set tag tagname=-2147483647 +#sql select tagname from st_int_0 +#if $data00 != -2147483647 then +# return -1 +#endi +#sql alter table st_int_0 set tag tagname=+100 +#sql select tagname from st_int_0 +#if $data00 != 100 then +# return -1 +#endi +#sql alter table st_int_0 set tag tagname=-33 +#sql select tagname from st_int_0 +#if $data00 != -33 then +# return -1 +#endi +#sql alter table st_int_0 set tag tagname='+98' +#sql select tagname from st_int_0 +#if $data00 != 98 then +# return -1 +#endi +#sql alter table st_int_0 set tag tagname='-076' +#sql select tagname from st_int_0 +#if $data00 != -76 then +# return -1 +#endi +#sql alter table st_int_0 set tag tagname=+0012 +#sql select tagname from st_int_0 +#if $data00 != 12 then +# return -1 +#endi +#sql alter table st_int_0 set tag tagname=-00063 +#sql select tagname from st_int_0 +#if $data00 != -63 then +# return -1 +#endi ## case 04: illegal input sql_error create table st_int_e0 using mt_int tags (2147483648) diff --git a/tests/script/general/parser/columnValue_smallint.sim b/tests/script/general/parser/columnValue_smallint.sim index bf41087d61..cf34a85a2a 100644 --- a/tests/script/general/parser/columnValue_smallint.sim +++ b/tests/script/general/parser/columnValue_smallint.sim @@ -10,89 +10,89 @@ print ========== smallint sql create table mt_smallint (ts timestamp, c smallint) tags (tagname smallint) ## case 00: static create table for test tag values -sql create table st_smallint_0 using mt_smallint tags (null) -sql describe st_smallint_0 -if $data23 != NULL then +sql create table st_smallint_0 using mt_smallint tags (NULL) +sql select tagname from st_smallint_0 +if $data00 != NULL then return -1 endi sql create table st_smallint_1 using mt_smallint tags (NULL) -sql describe st_smallint_1 -if $data23 != NULL then +sql select tagname from st_smallint_1 +if $data00 != NULL then return -1 endi -sql create table st_smallint_2 using mt_smallint tags ('null') -sql describe st_smallint_2 -if $data23 != NULL then +sql create table st_smallint_2 using mt_smallint tags ('NULL') +sql select tagname from st_smallint_2 +if $data00 != NULL then return -1 endi sql create table st_smallint_3 using mt_smallint tags ('NULL') -sql describe st_smallint_3 -if $data23 != NULL then +sql select tagname from st_smallint_3 +if $data00 != NULL then return -1 endi -sql create table st_smallint_4 using mt_smallint tags ("null") -sql describe st_smallint_4 -if $data23 != NULL then +sql create table st_smallint_4 using mt_smallint tags ("NULL") +sql select tagname from st_smallint_4 +if $data00 != NULL then return -1 endi sql create table st_smallint_5 using mt_smallint tags ("NULL") -sql describe st_smallint_5 -if $data23 != NULL then +sql select tagname from st_smallint_5 +if $data00 != NULL then return -1 endi sql create table st_smallint_6 using mt_smallint tags (-32767) -sql describe st_smallint_6 -if $data23 != -32767 then +sql select tagname from st_smallint_6 +if $data00 != -32767 then return -1 endi sql create table st_smallint_7 using mt_smallint tags (32767) -sql describe st_smallint_7 -if $data23 != 32767 then +sql select tagname from st_smallint_7 +if $data00 != 32767 then return -1 endi sql create table st_smallint_8 using mt_smallint tags (37) -sql describe st_smallint_8 -if $data23 != 37 then +sql select tagname from st_smallint_8 +if $data00 != 37 then return -1 endi sql create table st_smallint_9 using mt_smallint tags (-100) -sql describe st_smallint_9 -if $data23 != -100 then +sql select tagname from st_smallint_9 +if $data00 != -100 then return -1 endi sql create table st_smallint_10 using mt_smallint tags (+113) -sql describe st_smallint_10 -if $data23 != 113 then +sql select tagname from st_smallint_10 +if $data00 != 113 then return -1 endi sql create table st_smallint_11 using mt_smallint tags ('-100') -sql describe st_smallint_11 -if $data23 != -100 then +sql select tagname from st_smallint_11 +if $data00 != -100 then return -1 endi sql create table st_smallint_12 using mt_smallint tags ("+78") -sql describe st_smallint_12 -if $data23 != 78 then +sql select tagname from st_smallint_12 +if $data00 != 78 then return -1 endi sql create table st_smallint_13 using mt_smallint tags (+0078) -sql describe st_smallint_13 -if $data23 != 78 then +sql select tagname from st_smallint_13 +if $data00 != 78 then return -1 endi sql create table st_smallint_14 using mt_smallint tags (-00078) -sql describe st_smallint_14 -if $data23 != -78 then +sql select tagname from st_smallint_14 +if $data00 != -78 then return -1 endi ## case 01: insert values for test column values -sql insert into st_smallint_0 values (now, null) +sql insert into st_smallint_0 values (now, NULL) sql select * from st_smallint_0 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_1 values (now, NULL) @@ -100,15 +100,15 @@ sql select * from st_smallint_1 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_smallint_2 values (now, 'null') +sql insert into st_smallint_2 values (now, 'NULL') sql select * from st_smallint_2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_3 values (now, 'NULL') @@ -116,15 +116,15 @@ sql select * from st_smallint_3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_smallint_4 values (now, "null") +sql insert into st_smallint_4 values (now, "NULL") sql select * from st_smallint_4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_5 values (now, "NULL") @@ -132,7 +132,7 @@ sql select * from st_smallint_5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_6 values (now, 32767) @@ -211,64 +211,64 @@ if $data01 != -56 then endi ## case 02: dynamic create table for test tag values -sql insert into st_smallint_16 using mt_smallint tags (null) values (now, null) -sql describe st_smallint_16 -if $data23 != NULL then +sql insert into st_smallint_16 using mt_smallint tags (NULL) values (now, NULL) +sql select tagname from st_smallint_16 +if $data00 != NULL then return -1 endi sql select * from st_smallint_16 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_17 using mt_smallint tags (NULL) values (now, NULL) -sql describe st_smallint_17 -if $data23 != NULL then +sql select tagname from st_smallint_17 +if $data00 != NULL then return -1 endi sql select * from st_smallint_17 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_smallint_18 using mt_smallint tags ('null') values (now, 'null') -sql describe st_smallint_18 -if $data23 != NULL then +sql insert into st_smallint_18 using mt_smallint tags ('NULL') values (now, 'NULL') +sql select tagname from st_smallint_18 +if $data00 != NULL then return -1 endi sql select * from st_smallint_18 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_19 using mt_smallint tags ('NULL') values (now, 'NULL') -sql describe st_smallint_19 -if $data23 != NULL then +sql select tagname from st_smallint_19 +if $data00 != NULL then return -1 endi sql select * from st_smallint_19 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_smallint_20 using mt_smallint tags ("null") values (now, "null") -sql describe st_smallint_20 -if $data23 != NULL then +sql insert into st_smallint_20 using mt_smallint tags ("NULL") values (now, "NULL") +sql select tagname from st_smallint_20 +if $data00 != NULL then return -1 endi sql select * from st_smallint_20 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_21 using mt_smallint tags ("NULL") values (now, "NULL") -sql describe st_smallint_21 -if $data23 != NULL then +sql select tagname from st_smallint_21 +if $data00 != NULL then return -1 endi sql select * from st_smallint_21 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_smallint_22 using mt_smallint tags (32767) values (now, 32767) -sql describe st_smallint_22 -if $data23 != 32767 then +sql select tagname from st_smallint_22 +if $data00 != 32767 then return -1 endi sql select * from st_smallint_22 @@ -276,8 +276,8 @@ if $data01 != 32767 then return -1 endi sql insert into st_smallint_23 using mt_smallint tags (-32767) values (now, -32767) -sql describe st_smallint_23 -if $data23 != -32767 then +sql select tagname from st_smallint_23 +if $data00 != -32767 then return -1 endi sql select * from st_smallint_23 @@ -285,8 +285,8 @@ if $data01 != -32767 then return -1 endi sql insert into st_smallint_24 using mt_smallint tags (10) values (now, 10) -sql describe st_smallint_24 -if $data23 != 10 then +sql select tagname from st_smallint_24 +if $data00 != 10 then return -1 endi sql select * from st_smallint_24 @@ -294,8 +294,8 @@ if $data01 != 10 then return -1 endi sql insert into st_smallint_25 using mt_smallint tags ("-0") values (now, "-0") -sql describe st_smallint_25 -if $data23 != 0 then +sql select tagname from st_smallint_25 +if $data00 != 0 then return -1 endi sql select * from st_smallint_25 @@ -303,8 +303,8 @@ if $data01 != 0 then return -1 endi sql insert into st_smallint_26 using mt_smallint tags ('123') values (now, '123') -sql describe st_smallint_26 -if $data23 != 123 then +sql select tagname from st_smallint_26 +if $data00 != 123 then return -1 endi sql select * from st_smallint_26 @@ -312,8 +312,8 @@ if $data01 != 123 then return -1 endi sql insert into st_smallint_27 using mt_smallint tags (+056) values (now, +00056) -sql describe st_smallint_27 -if $data23 != 56 then +sql select tagname from st_smallint_27 +if $data00 != 56 then return -1 endi sql select * from st_smallint_27 @@ -321,8 +321,8 @@ if $data01 != 56 then return -1 endi sql insert into st_smallint_28 using mt_smallint tags (-056) values (now, -0056) -sql describe st_smallint_28 -if $data23 != -56 then +sql select tagname from st_smallint_28 +if $data00 != -56 then return -1 endi sql select * from st_smallint_28 @@ -331,46 +331,46 @@ if $data01 != -56 then endi ## case 03: alter tag values -sql alter table st_smallint_0 set tag tagname=32767 -sql describe st_smallint_0 -if $data23 != 32767 then - return -1 -endi -sql alter table st_smallint_0 set tag tagname=-32767 -sql describe st_smallint_0 -if $data23 != -32767 then - return -1 -endi -sql alter table st_smallint_0 set tag tagname=+100 -sql describe st_smallint_0 -if $data23 != 100 then - return -1 -endi -sql alter table st_smallint_0 set tag tagname=-33 -sql describe st_smallint_0 -if $data23 != -33 then - return -1 -endi -sql alter table st_smallint_0 set tag tagname='+98' -sql describe st_smallint_0 -if $data23 != 98 then - return -1 -endi -sql alter table st_smallint_0 set tag tagname='-076' -sql describe st_smallint_0 -if $data23 != -76 then - return -1 -endi -sql alter table st_smallint_0 set tag tagname=+0012 -sql describe st_smallint_0 -if $data23 != 12 then - return -1 -endi -sql alter table st_smallint_0 set tag tagname=-00063 -sql describe st_smallint_0 -if $data23 != -63 then - return -1 -endi +#sql alter table st_smallint_0 set tag tagname=32767 +#sql select tagname from st_smallint_0 +#if $data00 != 32767 then +# return -1 +#endi +#sql alter table st_smallint_0 set tag tagname=-32767 +#sql select tagname from st_smallint_0 +#if $data00 != -32767 then +# return -1 +#endi +#sql alter table st_smallint_0 set tag tagname=+100 +#sql select tagname from st_smallint_0 +#if $data00 != 100 then +# return -1 +#endi +#sql alter table st_smallint_0 set tag tagname=-33 +#sql select tagname from st_smallint_0 +#if $data00 != -33 then +# return -1 +#endi +#sql alter table st_smallint_0 set tag tagname='+98' +#sql select tagname from st_smallint_0 +#if $data00 != 98 then +# return -1 +#endi +#sql alter table st_smallint_0 set tag tagname='-076' +#sql select tagname from st_smallint_0 +#if $data00 != -76 then +# return -1 +#endi +#sql alter table st_smallint_0 set tag tagname=+0012 +#sql select tagname from st_smallint_0 +#if $data00 != 12 then +# return -1 +#endi +#sql alter table st_smallint_0 set tag tagname=-00063 +#sql select tagname from st_smallint_0 +#if $data00 != -63 then +# return -1 +#endi ## case 04: illegal input sql_error create table st_smallint_e0 using mt_smallint tags (32768) diff --git a/tests/script/general/parser/columnValue_tinyint.sim b/tests/script/general/parser/columnValue_tinyint.sim index f0d1b4e0c4..707242a23e 100644 --- a/tests/script/general/parser/columnValue_tinyint.sim +++ b/tests/script/general/parser/columnValue_tinyint.sim @@ -10,89 +10,90 @@ print ========== tinyint sql create table mt_tinyint (ts timestamp, c tinyint) tags (tagname tinyint) ## case 00: static create table for test tag values -sql create table st_tinyint_0 using mt_tinyint tags (null) -sql describe st_tinyint_0 -if $data23 != NULL then +sql create table st_tinyint_0 using mt_tinyint tags (NULL) +sql select tagname from st_tinyint_0 +if $data00 != NULL then + print expect NULL, actually: $data00 return -1 endi sql create table st_tinyint_1 using mt_tinyint tags (NULL) -sql describe st_tinyint_1 -if $data23 != NULL then +sql select tagname from st_tinyint_1 +if $data00 != NULL then return -1 endi -sql create table st_tinyint_2 using mt_tinyint tags ('null') -sql describe st_tinyint_2 -if $data23 != NULL then +sql create table st_tinyint_2 using mt_tinyint tags ('NULL') +sql select tagname from st_tinyint_2 +if $data00 != NULL then return -1 endi sql create table st_tinyint_3 using mt_tinyint tags ('NULL') -sql describe st_tinyint_3 -if $data23 != NULL then +sql select tagname from st_tinyint_3 +if $data00 != NULL then return -1 endi -sql create table st_tinyint_4 using mt_tinyint tags ("null") -sql describe st_tinyint_4 -if $data23 != NULL then +sql create table st_tinyint_4 using mt_tinyint tags ("NULL") +sql select tagname from st_tinyint_4 +if $data00 != NULL then return -1 endi sql create table st_tinyint_5 using mt_tinyint tags ("NULL") -sql describe st_tinyint_5 -if $data23 != NULL then +sql select tagname from st_tinyint_5 +if $data00 != NULL then return -1 endi sql create table st_tinyint_6 using mt_tinyint tags (-127) -sql describe st_tinyint_6 -if $data23 != -127 then +sql select tagname from st_tinyint_6 +if $data00 != -127 then return -1 endi sql create table st_tinyint_7 using mt_tinyint tags (127) -sql describe st_tinyint_7 -if $data23 != 127 then +sql select tagname from st_tinyint_7 +if $data00 != 127 then return -1 endi sql create table st_tinyint_8 using mt_tinyint tags (37) -sql describe st_tinyint_8 -if $data23 != 37 then +sql select tagname from st_tinyint_8 +if $data00 != 37 then return -1 endi sql create table st_tinyint_9 using mt_tinyint tags (-100) -sql describe st_tinyint_9 -if $data23 != -100 then +sql select tagname from st_tinyint_9 +if $data00 != -100 then return -1 endi sql create table st_tinyint_10 using mt_tinyint tags (+113) -sql describe st_tinyint_10 -if $data23 != 113 then +sql select tagname from st_tinyint_10 +if $data00 != 113 then return -1 endi sql create table st_tinyint_11 using mt_tinyint tags ('-100') -sql describe st_tinyint_11 -if $data23 != -100 then +sql select tagname from st_tinyint_11 +if $data00 != -100 then return -1 endi sql create table st_tinyint_12 using mt_tinyint tags ("+78") -sql describe st_tinyint_12 -if $data23 != 78 then +sql select tagname from st_tinyint_12 +if $data00 != 78 then return -1 endi sql create table st_tinyint_13 using mt_tinyint tags (+0078) -sql describe st_tinyint_13 -if $data23 != 78 then +sql select tagname from st_tinyint_13 +if $data00 != 78 then return -1 endi sql create table st_tinyint_14 using mt_tinyint tags (-00078) -sql describe st_tinyint_14 -if $data23 != -78 then +sql select tagname from st_tinyint_14 +if $data00 != -78 then return -1 endi ## case 01: insert values for test column values -sql insert into st_tinyint_0 values (now, null) +sql insert into st_tinyint_0 values (now, NULL) sql select * from st_tinyint_0 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_1 values (now, NULL) @@ -100,15 +101,15 @@ sql select * from st_tinyint_1 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_tinyint_2 values (now, 'null') +sql insert into st_tinyint_2 values (now, 'NULL') sql select * from st_tinyint_2 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_3 values (now, 'NULL') @@ -116,15 +117,15 @@ sql select * from st_tinyint_3 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_tinyint_4 values (now, "null") +sql insert into st_tinyint_4 values (now, "NULL") sql select * from st_tinyint_4 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_5 values (now, "NULL") @@ -132,7 +133,7 @@ sql select * from st_tinyint_5 if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_6 values (now, 127) @@ -211,64 +212,64 @@ if $data01 != -56 then endi ## case 02: dynamic create table for test tag values -sql insert into st_tinyint_16 using mt_tinyint tags (null) values (now, null) -sql describe st_tinyint_16 -if $data23 != NULL then +sql insert into st_tinyint_16 using mt_tinyint tags (NULL) values (now, NULL) +sql select tagname from st_tinyint_16 +if $data00 != NULL then return -1 endi sql select * from st_tinyint_16 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_17 using mt_tinyint tags (NULL) values (now, NULL) -sql describe st_tinyint_17 -if $data23 != NULL then +sql select tagname from st_tinyint_17 +if $data00 != NULL then return -1 endi sql select * from st_tinyint_17 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_tinyint_18 using mt_tinyint tags ('null') values (now, 'null') -sql describe st_tinyint_18 -if $data23 != NULL then +sql insert into st_tinyint_18 using mt_tinyint tags ('NULL') values (now, 'NULL') +sql select tagname from st_tinyint_18 +if $data00 != NULL then return -1 endi sql select * from st_tinyint_18 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_19 using mt_tinyint tags ('NULL') values (now, 'NULL') -sql describe st_tinyint_19 -if $data23 != NULL then +sql select tagname from st_tinyint_19 +if $data00 != NULL then return -1 endi sql select * from st_tinyint_19 -if $data01 != null then +if $data01 != NULL then return -1 endi -sql insert into st_tinyint_20 using mt_tinyint tags ("null") values (now, "null") -sql describe st_tinyint_20 -if $data23 != NULL then +sql insert into st_tinyint_20 using mt_tinyint tags ("NULL") values (now, "NULL") +sql select tagname from st_tinyint_20 +if $data00 != NULL then return -1 endi sql select * from st_tinyint_20 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_21 using mt_tinyint tags ("NULL") values (now, "NULL") -sql describe st_tinyint_21 -if $data23 != NULL then +sql select tagname from st_tinyint_21 +if $data00 != NULL then return -1 endi sql select * from st_tinyint_21 -if $data01 != null then +if $data01 != NULL then return -1 endi sql insert into st_tinyint_22 using mt_tinyint tags (127) values (now, 127) -sql describe st_tinyint_22 -if $data23 != 127 then +sql select tagname from st_tinyint_22 +if $data00 != 127 then return -1 endi sql select * from st_tinyint_22 @@ -276,8 +277,8 @@ if $data01 != 127 then return -1 endi sql insert into st_tinyint_23 using mt_tinyint tags (-127) values (now, -127) -sql describe st_tinyint_23 -if $data23 != -127 then +sql select tagname from st_tinyint_23 +if $data00 != -127 then return -1 endi sql select * from st_tinyint_23 @@ -285,8 +286,8 @@ if $data01 != -127 then return -1 endi sql insert into st_tinyint_24 using mt_tinyint tags (10) values (now, 10) -sql describe st_tinyint_24 -if $data23 != 10 then +sql select tagname from st_tinyint_24 +if $data00 != 10 then return -1 endi sql select * from st_tinyint_24 @@ -294,8 +295,8 @@ if $data01 != 10 then return -1 endi sql insert into st_tinyint_25 using mt_tinyint tags ("-0") values (now, "-0") -sql describe st_tinyint_25 -if $data23 != 0 then +sql select tagname from st_tinyint_25 +if $data00 != 0 then return -1 endi sql select * from st_tinyint_25 @@ -303,8 +304,8 @@ if $data01 != 0 then return -1 endi sql insert into st_tinyint_26 using mt_tinyint tags ('123') values (now, '123') -sql describe st_tinyint_26 -if $data23 != 123 then +sql select tagname from st_tinyint_26 +if $data00 != 123 then return -1 endi sql select * from st_tinyint_26 @@ -312,8 +313,8 @@ if $data01 != 123 then return -1 endi sql insert into st_tinyint_27 using mt_tinyint tags (+056) values (now, +00056) -sql describe st_tinyint_27 -if $data23 != 56 then +sql select tagname from st_tinyint_27 +if $data00 != 56 then return -1 endi sql select * from st_tinyint_27 @@ -321,8 +322,8 @@ if $data01 != 56 then return -1 endi sql insert into st_tinyint_28 using mt_tinyint tags (-056) values (now, -0056) -sql describe st_tinyint_28 -if $data23 != -56 then +sql select tagname from st_tinyint_28 +if $data00 != -56 then return -1 endi sql select * from st_tinyint_28 @@ -331,46 +332,46 @@ if $data01 != -56 then endi ## case 03: alter tag values -sql alter table st_tinyint_0 set tag tagname=127 -sql describe st_tinyint_0 -if $data23 != 127 then - return -1 -endi -sql alter table st_tinyint_0 set tag tagname=-127 -sql describe st_tinyint_0 -if $data23 != -127 then - return -1 -endi -sql alter table st_tinyint_0 set tag tagname=+100 -sql describe st_tinyint_0 -if $data23 != 100 then - return -1 -endi -sql alter table st_tinyint_0 set tag tagname=-33 -sql describe st_tinyint_0 -if $data23 != -33 then - return -1 -endi -sql alter table st_tinyint_0 set tag tagname='+98' -sql describe st_tinyint_0 -if $data23 != 98 then - return -1 -endi -sql alter table st_tinyint_0 set tag tagname='-076' -sql describe st_tinyint_0 -if $data23 != -76 then - return -1 -endi -sql alter table st_tinyint_0 set tag tagname=+0012 -sql describe st_tinyint_0 -if $data23 != 12 then - return -1 -endi -sql alter table st_tinyint_0 set tag tagname=-00063 -sql describe st_tinyint_0 -if $data23 != -63 then - return -1 -endi +#sql alter table st_tinyint_0 set tag tagname=127 +#sql select tagname from st_tinyint_0 +#if $data00 != 127 then +# return -1 +#endi +#sql alter table st_tinyint_0 set tag tagname=-127 +#sql select tagname from st_tinyint_0 +#if $data00 != -127 then +# return -1 +#endi +#sql alter table st_tinyint_0 set tag tagname=+100 +#sql select tagname from st_tinyint_0 +#if $data00 != 100 then +# return -1 +#endi +#sql alter table st_tinyint_0 set tag tagname=-33 +#sql select tagname from st_tinyint_0 +#if $data00 != -33 then +# return -1 +#endi +#sql alter table st_tinyint_0 set tag tagname='+98' +#sql select tagname from st_tinyint_0 +#if $data00 != 98 then +# return -1 +#endi +#sql alter table st_tinyint_0 set tag tagname='-076' +#sql select tagname from st_tinyint_0 +#if $data00 != -76 then +# return -1 +#endi +#sql alter table st_tinyint_0 set tag tagname=+0012 +#sql select tagname from st_tinyint_0 +#if $data00 != 12 then +# return -1 +#endi +#sql alter table st_tinyint_0 set tag tagname=-00063 +#sql select tagname from st_tinyint_0 +#if $data00 != -63 then +# return -1 +#endi ## case 04: illegal input sql_error create table st_tinyint_e0 using mt_tinyint tags (128) diff --git a/tests/script/general/parser/commit.sim b/tests/script/general/parser/commit.sim index eab9497b0b..2b69b1ab8c 100644 --- a/tests/script/general/parser/commit.sim +++ b/tests/script/general/parser/commit.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -23,7 +23,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db rows 255 ablocks 1024 tblocks 512 tables 100 ctime 3600 +sql create database $db maxrows 255 maxtables 100 ctime 3600 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/create_db.sim b/tests/script/general/parser/create_db.sim index b272ef1ddb..8048770198 100644 --- a/tests/script/general/parser/create_db.sim +++ b/tests/script/general/parser/create_db.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -108,10 +108,10 @@ $cache = 4096 # 4 kb $ablocks = 100 $tblocks = 32 # max=512, automatically trimmed when exceeding $ctime = 36000 # 10 hours -$clog = 0 # max=32, automatically trimmed when exceeding +$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 rows $rows_db cache $cache ablocks $ablocks tblocks $tblocks ctime $ctime clog $clog comp $comp +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 show databases if $rows != 1 then return -1 @@ -156,14 +156,14 @@ sql_error create database $db keep 0 #sql_error create database $db keep 3651 # rows [200, 10000] -sql_error create database $db rows 199 -#sql_error create database $db rows 10001 +sql_error create database $db maxrows 199 +#sql_error create database $db maxrows 10001 # cache [100, 10485760] sql_error create database $db cache 99 #sql_error create database $db cache 10485761 -# ablocks [overwriten by 4*sessionsPerVnode, 409600] +# ablocks [overwriten by 4*maxtablesPerVnode, 409600] sql_error create database $db ablocks -1 #sql_error create database $db ablocks 409601 @@ -175,9 +175,9 @@ sql_error create database $db ablocks -1 sql_error create database $db ctime 29 sql_error create database $db ctime 40961 -# clog {0, 1} -sql_error create database $db clog -1 -#sql_error create database $db clog 2 +# wal {0, 1} +sql_error create database $db wal -1 +#sql_error create database $db wal 2 # comp {0, 1, 2} sql_error create database $db comp -1 diff --git a/tests/script/general/parser/create_mt.sim b/tests/script/general/parser/create_mt.sim index 83dd09eb8f..76fb486f1e 100644 --- a/tests/script/general/parser/create_mt.sim +++ b/tests/script/general/parser/create_mt.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -46,7 +46,7 @@ if $rows != 0 then return -1 endi print data00 = $data00 -if $data00 != null then +if $data00 != NULL then return -1 endi print case_insensitivity test passed @@ -172,8 +172,8 @@ sql create table $tb using $mt tags (-1) # -x ng_tag_v # return -1 #ng_tag_v: -sql describe $tb -if $data23 != -1 then +sql select tg from $tb +if $data00 != -1 then return -1 endi sql drop table $tb @@ -182,9 +182,9 @@ sql drop table $tb print create_mt.sim unmatched_tag_types sql reset query cache sql create table $tb using $mt tags ('123') -sql describe $tb -#print data23 = $data23 -if $data23 != 123 then +sql select tg from $tb +print data00 = $data00 +if $data00 != 123 then return -1 endi sql drop table $tb @@ -194,14 +194,14 @@ sql_error create table $tb using $mt tags ('abc') sql drop table if exists $tb sql reset query cache sql create table $tb using $mt tags (1e1) -sql describe $tb -if $data23 != 10 then +sql select tg from $tb +if $data00 != 10 then return -1 endi sql drop table $tb sql create table $tb using $mt tags ('1e1') -sql describe $tb -if $data23 != 10 then +sql select tg from $tb +if $data00 != 10 then return -1 endi sql_error create table $tb using $mt tags (2147483649) @@ -234,13 +234,13 @@ $mt2 = mt2 #if $data20 != $mt2 then # return -1 #endi -#sql describe $mt1 +#sql select tg from $mt1 ##print expected $CN_char ##print returned $data10 #if $data10 != $CN_char then # return -1 #endi -#sql describe $mt2 +#sql select tg from $mt2 ##print expected: $CN_char ##print returned: $data20 #if $data20 != $CN_char then diff --git a/tests/script/general/parser/create_tb.sim b/tests/script/general/parser/create_tb.sim index 5e3007824a..7df7d8a4da 100644 --- a/tests/script/general/parser/create_tb.sim +++ b/tests/script/general/parser/create_tb.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -45,7 +45,7 @@ if $rows != 0 then return -1 endi print data00 = $data00 -if $data00 != null then +if $data00 != NULL then return -1 endi print case_insensitivity test passed @@ -172,7 +172,7 @@ print ========== create_tb.sim case7: table_name_length_exceeds_limit $tbname32 = _32_aaaabbbbccccddddaaaabbbbcccc $tbname64 = _64_aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbcccc $tbname63 = _63_aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbccc -$tbname65 = _65_aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbcccca +$tbname65 = _65_aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbcccca1111111111111111111111111111111111aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa sql create table $tbname32 (ts timestamp, col int) sql insert into $tbname32 values (now, 1) sql create table $tbname64 (ts timestamp, col int) diff --git a/tests/script/general/parser/dbtbnameValidate.sim b/tests/script/general/parser/dbtbnameValidate.sim index c4a789da79..5dea4a09c5 100644 --- a/tests/script/general/parser/dbtbnameValidate.sim +++ b/tests/script/general/parser/dbtbnameValidate.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 1000 sql connect diff --git a/tests/script/general/parser/fill.sim b/tests/script/general/parser/fill.sim index 33286ecfcb..459bc7611e 100644 --- a/tests/script/general/parser/fill.sim +++ b/tests/script/general/parser/fill.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -390,7 +390,7 @@ sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $ sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1) sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1') # fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24 -# fill values into binary or nchar columns will be set to null automatically Note:2018-10-24 +# fill values into binary or nchar columns will be set to NULL automatically Note:2018-10-24 sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1') sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true) sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true') @@ -649,25 +649,25 @@ endi if $data01 != 1 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data41 != 1 then return -1 endi -if $data51 != null then +if $data51 != NULL then return -1 endi if $data61 != 1 then return -1 endi -if $data71 != null then +if $data71 != NULL then return -1 endi if $data81 != 1 then @@ -686,25 +686,25 @@ endi if $data01 != 0.000000000 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi if $data21 != 1.000000000 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data41 != 2.000000000 then return -1 endi -if $data51 != null then +if $data51 != NULL then return -1 endi if $data61 != 3.000000000 then return -1 endi -if $data71 != null then +if $data71 != NULL then return -1 endi if $data81 != 4.000000000 then @@ -719,25 +719,25 @@ endi if $data01 != 0 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != null then +if $data51 != NULL then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != null then +if $data71 != NULL then return -1 endi if $data81 != 4 then @@ -752,25 +752,25 @@ endi if $data01 != 0 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != null then +if $data51 != NULL then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != null then +if $data71 != NULL then return -1 endi if $data81 != 4 then @@ -785,25 +785,25 @@ endi if $data01 != 0 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != null then +if $data51 != NULL then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != null then +if $data71 != NULL then return -1 endi if $data81 != 4 then @@ -818,25 +818,25 @@ endi if $data01 != 0 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi if $data21 != 1 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data41 != 2 then return -1 endi -if $data51 != null then +if $data51 != NULL then return -1 endi if $data61 != 3 then return -1 endi -if $data71 != null then +if $data71 != NULL then return -1 endi if $data81 != 4 then diff --git a/tests/script/general/parser/fill_stb.sim b/tests/script/general/parser/fill_stb.sim index 8fecaeb4c4..113f4b68a4 100644 --- a/tests/script/general/parser/fill_stb.sim +++ b/tests/script/general/parser/fill_stb.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -68,7 +68,7 @@ $tsu = $tsu + $ts0 #### fill test cases for stables -# null values in each group +# NULL values in each group #sql select count(*) from $stb where ts >= '2018-09-16 00:00:00.000' and ts <= $tsu interval(1d) fill(prev) group by t1 #$val = $tbNum * 2 #if rows != $val then @@ -227,7 +227,7 @@ sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1) sql select first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1') # fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24 -# fill values into binary or nchar columns will be set to null automatically Note:2018-10-24 +# fill values into binary or nchar columns will be set to NULL automatically Note:2018-10-24 sql_error select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1') sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true) sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true') @@ -283,13 +283,13 @@ endi if $data08 != 0 then return -1 endi -if $data15 != null then +if $data15 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi if $data18 != 0 then @@ -313,16 +313,16 @@ endi if $data07 != nchar0 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi if $data08 != 5 then @@ -341,7 +341,7 @@ endi if $data07 != nchar0 then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi @@ -359,16 +359,16 @@ endi if $data01 != 0 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi if $data09 != 5 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi if $data19 != 5 then @@ -386,17 +386,17 @@ endi ## NULL fill print fill(NULL) -sql select max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 interval(5m) fill(value, null) group by t1 limit 5 +sql select max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 interval(5m) fill(value, NULL) group by t1 limit 5 if $rows != 25 then return -1 endi if $data01 != 0 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi if $data06 != 1 then @@ -405,16 +405,16 @@ endi if $data09 != 5 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi if $data19 != 5 then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data59 != 6 then diff --git a/tests/script/general/parser/first_last.sim b/tests/script/general/parser/first_last.sim index b5133ed9a1..d2586ce04a 100644 --- a/tests/script/general/parser/first_last.sim +++ b/tests/script/general/parser/first_last.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -21,7 +21,9 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db rows 400 cache 4096 tables 4 + +sql create database $db maxrows 400 cache 1 maxTables 4 + 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) @@ -69,7 +71,7 @@ sql import into $tb (ts) values ( $ts ) print ====== test data created -run lite/parser/first_last_query.sim +run general/parser/first_last_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -79,5 +81,5 @@ print ================== server restart completed sql connect sleep 3000 -run lite/parser/first_last_query.sim +run general/parser/first_last_query.sim diff --git a/tests/script/general/parser/first_last_query.sim b/tests/script/general/parser/first_last_query.sim index 2a10e09db4..c6237198c5 100644 --- a/tests/script/general/parser/first_last_query.sim +++ b/tests/script/general/parser/first_last_query.sim @@ -40,27 +40,27 @@ print data03 = $data03 if $data03 != 0.00000 then return -1 endi -#if $data04 != null then +#if $data04 != NULL then if $data04 != 0.000000000 then return -1 endi -#if $data05 != null then +#if $data05 != NULL then if $data05 != 0 then return -1 endi -#if $data06 != null then +#if $data06 != NULL then if $data06 != 0 then return -1 endi -#if $data07 != null then +#if $data07 != NULL then if $data07 != 1 then return -1 endi -#if $data08 != null then if $data08 != BINARY then + print expect BINARY, actual: $data08 return -1 endi -#if $data09 != null then +#if $data09 != NULL then if $data09 != NCHAR then return -1 endi diff --git a/tests/script/general/parser/groupby.sim b/tests/script/general/parser/groupby.sim index 4d367999b2..5bf41772ed 100644 --- a/tests/script/general/parser/groupby.sim +++ b/tests/script/general/parser/groupby.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 1000 sql connect @@ -28,7 +28,7 @@ $tstart = 100000 sql drop database if exits $db -x step1 step1: -sql create database if not exists $db tables 4 keep 36500 +sql create database if not exists $db maxTables 4 keep 36500 sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12)) diff --git a/tests/script/general/parser/import.sim b/tests/script/general/parser/import.sim index 465f077fec..7ab0437685 100644 --- a/tests/script/general/parser/import.sim +++ b/tests/script/general/parser/import.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/import_commit1.sim b/tests/script/general/parser/import_commit1.sim index a1bc057aef..fde0698c33 100644 --- a/tests/script/general/parser/import_commit1.sim +++ b/tests/script/general/parser/import_commit1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -23,7 +23,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db cache 2048 +sql create database $db cache 16 print ====== create tables sql use $db diff --git a/tests/script/general/parser/import_commit2.sim b/tests/script/general/parser/import_commit2.sim index c02905a2d5..2c49aa7eca 100644 --- a/tests/script/general/parser/import_commit2.sim +++ b/tests/script/general/parser/import_commit2.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -22,7 +22,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db cache 2048 +sql create database $db cache 16 print ====== create tables sql use $db diff --git a/tests/script/general/parser/import_commit3.sim b/tests/script/general/parser/import_commit3.sim index c37ecd9a17..7ed5045b9a 100644 --- a/tests/script/general/parser/import_commit3.sim +++ b/tests/script/general/parser/import_commit3.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -22,7 +22,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db cache 16384 +sql create database $db cache 16 print ====== create tables sql use $db diff --git a/tests/script/general/parser/import_file.sim b/tests/script/general/parser/import_file.sim index f0fef295c4..cd63612a0e 100644 --- a/tests/script/general/parser/import_file.sim +++ b/tests/script/general/parser/import_file.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 2000 sql connect diff --git a/tests/script/general/parser/insert_multiTbl.sim b/tests/script/general/parser/insert_multiTbl.sim index 503ab7e1da..b24c1b629f 100644 --- a/tests/script/general/parser/insert_multiTbl.sim +++ b/tests/script/general/parser/insert_multiTbl.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 2000 sql connect diff --git a/tests/script/general/parser/insert_tb.sim b/tests/script/general/parser/insert_tb.sim index c69228d662..4f2c5fcc78 100644 --- a/tests/script/general/parser/insert_tb.sim +++ b/tests/script/general/parser/insert_tb.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -218,10 +218,10 @@ if $data46 != @quoted double@ then return -1 endi -# case: support null char of the binary field [TBASE-660] -sql create table nullb (ts timestamp, c1 binary(20), c2 binary(20), c3 float) -sql insert into nullb values ('2018-09-17 09:00:00.000', '', '', 3.746) -sql select * from nullb +# case: support NULL char of the binary field [TBASE-660] +sql create table NULLb (ts timestamp, c1 binary(20), c2 binary(20), c3 float) +sql insert into NULLb values ('2018-09-17 09:00:00.000', '', '', 3.746) +sql select * from NULLb if $rows != 1 then return -1 endi diff --git a/tests/script/general/parser/interp.sim b/tests/script/general/parser/interp.sim index 78369ec84c..c7c633d422 100644 --- a/tests/script/general/parser/interp.sim +++ b/tests/script/general/parser/interp.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -56,7 +56,7 @@ while $i < $halfNum endw print ====== tables created -run lite/parser/interp_test.sim +run general/parser/interp_test.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -64,4 +64,4 @@ sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -run lite/parser/interp_test.sim +run general/parser/interp_test.sim diff --git a/tests/script/general/parser/interp_test.sim b/tests/script/general/parser/interp_test.sim index 03e6997321..3e6d5de85b 100644 --- a/tests/script/general/parser/interp_test.sim +++ b/tests/script/general/parser/interp_test.sim @@ -87,7 +87,7 @@ $tb = $tbPrefix . 0 ### illegal queries on a table sql_error select interp(ts), c1 from $tb where ts = $ts0 sql_error select interp(ts) from $tb where ts >= $ts0 - sql_error select interp(ts), max(c1), min(c2), count(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(null) + sql_error select interp(ts), max(c1), min(c2), count(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(NULL) ### interp from tb + fill $t = $ts0 + 1000 @@ -107,7 +107,7 @@ $tb = $tbPrefix . 0 return -1 endi - ## fill(null) + ## fill(NULL) $t = $tsu - 1000 sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from $tb where ts = $t fill(value, NULL) order by ts asc if $rows != 1 then @@ -116,31 +116,31 @@ $tb = $tbPrefix . 0 if $data00 != @18-11-25 19:29:59.000@ then return -1 endi - if $data01 != null then + if $data01 != NULL then return -1 endi - if $data02 != null then + if $data02 != NULL then return -1 endi - if $data03 != null then + if $data03 != NULL then return -1 endi - if $data04 != null then + if $data04 != NULL then return -1 endi - if $data05 != null then + if $data05 != NULL then return -1 endi - if $data06 != null then + if $data06 != NULL then return -1 endi - if $data07 != null then + if $data07 != NULL then return -1 endi - if $data08 != null then + if $data08 != NULL then return -1 endi - if $data09 != null then + if $data09 != NULL then return -1 endi @@ -209,7 +209,7 @@ $tb = $tbPrefix . 0 if $data01 != 0 then return -1 endi - if $data02 != null then + if $data02 != NULL then return -1 endi if $data03 != 0.00000 then @@ -254,13 +254,13 @@ $tb = $tbPrefix . 0 if $data06 != 0 then return -1 endi - if $data07 != null then + if $data07 != NULL then return -1 endi - if $data08 != null then + if $data08 != NULL then return -1 endi - if $data09 != null then + if $data09 != NULL then return -1 endi # columns contain NULL values @@ -276,13 +276,13 @@ $tb = $tbPrefix . 0 if $data01 != 0 then return -1 endi - if $data02 != null then + if $data02 != NULL then return -1 endi if $data03 != 0.00167 then return -1 endi - if $data04 != null then + if $data04 != NULL then return -1 endi if $data05 != 0 then @@ -291,13 +291,13 @@ $tb = $tbPrefix . 0 if $data06 != 0 then return -1 endi - if $data07 != null then + if $data07 != NULL then return -1 endi - if $data08 != null then + if $data08 != NULL then return -1 endi - if $data09 != null then + if $data09 != NULL then return -1 endi @@ -346,13 +346,13 @@ $tb = $tbPrefix . 0 if $data01 != 0 then return -1 endi - if $data02 != null then + if $data02 != NULL then return -1 endi if $data03 != 0.00000 then return -1 endi - if $data04 != null then + if $data04 != NULL then return -1 endi if $data05 != 0 then @@ -413,10 +413,10 @@ $tb = $tbPrefix . 0 if $data07 != 1 then return -1 endi - if $data08 != null then + if $data08 != NULL then return -1 endi - if $data09 != null then + if $data09 != NULL then return -1 endi @@ -454,7 +454,7 @@ $tb = $tbPrefix . 0 if $data09 != nchar0 then return -1 endi - # table has null columns + # table has NULL columns sql select interp(ts), interp(c1), interp(c2), interp(c3), interp(c4), interp(c5), interp(c6), interp(c7), interp(c8), interp(c9) from intp_tb3 where ts = $ts0 fill(value, -1, -2, -3) if $rows != 1 then return -1 @@ -465,13 +465,13 @@ $tb = $tbPrefix . 0 if $data01 != 0 then return -1 endi - if $data02 != null then + if $data02 != NULL then return -1 endi if $data03 != 0.00000 then return -1 endi - if $data04 != null then + if $data04 != NULL then return -1 endi @@ -521,10 +521,10 @@ $tb = $tbPrefix . 0 if $data08 != intp_tb0 then return -1 endi - if $data22 != null then + if $data22 != NULL then return -1 endi - if $data24 != null then + if $data24 != NULL then return -1 endi if $data28 != intp_tb2 then @@ -558,51 +558,51 @@ $tb = $tbPrefix . 0 if $data21 != 0 then return -1 endi - if $data22 != null then + if $data22 != NULL then return -1 endi - if $data24 != null then + if $data24 != NULL then return -1 endi ## interp(*) from stb + group by + fill(none) $t = $ts0 + 1000 - sql select interp(*) from $stb where ts = $t fill(null) group by tbname + sql select interp(*) from $stb where ts = $t fill(NULL) group by tbname if $rows != $tbNum then return -1 endi if $data00 != @18-09-17 09:00:01.000@ then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi -if $data23 != null then +if $data23 != NULL then return -1 endi -if $data34 != null then +if $data34 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data16 != null then +if $data16 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi -if $data09 != null then +if $data09 != NULL then return -1 endi -sql select interp(*) from $stb where ts = $ts0 fill(null) group by tbname +sql select interp(*) from $stb where ts = $ts0 fill(NULL) group by tbname print $rows if $rows != 4 then @@ -619,10 +619,10 @@ endi if $data21 != 0 then return -1 endi -if $data22 != null then +if $data22 != NULL then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi @@ -670,13 +670,13 @@ endi if $data21 != 0 then return -1 endi - if $data22 != null then + if $data22 != NULL then return -1 endi if $data23 != 0.00000 then return -1 endi - if $data24 != null then + if $data24 != NULL then return -1 endi if $data25 != 0 then @@ -724,13 +724,13 @@ endi if $data06 != 0 then return -1 endi - if $data07 != null then + if $data07 != NULL then return -1 endi - if $data08 != null then + if $data08 != NULL then return -1 endi - if $data09 != null then + if $data09 != NULL then return -1 endi if $data20 != @18-09-17 09:00:01.000@ then @@ -739,13 +739,13 @@ endi if $data21 != 0 then return -1 endi - if $data22 != null then + if $data22 != NULL then return -1 endi if $data23 != 0.00167 then return -1 endi - if $data24 != null then + if $data24 != NULL then return -1 endi if $data25 != 0 then @@ -754,13 +754,13 @@ endi if $data26 != 0 then return -1 endi - if $data27 != null then + if $data27 != NULL then return -1 endi - if $data28 != null then + if $data28 != NULL then return -1 endi - if $data29 != null then + if $data29 != NULL then return -1 endi @@ -796,10 +796,10 @@ endi if $data07 != 1 then return -1 endi - if $data08 != null then + if $data08 != NULL then return -1 endi - if $data09 != null then + if $data09 != NULL then return -1 endi if $data20 != @18-09-17 09:00:01.000@ then @@ -826,9 +826,9 @@ endi if $data27 != 1 then return -1 endi - if $data28 != null then + if $data28 != NULL then return -1 endi - if $data29 != null then + if $data29 != NULL then return -1 endi diff --git a/tests/script/general/parser/join.sim b/tests/script/general/parser/join.sim index b90579d8d8..6addcb1ac1 100644 --- a/tests/script/general/parser/join.sim +++ b/tests/script/general/parser/join.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c debugFlag -v 135 system sh/cfg.sh -n dnode1 -c rpcDebugFlag -v 135 system sh/exec.sh -n dnode1 -s start @@ -24,7 +24,7 @@ $tstart = 100000 sql drop database if exits $db -x step1 step1: -sql create database if not exists $db tables 4 keep 36500 +sql create database if not exists $db maxTables 4 keep 36500 sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12)) diff --git a/tests/script/general/parser/join_multivnode.sim b/tests/script/general/parser/join_multivnode.sim index 983b7fad45..86488ea844 100644 --- a/tests/script/general/parser/join_multivnode.sim +++ b/tests/script/general/parser/join_multivnode.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sql connect sleep 1000 @@ -22,7 +22,7 @@ $tstart = 100000 sql drop database if exits $db -x step1 step1: -sql create database if not exists $db tables 4 keep 36500 +sql create database if not exists $db maxTables 4 keep 36500 sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12)) diff --git a/tests/script/general/parser/lastrow.sim b/tests/script/general/parser/lastrow.sim index 50317c7abc..5eb3b144a6 100644 --- a/tests/script/general/parser/lastrow.sim +++ b/tests/script/general/parser/lastrow.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -21,7 +21,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db tables 4 +sql create database $db maxTables 4 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) @@ -57,7 +57,7 @@ endw print ====== test data created -run lite/parser/lastrow_query.sim +run general/parser/lastrow_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -67,4 +67,4 @@ print ================== server restart completed sql connect sleep 3000 -run lite/parser/lastrow_query.sim +run general/parser/lastrow_query.sim diff --git a/tests/script/general/parser/lastrow_query.sim b/tests/script/general/parser/lastrow_query.sim index 3ff0426dcd..a5e003fb65 100644 --- a/tests/script/general/parser/lastrow_query.sim +++ b/tests/script/general/parser/lastrow_query.sim @@ -27,7 +27,7 @@ endi if $data01 != 1439 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi if $data03 != 1439.00000 then diff --git a/tests/script/general/parser/limit.sim b/tests/script/general/parser/limit.sim index 16b2a2878c..8f00912a59 100644 --- a/tests/script/general/parser/limit.sim +++ b/tests/script/general/parser/limit.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -56,8 +56,8 @@ while $i < $halfNum endw print ====== tables created -run lite/parser/limit_tb.sim -run lite/parser/limit_stb.sim +run general/parser/limit_tb.sim +run general/parser/limit_stb.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -67,5 +67,5 @@ print ================== server restart completed sql connect sleep 3000 -run lite/parser/limit_tb.sim -run lite/parser/limit_stb.sim +run general/parser/limit_tb.sim +run general/parser/limit_stb.sim diff --git a/tests/script/general/parser/limit1.sim b/tests/script/general/parser/limit1.sim index 9856365f8e..040b6303de 100644 --- a/tests/script/general/parser/limit1.sim +++ b/tests/script/general/parser/limit1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -56,8 +56,8 @@ while $i < $halfNum endw print ====== tables created -run lite/parser/limit1_tb.sim -run lite/parser/limit1_stb.sim +run general/parser/limit1_tb.sim +run general/parser/limit1_stb.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -65,5 +65,5 @@ sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -run lite/parser/limit1_tb.sim -run lite/parser/limit1_stb.sim +run general/parser/limit1_tb.sim +run general/parser/limit1_stb.sim diff --git a/tests/script/general/parser/limit1_stb.sim b/tests/script/general/parser/limit1_stb.sim index b9ba90ef50..e69d6ab14f 100644 --- a/tests/script/general/parser/limit1_stb.sim +++ b/tests/script/general/parser/limit1_stb.sim @@ -62,13 +62,13 @@ endi if $data01 != 9 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi if $data03 != 9.00000 then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi if $data05 != 9 then @@ -130,13 +130,13 @@ endi if $data11 != 0 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi if $data13 != 0.00000 then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi if $data15 != 0 then @@ -261,13 +261,13 @@ endi if $data01 != 0 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi if $data23 != 2.00000 then return -1 endi -if $data34 != null then +if $data34 != NULL then return -1 endi if $data45 != 4 then @@ -428,7 +428,7 @@ endi if $data26 != 1 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data42 != 4.500000000 then @@ -458,7 +458,7 @@ endi if $data00 != 9 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi if $data12 != 4.500000000 then diff --git a/tests/script/general/parser/limit1_tb.sim b/tests/script/general/parser/limit1_tb.sim index a9484d10db..8ed21a47e6 100644 --- a/tests/script/general/parser/limit1_tb.sim +++ b/tests/script/general/parser/limit1_tb.sim @@ -111,16 +111,16 @@ endi if $data09 != nchar0 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi @@ -543,7 +543,7 @@ endi if $data14 != 8.000000000 then return -1 endi -if $data21 != null then +if $data21 != NULL then return -1 endi @@ -613,7 +613,7 @@ endi if $data21 != 7.000000000 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5), avg(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 diff --git a/tests/script/general/parser/limit1_tblocks100.sim b/tests/script/general/parser/limit1_tblocks100.sim index b89b7892d4..a776459640 100644 --- a/tests/script/general/parser/limit1_tblocks100.sim +++ b/tests/script/general/parser/limit1_tblocks100.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -56,8 +56,8 @@ while $i < $halfNum endw print ====== tables created -run lite/parser/limit1_tb.sim -run lite/parser/limit1_stb.sim +run general/parser/limit1_tb.sim +run general/parser/limit1_stb.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -65,5 +65,5 @@ sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -run lite/parser/limit1_tb.sim -run lite/parser/limit1_stb.sim +run general/parser/limit1_tb.sim +run general/parser/limit1_stb.sim diff --git a/tests/script/general/parser/limit2.sim b/tests/script/general/parser/limit2.sim index 71f1c6f2e8..cc9334db36 100644 --- a/tests/script/general/parser/limit2.sim +++ b/tests/script/general/parser/limit2.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c rowsInFileBlock -v 255 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -65,7 +65,7 @@ while $i < $halfNum endw print ====== tables created -#run lite/parser/limit2_query.sim +#run general/parser/limit2_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -73,4 +73,4 @@ sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -run lite/parser/limit2_query.sim +run general/parser/limit2_query.sim diff --git a/tests/script/general/parser/limit2_query.sim b/tests/script/general/parser/limit2_query.sim index d5b4d3e5ff..57cd13abee 100644 --- a/tests/script/general/parser/limit2_query.sim +++ b/tests/script/general/parser/limit2_query.sim @@ -166,13 +166,13 @@ endi if $data47 != 1 then return -1 endi -if $data57 != null then +if $data57 != NULL then return -1 endi if $data68 != binary3 then return -1 endi -if $data79 != null then +if $data79 != NULL then return -1 endi @@ -216,10 +216,10 @@ endi if $data09 != nchar5 then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi -if $data19 != null then +if $data19 != NULL then return -1 endi if $data16 != -2.000000000 then @@ -269,10 +269,10 @@ endi if $data27 != 1 then return -1 endi -if $data38 != null then +if $data38 != NULL then return -1 endi -if $data49 != null then +if $data49 != NULL then return -1 endi diff --git a/tests/script/general/parser/limit2_tblocks100.sim b/tests/script/general/parser/limit2_tblocks100.sim index a91103270d..64f86edd28 100644 --- a/tests/script/general/parser/limit2_tblocks100.sim +++ b/tests/script/general/parser/limit2_tblocks100.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c rowsInFileBlock -v 255 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -65,7 +65,7 @@ while $i < $halfNum endw print ====== tables created -#run lite/parser/limit2_query.sim +#run general/parser/limit2_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -73,4 +73,4 @@ sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -run lite/parser/limit2_query.sim +run general/parser/limit2_query.sim diff --git a/tests/script/general/parser/limit_stb.sim b/tests/script/general/parser/limit_stb.sim index 3e3c75ddac..c6a3766b7d 100644 --- a/tests/script/general/parser/limit_stb.sim +++ b/tests/script/general/parser/limit_stb.sim @@ -117,13 +117,13 @@ endi if $data01 != 9 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi if $data03 != 9.00000 then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi if $data05 != 9 then @@ -185,13 +185,13 @@ endi if $data11 != 0 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi if $data13 != 0.00000 then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi if $data15 != 0 then @@ -405,7 +405,7 @@ endi if $data28 != 4 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi if $data47 != nchar0 then @@ -427,7 +427,7 @@ endi if $data00 != 9 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi if $data02 != 4.500000000 then @@ -726,16 +726,16 @@ endi if $data00 != @18-09-17 09:10:00.000@ then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi if $data09 != 5 then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi if $data19 != 5 then @@ -747,13 +747,13 @@ endi if $data24 != 0 then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi if $data28 != 1 then diff --git a/tests/script/general/parser/limit_tb.sim b/tests/script/general/parser/limit_tb.sim index 8fee85cece..00d49b556f 100644 --- a/tests/script/general/parser/limit_tb.sim +++ b/tests/script/general/parser/limit_tb.sim @@ -111,16 +111,16 @@ endi if $data09 != nchar0 then return -1 endi -if $data11 != null then +if $data11 != NULL then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi -if $data14 != null then +if $data14 != NULL then return -1 endi @@ -537,7 +537,7 @@ endi if $data14 != 8.000000000 then return -1 endi -if $data21 != null then +if $data21 != NULL then return -1 endi @@ -554,7 +554,7 @@ endi if $data21 != 9 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi @@ -574,7 +574,7 @@ endi if $data31 != 9 then return -1 endi -if $data41 != null then +if $data41 != NULL then return -1 endi sql select sum(c1), sum(c2), sum(c3), sum(c4), sum(c5), sum(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 5 offset 1 @@ -590,7 +590,7 @@ endi if $data21 != 9 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi @@ -607,7 +607,7 @@ endi if $data21 != 7.000000000 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5), avg(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 @@ -623,7 +623,7 @@ endi if $data21 != 9.000000000 then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi diff --git a/tests/script/general/parser/mixed_blocks.sim b/tests/script/general/parser/mixed_blocks.sim index 29f6d2a742..77838774df 100644 --- a/tests/script/general/parser/mixed_blocks.sim +++ b/tests/script/general/parser/mixed_blocks.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -22,7 +22,7 @@ sql drop database if exists $db $paramRows = 200 $rowNum = $paramRows * 4 $rowNum = $rowNum / 5 -sql create database $db rows $paramRows tables 4 +sql create database $db maxrows $paramRows maxTables 4 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 bool, c6 binary(10), c7 nchar(10)) tags(t1 int) diff --git a/tests/script/general/parser/nchar.sim b/tests/script/general/parser/nchar.sim index 51853825c1..fbdc12446a 100644 --- a/tests/script/general/parser/nchar.sim +++ b/tests/script/general/parser/nchar.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/parser/null_char.sim b/tests/script/general/parser/null_char.sim index 225c7b6cb7..e4f6c5f849 100644 --- a/tests/script/general/parser/null_char.sim +++ b/tests/script/general/parser/null_char.sim @@ -2,65 +2,64 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 3 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 3 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 3 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect -print ========== null_char.sim +print ========== NULL_char.sim $db = db sql drop database if exists $db sql create database $db sql use $db -#### case 0: field null, or 'null' +#### case 0: field NULL, or 'NULL' sql create table mt1 (ts timestamp, col1 int, col2 bigint, col3 float, col4 double, col5 binary(8), col6 bool, col7 smallint, col8 tinyint, col9 nchar(8)) tags (tag1 binary(8), tag2 nchar(8), tag3 int, tag4 bigint, tag5 bool, tag6 float) -sql create table st1 using mt1 tags (null, 'null', 100, 1000, 'false', 9.123) +sql create table st1 using mt1 tags (NULL, 'NULL', 100, 1000, 'false', 9.123) sql insert into st1 values ('2019-01-01 09:00:00.000', 123, -123, 3.0, 4.0, 'binary', true, 1000, 121, 'nchar') sql insert into st1 values ('2019-01-01 09:00:01.000', '456', '456', '3.33', '4.444', 'binary', 'true', '1001', '122', 'nchar') -sql insert into st1 values ('2019-01-01 09:00:02.000', null, null, null, null, null, null, null, null, null) -sql insert into st1 values ('2019-01-01 09:00:03.000', null, null, null, null, 'null', 'null', 2002, 127, 'null') +sql insert into st1 values ('2019-01-01 09:00:02.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) +sql insert into st1 values ('2019-01-01 09:00:03.000', NULL, NULL, NULL, NULL, 'NULL', 'NULL', 2002, 127, 'NULL') sql select * from mt1 if $rows != 4 then return -1 endi -if $data21 != null then +if $data21 != NULL then return -1 endi -if $data22 != null then +if $data22 != NULL then return -1 endi -if $data23 != null then +if $data23 != NULL then return -1 endi -if $data24 != null then +if $data24 != NULL then return -1 endi -if $data25 != null then +if $data25 != NULL then return -1 endi -if $data26 != null then +if $data26 != NULL then return -1 endi -if $data27 != null then +if $data27 != NULL then return -1 endi -if $data28 != null then +if $data28 != NULL then return -1 endi -if $data29 != null then +if $data29 != NULL then return -1 endi -if $data31 != null then +if $data31 != NULL then return -1 endi -if $data32 != null then +if $data32 != NULL then return -1 endi #if $data33 != 0.00000 then @@ -71,20 +70,20 @@ endi # print === expect 0.00000, actually $data34 # return -1 #endi -if $data35 != null then +if $data35 != NULL then return -1 endi -if $data36 != null then +if $data36 != NULL then return -1 endi -if $data39 != null then +if $data39 != NULL then return -1 endi -#### case 1: tag null, or 'null' +#### case 1: tag NULL, or 'NULL' sql create table mt2 (ts timestamp, col1 int, col3 float, col5 binary(8), col6 bool, col9 nchar(8)) tags (tag1 binary(8), tag2 nchar(8), tag3 int, tag5 bool) -sql create table st2 using mt2 tags (null, 'null', 102, 'true') +sql create table st2 using mt2 tags (NULL, 'NULL', 102, 'true') sql describe st2 if $rows != 10 then return -1 @@ -93,7 +92,7 @@ if $data63 != NULL then print ==1== expect: NULL, actually: $data63 return -1 endi -if $data73 != null then +if $data73 != NULL then print ==2== expect: NULL, actually: $data73 return -1 endi @@ -128,7 +127,7 @@ endi ### bool: sql_error create table stx using mt2 tags ('NULL', '123aBc', 104, '123') sql_error create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz') -sql create table st4 using mt2 tags ('NULL', '123aBc', 104, 'null') +sql create table st4 using mt2 tags ('NULL', '123aBc', 104, 'NULL') sql describe st4 if $rows != 10 then return -1 @@ -169,9 +168,9 @@ endi #### case 2: dynamic create table using super table when insert into sql create table mt3 (ts timestamp, col1 int, col3 float, col5 binary(8), col6 bool, col9 nchar(8)) tags (tag1 binary(8), tag2 nchar(8), tag3 int, tag5 bool) -sql_error insert into st31 using mt3 tags (null, 'null', 102, 'true') values (now+1s, 31, 31, 'bin_31', '123', 'nchar_31') +sql_error insert into st31 using mt3 tags (NULL, 'NULL', 102, 'true') values (now+1s, 31, 31, 'bin_31', '123', 'nchar_31') sql_error insert into st32 using mt3 tags (NULL, 'ABC', 103, 'FALSE') values (now+2s, 32, 32.12345, 'bin_32', 'abc', 'nchar_32') -sql_error insert into st33 using mt3 tags ('NULL', '123aBc', 104, 'null') values (now+3s, 33, 33, 'bin_33', 'false123', 'nchar_33') +sql_error insert into st33 using mt3 tags ('NULL', '123aBc', 104, 'NULL') values (now+3s, 33, 33, 'bin_33', 'false123', 'nchar_33') sql_error insert into st34 using mt3 tags ('NULL', '123aBc', 105, NULL) values (now+4s, 34, 34.12345, 'bin_34', 'true123', 'nchar_34') @@ -215,9 +214,9 @@ sql alter table st41 set tag tag_binary = "" #if $data23 != $tagvalue then # return -1 #endi -sql alter table st41 set tag tag_binary = "null" +sql alter table st41 set tag tag_binary = "NULL" sql describe st41 -if $data23 != null then +if $data23 != NULL then return -1 endi sql alter table st41 set tag tag_binary = NULL @@ -243,9 +242,9 @@ sql alter table st41 set tag tag_nchar = '' #if $data33 != $tagvalue then # return -1 #endi -sql alter table st41 set tag tag_nchar = "null" +sql alter table st41 set tag tag_nchar = "NULL" sql describe st41 -if $data33 != null then +if $data33 != NULL then return -1 endi sql alter table st41 set tag tag_nchar = NULL @@ -280,13 +279,13 @@ sql describe st41 if $data43 != -2000 then return -1 endi -sql alter table st41 set tag tag_int = null +sql alter table st41 set tag tag_int = NULL sql describe st41 if $data43 != NULL then print ==10== expect: NULL, actually: $data43 return -1 endi -sql alter table st41 set tag tag_int = 'null' +sql alter table st41 set tag tag_int = 'NULL' sql_error alter table st41 set tag tag_int = '' sql_error alter table st41 set tag tag_int = abc379 @@ -311,13 +310,13 @@ sql describe st41 if $data53 != true then return -1 endi -sql alter table st41 set tag tag_bool = 'null' +sql alter table st41 set tag tag_bool = 'NULL' sql describe st41 if $data53 != NULL then print ==14== expect: NULL, actually: $data53 return -1 endi -sql alter table st41 set tag tag_bool = null +sql alter table st41 set tag tag_bool = NULL sql describe st41 if $data53 != NULL then return -1 @@ -351,13 +350,13 @@ if $data63 != 54.123455 then print ==11== expect: 54.123455, actually : $data63 return -1 endi -sql alter table st41 set tag tag_float = null +sql alter table st41 set tag tag_float = NULL sql describe st41 if $data63 != NULL then print ==12== expect: NULL, actually : $data63 return -1 endi -sql alter table st41 set tag tag_float = 'null' +sql alter table st41 set tag tag_float = 'NULL' sql describe st41 if $data63 != NULL then print ==17== expect: NULL, actually : $data63 @@ -397,13 +396,13 @@ sql describe st41 if $data73 != -2456.000000 then return -1 endi -sql alter table st41 set tag tag_double = null +sql alter table st41 set tag tag_double = NULL sql describe st41 if $data73 != NULL then print ==13== expect: NULL, actually : $data73 return -1 endi -sql alter table st41 set tag tag_double = 'null' +sql alter table st41 set tag tag_double = 'NULL' sql describe st41 if $data73 != NULL then print ==20== expect: NULL, actually : $data73 @@ -421,7 +420,7 @@ sql create table mt5 (ts timestamp, c1 int) tags (tag_bigint bigint, tag_smallin sql create table st51 using mt5 tags (1, 2, 3) sql alter table st51 set tag tag_bigint = '-379' sql alter table st51 set tag tag_bigint = -2000 -sql alter table st51 set tag tag_bigint = null +sql alter table st51 set tag tag_bigint = NULL sql alter table st51 set tag tag_bigint = 9223372036854775807 sql describe st51 if $data23 != 9223372036854775807 then @@ -440,13 +439,13 @@ endi sql_error alter table st51 set tag tag_bigint = -9223372036854775808 -sql alter table st51 set tag tag_bigint = 'null' +sql alter table st51 set tag tag_bigint = 'NULL' sql_error alter table st51 set tag tag_bigint = '' sql_error alter table st51 set tag tag_bigint = abc379 #### sql alter table st51 set tag tag_smallint = -2000 -sql alter table st51 set tag tag_smallint = null +sql alter table st51 set tag tag_smallint = NULL sql alter table st51 set tag tag_smallint = 32767 sql describe st51 if $data33 != 32767 then @@ -461,13 +460,13 @@ if $data33 != -32767 then endi sql_error alter table st51 set tag tag_smallint = -32768 -sql alter table st51 set tag tag_smallint = 'null' +sql alter table st51 set tag tag_smallint = 'NULL' sql_error alter table st51 set tag tag_smallint = '' sql_error alter table st51 set tag tag_smallint = abc379 #### sql alter table st51 set tag tag_tinyint = -127 -sql alter table st51 set tag tag_tinyint = null +sql alter table st51 set tag tag_tinyint = NULL sql alter table st51 set tag tag_tinyint = 127 sql describe st51 if $data43 != 127 then @@ -480,7 +479,7 @@ if $data43 != -127 then endi sql_error alter table st51 set tag tag_tinyint = '-128' sql_error alter table st51 set tag tag_tinyint = 128 -sql alter table st51 set tag tag_tinyint = 'null' +sql alter table st51 set tag tag_tinyint = 'NULL' sql_error alter table st51 set tag tag_tinyint = '' sql_error alter table st51 set tag tag_tinyint = abc379 diff --git a/tests/script/general/parser/projection_limit_offset.sim b/tests/script/general/parser/projection_limit_offset.sim index 21c2151b77..4b10694190 100644 --- a/tests/script/general/parser/projection_limit_offset.sim +++ b/tests/script/general/parser/projection_limit_offset.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -22,7 +22,7 @@ $tstart = 100000 sql drop database if exits $db -x step1 step1: -sql create database if not exists $db tables 4 keep 36500 +sql create database if not exists $db maxTables 4 keep 36500 sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12)) @@ -344,11 +344,11 @@ if $data11 != 1 then return -1 endi -if $data12 != null then +if $data12 != NULL then return -1 endi -if $data13 != null then +if $data13 != NULL then return -1 endi diff --git a/tests/script/general/parser/repeatAlter.sim b/tests/script/general/parser/repeatAlter.sim index eec82f62c0..5f6a8e6a2a 100644 --- a/tests/script/general/parser/repeatAlter.sim +++ b/tests/script/general/parser/repeatAlter.sim @@ -2,6 +2,6 @@ $i = 1 $loops = 10 while $i <= $loops print ====== repeat: $i - run lite/parser/alter.sim + run general/parser/alter.sim $i = $i + 1 endw diff --git a/tests/script/general/parser/repeatStream.sim b/tests/script/general/parser/repeatStream.sim index 1301462c31..bd631e36a1 100644 --- a/tests/script/general/parser/repeatStream.sim +++ b/tests/script/general/parser/repeatStream.sim @@ -2,6 +2,6 @@ $i = 1 $repeats = 5 while $i <= $repeats print ====== repeat: $i - run lite/parser/stream.sim + run general/parser/stream.sim $i = $i + 1 endw diff --git a/tests/script/general/parser/selectResNum.sim b/tests/script/general/parser/selectResNum.sim index dd06d26521..0a4eafc8a0 100644 --- a/tests/script/general/parser/selectResNum.sim +++ b/tests/script/general/parser/selectResNum.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/select_across_vnodes.sim b/tests/script/general/parser/select_across_vnodes.sim index 67c727ef28..883d4d59cd 100644 --- a/tests/script/general/parser/select_across_vnodes.sim +++ b/tests/script/general/parser/select_across_vnodes.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 5 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 5 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/parser/select_from_cache_disk.sim b/tests/script/general/parser/select_from_cache_disk.sim index 9450d41720..04cc68c310 100644 --- a/tests/script/general/parser/select_from_cache_disk.sim +++ b/tests/script/general/parser/select_from_cache_disk.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/parser/select_with_tags.sim b/tests/script/general/parser/select_with_tags.sim index 92e30bc914..181d7f312a 100644 --- a/tests/script/general/parser/select_with_tags.sim +++ b/tests/script/general/parser/select_with_tags.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 1000 sql connect @@ -23,7 +23,7 @@ $tstart = 100000 sql drop database if exists $db -x step1 step1: -sql create database if not exists $db tables 4 keep 36500 +sql create database if not exists $db maxTables 4 keep 36500 sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12)) diff --git a/tests/script/general/parser/set_tag_vals.sim b/tests/script/general/parser/set_tag_vals.sim index 62fef45846..de29c28ba3 100644 --- a/tests/script/general/parser/set_tag_vals.sim +++ b/tests/script/general/parser/set_tag_vals.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -87,7 +87,7 @@ if $rows != 0 then return -1 endi -print ================== set tag to null +print ================== set tag to NULL sql create table stb1_tg (ts timestamp, c1 int) tags(t1 int,t2 bigint,t3 double,t4 float,t5 smallint,t6 tinyint) sql create table stb2_tg (ts timestamp, c1 int) tags(t1 bool,t2 binary(10), t3 nchar(10)) sql create table tb1_tg1 using stb1_tg tags(1,2,3,4,5,6) @@ -195,33 +195,33 @@ sql select * from stb1_tg if $rows != 1 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi sql select * from stb2_tg -if $data02 != null then +if $data02 != NULL then return -1 endi print $data03 -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi diff --git a/tests/script/general/parser/single_row_in_tb.sim b/tests/script/general/parser/single_row_in_tb.sim index 1a159d97fd..5ee65e3b10 100644 --- a/tests/script/general/parser/single_row_in_tb.sim +++ b/tests/script/general/parser/single_row_in_tb.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -15,7 +15,7 @@ $db = $dbPrefix $stb = $stbPrefix sql drop database if exists $db -sql create database $db rows 200 tables 4 +sql create database $db rows 200 maxTables 4 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 bool, c6 binary(10), c7 nchar(10)) tags(t1 int) @@ -27,7 +27,7 @@ sql create table $tb1 using $stb tags( 1 ) sql insert into $tb1 values ( $ts0 , 1, 2, 3, 4, true, 'binay10', '涛思nchar10' ) print ====== tables created -run lite/parser/single_row_in_tb_query.sim +run general/parser/single_row_in_tb_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -35,4 +35,4 @@ sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -run lite/parser/single_row_in_tb_query.sim +run general/parser/single_row_in_tb_query.sim diff --git a/tests/script/general/parser/slimit.sim b/tests/script/general/parser/slimit.sim index 61abf1eb2a..017e8d4d2e 100644 --- a/tests/script/general/parser/slimit.sim +++ b/tests/script/general/parser/slimit.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -22,7 +22,7 @@ $db = $dbPrefix . $i $stb = $stbPrefix . $i sql drop database if exists $db -sql create database $db rows 200 cache 1024 tblocks 200 tables 4 +sql create database $db maxrows 200 cache 1024 tblocks 200 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) @@ -57,14 +57,14 @@ while $i < $tbNum $x = $x + 1 endw $ts = $ts + $delta - sql insert into $tb values ( $ts , null, null, null, null, null, null, null, null, null ) + sql insert into $tb values ( $ts , NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) $i = $i + 1 endw print ====== $db tables created $db = $dbPrefix . 1 sql drop database if exists $db -sql create database $db rows 200 cache 1024 +sql create database $db maxrows 200 cache 1024 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) @@ -87,14 +87,14 @@ while $i < $tbNum while $x < $rowNum $xs = $x * $delta $ts = $ts0 + $xs - sql insert into $tb values ( $ts , null , null , null , null , null , null , null , null , null ) + sql insert into $tb values ( $ts , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL ) $x = $x + 1 endw $i = $i + 1 endw print ====== $db tables created -run lite/parser/slimit_query.sim +run general/parser/slimit_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -104,4 +104,4 @@ print ================== server restart completed sql connect sleep 3000 -run lite/parser/slimit_query.sim +run general/parser/slimit_query.sim diff --git a/tests/script/general/parser/slimit1.sim b/tests/script/general/parser/slimit1.sim index d034d5bf17..3dbe9f0a06 100644 --- a/tests/script/general/parser/slimit1.sim +++ b/tests/script/general/parser/slimit1.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 10 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -18,7 +18,7 @@ $delta = 600000 $db = $dbPrefix sql drop database if exists $db -sql create database $db rows 200 +sql create database $db maxrows 200 sql use $db sql create table stb (ts timestamp, c1 int, c2 bigint, c3 double) tags(t1 int, t2 int) @@ -53,7 +53,7 @@ endw print ================== tables and data created -run lite/parser/slimit1_query.sim +run general/parser/slimit1_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -63,4 +63,4 @@ print ================== server restart completed sql connect sleep 3000 -run lite/parser/slimit1_query.sim +run general/parser/slimit1_query.sim diff --git a/tests/script/general/parser/slimit_alter_tags.sim b/tests/script/general/parser/slimit_alter_tags.sim index 6579549287..5c62482802 100644 --- a/tests/script/general/parser/slimit_alter_tags.sim +++ b/tests/script/general/parser/slimit_alter_tags.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 10 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -18,7 +18,7 @@ $delta = 600000 $db = $dbPrefix sql drop database if exists $db -sql create database $db rows 200 +sql create database $db maxrows 200 sql use $db sql create table stb (ts timestamp, c1 int, c2 bigint, c3 double) tags(t1 int, t2 int) diff --git a/tests/script/general/parser/slimit_query.sim b/tests/script/general/parser/slimit_query.sim index 7735b1b84b..655bc5f8be 100644 --- a/tests/script/general/parser/slimit_query.sim +++ b/tests/script/general/parser/slimit_query.sim @@ -219,10 +219,10 @@ endi if $data13 != -2.000000000 then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data19 != slm_tb6 then @@ -293,10 +293,10 @@ endi if $data13 != -2.000000000 then return -1 endi -if $data17 != null then +if $data17 != NULL then return -1 endi -if $data18 != null then +if $data18 != NULL then return -1 endi if $data19 != slm_tb5 then diff --git a/tests/script/general/parser/stream.sim b/tests/script/general/parser/stream.sim index b3334d970e..c4be6efa1c 100644 --- a/tests/script/general/parser/stream.sim +++ b/tests/script/general/parser/stream.sim @@ -1,9 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 5 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 5 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 5 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/stream_on_sys.sim b/tests/script/general/parser/stream_on_sys.sim index aa3595eaf6..b7bf7a8900 100644 --- a/tests/script/general/parser/stream_on_sys.sim +++ b/tests/script/general/parser/stream_on_sys.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c monitor -v 1 system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 system sh/exec.sh -n dnode1 -s start diff --git a/tests/script/general/parser/tags_dynamically_specifiy.sim b/tests/script/general/parser/tags_dynamically_specifiy.sim index ca8d335742..af514d1a07 100644 --- a/tests/script/general/parser/tags_dynamically_specifiy.sim +++ b/tests/script/general/parser/tags_dynamically_specifiy.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/tags_filter.sim b/tests/script/general/parser/tags_filter.sim index bc6c6c52f0..42e8c8f9f9 100644 --- a/tests/script/general/parser/tags_filter.sim +++ b/tests/script/general/parser/tags_filter.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/tbnameIn.sim b/tests/script/general/parser/tbnameIn.sim index 38551dd59e..548560e945 100644 --- a/tests/script/general/parser/tbnameIn.sim +++ b/tests/script/general/parser/tbnameIn.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -64,7 +64,7 @@ while $i < $halfNum endw print ====== tables created -run lite/parser/tbnameIn_query.sim +run general/parser/tbnameIn_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -72,4 +72,4 @@ sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -run lite/parser/tbnameIn_query.sim +run general/parser/tbnameIn_query.sim diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index 402ed19918..aaf8979337 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -1,92 +1,113 @@ -run general/parser/alter.sim +# run general/parser/alter.sim +# sleep 2000 +# run general/parser/alter1.sim +# sleep 2000 +# run general/parser/alter_stable.sim +# sleep 2000 +# run general/parser/auto_create_tb.sim +# sleep 2000 +# run general/parser/auto_create_tb_drop_tb.sim +# sleep 2000 + +run general/parser/binary_escapeCharacter.sim sleep 2000 -run general/parser/alter1.sim -sleep 2000 -run general/parser/alter_stable.sim -sleep 2000 -run general/parser/auto_create_tb.sim -sleep 2000 -run general/parser/auto_create_tb_drop_tb.sim +run general/parser/bug.sim sleep 2000 run general/parser/col_arithmetic_operation.sim sleep 2000 -run general/parser/columnValue.sim +run general/parser/columnValue_bigint.sim sleep 2000 -run general/parser/commit.sim -run general/parser/create_db.sim +run general/parser/columnValue_bool.sim sleep 2000 -run general/parser/create_mt.sim +run general/parser/columnValue_double.sim sleep 2000 -run general/parser/create_tb.sim +run general/parser/columnValue_float.sim sleep 2000 -run general/parser/dbtbnameValidate.sim -sleep 2000 -run general/parser/fill.sim -sleep 2000 -run general/parser/fill_stb.sim -sleep 2000 -run general/parser/first_last.sim -sleep 2000 -run general/parser/import_commit1.sim -sleep 2000 -run general/parser/import_commit2.sim -sleep 2000 -run general/parser/import_commit3.sim -sleep 2000 -run general/parser/import_file.sim -sleep 2000 -run general/parser/insert_tb.sim -sleep 2000 -run general/parser/tags_dynamically_specifiy.sim -sleep 2000 -run general/parser/interp.sim -run general/parser/lastrow.sim -sleep 2000 -run general/parser/limit.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/nchar.sim -sleep 2000 -run general/parser/null_char.sim -sleep 2000 -run general/parser/selectResNum.sim -sleep 2000 -run general/parser/select_across_vnodes.sim +run general/parser/columnValue_int.sim sleep 2000 + +# sleep 2000 +# run general/parser/col_arithmetic_operation.sim +# sleep 2000 +# run general/parser/columnValue.sim +# sleep 2000 +# run general/parser/commit.sim +# run general/parser/create_db.sim +# sleep 2000 +# run general/parser/create_mt.sim +# sleep 2000 +# run general/parser/create_tb.sim +# sleep 2000 +# run general/parser/dbtbnameValidate.sim +# sleep 2000 +# run general/parser/fill.sim +# sleep 2000 +# run general/parser/fill_stb.sim +# sleep 2000 +# run general/parser/first_last.sim +# sleep 2000 +# run general/parser/import_commit1.sim +# sleep 2000 +# run general/parser/import_commit2.sim +# sleep 2000 +# run general/parser/import_commit3.sim +# sleep 2000 +# run general/parser/import_file.sim +# sleep 2000 +# run general/parser/insert_tb.sim +# sleep 2000 +# run general/parser/tags_dynamically_specifiy.sim +# sleep 2000 +# run general/parser/interp.sim +# run general/parser/lastrow.sim +# sleep 2000 +# run general/parser/limit.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/nchar.sim +# sleep 2000 +# run general/parser/null_char.sim +# sleep 2000 +# run general/parser/selectResNum.sim +# sleep 2000 +# run general/parser/select_across_vnodes.sim +# sleep 2000 run general/parser/select_from_cache_disk.sim sleep 2000 -run general/parser/set_tag_vals.sim -sleep 2000 -run general/parser/single_row_in_tb.sim -sleep 2000 -run general/parser/slimit.sim -sleep 2000 +# run general/parser/set_tag_vals.sim +# sleep 2000 +# run general/parser/single_row_in_tb.sim +# sleep 2000 +# run general/parser/slimit.sim +# sleep 2000 run general/parser/slimit1.sim sleep 2000 -run general/parser/slimit_alter_tags.sim +run general/parser/slimit1_query.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 -#run general/parser/repeatAlter.sim -sleep 2000 -#run general/parser/repeatStream.sim -sleep 2000 -run general/parser/join.sim -run general/parser/join_multivnode.sim -run general/parser/projection_limit_offset.sim -sleep 2000 -run general/parser/select_with_tags.sim -run general/parser/groupby.sim +# 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 +# #run general/parser/repeatAlter.sim +# sleep 2000 +# #run general/parser/repeatStream.sim +# sleep 2000 +# run general/parser/join.sim +# run general/parser/join_multivnode.sim +# run general/parser/projection_limit_offset.sim +# sleep 2000 +# run general/parser/select_with_tags.sim +# run general/parser/groupby.sim diff --git a/tests/script/general/parser/timestamp.sim b/tests/script/general/parser/timestamp.sim index 8d407dd5cc..fbe0f24a47 100644 --- a/tests/script/general/parser/timestamp.sim +++ b/tests/script/general/parser/timestamp.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -21,7 +21,7 @@ $db = $dbPrefix . $i $stb = $stbPrefix . $i sql drop database if exists $db -sql create database $db rows 200 cache 1024 tblocks 200 tables 4 +sql create database $db maxrows 200 cache 1024 tblocks 200 maxTables 4 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 timestamp, c2 int) tags(t1 binary(20)) @@ -49,12 +49,12 @@ while $i < $tbNum $x = $x + 1 endw $ts = $ts + $delta - sql insert into $tb values ( $ts , null, null ) + sql insert into $tb values ( $ts , NULL, NULL ) $i = $i + 1 endw print ====== $db tables created -run lite/parser/timestamp_query.sim +run general/parser/timestamp_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -64,4 +64,4 @@ print ================== server restart completed sql connect sleep 3000 -run lite/parser/timestamp_query.sim +run general/parser/timestamp_query.sim diff --git a/tests/script/general/parser/where.sim b/tests/script/general/parser/where.sim index 05237c392b..fb3a0a69e7 100644 --- a/tests/script/general/parser/where.sim +++ b/tests/script/general/parser/where.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -21,7 +21,7 @@ $mt = $mtPrefix . $i sql drop database if exits $db -x step1 step1: -sql create database if not exists $db tables 4 +sql create database if not exists $db maxTables 4 sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int) @@ -228,47 +228,47 @@ if $data11 != @19-01-01 09:10:00.000@ then return -1 endi -sql create table tb_where_null (ts timestamp, c1 float, c2 binary(10)) -sql insert into tb_where_null values ('2019-01-01 09:00:00.000', 1, 'val1') -sql insert into tb_where_null values ('2019-01-01 09:00:01.000', NULL, NULL) -sql insert into tb_where_null values ('2019-01-01 09:00:02.000', 2, 'val2') -sql_error select * from tb_where_null where c1 = NULL -sql_error select * from tb_where_null where c1 <> NULL -sql_error select * from tb_where_null where c1 < NULL -sql select * from tb_where_null where c1 = "NULL" +sql create table tb_where_NULL (ts timestamp, c1 float, c2 binary(10)) +sql insert into tb_where_NULL values ('2019-01-01 09:00:00.000', 1, 'val1') +sql insert into tb_where_NULL values ('2019-01-01 09:00:01.000', NULL, NULL) +sql insert into tb_where_NULL values ('2019-01-01 09:00:02.000', 2, 'val2') +sql_error select * from tb_where_NULL where c1 = NULL +sql_error select * from tb_where_NULL where c1 <> NULL +sql_error select * from tb_where_NULL where c1 < NULL +sql select * from tb_where_NULL where c1 = "NULL" if $rows != 0 then return -1 endi -sql select * from tb_where_null where c1 <> "NULL" +sql select * from tb_where_NULL where c1 <> "NULL" if $rows != 2 then return -1 endi -sql select * from tb_where_null where c1 <> "nulL" +sql select * from tb_where_NULL where c1 <> "nulL" if $rows != 2 then return -1 endi -sql select * from tb_where_null where c1 > "NULL" +sql select * from tb_where_NULL where c1 > "NULL" if $rows != 0 then return -1 endi -sql select * from tb_where_null where c1 >= "NULL" +sql select * from tb_where_NULL where c1 >= "NULL" if $rows != 0 then return -1 endi -sql select * from tb_where_null where c2 = "NULL" +sql select * from tb_where_NULL where c2 = "NULL" if $rows != 0 then return -1 endi -sql select * from tb_where_null where c2 <> "NULL" +sql select * from tb_where_NULL where c2 <> "NULL" if $rows != 2 then return -1 endi -sql select * from tb_where_null where c2 <> "nUll" +sql select * from tb_where_NULL where c2 <> "nUll" if $rows != 2 then return -1 endi diff --git a/tests/script/general/show/dnodes.sim b/tests/script/general/show/dnodes.sim deleted file mode 100644 index 4609138325..0000000000 --- a/tests/script/general/show/dnodes.sim +++ /dev/null @@ -1,16 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/exec.sh -n dnode1 -s start -sql connect - -print =============== unsupport -sql_error create dnode $hostname2 -sql_error drop dnode $hostname2 - -print =============== show dnodes -sql show dnodes; -if $rows != 1 then - return -1 -endi - -print $data00 $data01 $data02 diff --git a/tests/script/general/metrics/disk.sim b/tests/script/general/stable/disk.sim similarity index 95% rename from tests/script/general/metrics/disk.sim rename to tests/script/general/stable/disk.sim index 421b5f7c6a..0865719a14 100644 --- a/tests/script/general/metrics/disk.sim +++ b/tests/script/general/stable/disk.sim @@ -2,9 +2,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +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 sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -24,7 +24,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -194,4 +194,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/metrics/metrics.sim b/tests/script/general/stable/metrics.sim similarity index 93% rename from tests/script/general/metrics/metrics.sim rename to tests/script/general/stable/metrics.sim index f0864034de..b9367469b3 100644 --- a/tests/script/general/metrics/metrics.sim +++ b/tests/script/general/stable/metrics.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +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 sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -135,3 +133,5 @@ sql show databases if $rows != 0 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/stable/testSuite.sim b/tests/script/general/stable/testSuite.sim new file mode 100644 index 0000000000..a3696c8706 --- /dev/null +++ b/tests/script/general/stable/testSuite.sim @@ -0,0 +1,4 @@ +run general/stable/disk.sim +run general/stable/metrics.sim +run general/stable/values.sim +run general/stable/vnode3.sim diff --git a/tests/script/general/metrics/values.sim b/tests/script/general/stable/values.sim similarity index 97% rename from tests/script/general/metrics/values.sim rename to tests/script/general/stable/values.sim index aa5aecd6ac..f524eee411 100644 --- a/tests/script/general/metrics/values.sim +++ b/tests/script/general/stable/values.sim @@ -2,9 +2,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +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 sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -102,25 +102,4 @@ 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/metrics/vnode3.sim b/tests/script/general/stable/vnode3.sim similarity index 94% rename from tests/script/general/metrics/vnode3.sim rename to tests/script/general/stable/vnode3.sim index a2642ac7e8..73be7a1195 100644 --- a/tests/script/general/metrics/vnode3.sim +++ b/tests/script/general/stable/vnode3.sim @@ -2,9 +2,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +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 sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -24,7 +24,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -175,4 +175,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/agg/stream.sim b/tests/script/general/stream/agg_stream.sim similarity index 99% rename from tests/script/general/agg/stream.sim rename to tests/script/general/stream/agg_stream.sim index 2217c39430..814438ac74 100644 --- a/tests/script/general/agg/stream.sim +++ b/tests/script/general/stream/agg_stream.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 print ========== step1 system sh/cfg.sh -n dnode1 -c monitor -v 1 diff --git a/tests/script/general/column/stream.sim b/tests/script/general/stream/column_stream.sim similarity index 99% rename from tests/script/general/column/stream.sim rename to tests/script/general/stream/column_stream.sim index 6972e34197..cb94904ff2 100644 --- a/tests/script/general/column/stream.sim +++ b/tests/script/general/stream/column_stream.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 print ========== step1 system sh/cfg.sh -n dnode1 -c monitor -v 1 diff --git a/tests/script/general/stream/metrics_1.sim b/tests/script/general/stream/metrics_1.sim index 2e8d02bf21..c60bde6b2f 100644 --- a/tests/script/general/stream/metrics_1.sim +++ b/tests/script/general/stream/metrics_1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/stream/metrics_del.sim b/tests/script/general/stream/metrics_del.sim index 7ca74dc102..c856871e93 100644 --- a/tests/script/general/stream/metrics_del.sim +++ b/tests/script/general/stream/metrics_del.sim @@ -1,10 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c numOfBlocksPerMeter -v 4 -system sh/cfg.sh -n dnode1 -c pointsPerCompBlock -v 100 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 1024 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -87,12 +84,12 @@ $st = $stPrefix . c3 sql select * from $st print ===> select * from $st print ===> $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data01 != null then +if $data01 != NULL then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi diff --git a/tests/script/general/stream/metrics_n.sim b/tests/script/general/stream/metrics_n.sim index 31f9fc64ff..47089403dd 100644 --- a/tests/script/general/stream/metrics_n.sim +++ b/tests/script/general/stream/metrics_n.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/stream/metrics_replica1_vnoden.sim b/tests/script/general/stream/metrics_replica1_vnoden.sim index 76ffd99d89..13cd18adf3 100644 --- a/tests/script/general/stream/metrics_replica1_vnoden.sim +++ b/tests/script/general/stream/metrics_replica1_vnoden.sim @@ -2,9 +2,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/cache/new_stream.sim b/tests/script/general/stream/new_stream.sim similarity index 91% rename from tests/script/general/cache/new_stream.sim rename to tests/script/general/stream/new_stream.sim index 23904a0210..8aa0a89870 100644 --- a/tests/script/general/cache/new_stream.sim +++ b/tests/script/general/stream/new_stream.sim @@ -2,9 +2,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 10 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 10 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/cache/restart_stream.sim b/tests/script/general/stream/restart_stream.sim similarity index 91% rename from tests/script/general/cache/restart_stream.sim rename to tests/script/general/stream/restart_stream.sim index b119dcf856..aa16934f33 100644 --- a/tests/script/general/cache/restart_stream.sim +++ b/tests/script/general/stream/restart_stream.sim @@ -2,9 +2,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 1 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 1 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -98,9 +97,8 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 1 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 1 system sh/exec.sh -n dnode1 -s start print =============== step5 diff --git a/tests/script/general/stream/stream_1.sim b/tests/script/general/stream/stream_1.sim index bb2d4a05a5..2309d341c1 100644 --- a/tests/script/general/stream/stream_1.sim +++ b/tests/script/general/stream/stream_1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/stream/stream_2.sim b/tests/script/general/stream/stream_2.sim index d0fa60ff90..13aac98337 100644 --- a/tests/script/general/stream/stream_2.sim +++ b/tests/script/general/stream/stream_2.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -185,10 +185,10 @@ print select * from $st => $data01 $data02, $data03 if $data01 != 200 then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi diff --git a/tests/script/general/stream/stream_3.sim b/tests/script/general/stream/stream_3.sim index 3e7d574cd4..914ecd8484 100644 --- a/tests/script/general/stream/stream_3.sim +++ b/tests/script/general/stream/stream_3.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -108,10 +108,7 @@ print =============== step7 system sh/exec.sh -n dnode1 -s stop system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c numOfBlocksPerMeter -v 4 -system sh/cfg.sh -n dnode1 -c pointsPerCompBlock -v 100 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 1024 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 4000 diff --git a/tests/script/general/stream/stream_restart.sim b/tests/script/general/stream/stream_restart.sim index f37fbf471d..d5fbef4908 100644 --- a/tests/script/general/stream/stream_restart.sim +++ b/tests/script/general/stream/stream_restart.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/stream/table_1.sim b/tests/script/general/stream/table_1.sim index be45a98f49..efc7c370ca 100644 --- a/tests/script/general/stream/table_1.sim +++ b/tests/script/general/stream/table_1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/stream/table_del.sim b/tests/script/general/stream/table_del.sim index a2db5b250d..66fd58308f 100644 --- a/tests/script/general/stream/table_del.sim +++ b/tests/script/general/stream/table_del.sim @@ -1,10 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c numOfBlocksPerMeter -v 4 -system sh/cfg.sh -n dnode1 -c pointsPerCompBlock -v 100 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 1024 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -82,12 +79,12 @@ $st = $stPrefix . c3 sql select * from $st print ===> select * from $st print ===> $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -if $data01 != null then +if $data01 != NULL then return -1 endi -if $data02 != null then +if $data02 != NULL then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi diff --git a/tests/script/general/stream/table_n.sim b/tests/script/general/stream/table_n.sim index 49e8e723da..e6037c5292 100644 --- a/tests/script/general/stream/table_n.sim +++ b/tests/script/general/stream/table_n.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/stream/table_replica1_vnoden.sim b/tests/script/general/stream/table_replica1_vnoden.sim index 1ed649a3fb..44d4008dbd 100644 --- a/tests/script/general/stream/table_replica1_vnoden.sim +++ b/tests/script/general/stream/table_replica1_vnoden.sim @@ -2,9 +2,9 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/table/autocreate.sim b/tests/script/general/table/autocreate.sim index eac153e3c2..02910c2737 100644 --- a/tests/script/general/table/autocreate.sim +++ b/tests/script/general/table/autocreate.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database @@ -100,3 +101,5 @@ sql select * from db.s4 if $rows != 3 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/table/basic1.sim b/tests/script/general/table/basic1.sim index 0e425c95f9..e8d0cd7bd8 100644 --- a/tests/script/general/table/basic1.sim +++ b/tests/script/general/table/basic1.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database @@ -69,3 +70,4 @@ if $data21 != 3 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/table/basic2.sim b/tests/script/general/table/basic2.sim index 40688403a8..d1678e8abd 100644 --- a/tests/script/general/table/basic2.sim +++ b/tests/script/general/table/basic2.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== one table @@ -65,3 +66,4 @@ if $data21 != 3 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/table/basic3.sim b/tests/script/general/table/basic3.sim index 18c3f9b625..ded00e153a 100644 --- a/tests/script/general/table/basic3.sim +++ b/tests/script/general/table/basic3.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start +sleep 3000 sql connect print =============== create database @@ -69,3 +70,11 @@ if $data21 != 3 then return -1 endi +print =============== drop stable +sql drop table db.st +sql show db.stables +if $rows != 0 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/table/bigint.sim b/tests/script/general/table/bigint.sim index 4145968fbd..dd61d25ef9 100644 --- a/tests/script/general/table/bigint.sim +++ b/tests/script/general/table/bigint.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -71,3 +69,5 @@ sql show databases if $rows != 0 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/table/binary.sim b/tests/script/general/table/binary.sim index b0c5166d20..cdbfcd4cbf 100644 --- a/tests/script/general/table/binary.sim +++ b/tests/script/general/table/binary.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -61,3 +59,5 @@ sql show databases if $rows != 0 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/table/bool.sim b/tests/script/general/table/bool.sim index b55147b67e..fbb6fe823c 100644 --- a/tests/script/general/table/bool.sim +++ b/tests/script/general/table/bool.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -90,3 +88,5 @@ sql show databases if $rows != 0 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/table/column2.sim b/tests/script/general/table/column2.sim index 4c27ae68ad..9251e31daa 100644 --- a/tests/script/general/table/column2.sim +++ b/tests/script/general/table/column2.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -23,4 +21,6 @@ sql drop database db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/column_name.sim b/tests/script/general/table/column_name.sim index 41a4179a41..0b09f65129 100644 --- a/tests/script/general/table/column_name.sim +++ b/tests/script/general/table/column_name.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -85,6 +83,4 @@ if $rows != 0 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/table/column_num.sim b/tests/script/general/table/column_num.sim index bf82b9fc05..d1091528b2 100644 --- a/tests/script/general/table/column_num.sim +++ b/tests/script/general/table/column_num.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -83,3 +81,5 @@ sql show databases if $rows != 0 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/table/column_value.sim b/tests/script/general/table/column_value.sim index 2a1636e5ca..bd98d3b290 100644 --- a/tests/script/general/table/column_value.sim +++ b/tests/script/general/table/column_value.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -77,6 +75,4 @@ if $rows != 0 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/table/date.sim b/tests/script/general/table/date.sim index f702a55750..2e73a217a6 100644 --- a/tests/script/general/table/date.sim +++ b/tests/script/general/table/date.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -88,3 +86,5 @@ sql show databases if $rows != 0 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/table/db.table.sim b/tests/script/general/table/db.table.sim index 653a73310f..50224f83b5 100644 --- a/tests/script/general/table/db.table.sim +++ b/tests/script/general/table/db.table.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -44,4 +42,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/delete_reuse1.sim b/tests/script/general/table/delete_reuse1.sim index 1f42637088..94f5bdb287 100644 --- a/tests/script/general/table/delete_reuse1.sim +++ b/tests/script/general/table/delete_reuse1.sim @@ -1,18 +1,13 @@ system sh/stop_dnodes.sh - - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c 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 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 numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -87,3 +82,5 @@ while $x < 20 print ===> loop times: $x endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/delete_reuse2.sim b/tests/script/general/table/delete_reuse2.sim index 238eac975d..1a9c80cff0 100644 --- a/tests/script/general/table/delete_reuse2.sim +++ b/tests/script/general/table/delete_reuse2.sim @@ -1,18 +1,13 @@ system sh/stop_dnodes.sh - - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c 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 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 numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -89,3 +84,5 @@ while $x < 20 print ===> loop times: $x endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/table/delete_writing.sim b/tests/script/general/table/delete_writing.sim index b697c7f841..73d028928f 100644 --- a/tests/script/general/table/delete_writing.sim +++ b/tests/script/general/table/delete_writing.sim @@ -1,18 +1,13 @@ system sh/stop_dnodes.sh - - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c 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 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 numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -40,7 +35,7 @@ sql create table db.tb (ts timestamp, i int) sql insert into db.tb values(now, 1) print ======== start back -run_back lite/table/back_insert.sim +run_back general/table/back_insert.sim sleep 1000 print ======== step1 @@ -57,3 +52,5 @@ while $x < 20 $x = $x + 1 endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/describe.sim b/tests/script/general/table/describe.sim index fd9a8eda18..ebec004f19 100644 --- a/tests/script/general/table/describe.sim +++ b/tests/script/general/table/describe.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -47,4 +45,5 @@ sql show databases if $rows != 0 then return -1 endi - \ No newline at end of file + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/double.sim b/tests/script/general/table/double.sim index 36013be51d..10239568fe 100644 --- a/tests/script/general/table/double.sim +++ b/tests/script/general/table/double.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -96,3 +94,5 @@ sql show databases if $rows != 0 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/agg/fill.sim b/tests/script/general/table/fill.sim similarity index 97% rename from tests/script/general/agg/fill.sim rename to tests/script/general/table/fill.sim index de579238b8..00048eb025 100644 --- a/tests/script/general/agg/fill.sim +++ b/tests/script/general/table/fill.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/general/table/float.sim b/tests/script/general/table/float.sim index 195a2268b7..e4ef8a42d6 100644 --- a/tests/script/general/table/float.sim +++ b/tests/script/general/table/float.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -96,3 +94,5 @@ sql show databases if $rows != 0 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/table/int.sim b/tests/script/general/table/int.sim index 0f8223896c..81bdcda47d 100644 --- a/tests/script/general/table/int.sim +++ b/tests/script/general/table/int.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -24,7 +22,7 @@ sql select * from $tb order by ts desc if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -37,7 +35,7 @@ sql select * from $tb order by ts desc if $rows != 2 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -60,7 +58,7 @@ sql select * from $tb order by ts desc if $rows != 4 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -98,22 +96,22 @@ if $data01 != 2 then endi print =============== step8 -sql insert into $tb values (now+8m, "null") +sql insert into $tb values (now+8m, "NULL") sql select * from $tb order by ts desc if $rows != 8 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi print =============== step9 -sql insert into $tb values (now+9m, 'null') +sql insert into $tb values (now+9m, 'NULL') sql select * from $tb order by ts desc if $rows != 9 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -133,3 +131,4 @@ if $rows != 0 then return -1 endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/table/limit.sim b/tests/script/general/table/limit.sim index e01a209b61..46fc5103c1 100644 --- a/tests/script/general/table/limit.sim +++ b/tests/script/general/table/limit.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 129 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 129 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -19,7 +17,7 @@ $db = $dbPrefix . $i $tb = $tbPrefix . $i print =================== step 0 -sql create database $db tables 129 +sql create database $db maxtables 129 sql use $db sql show vgroups if $rows != 0 then @@ -91,4 +89,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/smallint.sim b/tests/script/general/table/smallint.sim index 6a0fbd7fb5..b6f0d6948f 100644 --- a/tests/script/general/table/smallint.sim +++ b/tests/script/general/table/smallint.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -24,7 +22,8 @@ sql select * from $tb order by ts desc if $rows != 1 then return -1 endi -if $data01 != null then +print $data01 +if $data01 != NULL then return -1 endi @@ -37,7 +36,7 @@ sql select * from $tb order by ts desc if $rows != 2 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -60,7 +59,7 @@ sql select * from $tb order by ts desc if $rows != 4 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -102,4 +101,5 @@ sql show databases if $rows != 0 then return -1 endi - \ No newline at end of file + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/table.sim b/tests/script/general/table/table.sim index 468e60f1ba..6ad1b13b1c 100644 --- a/tests/script/general/table/table.sim +++ b/tests/script/general/table/table.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -223,4 +221,4 @@ if $rows != 0 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/table/table_len.sim b/tests/script/general/table/table_len.sim index e1ed254fe1..2568ebc7a5 100644 --- a/tests/script/general/table/table_len.sim +++ b/tests/script/general/table/table_len.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -58,7 +56,7 @@ if $rows != 0 then endi print =============== step4 -sql create table ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789 (ts timestamp, speed int) -x step4 +sql create table ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789 (ts timestamp, speed int) -x step4 return -1 step4: sql show tables @@ -102,4 +100,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/testSuite.sim b/tests/script/general/table/testSuite.sim index 5e4388619b..d6cc88b36a 100644 --- a/tests/script/general/table/testSuite.sim +++ b/tests/script/general/table/testSuite.sim @@ -3,24 +3,25 @@ run general/table/basic1.sim run general/table/basic2.sim run general/table/basic3.sim run general/table/bigint.sim -#run general/table/binary.sim +run general/table/binary.sim run general/table/bool.sim run general/table/column_name.sim run general/table/column_num.sim -#run general/table/column_value.sim -#run general/table/column2.sim -#run general/table/date.sim +run general/table/column_value.sim +run general/table/column2.sim +run general/table/date.sim run general/table/db.table.sim -#run general/table/delete_reuse1.sim -#run general/table/delete_reuse2.sim -#run general/table/delete_writing.sim -#run general/table/describe.sim +run general/table/delete_reuse1.sim +run general/table/delete_reuse2.sim +run general/table/delete_writing.sim +run general/table/describe.sim run general/table/double.sim +run general/table/fill.sim run general/table/float.sim run general/table/int.sim -#run general/table/limit.sim +run general/table/limit.sim run general/table/smallint.sim -#run general/table/table_len.sim -#run general/table/table.sim +run general/table/table_len.sim +run general/table/table.sim run general/table/tinyint.sim -#run general/table/vgroup.sim +run general/table/vgroup.sim diff --git a/tests/script/general/table/tinyint.sim b/tests/script/general/table/tinyint.sim index d22331c2a3..017c007e84 100644 --- a/tests/script/general/table/tinyint.sim +++ b/tests/script/general/table/tinyint.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -24,7 +22,7 @@ sql select * from $tb order by ts desc if $rows != 1 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -37,7 +35,7 @@ sql select * from $tb order by ts desc if $rows != 2 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -60,7 +58,7 @@ sql select * from $tb if $rows != 4 then return -1 endi -if $data01 != null then +if $data01 != NULL then return -1 endi @@ -101,4 +99,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/vgroup.sim b/tests/script/general/table/vgroup.sim index cd5c44fb60..7efa3e9f73 100644 --- a/tests/script/general/table/vgroup.sim +++ b/tests/script/general/table/vgroup.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/exec.sh -n dnode1 -s start @@ -17,7 +15,7 @@ $db = $dbPrefix . $i $tb = $tbPrefix . $i print =================== step 1 -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql show vgroups if $rows != 0 then @@ -156,7 +154,4 @@ if $rows != 0 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/tag/3.sim b/tests/script/general/tag/3.sim index 1cc2fa8cf7..4b3104fe1b 100644 --- a/tests/script/general/tag/3.sim +++ b/tests/script/general/tag/3.sim @@ -1,13 +1,10 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect -sql reset query cache print ======================== dnode1 start @@ -521,3 +518,5 @@ sql show databases if $rows != 0 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/tag/4.sim b/tests/script/general/tag/4.sim index 02bb910888..120ef4e4e3 100644 --- a/tests/script/general/tag/4.sim +++ b/tests/script/general/tag/4.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -711,3 +711,5 @@ sql show databases if $rows != 0 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/tag/5.sim b/tests/script/general/tag/5.sim index 3231f738a7..efe88b3650 100644 --- a/tests/script/general/tag/5.sim +++ b/tests/script/general/tag/5.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -834,3 +834,5 @@ sql show databases if $rows != 0 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/tag/6.sim b/tests/script/general/tag/6.sim index 9c106a189c..d5f0a6c4af 100644 --- a/tests/script/general/tag/6.sim +++ b/tests/script/general/tag/6.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -989,3 +989,5 @@ sql show databases if $rows != 0 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/tag/add.sim b/tests/script/general/tag/add.sim index 6c9456d57a..69fd909dcf 100644 --- a/tests/script/general/tag/add.sim +++ b/tests/script/general/tag/add.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -545,7 +545,7 @@ endi if $data04 != 0 then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi @@ -851,4 +851,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/bigint.sim b/tests/script/general/tag/bigint.sim index 3522d91b93..4fa22d3995 100644 --- a/tests/script/general/tag/bigint.sim +++ b/tests/script/general/tag/bigint.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -239,4 +239,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/binary.sim b/tests/script/general/tag/binary.sim index 45aedf6db8..7c6f95b1ef 100644 --- a/tests/script/general/tag/binary.sim +++ b/tests/script/general/tag/binary.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -239,4 +239,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/binary_binary.sim b/tests/script/general/tag/binary_binary.sim index fdb10d5877..077ec85b52 100644 --- a/tests/script/general/tag/binary_binary.sim +++ b/tests/script/general/tag/binary_binary.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -306,4 +306,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/bool.sim b/tests/script/general/tag/bool.sim index da3da99b19..540eaf1238 100644 --- a/tests/script/general/tag/bool.sim +++ b/tests/script/general/tag/bool.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -236,4 +236,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/bool_binary.sim b/tests/script/general/tag/bool_binary.sim index ddd5b3df94..a3f99e25ad 100644 --- a/tests/script/general/tag/bool_binary.sim +++ b/tests/script/general/tag/bool_binary.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -306,4 +306,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/bool_int.sim b/tests/script/general/tag/bool_int.sim index 6f1a637965..1a2726dbaa 100644 --- a/tests/script/general/tag/bool_int.sim +++ b/tests/script/general/tag/bool_int.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -322,4 +322,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/change.sim b/tests/script/general/tag/change.sim index f0f4efb9c6..1577514765 100644 --- a/tests/script/general/tag/change.sim +++ b/tests/script/general/tag/change.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -394,7 +394,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -421,7 +421,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -448,7 +448,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -475,7 +475,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -502,7 +502,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -511,4 +511,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/column.sim b/tests/script/general/tag/column.sim index 4313f48e5f..4a36e832f1 100644 --- a/tests/script/general/tag/column.sim +++ b/tests/script/general/tag/column.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -91,4 +91,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/commit.sim b/tests/script/general/tag/commit.sim index 94ea85781a..94dc13f0cf 100644 --- a/tests/script/general/tag/commit.sim +++ b/tests/script/general/tag/commit.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -544,7 +544,7 @@ endi if $data04 != 0 then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi @@ -1054,7 +1054,7 @@ endi if $data04 != 0 then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi @@ -1180,4 +1180,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/create.sim b/tests/script/general/tag/create.sim index 852eadfbcc..c0cdbe87dc 100644 --- a/tests/script/general/tag/create.sim +++ b/tests/script/general/tag/create.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -598,3 +598,5 @@ print $data00 $data01 $data02 if $data02 != 12345 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/tag/delete.sim b/tests/script/general/tag/delete.sim index ae424ef58c..3454ce9d82 100644 --- a/tests/script/general/tag/delete.sim +++ b/tests/script/general/tag/delete.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -428,7 +428,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -452,7 +452,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -476,7 +476,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -500,7 +500,7 @@ endi if $data02 != 1.000000000 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -524,10 +524,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -554,10 +554,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -584,10 +584,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -614,10 +614,10 @@ endi if $data02 != 1.000000000 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -644,13 +644,13 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi @@ -683,13 +683,13 @@ endi if $data03 != 4.00000 then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi @@ -722,16 +722,16 @@ endi if $data03 != 4.000000000 then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -771,13 +771,13 @@ endi if $data04 != 5.000000000 then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -823,4 +823,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/double.sim b/tests/script/general/tag/double.sim index d811325b10..13dcb1fc72 100644 --- a/tests/script/general/tag/double.sim +++ b/tests/script/general/tag/double.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -239,4 +239,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/filter.sim b/tests/script/general/tag/filter.sim index b10e8a0372..4388f029f9 100644 --- a/tests/script/general/tag/filter.sim +++ b/tests/script/general/tag/filter.sim @@ -1,6 +1,4 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start @@ -146,3 +144,5 @@ sql show databases if $rows != 0 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/tag/float.sim b/tests/script/general/tag/float.sim index 537211fe1b..2352bbaf2e 100644 --- a/tests/script/general/tag/float.sim +++ b/tests/script/general/tag/float.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -239,4 +239,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/int.sim b/tests/script/general/tag/int.sim index ea635d9db6..a93df9a57a 100644 --- a/tests/script/general/tag/int.sim +++ b/tests/script/general/tag/int.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -239,4 +239,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/int_binary.sim b/tests/script/general/tag/int_binary.sim index 166285f799..d379500668 100644 --- a/tests/script/general/tag/int_binary.sim +++ b/tests/script/general/tag/int_binary.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -306,4 +306,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/int_float.sim b/tests/script/general/tag/int_float.sim index 4745ae704f..510c4f92d0 100644 --- a/tests/script/general/tag/int_float.sim +++ b/tests/script/general/tag/int_float.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -322,4 +322,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/set.sim b/tests/script/general/tag/set.sim index fd9fdd2807..917844c3e3 100644 --- a/tests/script/general/tag/set.sim +++ b/tests/script/general/tag/set.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -338,7 +338,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -365,7 +365,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -392,7 +392,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -419,7 +419,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -446,7 +446,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -455,4 +455,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/smallint.sim b/tests/script/general/tag/smallint.sim index 701e605e38..18b0957b15 100644 --- a/tests/script/general/tag/smallint.sim +++ b/tests/script/general/tag/smallint.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -239,4 +239,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/tag/testSuite.sim b/tests/script/general/tag/testSuite.sim index 10874262d6..45356efac1 100644 --- a/tests/script/general/tag/testSuite.sim +++ b/tests/script/general/tag/testSuite.sim @@ -1,25 +1,25 @@ -run general/tag/filter.sim -run general/tag/column.sim -run general/tag/bool.sim -run general/tag/smallint.sim -run general/tag/tinyint.sim -run general/tag/int.sim -run general/tag/bigint.sim -run general/tag/float.sim -run general/tag/double.sim -run general/tag/binary.sim -run general/tag/bool_int.sim -run general/tag/bool_binary.sim -run general/tag/int_float.sim -run general/tag/int_binary.sim -run general/tag/binary_binary.sim run general/tag/3.sim run general/tag/4.sim run general/tag/5.sim run general/tag/6.sim +run general/tag/add.sim +run general/tag/bigint.sim +run general/tag/binary_binary.sim +run general/tag/binary.sim +run general/tag/bool_binary.sim +run general/tag/bool_int.sim +run general/tag/bool.sim +run general/tag/change.sim +run general/tag/column.sim +run general/tag/commit.sim run general/tag/create.sim run general/tag/delete.sim -run general/tag/change.sim +run general/tag/double.sim +run general/tag/filter.sim +run general/tag/float.sim +run general/tag/int_binary.sim +run general/tag/int_float.sim +run general/tag/int.sim run general/tag/set.sim -run general/tag/add.sim -run general/tag/commit.sim \ No newline at end of file +run general/tag/smallint.sim +run general/tag/tinyint.sim diff --git a/tests/script/general/tag/tinyint.sim b/tests/script/general/tag/tinyint.sim index b65be72036..f104f8df04 100644 --- a/tests/script/general/tag/tinyint.sim +++ b/tests/script/general/tag/tinyint.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -239,4 +239,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/user/basic1.sim b/tests/script/general/user/basic1.sim index 1cff77d317..3670c1ddb0 100644 --- a/tests/script/general/user/basic1.sim +++ b/tests/script/general/user/basic1.sim @@ -71,4 +71,4 @@ print $data10 $data11 $data22 print $data20 $data11 $data22 print $data30 $data31 $data32 -system sh/exec.sh -n dnode1 -s stop \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/user/basicSuite.sim b/tests/script/general/user/basicSuite.sim deleted file mode 100644 index 199c8f39a1..0000000000 --- a/tests/script/general/user/basicSuite.sim +++ /dev/null @@ -1 +0,0 @@ -run general/user/basic1.sim \ No newline at end of file diff --git a/tests/script/general/user/monitor.sim b/tests/script/general/user/monitor.sim index 987cb84357..208b85f16c 100644 --- a/tests/script/general/user/monitor.sim +++ b/tests/script/general/user/monitor.sim @@ -1,10 +1,8 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 print ========== step1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c monitor -v 1 system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 system sh/exec.sh -n dnode1 -s start @@ -16,7 +14,7 @@ print ========== step2 sql drop database log -x step21 return -1 step21: -sql drop table log.cpu -x step22 +sql drop table log.dn -x step22 return -1 step22: sql drop user log -x step23 @@ -31,6 +29,4 @@ if $rows == 0 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/user/pass_alter.sim b/tests/script/general/user/pass_alter.sim index f7eee1359b..857d658db1 100644 --- a/tests/script/general/user/pass_alter.sim +++ b/tests/script/general/user/pass_alter.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect @@ -21,29 +19,50 @@ endi print ============= step2 sql close +sleep 2500 +print user read login sql connect read -sleep 2000 sql alter user read pass 'taosdata' sql alter user write pass 'taosdata1' -x step2 return -1 step2: +sql_error create user read pass 'taosdata1' +sql_error create user write pass 'taosdata1' + +sql show users +if $rows != 5 then + return -1 +endi print ============= step3 sql close +sleep 2500 +print user write login sql connect write -sleep 2000 + +sql_error create user read pass 'taosdata1' +sql_error create user write pass 'taosdata1' sql alter user write pass 'taosdata' sql alter user read pass 'taosdata' -x step3 return -1 step3: +sql show users +if $rows != 5 then + return -1 +endi + print ============= step4 sql close +sleep 2500 +print root write login sql connect -sleep 2000 sql create user oroot pass 'taosdata' + sql show users if $rows != 6 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/user/pass_len.sim b/tests/script/general/user/pass_len.sim index 583c2e73d3..d5d7b3250f 100644 --- a/tests/script/general/user/pass_len.sim +++ b/tests/script/general/user/pass_len.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -80,4 +79,4 @@ if $rows != 3 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/user/testSuite.sim b/tests/script/general/user/testSuite.sim index 242e8ca27a..b4bf52cfd1 100644 --- a/tests/script/general/user/testSuite.sim +++ b/tests/script/general/user/testSuite.sim @@ -1,6 +1,6 @@ run general/user/basic1.sim +run general/user/monitor.sim run general/user/pass_alter.sim run general/user/pass_len.sim run general/user/user_create.sim -run general/user/user_len.sim -#run general/user/monitor.sim \ No newline at end of file +run general/user/user_len.sim \ No newline at end of file diff --git a/tests/script/general/user/user_create.sim b/tests/script/general/user/user_create.sim index 4b81313695..34934d09e6 100644 --- a/tests/script/general/user/user_create.sim +++ b/tests/script/general/user/user_create.sim @@ -1,8 +1,7 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start sql connect @@ -35,10 +34,10 @@ print =============== step3 sql drop user read -x step31 return -1 step31: -sql drop user sys -x step32 +sql drop user _root -x step32 return -1 step32: -sql drop user stream -x step33 +sql drop user monitor -x step33 return -1 step33: @@ -72,17 +71,14 @@ sql alter user read privilege 1 -x step43 return -1 step43: -sql drop user sys -x step41 +sql drop user _root -x step41 return -1 step41: -sql drop user stream -x step42 +sql drop user monitor -x step42 return -1 step42: sql drop user read - - - - +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/user/user_len.sim b/tests/script/general/user/user_len.sim index 4d2658cec9..79b72468bb 100644 --- a/tests/script/general/user/user_len.sim +++ b/tests/script/general/user/user_len.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -86,3 +86,5 @@ sql show users if $rows != 3 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/vector/metrics_field.sim b/tests/script/general/vector/metrics_field.sim index a883c81e18..2a03ccea19 100644 --- a/tests/script/general/vector/metrics_field.sim +++ b/tests/script/general/vector/metrics_field.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -618,4 +618,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/metrics_mix.sim b/tests/script/general/vector/metrics_mix.sim index 26ff0af063..96b2f6a7a0 100644 --- a/tests/script/general/vector/metrics_mix.sim +++ b/tests/script/general/vector/metrics_mix.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -618,4 +618,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/metrics_query.sim b/tests/script/general/vector/metrics_query.sim index d797fa6467..824aa6f22e 100644 --- a/tests/script/general/vector/metrics_query.sim +++ b/tests/script/general/vector/metrics_query.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -614,4 +614,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/metrics_tag.sim b/tests/script/general/vector/metrics_tag.sim index 29923d3d42..e7575cc9df 100644 --- a/tests/script/general/vector/metrics_tag.sim +++ b/tests/script/general/vector/metrics_tag.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -614,4 +614,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/metrics_time.sim b/tests/script/general/vector/metrics_time.sim index 9400b2a76a..bbcabfd1b7 100644 --- a/tests/script/general/vector/metrics_time.sim +++ b/tests/script/general/vector/metrics_time.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -614,4 +614,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/multi.sim b/tests/script/general/vector/multi.sim index dfdc015edf..105f210950 100644 --- a/tests/script/general/vector/multi.sim +++ b/tests/script/general/vector/multi.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -206,10 +206,11 @@ sql select a + f from $tb where g = 2 and ts > now + 4m order by ts asc -x step return -1 step74: - print =============== clear sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/single.sim b/tests/script/general/vector/single.sim index cd892bfd87..2292d6f44a 100644 --- a/tests/script/general/vector/single.sim +++ b/tests/script/general/vector/single.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -298,4 +298,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/table_field.sim b/tests/script/general/vector/table_field.sim index 2894b04c6d..a9d6910f4d 100644 --- a/tests/script/general/vector/table_field.sim +++ b/tests/script/general/vector/table_field.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -614,4 +614,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/table_mix.sim b/tests/script/general/vector/table_mix.sim index 9cd4085912..a6c4dc92da 100644 --- a/tests/script/general/vector/table_mix.sim +++ b/tests/script/general/vector/table_mix.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -614,4 +614,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/table_query.sim b/tests/script/general/vector/table_query.sim index 1e1784e726..812229afc4 100644 --- a/tests/script/general/vector/table_query.sim +++ b/tests/script/general/vector/table_query.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -614,4 +614,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/table_time.sim b/tests/script/general/vector/table_time.sim index f0b0d525e6..a83195beba 100644 --- a/tests/script/general/vector/table_time.sim +++ b/tests/script/general/vector/table_time.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sleep 3000 @@ -614,4 +614,6 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/vector/testSuite.sim b/tests/script/general/vector/testSuite.sim index e660fd90a9..f0b9fef991 100644 --- a/tests/script/general/vector/testSuite.sim +++ b/tests/script/general/vector/testSuite.sim @@ -1,12 +1,11 @@ -run general/vector/single.sim -run general/vector/multi.sim -run general/vector/table_query.sim -run general/vector/table_time.sim -run general/vector/table_field.sim -run general/vector/table_mix.sim +run general/vector/metrics_field.sim +run general/vector/metrics_mix.sim run general/vector/metrics_query.sim run general/vector/metrics_tag.sim run general/vector/metrics_time.sim -run general/vector/metrics_field.sim -run general/vector/metrics_mix.sim - +run general/vector/multi.sim +run general/vector/single.sim +run general/vector/table_field.sim +run general/vector/table_mix.sim +run general/vector/table_query.sim +run general/vector/table_time.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 81f6bc55f7..d96a1db2b4 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -6,6 +6,239 @@ cd ../../../debug; cmake .. #cd ../../../debug; make clean cd ../../../debug; make +#./test.sh -f general/alter/cached_schema_after_alter.sim +#./test.sh -f general/alter/count.sim +#./test.sh -f general/alter/import.sim +#./test.sh -f general/alter/insert1.sim +#./test.sh -f general/alter/insert2.sim +#./test.sh -f general/alter/metrics.sim +#./test.sh -f general/alter/table.sim + +./test.sh -f general/cache/new_metrics.sim +#./test.sh -f general/cache/restart_metrics.sim +./test.sh -f general/cache/restart_table.sim + +#./test.sh -f general/column/commit.sim +#./test.sh -f general/column/metrics.sim +#./test.sh -f general/column/table.sim + +./test.sh -f general/compress/commitlog.sim +./test.sh -f general/compress/compress.sim +./test.sh -f general/compress/compress2.sim +./test.sh -f general/compress/uncompress.sim + +./test.sh -f general/compute/avg.sim +./test.sh -f general/compute/bottom.sim +./test.sh -f general/compute/count.sim +./test.sh -f general/compute/diff.sim +#./test.sh -f general/compute/diff2.sim +./test.sh -f general/compute/first.sim +#./test.sh -f general/compute/interval.sim +#./test.sh -f general/compute/last.sim +#./test.sh -f general/compute/leastsquare.sim +./test.sh -f general/compute/max.sim +./test.sh -f general/compute/min.sim +./test.sh -f general/compute/null.sim +./test.sh -f general/compute/percentile.sim +./test.sh -f general/compute/stddev.sim +./test.sh -f general/compute/sum.sim +./test.sh -f general/compute/top.sim + +./test.sh -f general/db/basic.sim +./test.sh -f general/db/basic1.sim +./test.sh -f general/db/basic2.sim +./test.sh -f general/db/basic3.sim +./test.sh -f general/db/basic4.sim +./test.sh -f general/db/basic5.sim +./test.sh -f general/db/delete_reuse1.sim +./test.sh -f general/db/delete_reuse2.sim +./test.sh -f general/db/delete_reusevnode.sim +#./test.sh -f general/db/delete_reusevnode2.sim +./test.sh -f general/db/delete_writing1.sim +./test.sh -f general/db/delete_writing2.sim +./test.sh -f general/db/len.sim +./test.sh -f general/db/repeat.sim +./test.sh -f general/db/tables.sim + +#./test.sh -f general/field/2.sim +#./test.sh -f general/field/3.sim +#./test.sh -f general/field/4.sim +#./test.sh -f general/field/5.sim +#./test.sh -f general/field/6.sim +##./test.sh -f general/field/bigint.sim +#./test.sh -f general/field/binary.sim +##./test.sh -f general/field/bool.sim +#./test.sh -f general/field/single.sim +##./test.sh -f general/field/smallint.sim +##./test.sh -f general/field/tinyint.sim + +##./test.sh -f general/http/restful.sim +./test.sh -f general/http/restful_insert.sim +./test.sh -f general/http/restful_limit.sim +##./test.sh -f general/http/restful_full.sim +./test.sh -f general/http/prepare.sim +./test.sh -f general/http/telegraf.sim +./test.sh -f general/http/grafana_bug.sim +#./test.sh -f general/http/grafana.sim + +./test.sh -f general/import/basic.sim +./test.sh -f general/import/commit.sim +./test.sh -f general/import/large.sim +#./test.sh -f general/import/replica1.sim + +./test.sh -f general/insert/basic.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 +./test.sh -f general/insert/query_block2_file.sim +./test.sh -f general/insert/query_file_memory.sim +./test.sh -f general/insert/query_multi_file.sim +./test.sh -f general/insert/tcp.sim + +#parser + +# ./test.sh -f general/parser/alter.sim +# ./test.sh -f general/parser/alter1.sim +# ./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 +./test.sh -f general/parser/binary_escapeCharacter.sim +#./test.sh -f general/parser/bug.sim +./test.sh -f general/parser/col_arithmetic_operation.sim +./test.sh -f general/parser/columnValue_bigint.sim +./test.sh -f general/parser/columnValue_bool.sim +./test.sh -f general/parser/columnValue_double.sim +./test.sh -f general/parser/columnValue_float.sim +./test.sh -f general/parser/columnValue_int.sim +# ./test.sh -f general/parser/col_arithmetic_operation.sim +# ./test.sh -f general/parser/columnValue.sim +# ./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/fill.sim +# ./test.sh -f general/parser/fill_stb.sim +# ./test.sh -f general/parser/first_last.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/import_file.sim +# ./test.sh -f general/parser/insert_tb.sim +# ./test.sh -f general/parser/tags_dynamically_specifiy.sim +# ./test.sh -f general/parser/interp.sim +# ./test.sh -f general/parser/lastrow.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/limit2.sim +# ./test.sh -f general/parser/mixed_blocks.sim +# ./test.sh -f general/parser/nchar.sim +# ./test.sh -f general/parser/null_char.sim +# ./test.sh -f general/parser/selectResNum.sim +# ./test.sh -f general/parser/select_across_vnodes.sim +./test.sh -f general/parser/select_from_cache_disk.sim +# ./test.sh -f general/parser/set_tag_vals.sim +# ./test.sh -f general/parser/single_row_in_tb.sim +# ./test.sh -f general/parser/slimit.sim +./test.sh -f general/parser/slimit1.sim +./test.sh -f general/parser/slimit1_query.sim +# ./test.sh -f general/parser/slimit_alter_tags.sim +# ./test.sh -f general/parser/stream_on_sys.sim +# ./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 +# #./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/stable/disk.sim +#./test.sh -f general/stable/metrics.sim +#./test.sh -f general/stable/values.sim +#./test.sh -f general/stable/vnode3.sim + +#stream + +./test.sh -f general/table/autocreate.sim +./test.sh -f general/table/basic1.sim +./test.sh -f general/table/basic2.sim +./test.sh -f general/table/basic3.sim +./test.sh -f general/table/bigint.sim +./test.sh -f general/table/binary.sim +./test.sh -f general/table/bool.sim +./test.sh -f general/table/column_name.sim +./test.sh -f general/table/column_num.sim +./test.sh -f general/table/column_value.sim +./test.sh -f general/table/column2.sim +./test.sh -f general/table/date.sim +./test.sh -f general/table/db.table.sim +#./test.sh -f general/table/delete_reuse1.sim +#./test.sh -f general/table/delete_reuse2.sim +#./test.sh -f general/table/delete_writing.sim +#./test.sh -f general/table/describe.sim +./test.sh -f general/table/double.sim +#./test.sh -f general/table/fill.sim +./test.sh -f general/table/float.sim +./test.sh -f general/table/int.sim +./test.sh -f general/table/limit.sim +./test.sh -f general/table/smallint.sim +#./test.sh -f general/table/table_len.sim +./test.sh -f general/table/table.sim +./test.sh -f general/table/tinyint.sim +./test.sh -f general/table/vgroup.sim + +#./test.sh -f general/tag/3.sim +#./test.sh -f general/tag/4.sim +#./test.sh -f general/tag/5.sim +#./test.sh -f general/tag/6.sim +#./test.sh -f general/tag/add.sim +#./test.sh -f general/tag/bigint.sim +#./test.sh -f general/tag/binary_binary.sim +#./test.sh -f general/tag/binary.sim +#./test.sh -f general/tag/bool_binary.sim +#./test.sh -f general/tag/bool_int.sim +#./test.sh -f general/tag/bool.sim +#./test.sh -f general/tag/change.sim +#./test.sh -f general/tag/column.sim +#./test.sh -f general/tag/commit.sim +#./test.sh -f general/tag/create.sim +#./test.sh -f general/tag/delete.sim +#./test.sh -f general/tag/double.sim +#./test.sh -f general/tag/filter.sim +#./test.sh -f general/tag/float.sim +#./test.sh -f general/tag/int_binary.sim +#./test.sh -f general/tag/int_float.sim +#./test.sh -f general/tag/int.sim +#./test.sh -f general/tag/set.sim +#./test.sh -f general/tag/smallint.sim +#./test.sh -f general/tag/tinyint.sim + +./test.sh -f general/user/basic1.sim +#./test.sh -f general/user/monitor.sim +./test.sh -f general/user/pass_alter.sim +./test.sh -f general/user/pass_len.sim +./test.sh -f general/user/user_create.sim +./test.sh -f general/user/user_len.sim + +#./test.sh -f general/vector/metrics_field.sim +#./test.sh -f general/vector/metrics_mix.sim +#./test.sh -f general/vector/metrics_query.sim +#./test.sh -f general/vector/metrics_tag.sim +#./test.sh -f general/vector/metrics_time.sim +#./test.sh -f general/vector/multi.sim +./test.sh -f general/vector/single.sim +#./test.sh -f general/vector/table_field.sim +#./test.sh -f general/vector/table_mix.sim +#./test.sh -f general/vector/table_query.sim +#./test.sh -f general/vector/table_time.sim + +################################# + ./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 @@ -18,46 +251,75 @@ cd ../../../debug; make ./test.sh -u -f unique/account/user_create.sim ./test.sh -u -f unique/account/user_len.sim -#big +#./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/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/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/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/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/admin.sim +##./test.sh -u -f unique/http/opentsdb.sim -#import +#./test.sh -u -f unique/import/replica2.sim +#./test.sh -u -f unique/import/replica3.sim -#metrics +#./test.sh -u -f unique/metrics/balance_replica1.sim +#./test.sh -u -f unique/metrics/dnode2_stop.sim +#./test.sh -u -f unique/metrics/dnode2.sim +#./test.sh -u -f unique/metrics/dnode3.sim +#./test.sh -u -f unique/metrics/replica2_dnode4.sim +#./test.sh -u -f unique/metrics/replica2_vnode3.sim +#./test.sh -u -f unique/metrics/replica3_dnode6.sim +#./test.sh -u -f unique/metrics/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/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/mnode/secondIp.sim #stream -#table +##./test.sh -u -f unique/table/delete_part.sim -./test.sh -u -f unique/vnode/replica2_basic2.sim -./test.sh -u -f unique/vnode/replica3_basic.sim \ No newline at end of file +##./test.sh -u -f unique/vnode/replica2_basic2.sim +##./test.sh -u -f unique/vnode/replica3_basic.sim + +#./test.sh -u -f unique/vnode/commit.sim +#./test.sh -u -f unique/vnode/many.sim +#./test.sh -u -f unique/vnode/replica2_basic.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 bfbba3a012..5587e3bb8c 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -108,6 +108,7 @@ echo "udebugFlag 131" >> $TAOS_CFG echo "jnidebugFlag 131" >> $TAOS_CFG echo "sdebugFlag 135" >> $TAOS_CFG echo "monitor 0" >> $TAOS_CFG +echo "monitorInterval 1" >> $TAOS_CFG echo "http 0" >> $TAOS_CFG echo "numOfThreadsPerCore 2.0" >> $TAOS_CFG echo "defaultPass taosdata" >> $TAOS_CFG diff --git a/tests/script/sh/stop_dnodes.sh b/tests/script/sh/stop_dnodes.sh index a873eb5654..2364dff9b3 100755 --- a/tests/script/sh/stop_dnodes.sh +++ b/tests/script/sh/stop_dnodes.sh @@ -2,14 +2,14 @@ PID=`ps -ef|grep /usr/bin/taosd | grep -v grep | awk '{print $2}'` if [ -n "$PID" ]; then - echo sudo systemctl stop taosd - sudo systemctl stop taosd + echo systemctl stop taosd + systemctl stop taosd fi PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` while [ -n "$PID" ]; do - echo sudo kill -9 $PID - sudo pkill -9 taosd - sudo fuser -k -n tcp 6030 + echo kill -9 $PID + pkill -9 taosd + fuser -k -n tcp 6030 PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` done diff --git a/tests/script/tmp/prepare.sim b/tests/script/tmp/prepare.sim index eda0452459..68a05a33e7 100644 --- a/tests/script/tmp/prepare.sim +++ b/tests/script/tmp/prepare.sim @@ -5,10 +5,10 @@ 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 commitLog -v 2 -system sh/cfg.sh -n dnode2 -c commitLog -v 2 -system sh/cfg.sh -n dnode3 -c commitLog -v 2 -system sh/cfg.sh -n dnode4 -c commitLog -v 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode3 -c walLevel -v 2 +system sh/cfg.sh -n dnode4 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 diff --git a/tests/script/unique/account/account_create.sim b/tests/script/unique/account/account_create.sim index b6eb239052..d1d5ebece0 100644 --- a/tests/script/unique/account/account_create.sim +++ b/tests/script/unique/account/account_create.sim @@ -1,9 +1,10 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sql connect +sleep 3000 print ============================ dnode1 start @@ -76,4 +77,4 @@ if $rows != 1 then return -1 endi - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/account_delete.sim b/tests/script/unique/account/account_delete.sim index 6d1c148698..71a75a7b35 100644 --- a/tests/script/unique/account/account_delete.sim +++ b/tests/script/unique/account/account_delete.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sql connect @@ -94,4 +94,6 @@ sql drop account oroot sql show accounts if $rows != 1 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/account_len.sim b/tests/script/unique/account/account_len.sim index 06fb37bb5a..ae2db26d58 100644 --- a/tests/script/unique/account/account_len.sim +++ b/tests/script/unique/account/account_len.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sql connect @@ -88,3 +88,5 @@ sql show users if $rows != 3 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/authority.sim b/tests/script/unique/account/authority.sim index 4198f2c333..fe978a5827 100644 --- a/tests/script/unique/account/authority.sim +++ b/tests/script/unique/account/authority.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 system sh/exec_up.sh -n dnode1 -s start @@ -343,3 +343,5 @@ sql drop database d1 sql drop database d2 sql drop database d3 sql drop database d4 + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/basic.sim b/tests/script/unique/account/basic.sim index b2d8904cc6..d06f7a15d9 100644 --- a/tests/script/unique/account/basic.sim +++ b/tests/script/unique/account/basic.sim @@ -42,4 +42,4 @@ endi print $data00 $data01 $data02 print $data10 $data11 $data22 - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/paras.sim b/tests/script/unique/account/paras.sim index d1d573d334..b2e540400c 100644 --- a/tests/script/unique/account/paras.sim +++ b/tests/script/unique/account/paras.sim @@ -109,3 +109,5 @@ endi if $data16 != 0.000/10.000 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/pass_alter.sim b/tests/script/unique/account/pass_alter.sim index 54ab8fbda8..936611833a 100644 --- a/tests/script/unique/account/pass_alter.sim +++ b/tests/script/unique/account/pass_alter.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sql connect @@ -112,3 +112,5 @@ sql alter user oroot pass 'taosdata' sql drop account oroot sql drop user read sql drop user write + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/pass_len.sim b/tests/script/unique/account/pass_len.sim index acf4f50c69..f4f9c04964 100644 --- a/tests/script/unique/account/pass_len.sim +++ b/tests/script/unique/account/pass_len.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sql connect @@ -78,4 +78,4 @@ if $rows != 3 then return -1 endi - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/usage.sim b/tests/script/unique/account/usage.sim index af904815a0..f022380ac4 100644 --- a/tests/script/unique/account/usage.sim +++ b/tests/script/unique/account/usage.sim @@ -54,4 +54,6 @@ if $data05 != 0/10 then endi print =============== check grant -sql_error create database d6 \ No newline at end of file +sql_error create database d6 + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/user_create.sim b/tests/script/unique/account/user_create.sim index bc4a8f6e8e..789035cfcc 100644 --- a/tests/script/unique/account/user_create.sim +++ b/tests/script/unique/account/user_create.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sql connect @@ -35,10 +35,10 @@ print =============== step3 sql drop user read -x step31 return -1 step31: -sql drop user sys -x step32 +sql drop user _root -x step32 return -1 step32: -sql drop user stream -x step33 +sql drop user monitor -x step33 return -1 step33: @@ -71,17 +71,14 @@ sql alter user read privilege 1 -x step43 return -1 step43: -sql drop user sys -x step41 +sql drop user _root -x step41 return -1 step41: -sql drop user stream -x step42 +sql drop user monitor -x step42 return -1 step42: sql drop user read - - - - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/account/user_len.sim b/tests/script/unique/account/user_len.sim index 0e25f554e0..918551fa66 100644 --- a/tests/script/unique/account/user_len.sim +++ b/tests/script/unique/account/user_len.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sql connect @@ -29,6 +29,7 @@ endi print =============== step2 sql drop user a -x step2 step2: +sleep 1000 sql create user a PASS '123' sql show users if $rows != 4 then @@ -89,3 +90,5 @@ sql show accounts if $rows != 1 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/balance.sim b/tests/script/unique/big/balance.sim index 270c3810a7..52199f046e 100644 --- a/tests/script/unique/big/balance.sim +++ b/tests/script/unique/big/balance.sim @@ -1,23 +1,23 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c tables -v 1000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode2 -c tables -v 1000 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 1000 system sh/deploy.sh -n dnode3 -i 3 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode3 -c tables -v 1000 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 1000 system sh/deploy.sh -n dnode4 -i 4 system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode4 -c tables -v 1000 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 1000 system sh/deploy.sh -n dnode5 -i 5 system sh/cfg.sh -n dnode5 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode5 -c tables -v 1000 +system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 1000 print =============== prepare data system sh/exec.sh -n dnode1 -s start @@ -160,7 +160,7 @@ print dnode3 freeVnodes $data3_192.168.0.3 if $data3_192.168.0.1 != 2 then goto show3 endi -if $data3_192.168.0.2 != null then +if $data3_192.168.0.2 != NULL then goto show3 endi if $data3_192.168.0.3 != 2 then @@ -216,7 +216,7 @@ print dnode3 freeVnodes $data3_192.168.0.3 if $data3_192.168.0.1 != 0 then goto show4 endi -if $data3_192.168.0.3 != null then +if $data3_192.168.0.3 != NULL then goto show4 endi @@ -304,3 +304,12 @@ print select count(*) from mt $data00 expect $rowNum if $data00 != $totalNum then goto show5 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim index 12affc72c5..00995ba32c 100644 --- a/tests/script/unique/big/maxvnodes.sim +++ b/tests/script/unique/big/maxvnodes.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 -system sh/cfg.sh -n dnode1 -c tables -v 100 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 100 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 256 system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000 system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000 @@ -39,8 +39,8 @@ endi system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode2 -c clog -v 0 -system sh/cfg.sh -n dnode2 -c tables -v 100 +system sh/cfg.sh -n dnode2 -c walLevel -v 0 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 100 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 256 system sh/cfg.sh -n dnode2 -c maxVnodeConnections -v 100000 system sh/cfg.sh -n dnode2 -c maxMeterConnections -v 100000 @@ -79,3 +79,12 @@ sql select count(*) from mt if $data00 != 25600 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/big/tcp.sim b/tests/script/unique/big/tcp.sim index 9e98ddd349..1fb414ec74 100644 --- a/tests/script/unique/big/tcp.sim +++ b/tests/script/unique/big/tcp.sim @@ -1,8 +1,8 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode1 -c tables -v 30000 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 30000 system sh/cfg.sh -n dnode1 -c dDebugFlag -v 131 system sh/cfg.sh -n dnode1 -c mDebugFlag -v 131 @@ -103,5 +103,12 @@ while $i < 100 $i = $i + 1 endw -system sh/stop_dnodes.sh -sleep 10000 + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/big/testSuite.sim b/tests/script/unique/big/testSuite.sim index 5881d1fb67..2cead5626a 100644 --- a/tests/script/unique/big/testSuite.sim +++ b/tests/script/unique/big/testSuite.sim @@ -1,3 +1,3 @@ -#run unique/big/balance.sim -#run unique/big/maxvnodes.sim -#run unique/big/tcp.sim +run unique/big/balance.sim +run unique/big/maxvnodes.sim +run unique/big/tcp.sim diff --git a/tests/script/unique/cluster/balance1.sim b/tests/script/unique/cluster/balance1.sim index 50f56688f3..10e05971d7 100644 --- a/tests/script/unique/cluster/balance1.sim +++ b/tests/script/unique/cluster/balance1.sim @@ -35,21 +35,21 @@ system sh/cfg.sh -n dnode6 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode7 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode8 -c mgmtEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 -system sh/cfg.sh -n dnode5 -c clog -v 1 -system sh/cfg.sh -n dnode6 -c clog -v 1 -system sh/cfg.sh -n dnode7 -c clog -v 1 -system sh/cfg.sh -n dnode8 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 +system sh/cfg.sh -n dnode5 -c wallevel -v 1 +system sh/cfg.sh -n dnode6 -c wallevel -v 1 +system sh/cfg.sh -n dnode7 -c wallevel -v 1 +system sh/cfg.sh -n dnode8 -c wallevel -v 1 print ============== step1 print ========= start dnode1 system sh/exec_up.sh -n dnode1 -s start sql connect -sql create database c_b1_d1 tables 4 +sql create database c_b1_d1 maxTables 4 sql use c_b1_d1 sql create table c_b1_t1 (t timestamp, i int) @@ -59,7 +59,7 @@ sql insert into c_b1_t1 values(1520000022013, 13) sql insert into c_b1_t1 values(1520000023012, 12) sql insert into c_b1_t1 values(1520000024011, 11) -sql create database c_b1_d2 tables 4 +sql create database c_b1_d2 maxTables 4 sql use c_b1_d2 sql create table c_b1_t2 (t timestamp, i int) sql insert into c_b1_t2 values(1520000020025, 25) @@ -77,7 +77,7 @@ print dnode2 $dnode2Vnodes if $dnode1Vnodes != 2 then return -1 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then return -1 endi @@ -116,7 +116,7 @@ print dnode2 ==> $dnode2Role print ============================== step3 print ========= add db3 -sql create database c_b1_d3 tables 4 +sql create database c_b1_d3 maxTables 4 sql use c_b1_d3 sql create table c_b1_t3 (t timestamp, i int) sql insert into c_b1_t3 values(1520000020035, 35) @@ -146,7 +146,7 @@ print dnode2 $dnode2Vnodes if $dnode1Vnodes != 3 then goto show4 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then goto show4 endi @@ -229,7 +229,7 @@ print dnode3 $dnode3Vnodes if $dnode1Vnodes != 3 then goto show8 endi -if $dnode3Vnodes != null then +if $dnode3Vnodes != NULL then goto show8 endi @@ -245,7 +245,7 @@ if $dnode1Role != master then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi @@ -289,7 +289,7 @@ if $dnode4Role != slave then endi print ============================== step10 -sql create database c_b1_d4 tables 4 +sql create database c_b1_d4 maxTables 4 sql use c_b1_d4 sql create table c_b1_t4 (t timestamp, i int) sql insert into c_b1_t4 values(1520000020045, 45) @@ -327,7 +327,7 @@ sql use c_b1_d2 sql insert into c_b1_t2 values(1520000025026, 26) print ============================== step12 -sql create database c_b1_d5 tables 4 +sql create database c_b1_d5 maxTables 4 sql use c_b1_d5 sql_error create table c_b1_t5 (t timestamp, i int) -x error3 @@ -352,7 +352,7 @@ sql insert into c_b1_t5 values(1520000022053, 53) sql insert into c_b1_t5 values(1520000023052, 52) sql insert into c_b1_t5 values(1520000024051, 51) -sql create database c_b1_d6 tables 4 +sql create database c_b1_d6 maxTables 4 sql use c_b1_d6 sql create table c_b1_t6 (t timestamp, i int) sql insert into c_b1_t6 values(1520000020065, 65) @@ -384,7 +384,7 @@ sql create dnode $hostname6 system sh/exec_up.sh -n dnode6 -s start sleep 15000 -sql create database c_b1_d7 tables 4 +sql create database c_b1_d7 maxTables 4 sql use c_b1_d7 sql create table c_b1_t7 (t timestamp, i int) sql insert into c_b1_t7 values(1520000020075, 75) @@ -393,7 +393,7 @@ sql insert into c_b1_t7 values(1520000022073, 73) sql insert into c_b1_t7 values(1520000023072, 72) sql insert into c_b1_t7 values(1520000024071, 71) -sql create database c_b1_d8 tables 4 +sql create database c_b1_d8 maxTables 4 sql use c_b1_d8 sql create table c_b1_t8 (t timestamp, i int) sql insert into c_b1_t8 values(1520000020085, 85) @@ -553,11 +553,12 @@ if $data41 != 85 then return -1 endi -print ============================================ over -system sh/exec_up.sh -n dnode2 -s stop -x SIGINT -system sh/exec_up.sh -n dnode3 -s stop -x SIGINT -system sh/exec_up.sh -n dnode4 -s stop -x SIGINT -system sh/exec_up.sh -n dnode5 -s stop -x SIGINT - - - +print ============================================ over= +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/cluster/balance2.sim b/tests/script/unique/cluster/balance2.sim index 04ab5f8fe4..d741e03eec 100644 --- a/tests/script/unique/cluster/balance2.sim +++ b/tests/script/unique/cluster/balance2.sim @@ -26,14 +26,14 @@ system sh/cfg.sh -n dnode6 -c numOfMPeers -v 3 system sh/cfg.sh -n dnode7 -c numOfMPeers -v 3 system sh/cfg.sh -n dnode8 -c numOfMPeers -v 3 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 -system sh/cfg.sh -n dnode5 -c clog -v 1 -system sh/cfg.sh -n dnode6 -c clog -v 1 -system sh/cfg.sh -n dnode7 -c clog -v 1 -system sh/cfg.sh -n dnode8 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 +system sh/cfg.sh -n dnode5 -c wallevel -v 1 +system sh/cfg.sh -n dnode6 -c wallevel -v 1 +system sh/cfg.sh -n dnode7 -c wallevel -v 1 +system sh/cfg.sh -n dnode8 -c wallevel -v 1 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0 @@ -56,7 +56,7 @@ system sh/exec_up.sh -n dnode2 -s start system sh/exec_up.sh -n dnode3 -s start sleep 4001 -sql create database c_b2_d1 replica 2 tables 4 +sql create database c_b2_d1 replica 2 maxTables 4 sql use c_b2_d1 sql create table c_b2_t1 (t timestamp, i int) sql insert into c_b2_t1 values(1520000020015, 15) @@ -65,7 +65,7 @@ sql insert into c_b2_t1 values(1520000022013, 13) sql insert into c_b2_t1 values(1520000023012, 12) sql insert into c_b2_t1 values(1520000024011, 11) -sql create database c_b2_d2 replica 2 tables 4 +sql create database c_b2_d2 replica 2 maxTables 4 sql use c_b2_d2 sql create table c_b2_t2 (t timestamp, i int) sql insert into c_b2_t2 values(1520000020025, 25) @@ -74,7 +74,7 @@ sql insert into c_b2_t2 values(1520000022023, 23) sql insert into c_b2_t2 values(1520000023022, 22) sql insert into c_b2_t2 values(1520000024021, 21) -sql create database c_b2_d3 replica 2 tables 4 +sql create database c_b2_d3 replica 2 maxTables 4 sql use c_b2_d3 sql create table c_b2_t3 (t timestamp, i int) sql insert into c_b2_t3 values(1520000020035, 35) @@ -131,7 +131,7 @@ print dnode3 $dnode3Vnodes if $dnode1Vnodes != 3 then goto show2 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then goto show2 endi if $dnode3Vnodes != 3 then @@ -194,7 +194,7 @@ print dnode4 ==> $dnode4Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then @@ -231,7 +231,7 @@ endi if $dnode4Vnodes != 3 then goto show4 endi -if $dnode3Vnodes != null then +if $dnode3Vnodes != NULL then goto show4 endi @@ -248,10 +248,10 @@ print dnode4 ==> $dnode4Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi @@ -339,7 +339,7 @@ print dnode4 $dnode4Vnodes $dnode5Vnodes = $data2_5 print dnode5 $dnode5Vnodes -if $dnode1Vnodes != null then +if $dnode1Vnodes != NULL then goto show6 endi if $dnode4Vnodes != 3 then @@ -386,21 +386,21 @@ endi sql select * from c_b2_d2.c_b2_t2 order by t desc print $data01 $data11 $data21 $data31 $data41 -#if $data01 != 21 then -# return -1 -#endi -#if $data11 != 22 then -# return -1 -#endi -#if $data21 != 23 then -# return -1 -#endi -#if $data31 != 24 then -# return -1 -#endi -#if $data41 != 25 then -# return -1 -#endi +if $data01 != 21 then + return -1 +endi +if $data11 != 22 then + return -1 +endi +if $data21 != 23 then + return -1 +endi +if $data31 != 24 then + return -1 +endi +if $data41 != 25 then + return -1 +endi sql select * from c_b2_d3.c_b2_t3 order by t desc print $data01 $data11 $data21 $data31 $data41 @@ -420,60 +420,6 @@ if $data41 != 35 then return -1 endi -sql select * from c_b2_d4.c_b2_t4 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 41 then - return -1 -endi -if $data11 != 42 then - return -1 -endi -if $data21 != 43 then - return -1 -endi -if $data31 != 44 then - return -1 -endi -if $data41 != 45 then - return -1 -endi - -sql select * from c_b2_d5.c_b2_t5 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 51 then - return -1 -endi -if $data11 != 52 then - return -1 -endi -if $data21 != 53 then - return -1 -endi -if $data31 != 54 then - return -1 -endi -if $data41 != 55 then - return -1 -endi - -sql select * from c_b2_d6.c_b2_t6 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 61 then - return -1 -endi -if $data11 != 62 then - return -1 -endi -if $data21 != 63 then - return -1 -endi -if $data31 != 64 then - return -1 -endi -if $data41 != 65 then - return -1 -endi - print ============================================ over system sh/exec_up.sh -n dnode1 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT diff --git a/tests/script/unique/cluster/balance3.sim b/tests/script/unique/cluster/balance3.sim index 1e66fcf253..e9847e21da 100644 --- a/tests/script/unique/cluster/balance3.sim +++ b/tests/script/unique/cluster/balance3.sim @@ -36,14 +36,14 @@ system sh/cfg.sh -n dnode6 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode7 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode8 -c mgmtEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 -system sh/cfg.sh -n dnode5 -c clog -v 1 -system sh/cfg.sh -n dnode6 -c clog -v 1 -system sh/cfg.sh -n dnode7 -c clog -v 1 -system sh/cfg.sh -n dnode8 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 +system sh/cfg.sh -n dnode5 -c wallevel -v 1 +system sh/cfg.sh -n dnode6 -c wallevel -v 1 +system sh/cfg.sh -n dnode7 -c wallevel -v 1 +system sh/cfg.sh -n dnode8 -c wallevel -v 1 print ============== step1 print ========= start dnode1 @@ -88,7 +88,7 @@ $x = 0 show1: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show1 @@ -101,16 +101,16 @@ print dnode3 $dnode3Vnodes $dnode4Vnodes = $data2_4 print dnode4 $dnode4Vnodes -if $dnode1Vnodes != 1 then +if $dnode1Vnodes != 3 then goto show1 endi -if $dnode2Vnodes != 1 then +if $dnode2Vnodes != 3 then goto show1 endi -if $dnode3Vnodes != 1 then +if $dnode3Vnodes != 3 then goto show1 endi -if $dnode4Vnodes != null then +if $dnode4Vnodes != NULL then goto show1 endi @@ -124,7 +124,7 @@ $x = 0 show2: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show2 @@ -150,7 +150,7 @@ $x = 0 show3: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show3 @@ -163,16 +163,16 @@ print dnode3 $dnode3Vnodes $dnode4Vnodes = $data2_4 print dnode4 $dnode4Vnodes -if $dnode1Vnodes != 1 then +if $dnode1Vnodes != 3 then goto show3 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then goto show3 endi -if $dnode3Vnodes != 1 then +if $dnode3Vnodes != 3 then goto show3 endi -if $dnode4Vnodes != 1 then +if $dnode4Vnodes != 3 then goto show3 endi @@ -187,7 +187,7 @@ $x = 0 show4: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show4 @@ -213,7 +213,7 @@ $x = 0 show5: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show5 @@ -226,16 +226,16 @@ print dnode3 $dnode3Vnodes $dnode4Vnodes = $data2_4 print dnode4 $dnode4Vnodes -if $dnode1Vnodes != 1 then +if $dnode1Vnodes != 3 then goto show5 endi -if $dnode5Vnodes != 1 then +if $dnode5Vnodes != 3 then goto show5 endi -if $dnode3Vnodes != null then +if $dnode3Vnodes != NULL then goto show5 endi -if $dnode4Vnodes != 1 then +if $dnode4Vnodes != 3 then goto show5 endi @@ -250,7 +250,7 @@ $x = 0 show6: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show6 @@ -276,7 +276,7 @@ $x = 0 show7: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show7 @@ -289,16 +289,16 @@ print dnode5 $dnode5Vnodes $dnode6Vnodes = $data2_6 print dnode6 $dnode6Vnodes -if $dnode1Vnodes != 1 then +if $dnode1Vnodes != 3 then goto show7 endi -if $dnode5Vnodes != 1 then +if $dnode5Vnodes != 3 then goto show7 endi -if $dnode6Vnodes != 1 then +if $dnode6Vnodes != 3 then goto show7 endi -if $dnode4Vnodes != null then +if $dnode4Vnodes != NULL then goto show7 endi @@ -313,7 +313,7 @@ $x = 0 show8: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show8 @@ -340,11 +340,26 @@ sql drop dnode $hostname1 print drop dnode1 and sleep 9000 sleep 9000 +sql show mnodes +$dnode1Role = $data2_1 +$dnode4Role = $data2_4 +$dnode5Role = $data2_5 +print dnode1 ==> $dnode1Role +print dnode4 ==> $dnode4Role +print dnode5 ==> $dnode5Role + +if $dnode1Role != offline then + return -1 +endi + +print ============================== step9.1 +system sh/exec_up.sh -n dnode1 -s start + $x = 0 show9: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql show dnodes -x show9 @@ -355,41 +370,17 @@ print dnode6 $dnode6Vnodes $dnode7Vnodes = $data2_7 print dnode7 $dnode7Vnodes -if $dnode5Vnodes != 1 then +if $dnode5Vnodes != 3 then goto show9 endi -if $dnode6Vnodes != 1 then +if $dnode6Vnodes != 3 then goto show9 endi -if $dnode7Vnodes != 1 then +if $dnode7Vnodes != 3 then goto show9 endi -print ============================== step10 -sql create dnode $hostname8 -system sh/exec_up.sh -n dnode8 -s start -sleep 9000 - -$x = 0 -show10: - $x = $x + 1 - sleep 2000 - if $x == 30 then - return -1 - endi -sql show dnodes -x show10 -$dnode5Vnodes = $data2_5 -print dnode5 $dnode5Vnodes -$dnode6Vnodes = $data2_6 -print dnode6 $dnode6Vnodes -$dnode7Vnodes = $data2_7 -print dnode7 $dnode7Vnodes -$dnode8Vnodes = $data2_8 -print dnode8 $dnode8Vnodes - -if $dnode8Vnodes != 2 then - goto show10 -endi +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT print ============================== step11 print ========= add db4 @@ -400,7 +391,7 @@ $x = 0 create4: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi sql create table c_b3_t4 (t timestamp, i int) -x create4 @@ -409,37 +400,33 @@ sql insert into c_b3_t4 values(1520000021044, 44) sql insert into c_b3_t4 values(1520000022043, 43) sql insert into c_b3_t4 values(1520000023042, 42) sql insert into c_b3_t4 values(1520000024041, 41) -sleep 9000 + +sleep 3000 $x = 0 show11: $x = $x + 1 sleep 2000 - if $x == 30 then + if $x == 20 then return -1 endi -sql show dnodes -x show11 -$dnode1Vnodes = $data2_1 -print dnode1 $dnode1Vnodes -$dnode2Vnodes = $data2_2 -print dnode2 $dnode2Vnodes -$dnode3Vnodes = $data2_3 -print dnode3 $dnode3Vnodes -$dnode4Vnodes = $data2_4 -print dnode4 $dnode4Vnodes +sql show dnodes -x show11 +$dnode5Vnodes = $data2_5 +print dnode5 $dnode5Vnodes +$dnode6Vnodes = $data2_6 +print dnode6 $dnode6Vnodes +$dnode7Vnodes = $data2_7 +print dnode7 $dnode7Vnodes -if $dnode1Vnodes != 1 then +if $dnode5Vnodes != 4 then goto show11 endi -if $dnode2Vnodes != 1 then +if $dnode6Vnodes != 4 then + goto show11 +endi +if $dnode7Vnodes != 4 then goto show11 endi -#if $dnode3Vnodes != 1 then -# goto show11 -#endi -#if $dnode4Vnodes != 1 then -# goto show11 -#endi system sh/exec_up.sh -n dnode1 -s stop -x SIGINT @@ -504,25 +491,6 @@ if $data41 != 35 then return -1 endi -sql select * from c_b3_d4.c_b3_t4 order by t desc -print $data01 $data11 $data21 $data31 $data41 -if $data01 != 41 then - return -1 -endi -if $data11 != 42 then - return -1 -endi -if $data21 != 43 then - return -1 -endi -if $data31 != 44 then - return -1 -endi -if $data41 != 45 then - return -1 -endi - - print ============================================ over system sh/exec_up.sh -n dnode1 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT diff --git a/tests/script/general/cache/cache_balance.sim b/tests/script/unique/cluster/cache.sim similarity index 93% rename from tests/script/general/cache/cache_balance.sim rename to tests/script/unique/cluster/cache.sim index 27d048652c..41f9db69f3 100644 --- a/tests/script/general/cache/cache_balance.sim +++ b/tests/script/unique/cluster/cache.sim @@ -4,8 +4,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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 httpMaxThreads -v 2 system sh/cfg.sh -n dnode2 -c httpMaxThreads -v 2 system sh/cfg.sh -n dnode1 -c monitor -v 1 diff --git a/tests/script/unique/cluster/testSuite.sim b/tests/script/unique/cluster/testSuite.sim index 34cdda85dd..9657558c12 100644 --- a/tests/script/unique/cluster/testSuite.sim +++ b/tests/script/unique/cluster/testSuite.sim @@ -1,3 +1,4 @@ run unique/cluster/balance1.sim run unique/cluster/balance2.sim run unique/cluster/balance3.sim +run unique/cluster/cache.sim diff --git a/tests/script/unique/column/replica3.sim b/tests/script/unique/column/replica3.sim index 1b4884cb90..4b08b13e2f 100644 --- a/tests/script/unique/column/replica3.sim +++ b/tests/script/unique/column/replica3.sim @@ -3,9 +3,9 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 system sh/cfg.sh -n dnode3 -c numofMpeers -v 3 @@ -29,8 +29,11 @@ while $x < 1010 $x = $x + 1 endw -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop - - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/commit.sim b/tests/script/unique/db/commit.sim index d9c507f5fb..648cd8db2f 100644 --- a/tests/script/unique/db/commit.sim +++ b/tests/script/unique/db/commit.sim @@ -1,14 +1,11 @@ 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 commitLog -v 2 -system sh/cfg.sh -n dnode2 -c commitLog -v 2 -system sh/cfg.sh -n dnode3 -c commitLog -v 2 +system sh/cfg.sh -n dnode1 -c walLevel -v 2 +system sh/cfg.sh -n dnode2 -c walLevel -v 2 +system sh/cfg.sh -n dnode3 -c walLevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 @@ -118,3 +115,11 @@ if $data01 != 40 then return -1 endi +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/delete.sim b/tests/script/unique/db/delete.sim index ed41f1bb90..e222db8d70 100644 --- a/tests/script/unique/db/delete.sim +++ b/tests/script/unique/db/delete.sim @@ -6,18 +6,15 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 3 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 3 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 10 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 10 -system sh/cfg.sh -n dnode1 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode2 -c cacheBlockSize -v 200 -system sh/cfg.sh -n dnode3 -c cacheBlockSize -v 200 print ========= start dnodes system sh/exec_up.sh -n dnode1 -s start @@ -29,7 +26,7 @@ system sh/exec_up.sh -n dnode3 -s start sleep 3000 print ======== step1 -sql create database db replica 3 ablocks 2 tblocks 5 tables 10000 +sql create database db replica 3 ablocks 2 tblocks 5 maxtables 10000 sql create table db.mt (ts timestamp, tbcol int) TAGS(tgcol int) $tbPrefix = db.t @@ -47,3 +44,12 @@ sql show databases if $rows != 0 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/delete_part.sim b/tests/script/unique/db/delete_part.sim index 7e4e1b0b96..3d1cc5dc63 100644 --- a/tests/script/unique/db/delete_part.sim +++ b/tests/script/unique/db/delete_part.sim @@ -1,18 +1,13 @@ system sh/stop_dnodes.sh - - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -29,10 +24,10 @@ 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 -system sh/cfg.sh -n dnode1 -c tables -v 4 -system sh/cfg.sh -n dnode2 -c tables -v 4 -system sh/cfg.sh -n dnode3 -c tables -v 4 -system sh/cfg.sh -n dnode4 -c tables -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 print ========= start dnodes system sh/exec_up.sh -n dnode1 -s start @@ -77,3 +72,11 @@ begin: goto begin +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_add12.sim b/tests/script/unique/db/replica_add12.sim index 6217a965c0..b0de807fca 100644 --- a/tests/script/unique/db/replica_add12.sim +++ b/tests/script/unique/db/replica_add12.sim @@ -5,10 +5,10 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -73,9 +73,9 @@ endi sleep 2000 sql show dnodes -print dnode1 ==> openVnodes: $data3_1 -print dnode2 ==> openVnodes: $data3_2 -print dnode3 ==> openVnodes: $data3_3 +print dnode1 ==> openVnodes: $data2_1 +print dnode2 ==> openVnodes: $data2_2 +print dnode3 ==> openVnodes: $data2_3 if $data2_1 != 0 then return -1 @@ -99,9 +99,9 @@ sleep 10000 print ======== step3 sql show dnodes -print dnode1 ==> openVnodes: $data3_1 -print dnode2 ==> openVnodes: $data3_2 -print dnode3 ==> openVnodes: $data3_3 +print dnode1 ==> openVnodes: $data2_1 +print dnode2 ==> openVnodes: $data2_2 +print dnode3 ==> openVnodes: $data2_3 if $data2_1 != 0 then return -1 @@ -281,4 +281,13 @@ endi sql select * from d4.t4 if $rows != 4 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_add13.sim b/tests/script/unique/db/replica_add13.sim index 193238f5c0..ac7e3f5c5c 100644 --- a/tests/script/unique/db/replica_add13.sim +++ b/tests/script/unique/db/replica_add13.sim @@ -5,10 +5,10 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -258,4 +258,13 @@ endi sql select * from d4.t4 if $rows != 6 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_add23.sim b/tests/script/unique/db/replica_add23.sim index 5cc0347ac7..995cd4116c 100644 --- a/tests/script/unique/db/replica_add23.sim +++ b/tests/script/unique/db/replica_add23.sim @@ -5,10 +5,10 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -259,4 +259,13 @@ endi sql select * from d4.t4 if $rows != 6 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_part.sim b/tests/script/unique/db/replica_part.sim index 7fc81fbf5b..f0ffb89015 100644 --- a/tests/script/unique/db/replica_part.sim +++ b/tests/script/unique/db/replica_part.sim @@ -4,9 +4,9 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n 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 @@ -145,3 +145,12 @@ sql select * from d1.t1 sql select * from d2.t2 sql select * from d3.t3 sql select * from d4.t4 + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce21.sim b/tests/script/unique/db/replica_reduce21.sim index eddcaf0e6c..3a324c604a 100644 --- a/tests/script/unique/db/replica_reduce21.sim +++ b/tests/script/unique/db/replica_reduce21.sim @@ -4,9 +4,9 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 @@ -144,3 +144,12 @@ sql select * from d4.t4 if $rows != 3 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce31.sim b/tests/script/unique/db/replica_reduce31.sim index 658110e83d..fdb5e3c1dc 100644 --- a/tests/script/unique/db/replica_reduce31.sim +++ b/tests/script/unique/db/replica_reduce31.sim @@ -4,9 +4,9 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 @@ -182,3 +182,12 @@ sql select * from d1.t1 sql select * from d2.t2 sql select * from d3.t3 sql select * from d4.t4 + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/replica_reduce32.sim b/tests/script/unique/db/replica_reduce32.sim index 85f35f996c..83b5cb7a5b 100644 --- a/tests/script/unique/db/replica_reduce32.sim +++ b/tests/script/unique/db/replica_reduce32.sim @@ -4,9 +4,9 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 @@ -155,3 +155,12 @@ print d3.t3 $rows sql select * from d4.t4 print d4.t4 $rows + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/db/testSuite.sim b/tests/script/unique/db/testSuite.sim index 4918850426..adc1883a71 100644 --- a/tests/script/unique/db/testSuite.sim +++ b/tests/script/unique/db/testSuite.sim @@ -1,5 +1,5 @@ -#run unique/db/commit.sim -#run unique/db/delete.sim +run unique/db/commit.sim +run unique/db/delete.sim run unique/db/replica_add12.sim run unique/db/replica_add13.sim run unique/db/replica_add23.sim @@ -7,4 +7,4 @@ run unique/db/replica_reduce21.sim run unique/db/replica_reduce32.sim run unique/db/replica_reduce31.sim run unique/db/replica_part.sim -#run unique/db/delete_part.sim +run unique/db/delete_part.sim diff --git a/tests/script/unique/dnode/balance1.sim b/tests/script/unique/dnode/balance1.sim index 72286aad90..34d3310394 100644 --- a/tests/script/unique/dnode/balance1.sim +++ b/tests/script/unique/dnode/balance1.sim @@ -15,22 +15,22 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 print ========== step1 system sh/exec_up.sh -n dnode1 -s start sql connect sleep 3000 -sql create database d1 tables 4 +sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -68,7 +68,7 @@ if $data2_2 != 1 then endi print ========== step3 -sql create database d2 tables 4 +sql create database d2 maxTables 4 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -103,7 +103,7 @@ print dnode2 openVnodes $data2_2 if $data2_1 != 2 then goto show4 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show4 endi if $rows != 1 then @@ -131,7 +131,7 @@ print dnode3 openVnodes $data2_3 if $data2_1 != 0 then goto show5 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show5 endi if $data2_3 != 2 then @@ -139,7 +139,7 @@ if $data2_3 != 2 then endi print ========== step6 -sql create database d3 tables 4 +sql create database d3 maxTables 4 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -155,7 +155,7 @@ print dnode3 openVnodes $data2_3 if $data2_1 != 0 then return -1 endi -if $data2_2 != null then +if $data2_2 != NULL then return -1 endi if $data2_3 != 3 then @@ -182,7 +182,7 @@ print dnode4 openVnodes $data2_4 if $data2_1 != 0 then goto show7 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show7 endi if $data2_3 != 2 then @@ -193,7 +193,7 @@ if $data2_4 != 1 then endi print ========== step8 -sql create database d4 tables 4 +sql create database d4 maxTables 4 sql create table d4.t4 (t timestamp, i int) sql insert into d4.t4 values(now+1s, 45) sql insert into d4.t4 values(now+2s, 44) @@ -210,7 +210,7 @@ print dnode4 openVnodes $data2_4 if $data2_1 != 0 then return -1 endi -if $data2_2 != null then +if $data2_2 != NULL then return -1 endi if $data2_3 != 2 then @@ -240,10 +240,10 @@ print dnode4 openVnodes $data2_4 if $data2_1 != 0 then goto show9 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show9 endi -if $data2_3 != null then +if $data2_3 != NULL then goto show9 endi if $data2_4 != 4 then @@ -327,3 +327,12 @@ endi if $data41 != 45 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balance2.sim b/tests/script/unique/dnode/balance2.sim index decec25683..9786a854a5 100644 --- a/tests/script/unique/dnode/balance2.sim +++ b/tests/script/unique/dnode/balance2.sim @@ -12,11 +12,11 @@ system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode5 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 -system sh/cfg.sh -n dnode5 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 +system sh/cfg.sh -n dnode5 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start @@ -28,7 +28,7 @@ system sh/exec_up.sh -n dnode2 -s start system sh/exec_up.sh -n dnode3 -s start sleep 3000 -sql create database d1 replica 2 tables 4 +sql create database d1 replica 2 maxTables 4 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -36,7 +36,7 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 replica 2 tables 4 +sql create database d2 replica 2 maxTables 4 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -76,7 +76,7 @@ print dnode3 openVnodes $data2_3 if $data2_1 != 2 then goto show2 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show2 endi if $data2_3 != 2 then @@ -105,7 +105,7 @@ print dnode4 openVnodes $data2_4 if $data2_1 != 0 then goto show3 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show3 endi if $data2_3 != 2 then @@ -116,7 +116,7 @@ if $data2_4 != 2 then endi print ========== step4 -sql create database d3 replica 2 tables 4 +sql create database d3 replica 2 maxTables 4 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -132,7 +132,7 @@ print dnode4 openVnodes $data2_4 if $data2_1 != 0 then return -1 endi -if $data2_2 != null then +if $data2_2 != NULL then return -1 endi if $data2_3 != 3 then @@ -163,7 +163,7 @@ print dnode5 openVnodes $data2_5 if $data2_1 != 0 then goto show5 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show5 endi if $data2_3 != 2 then @@ -196,10 +196,10 @@ print dnode5 openVnodes $data2_5 if $data2_1 != 0 then goto show6 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show6 endi -if $data2_3 != null then +if $data2_3 != NULL then goto show6 endi if $data2_4 != 3 then @@ -268,3 +268,12 @@ endi if $data41 != 35 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balance3.sim b/tests/script/unique/dnode/balance3.sim index 53fda28dc4..6d5bbc77a5 100644 --- a/tests/script/unique/dnode/balance3.sim +++ b/tests/script/unique/dnode/balance3.sim @@ -14,12 +14,12 @@ system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode5 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode6 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 -system sh/cfg.sh -n dnode5 -c clog -v 1 -system sh/cfg.sh -n dnode6 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 +system sh/cfg.sh -n dnode5 -c wallevel -v 1 +system sh/cfg.sh -n dnode6 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start @@ -33,7 +33,7 @@ system sh/exec_up.sh -n dnode3 -s start system sh/exec_up.sh -n dnode4 -s start sleep 3000 -sql create database d1 replica 3 tables 4 +sql create database d1 replica 3 maxTables 4 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -41,7 +41,7 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 replica 3 tables 4 +sql create database d2 replica 3 maxTables 4 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -88,7 +88,7 @@ print dnode4 openVnodes $data2_4 if $data2_1 != 2 then goto show2 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show2 endi if $data2_3 != 2 then @@ -122,7 +122,7 @@ print dnode5 openVnodes $data2_5 if $data2_1 != 0 then goto show3 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show3 endi if $data2_3 != 2 then @@ -136,7 +136,7 @@ if $data2_5 != 2 then endi print ========== step4 -sql create database d3 replica 3 tables 4 +sql create database d3 replica 3 maxTables 4 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -162,7 +162,7 @@ print dnode5 openVnodes $data2_5 if $data2_1 != 0 then goto show4 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show4 endi if $data2_3 != 3 then @@ -228,7 +228,7 @@ endi if $data2_6 != 3 then goto show6 endi -if $data2_3 != null then +if $data2_3 != NULL then goto show6 endi if $data2_4 != 3 then @@ -298,3 +298,11 @@ if $data41 != 35 then return -1 endi +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/balancex.sim b/tests/script/unique/dnode/balancex.sim index 6c851b5559..4b46db4b49 100644 --- a/tests/script/unique/dnode/balancex.sim +++ b/tests/script/unique/dnode/balancex.sim @@ -10,17 +10,17 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start sql connect sleep 3000 -sql create database d1 tables 4 +sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -28,7 +28,7 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 tables 4 +sql create database d2 maxTables 4 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -65,7 +65,7 @@ if $data2_2 != 2 then endi print ========== step3 -sql create database d3 replica 2 tables 4 +sql create database d3 replica 2 maxTables 4 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -132,7 +132,7 @@ print dnode3 openVnodes $data2_3 if $data2_1 != 1 then goto show5 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show5 endi if $data2_3 != 3 then @@ -199,3 +199,11 @@ if $data41 != 35 then return -1 endi +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/monitor_bug.sim b/tests/script/unique/dnode/monitor_bug.sim index fda7f4ad77..8726caf1db 100644 --- a/tests/script/unique/dnode/monitor_bug.sim +++ b/tests/script/unique/dnode/monitor_bug.sim @@ -6,8 +6,8 @@ system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 system sh/cfg.sh -n dnode1 -c monitor -v 1 system sh/cfg.sh -n dnode2 -c monitor -v 0 diff --git a/tests/script/unique/dnode/offline1.sim b/tests/script/unique/dnode/offline1.sim index c4751bb66b..4d67b5f55c 100644 --- a/tests/script/unique/dnode/offline1.sim +++ b/tests/script/unique/dnode/offline1.sim @@ -16,9 +16,9 @@ system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start @@ -63,7 +63,15 @@ print dnode1 $data4_2 if $data4_1 != ready then return -1 endi -if $data4_2 != null then +if $data4_2 != NULL then return -1 endi +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/offline2.sim b/tests/script/unique/dnode/offline2.sim index b9a3464811..6aa85465dd 100644 --- a/tests/script/unique/dnode/offline2.sim +++ b/tests/script/unique/dnode/offline2.sim @@ -16,9 +16,9 @@ system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start @@ -27,7 +27,7 @@ sql create dnode $hostname2 system sh/exec_up.sh -n dnode2 -s start sleep 3000 -sql create database d1 replica 2 tables 4 +sql create database d1 replica 2 maxTables 4 sql create table d1.t1(ts timestamp, i int) sql insert into d1.t1 values(now, 1) @@ -90,7 +90,7 @@ sql show dnodes if $data4_1 != ready then goto show4 endi -if $data4_2 != null then +if $data4_2 != NULL then goto show4 endi if $data4_3 != ready then @@ -106,3 +106,11 @@ if $rows != 1 then return -1 endi +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/remove1.sim b/tests/script/unique/dnode/remove1.sim index c345aa202b..545c28a4ea 100644 --- a/tests/script/unique/dnode/remove1.sim +++ b/tests/script/unique/dnode/remove1.sim @@ -10,17 +10,17 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start sql connect sleep 3000 -sql create database d1 tables 4 +sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -28,7 +28,7 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 tables 4 +sql create database d2 maxTables 4 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -47,7 +47,7 @@ sql create dnode $hostname2 system sh/exec_up.sh -n dnode2 -s start sleep 9000 -sql create database d3 replica 2 tables 4 +sql create database d3 replica 2 maxTables 4 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -105,7 +105,7 @@ 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_2 != NULL then goto show4 endi @@ -130,7 +130,7 @@ print dnode4 openVnodes $data2_4 if $data2_1 != 4 then goto show5 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show5 endi if $data2_3 != 2 then @@ -194,3 +194,12 @@ endi if $data41 != 35 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/remove2.sim b/tests/script/unique/dnode/remove2.sim index 909f82e61c..972b77a35d 100644 --- a/tests/script/unique/dnode/remove2.sim +++ b/tests/script/unique/dnode/remove2.sim @@ -10,17 +10,17 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start sql connect sleep 3000 -sql create database d1 tables 4 +sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -28,7 +28,7 @@ sql insert into d1.t1 values(now+3s, 13) sql insert into d1.t1 values(now+4s, 12) sql insert into d1.t1 values(now+5s, 11) -sql create database d2 tables 4 +sql create database d2 maxTables 4 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) sql insert into d2.t2 values(now+2s, 24) @@ -47,7 +47,7 @@ sql create dnode $hostname2 system sh/exec_up.sh -n dnode2 -s start sleep 9000 -sql create database d3 replica 2 tables 4 +sql create database d3 replica 2 maxTables 4 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -106,7 +106,7 @@ 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_2 != NULL then goto show4 endi if $data2_1 != 3 then @@ -140,3 +140,12 @@ endi if $data41 != 35 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/dnode/testSuite.sim b/tests/script/unique/dnode/testSuite.sim index 9921cbf378..ecd43cc224 100644 --- a/tests/script/unique/dnode/testSuite.sim +++ b/tests/script/unique/dnode/testSuite.sim @@ -4,6 +4,6 @@ run unique/dnode/balance3.sim run unique/dnode/balancex.sim run unique/dnode/offline1.sim run unique/dnode/offline2.sim -#run unique/dnode/remove1.sim -#run unique/dnode/remove2.sim -#run unique/dnode/vnode_clean.sim +run unique/dnode/remove1.sim +run unique/dnode/remove2.sim +run unique/dnode/vnode_clean.sim diff --git a/tests/script/unique/dnode/vnode_clean.sim b/tests/script/unique/dnode/vnode_clean.sim index 3693868497..da34c7bc9b 100644 --- a/tests/script/unique/dnode/vnode_clean.sim +++ b/tests/script/unique/dnode/vnode_clean.sim @@ -10,16 +10,16 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 print ========== step1 system sh/exec_up.sh -n dnode1 -s start sql connect -sql create database d1 tables 4 +sql create database d1 maxTables 4 sql create table d1.t1 (t timestamp, i int) sql insert into d1.t1 values(now+1s, 15) sql insert into d1.t1 values(now+2s, 14) @@ -55,7 +55,7 @@ if $data2_2 != 3 then endi print ========== step3 -sql create database d2 tables 4 +sql create database d2 maxTables 4 sql create table d2.t2 (t timestamp, i int) sql insert into d2.t2 values(now+1s, 25) @@ -91,7 +91,7 @@ print dnode2 openVnodes $data2_2 if $data2_1 != 2 then goto show4 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show4 endi if $rows != 1 then @@ -107,7 +107,7 @@ system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c clog -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 system sh/exec_up.sh -n dnode2 -s start $x = 0 @@ -128,7 +128,7 @@ if $data2_2 != 2 then endi print ========== step6 -sql create database d3 tables 4 +sql create database d3 maxTables 4 sql create table d3.t3 (t timestamp, i int) sql insert into d3.t3 values(now+1s, 35) sql insert into d3.t3 values(now+2s, 34) @@ -220,7 +220,7 @@ print dnode3 openVnodes $data2_3 if $data2_1 != 4 then goto show9 endi -if $data2_2 != null then +if $data2_2 != NULL then goto show9 endi if $data2_3 != 0 then @@ -302,3 +302,11 @@ if $data41 != 45 then return -1 endi +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/http/admin.sim b/tests/script/unique/http/admin.sim index 2b1c7e08c9..51307af00e 100644 --- a/tests/script/unique/http/admin.sim +++ b/tests/script/unique/http/admin.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c http -v 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 #system sh/cfg.sh -n dnode1 -c adminRowLimit -v 10 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec_up.sh -n dnode1 -s start @@ -177,4 +177,13 @@ print =============== step8 - monitor dbs #print 24-> $system_content #if $system_content != @[{"status":"succ","head":["IP","created time","open vnodes","free vnodes","status","balance state"],"data":[["127.0.0.1","2018-09-04 #11:16:13.985",1,3,"ready","balanced"]],"rows":1},{"status":"succ","head":["IP","created time","status","role"],"data":[["127.0.0.1","2018-09-04 11:16:13.371","serving","master"]],"rows":1}]@ then # return -1 -# endi \ No newline at end of file +# endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/http/opentsdb.sim b/tests/script/unique/http/opentsdb.sim index 3c59a73454..914838361a 100644 --- a/tests/script/unique/http/opentsdb.sim +++ b/tests/script/unique/http/opentsdb.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c clog -v 0 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start sleep 3000 @@ -12,7 +12,7 @@ print ============================ dnode1 start print =============== step1 - parse system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/ print $system_content -if $system_content != @{"status":"error","code":1057,"desc":"database name can not be null"}@ then +if $system_content != @{"status":"error","code":1057,"desc":"database name can not be NULL"}@ then return -1 endi @@ -24,7 +24,7 @@ endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/ print $system_content -if $system_content != @{"status":"error","code":1057,"desc":"database name can not be null"}@ then +if $system_content != @{"status":"error","code":1057,"desc":"database name can not be NULL"}@ then return -1 endi @@ -129,7 +129,7 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:6020/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":1073,"desc":"tag name is null"}@ then +if $system_content != @{"status":"error","code":1073,"desc":"tag name is NULL"}@ then return -1 endi @@ -147,7 +147,7 @@ endi system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:6020/opentsdb/db/put print $system_content -if $system_content != @{"status":"error","code":1076,"desc":"tag value is null"}@ then +if $system_content != @{"status":"error","code":1076,"desc":"tag value is NULL"}@ then return -1 endi @@ -234,4 +234,13 @@ system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' print $system_content if $system_content != @{"status":"succ","head":["count(*)"],"data":[[8]],"rows":1}@ then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/http/testSuite.sim b/tests/script/unique/http/testSuite.sim index d4a6b1f5f5..3a9753e744 100644 --- a/tests/script/unique/http/testSuite.sim +++ b/tests/script/unique/http/testSuite.sim @@ -1,2 +1,2 @@ run unique/http/admin.sim -#run general/http/opentsdb.sim \ No newline at end of file +run general/http/opentsdb.sim \ No newline at end of file diff --git a/tests/script/unique/import/replica2.sim b/tests/script/unique/import/replica2.sim index 52afbd93cb..bcb4179c12 100644 --- a/tests/script/unique/import/replica2.sim +++ b/tests/script/unique/import/replica2.sim @@ -15,10 +15,10 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 system sh/cfg.sh -n dnode1 -c commitlog -v 0 system sh/cfg.sh -n dnode2 -c commitlog -v 0 @@ -40,14 +40,16 @@ sql create table tb(ts timestamp, i int) print ================= step1 sql import into tb values(1520000010000, 10000) sql select * from tb; +print $rows if $rows != 1 then return -1 endi print ================= step2 sql insert into tb values(1520000008000, 8000) +print $rows sql select * from tb; -if $rows != 1 then +if $rows != 2 then return -1 endi @@ -55,7 +57,7 @@ print ================= step3 sql insert into tb values(1520000020000, 20000) sql select * from tb; print $rows -if $rows != 2 then +if $rows != 3 then return -1 endi @@ -64,7 +66,8 @@ sql import into tb values(1520000009000, 9000) sql import into tb values(1520000015000, 15000) sql import into tb values(1520000030000, 30000) sql select * from tb; -if $rows != 5 then +print $rows +if $rows != 6 then return -1 endi @@ -74,7 +77,8 @@ sql insert into tb values(1520000014000, 14000) sql insert into tb values(1520000025000, 25000) sql insert into tb values(1520000040000, 40000) sql select * from tb; -if $rows != 6 then +print $rows +if $rows != 9 then return -1 endi @@ -85,7 +89,8 @@ sql import into tb values(1520000023000, 23000) sql import into tb values(1520000034000, 34000) sql import into tb values(1520000050000, 50000) sql select * from tb; -if $rows != 11 then +print $rows +if $rows != 14 then return -1 endi @@ -95,7 +100,7 @@ sleep 5000 system sh/exec_up.sh -n dnode1 -s start sleep 5000 sql select * from tb; -if $rows != 11 then +if $rows != 14 then return -1 endi @@ -106,7 +111,8 @@ sql import into tb values(1520000023001, 23001) sql import into tb values(1520000034001, 34001) sql import into tb values(1520000050001, 50001) sql select * from tb; -if $rows != 16 then +print $rows +if $rows != 19 then return -1 endi @@ -116,7 +122,8 @@ sql insert into tb values(1520000014002, 14002) sql insert into tb values(1520000025002, 25002) sql insert into tb values(1520000060000, 60000) sql select * from tb; -if $rows != 17 then +print $rows +if $rows != 24 then return -1 endi @@ -148,7 +155,8 @@ sql import into tb values(1521900800000, 50004) sql import into tb values(1523110400000, 50001) sql import into tb values(1521382400000, 500051) sql select * from tb; -if $rows != 29 then +print $rows +if $rows != 36 then return -1 endi @@ -158,7 +166,8 @@ sleep 5000 system sh/exec_up.sh -n dnode1 -s start sleep 5000 sql select * from tb; -if $rows != 29 then +print $rows +if $rows != 36 then return -1 endi @@ -167,7 +176,7 @@ 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 select * from tb; -if $rows != 34 then +if $rows != 41 then return -1 endi @@ -176,7 +185,8 @@ print ================= step12 #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 select * from tb; -if $rows != 43 then +print $rows +if $rows != 50 then return -1 endi @@ -195,7 +205,7 @@ sql import into tb values(1516716800000, 50001) sql import into tb values(1517580800000, 50001) sql select * from tb; -if $rows != 46 then +if $rows != 50 then return -1 endi @@ -205,6 +215,15 @@ sleep 8000 system sh/exec_up.sh -n dnode1 -s stop sleep 10000 -if $rows != 46 then +if $rows != 50 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/import/replica3.sim b/tests/script/unique/import/replica3.sim index 8b8602df66..8d70d227a5 100644 --- a/tests/script/unique/import/replica3.sim +++ b/tests/script/unique/import/replica3.sim @@ -15,10 +15,10 @@ system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 2000 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 2000 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000 system sh/cfg.sh -n dnode1 -c commitlog -v 0 system sh/cfg.sh -n dnode2 -c commitlog -v 0 @@ -41,53 +41,59 @@ sql use ir3db sql create table tb(ts timestamp, i int) print ================= step1 -sql import into tb values(now+10000a, 10000) +sql import into tb values(1520000010000, 10000) sql select * from tb; +print $rows if $rows != 1 then return -1 endi print ================= step2 -sql insert into tb values(now+8000a, 8000) -sql select * from tb; -if $rows != 1 then - return -1 -endi - -print ================= step3 -sql insert into tb values(now+20000a, 20000) +sql insert into tb values(1520000008000, 8000) +print $rows sql select * from tb; if $rows != 2 then return -1 endi -print ================= step4 -sql import into tb values(now+8000a, 9000) -sql import into tb values(now+15000a, 15000) -sql import into tb values(now+30000a, 30000) +print ================= step3 +sql insert into tb values(1520000020000, 20000) sql select * from tb; -if $rows != 5 then +print $rows +if $rows != 3 then return -1 endi -print ================= step5 -sql insert into tb values(now+8000a, 8000) -sql insert into tb values(now+14000a, 14000) -sql insert into tb values(now+25000a, 25000) -sql insert into tb values(now+40000a, 40000) +print ================= step4 +sql import into tb values(1520000009000, 9000) +sql import into tb values(1520000015000, 15000) +sql import into tb values(1520000030000, 30000) sql select * from tb; +print $rows if $rows != 6 then return -1 endi -print ================= step6 -sql import into tb values(now+7000a, 7000) -sql import into tb values(now+12000a, 12000) -sql import into tb values(now+23000a, 23000) -sql import into tb values(now+34000a, 34000) -sql import into tb values(now+50000a, 50000) +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 select * from tb; -if $rows != 11 then +print $rows +if $rows != 9 then + return -1 +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 select * from tb; +print $rows +if $rows != 14 then return -1 endi @@ -97,46 +103,63 @@ endi #system sh/exec_up.sh -n dnode1 -s start #sleep 5000 #sql select * from tb; -#if $rows != 11 then +#if $rows != 14 then # return -1 #endi print ================= step7 -sql import into tb values(now+7001a, 7001) -sql import into tb values(now+12001a, 12001) -sql import into tb values(now+23001a, 23001) -sql import into tb values(now+34001a, 34001) -sql import into tb values(now+50001a, 50001) +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 select * from tb; -if $rows != 16 then +print $rows +if $rows != 19 then return -1 endi print ================= step8 -sql insert into tb values(now+8002a, 8002) -sql insert into tb values(now+14002a, 14002) -sql insert into tb values(now+25002a, 25002) -sql insert into tb values(now+200000a, 60000) +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 select * from tb; -if $rows != 17 then +print $rows +if $rows != 24 then return -1 endi print ================= step9 -sql import into tb values(now-30d, 7003) -sql import into tb values(now-20d, 34003) -sql import into tb values(now-10d, 34003) -sql import into tb values(now-5d, 34003) -sql import into tb values(now+1m, 50001) -sql import into tb values(now+2m, 50001) -sql import into tb values(now+6m, 50001) -sql import into tb values(now+8m, 50002) -sql import into tb values(now+10m, 50003) -sql import into tb values(now+12m, 50004) -sql import into tb values(now+14m, 50001) -sql import into tb values(now+16m, 500051) +#1520000000000 +#sql import into tb values(now-30d, 7003) +#sql import into tb values(now-20d, 34003) +#sql import into tb values(now-10d, 34003) +#sql import into tb values(now-5d, 34003) +#sql import into tb values(now+1d, 50001) +#sql import into tb values(now+2d, 50001) +#sql import into tb values(now+6d, 50001) +#sql import into tb values(now+8d, 50002) +#sql import into tb values(now+10d, 50003) +#sql import into tb values(now+12d, 50004) +#sql import into tb values(now+14d, 50001) +#sql import into tb values(now+16d, 500051) + +sql import into tb values(1517408000000, 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 select * from tb; -if $rows != 29 then +print $rows +if $rows != 36 then return -1 endi @@ -146,21 +169,27 @@ sleep 5000 system sh/exec_up.sh -n dnode1 -s start sleep 5000 sql select * from tb; -if $rows != 29 then +print $rows +if $rows != 36 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(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 select * from tb; -if $rows != 34 then +if $rows != 41 then return -1 endi print ================= step12 -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) +#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 select * from tb; -if $rows != 43 then +print $rows +if $rows != 50 then return -1 endi @@ -169,11 +198,17 @@ system sh/exec_up.sh -n dnode2 -s stop sleep 5000 print ================= step14 -sql import into tb values(now-48d, 34003) -sql import into tb values(now-38d, 50001) -sql import into tb values(now-28d, 50001) +#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(1515852800001, 34003) +sql import into tb values(1516716800000, 50001) +sql import into tb values(1517580800000, 50001) + sql select * from tb; -if $rows != 46 then +if $rows != 50 then return -1 endi @@ -183,6 +218,15 @@ sleep 8000 system sh/exec_up.sh -n dnode3 -s stop sleep 3000 -if $rows != 46 then +if $rows != 50 then return -1 endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/import/testSuite.sim b/tests/script/unique/import/testSuite.sim index df87ebf1be..8be358ce17 100644 --- a/tests/script/unique/import/testSuite.sim +++ b/tests/script/unique/import/testSuite.sim @@ -1,2 +1,2 @@ -#run unique/import/replica2.sim -#run unique/import/replica3.sim \ No newline at end of file +run unique/import/replica2.sim +run unique/import/replica3.sim \ No newline at end of file diff --git a/tests/script/unique/metrics/balance_replica1.sim b/tests/script/unique/metrics/balance_replica1.sim index d32e647fbe..52bf558faa 100644 --- a/tests/script/unique/metrics/balance_replica1.sim +++ b/tests/script/unique/metrics/balance_replica1.sim @@ -10,12 +10,12 @@ 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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 $dbPrefix = br1_db $tbPrefix = br1_tb @@ -34,7 +34,7 @@ $db = $dbPrefix $mt = $mtPrefix $st = $stPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) @@ -76,7 +76,7 @@ print dnode2 $dnode2Vnodes if $dnode1Vnodes != 0 then goto show1 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then goto show1 endi print =============== step3 start dnode2 @@ -136,4 +136,13 @@ sql select * from $mt print select * from $mt ==> $rows if $rows != 2600 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/dnode2.sim b/tests/script/unique/metrics/dnode2.sim index c4556d0f0e..cd76b39ba0 100644 --- a/tests/script/unique/metrics/dnode2.sim +++ b/tests/script/unique/metrics/dnode2.sim @@ -4,12 +4,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect @@ -43,7 +43,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -195,4 +195,13 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/dnode2_stop.sim b/tests/script/unique/metrics/dnode2_stop.sim index 93012e53ae..996482d11e 100644 --- a/tests/script/unique/metrics/dnode2_stop.sim +++ b/tests/script/unique/metrics/dnode2_stop.sim @@ -4,12 +4,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect @@ -48,7 +48,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -148,4 +148,13 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/dnode3.sim b/tests/script/unique/metrics/dnode3.sim index 9ca7dec33d..3a5419dff4 100644 --- a/tests/script/unique/metrics/dnode3.sim +++ b/tests/script/unique/metrics/dnode3.sim @@ -6,15 +6,15 @@ 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 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 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 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 dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect @@ -54,7 +54,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -224,4 +224,13 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/replica2_dnode4.sim b/tests/script/unique/metrics/replica2_dnode4.sim index 262f7f3a7c..bedc895dd1 100644 --- a/tests/script/unique/metrics/replica2_dnode4.sim +++ b/tests/script/unique/metrics/replica2_dnode4.sim @@ -8,18 +8,18 @@ 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 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 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 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 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect @@ -63,7 +63,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 2 tables 4 +sql create database $db replica 2 maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -215,4 +215,13 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/replica2_vnode3.sim b/tests/script/unique/metrics/replica2_vnode3.sim index 0611af0b9e..9a1d3477be 100644 --- a/tests/script/unique/metrics/replica2_vnode3.sim +++ b/tests/script/unique/metrics/replica2_vnode3.sim @@ -4,12 +4,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect @@ -42,7 +42,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 2 tables 4 +sql create database $db replica 2 maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -192,4 +192,13 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/replica3_dnode6.sim b/tests/script/unique/metrics/replica3_dnode6.sim index 73c67e54c2..135e594cdc 100644 --- a/tests/script/unique/metrics/replica3_dnode6.sim +++ b/tests/script/unique/metrics/replica3_dnode6.sim @@ -14,12 +14,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 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 dnode5 -c commitLog -v 0 -system sh/cfg.sh -n dnode6 -c commitLog -v 0 +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 numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 @@ -28,12 +28,12 @@ system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode5 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode6 -c numOfTotalVnodes -v 4 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode6 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode6 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect @@ -93,7 +93,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 3 tables 4 +sql create database $db replica 3 maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -245,4 +245,13 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/replica3_vnode3.sim b/tests/script/unique/metrics/replica3_vnode3.sim index 006b01bc74..ca147c1ef5 100644 --- a/tests/script/unique/metrics/replica3_vnode3.sim +++ b/tests/script/unique/metrics/replica3_vnode3.sim @@ -8,18 +8,18 @@ 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 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 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 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 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect @@ -62,7 +62,7 @@ $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i -sql create database $db replica 3 tables 4 +sql create database $db replica 3 maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) @@ -214,4 +214,13 @@ sql drop database $db sql show databases if $rows != 0 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/metrics/testSuite.sim b/tests/script/unique/metrics/testSuite.sim index dd8ab53aa1..2e3ab31a44 100644 --- a/tests/script/unique/metrics/testSuite.sim +++ b/tests/script/unique/metrics/testSuite.sim @@ -1,4 +1,8 @@ -#run unique/metrics/disk.sim -#run unique/metrics/metrics.sim -#run unique/metrics/values.sim -#run unique/metrics/vnode3.sim \ No newline at end of file +run unique/metrics/balance_replica1.sim +run unique/metrics/dnode2_stop.sim +run unique/metrics/dnode2.sim +run unique/metrics/dnode3.sim +run unique/metrics/replica2_dnode4.sim +run unique/metrics/replica2_vnode3.sim +run unique/metrics/replica3_dnode6.sim +run unique/metrics/replica3_vnode3.sim \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt22.sim b/tests/script/unique/mnode/mgmt22.sim index 05e636d0de..37e38fbf66 100644 --- a/tests/script/unique/mnode/mgmt22.sim +++ b/tests/script/unique/mnode/mgmt22.sim @@ -9,6 +9,7 @@ system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 print ============== step1 system sh/exec_up.sh -n dnode1 -s start +sleep 3000 sql connect sql show mnodes @@ -45,7 +46,7 @@ sql_error drop dnode $hostname1 -x error1 print should not drop master print ============== step4 -system sh/exec_up.sh -n dnode1 -s stop +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT sql_error show mnodes print error of no master @@ -104,6 +105,11 @@ if $data3_3 != null then goto show7 endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt23.sim b/tests/script/unique/mnode/mgmt23.sim index 07f8894769..99d9159573 100644 --- a/tests/script/unique/mnode/mgmt23.sim +++ b/tests/script/unique/mnode/mgmt23.sim @@ -59,7 +59,7 @@ endi if $dnode2Role != slave then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi @@ -78,7 +78,7 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then @@ -106,7 +106,7 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then @@ -122,6 +122,11 @@ sql_error show mnodes print ============== step7 sql_error drop dnode $hostname1 -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt24.sim b/tests/script/unique/mnode/mgmt24.sim index 3598534504..4c61cbd7ae 100644 --- a/tests/script/unique/mnode/mgmt24.sim +++ b/tests/script/unique/mnode/mgmt24.sim @@ -73,6 +73,11 @@ if $data2_2 != slave then goto step5 endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt25.sim b/tests/script/unique/mnode/mgmt25.sim index cedfad4bd0..ba545f9479 100644 --- a/tests/script/unique/mnode/mgmt25.sim +++ b/tests/script/unique/mnode/mgmt25.sim @@ -59,7 +59,7 @@ endi if $dnode2Role != slave then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi @@ -78,13 +78,18 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then return -1 endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt26.sim b/tests/script/unique/mnode/mgmt26.sim index 105e753634..e5ead5bb39 100644 --- a/tests/script/unique/mnode/mgmt26.sim +++ b/tests/script/unique/mnode/mgmt26.sim @@ -59,7 +59,7 @@ endi if $dnode2Role != slave then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi @@ -79,7 +79,7 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then @@ -106,13 +106,18 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then return -1 endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt33.sim b/tests/script/unique/mnode/mgmt33.sim index ef9b0bbcc7..36b7ba8139 100644 --- a/tests/script/unique/mnode/mgmt33.sim +++ b/tests/script/unique/mnode/mgmt33.sim @@ -18,10 +18,10 @@ print dnode3 ==> $data3_3 if $data2_1 != master then return -1 endi -if $data3_2 != null then +if $data3_2 != NULL then return -1 endi -if $data3_3 != null then +if $data3_3 != NULL then return -1 endi @@ -44,7 +44,7 @@ endi if $dnode2Role != slave then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi @@ -86,7 +86,7 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then @@ -156,7 +156,7 @@ print dnode1 ==> $dnode1Role print dnode2 ==> $dnode2Role print dnode3 ==> $dnode3Role -if $dnode1Role != null then +if $dnode1Role != NULL then return -1 endi #if $dnode2Role != master then @@ -166,6 +166,11 @@ endi # return -1 #endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt34.sim b/tests/script/unique/mnode/mgmt34.sim index af4353b563..1139daea1c 100644 --- a/tests/script/unique/mnode/mgmt34.sim +++ b/tests/script/unique/mnode/mgmt34.sim @@ -22,10 +22,10 @@ print dnode3 ==> $data3_3 if $data2_1 != master then return -1 endi -if $data3_2 != null then +if $data3_2 != NULL then return -1 endi -if $data3_3 != null then +if $data3_3 != NULL then return -1 endi @@ -50,10 +50,10 @@ endi if $dnode2Role != slave then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi -if $dnode4Role != null then +if $dnode4Role != NULL then return -1 endi @@ -81,7 +81,7 @@ endi if $dnode3Role != slave then return -1 endi -if $dnode4Role != null then +if $dnode4Role != NULL then return -1 endi @@ -110,7 +110,7 @@ endi if $dnode3Role != slave then return -1 endi -if $dnode4Role != null then +if $dnode4Role != NULL then return -1 endi @@ -131,7 +131,7 @@ print dnode4 ==> $dnode4Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then @@ -165,7 +165,7 @@ print dnode4 ==> $dnode4Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi if $dnode3Role != slave then @@ -207,7 +207,7 @@ print dnode2 ==> $dnode2Role print dnode3 ==> $dnode3Role print dnode4 ==> $dnode4Role -if $dnode1Role != null then +if $dnode1Role != NULL then return -1 endi if $dnode2Role != slave then @@ -220,7 +220,11 @@ endi # return -1 #endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop -system sh/exec_up.sh -n dnode4 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmtr2.sim b/tests/script/unique/mnode/mgmtr2.sim index 097d510929..56a4b30573 100644 --- a/tests/script/unique/mnode/mgmtr2.sim +++ b/tests/script/unique/mnode/mgmtr2.sim @@ -23,10 +23,10 @@ print dnode3 ==> $dnode3Role if $dnode1Role != master then return -1 endi -if $dnode2Role != null then +if $dnode2Role != NULL then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi @@ -71,10 +71,15 @@ endi if $rows != 2 then return -1 endi -if $dnode3Role != null then +if $dnode3Role != NULL then return -1 endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/mnode/secondIp.sim b/tests/script/unique/mnode/secondIp.sim index 71c2cdfb76..cfe75ffc84 100644 --- a/tests/script/unique/mnode/secondIp.sim +++ b/tests/script/unique/mnode/secondIp.sim @@ -34,6 +34,11 @@ if $data4_2 != 4 then return -1 endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop \ No newline at end of file +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/stream/metrics_balance.sim b/tests/script/unique/stream/metrics_balance.sim index feac15f4db..e711baf206 100644 --- a/tests/script/unique/stream/metrics_balance.sim +++ b/tests/script/unique/stream/metrics_balance.sim @@ -10,16 +10,14 @@ 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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode1 -c meterMetaKeepTimer -v 5 -system sh/cfg.sh -n dnode2 -c meterMetaKeepTimer -v 5 -system sh/cfg.sh -n dnode1 -c metricMetaKeepTimer -v 5 -system sh/cfg.sh -n dnode2 -c metricMetaKeepTimer -v 5 +system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 5 +system sh/cfg.sh -n dnode2 -c tableMetaKeepTimer -v 5 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 @@ -36,7 +34,7 @@ sql connect print ============== step1 $db = $dbPrefix -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db $i = 0 @@ -194,7 +192,7 @@ print dnode2 $dnode2Vnodes if $dnode1Vnodes != 0 then goto show1 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then goto show1 endi diff --git a/tests/script/unique/stream/metrics_replica1_dnode2.sim b/tests/script/unique/stream/metrics_replica1_dnode2.sim index f932f601ff..78b9165681 100644 --- a/tests/script/unique/stream/metrics_replica1_dnode2.sim +++ b/tests/script/unique/stream/metrics_replica1_dnode2.sim @@ -4,12 +4,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/metrics_replica2_dnode2.sim b/tests/script/unique/stream/metrics_replica2_dnode2.sim index ba90d8b833..e9944daf37 100644 --- a/tests/script/unique/stream/metrics_replica2_dnode2.sim +++ b/tests/script/unique/stream/metrics_replica2_dnode2.sim @@ -4,8 +4,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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode2 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/metrics_replica2_dnode2_vnoden.sim b/tests/script/unique/stream/metrics_replica2_dnode2_vnoden.sim index d0ef82b6a0..47454501c6 100644 --- a/tests/script/unique/stream/metrics_replica2_dnode2_vnoden.sim +++ b/tests/script/unique/stream/metrics_replica2_dnode2_vnoden.sim @@ -4,12 +4,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/metrics_replica2_dnode3.sim b/tests/script/unique/stream/metrics_replica2_dnode3.sim index fc4b454059..a8c986cce9 100644 --- a/tests/script/unique/stream/metrics_replica2_dnode3.sim +++ b/tests/script/unique/stream/metrics_replica2_dnode3.sim @@ -6,15 +6,15 @@ 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 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 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 dnode1 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/metrics_replica3_dnode4.sim b/tests/script/unique/stream/metrics_replica3_dnode4.sim index 90f9ed16ed..8ff7a3738e 100644 --- a/tests/script/unique/stream/metrics_replica3_dnode4.sim +++ b/tests/script/unique/stream/metrics_replica3_dnode4.sim @@ -8,18 +8,18 @@ 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 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 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 numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/metrics_vnode_stop.sim b/tests/script/unique/stream/metrics_vnode_stop.sim index 71a085454b..4f85d75e7f 100644 --- a/tests/script/unique/stream/metrics_vnode_stop.sim +++ b/tests/script/unique/stream/metrics_vnode_stop.sim @@ -4,8 +4,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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfMPeers -v 2 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 system sh/exec.sh -n dnode1 -s start @@ -99,8 +99,8 @@ system sh/exec.sh -n dnode1 -s stop system sh/exec.sh -n dnode2 -s stop system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -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 dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode2 -c walLevel -v 0 system sh/exec.sh -n dnode2 -s start sleep 2000 diff --git a/tests/script/unique/stream/table_balance.sim b/tests/script/unique/stream/table_balance.sim index 3eab029529..7e33005b9b 100644 --- a/tests/script/unique/stream/table_balance.sim +++ b/tests/script/unique/stream/table_balance.sim @@ -10,12 +10,12 @@ 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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 @@ -38,7 +38,7 @@ $db = $dbPrefix $mt = $mtPrefix $st = $stPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) @@ -129,7 +129,7 @@ print dnode2 $dnode2Vnodes if $dnode1Vnodes != 0 then goto show1 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then goto show1 endi diff --git a/tests/script/unique/stream/table_move.sim b/tests/script/unique/stream/table_move.sim index 3096bcc9f9..54cd3195db 100644 --- a/tests/script/unique/stream/table_move.sim +++ b/tests/script/unique/stream/table_move.sim @@ -25,20 +25,20 @@ system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode1 -c clog -v 1 -system sh/cfg.sh -n dnode2 -c clog -v 1 -system sh/cfg.sh -n dnode3 -c clog -v 1 -system sh/cfg.sh -n dnode4 -c clog -v 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 1 +system sh/cfg.sh -n dnode2 -c wallevel -v 1 +system sh/cfg.sh -n dnode3 -c wallevel -v 1 +system sh/cfg.sh -n dnode4 -c wallevel -v 1 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 0 system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 0 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 3 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 3 @@ -75,7 +75,7 @@ $db = $dbPrefix . $i $mt = $mtPrefix . $i $st = $stPrefix . $i -sql create database $db tables 4 +sql create database $db maxTables 4 sql use $db sql create table $mt (ts timestamp, tbcol int, tbcol2 float) TAGS(tgcol int) @@ -163,7 +163,7 @@ print dnode2 $dnode2Vnodes if $dnode1Vnodes != 6 then goto show1 endi -if $dnode2Vnodes != null then +if $dnode2Vnodes != NULL then goto show1 endi @@ -214,7 +214,7 @@ print dnode1 $dnode1Vnodes $dnode2Vnodes = $data3_192.168.0.2 print dnode2 $dnode2Vnodes -if $dnode1Vnodes != null then +if $dnode1Vnodes != NULL then goto show6 endi if $dnode2Vnodes != 6 then diff --git a/tests/script/unique/stream/table_replica1_dnode2.sim b/tests/script/unique/stream/table_replica1_dnode2.sim index 0640de11b3..3d88493f40 100644 --- a/tests/script/unique/stream/table_replica1_dnode2.sim +++ b/tests/script/unique/stream/table_replica1_dnode2.sim @@ -4,12 +4,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/table_replica2_dnode2.sim b/tests/script/unique/stream/table_replica2_dnode2.sim index 2b9d22d150..da24b5ab4e 100644 --- a/tests/script/unique/stream/table_replica2_dnode2.sim +++ b/tests/script/unique/stream/table_replica2_dnode2.sim @@ -4,8 +4,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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode2 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/table_replica2_dnode2_vnoden.sim b/tests/script/unique/stream/table_replica2_dnode2_vnoden.sim index 917d6935e8..809627432b 100644 --- a/tests/script/unique/stream/table_replica2_dnode2_vnoden.sim +++ b/tests/script/unique/stream/table_replica2_dnode2_vnoden.sim @@ -4,12 +4,12 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -system sh/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/table_replica2_dnode3.sim b/tests/script/unique/stream/table_replica2_dnode3.sim index 28d40d237e..abee70d048 100644 --- a/tests/script/unique/stream/table_replica2_dnode3.sim +++ b/tests/script/unique/stream/table_replica2_dnode3.sim @@ -6,15 +6,15 @@ 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 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 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 dnode1 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start diff --git a/tests/script/unique/stream/table_replica3_dnode4.sim b/tests/script/unique/stream/table_replica3_dnode4.sim index b6d76c3719..effdd38c2e 100644 --- a/tests/script/unique/stream/table_replica3_dnode4.sim +++ b/tests/script/unique/stream/table_replica3_dnode4.sim @@ -8,18 +8,18 @@ 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 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 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 numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 8 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/unique/stream/table_vnode_stop.sim b/tests/script/unique/stream/table_vnode_stop.sim index fe7165a166..8528ee6755 100644 --- a/tests/script/unique/stream/table_vnode_stop.sim +++ b/tests/script/unique/stream/table_vnode_stop.sim @@ -4,8 +4,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 commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 +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 numOfMPeers -v 2 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 system sh/exec.sh -n dnode1 -s start @@ -100,8 +100,8 @@ system sh/exec.sh -n dnode1 -s stop system sh/exec.sh -n dnode2 -s stop system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 -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 dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode2 -c walLevel -v 0 sleep 2000 system sh/exec.sh -n dnode2 -s start diff --git a/tests/script/unique/table/delete_part.sim b/tests/script/unique/table/delete_part.sim index 4766be5131..04cb03598c 100644 --- a/tests/script/unique/table/delete_part.sim +++ b/tests/script/unique/table/delete_part.sim @@ -1,18 +1,13 @@ system sh/stop_dnodes.sh - - - - - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c 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 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 numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -29,10 +24,10 @@ 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 -system sh/cfg.sh -n dnode1 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c sessionsPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c sessionsPerVnode -v 4 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 +system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 print ========= start dnodes system sh/exec.sh -n dnode1 -s start @@ -79,4 +74,12 @@ begin: $loop = $loop + 1 goto begin - \ No newline at end of file + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/table/testSuite.sim b/tests/script/unique/table/testSuite.sim index 373f358ac8..e0c0a1f2fa 100644 --- a/tests/script/unique/table/testSuite.sim +++ b/tests/script/unique/table/testSuite.sim @@ -1 +1 @@ -#run unique/table/delete_part.sim +run unique/table/delete_part.sim diff --git a/tests/script/unique/vnode/backup/replica4.sim b/tests/script/unique/vnode/backup/replica4.sim index afddf58b80..bccc17e682 100644 --- a/tests/script/unique/vnode/backup/replica4.sim +++ b/tests/script/unique/vnode/backup/replica4.sim @@ -10,10 +10,10 @@ 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 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 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/exec.sh -n dnode1 -s start $x = 0 diff --git a/tests/script/unique/vnode/backup/replica5.sim b/tests/script/unique/vnode/backup/replica5.sim index 32d30c110c..d29d11fdaf 100644 --- a/tests/script/unique/vnode/backup/replica5.sim +++ b/tests/script/unique/vnode/backup/replica5.sim @@ -12,11 +12,11 @@ system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode1 -c 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 dnode5 -c commitLog -v 0 +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/exec.sh -n dnode1 -s start diff --git a/tests/script/unique/vnode/commit.sim b/tests/script/unique/vnode/commit.sim index 7383934aac..29c9f72335 100644 --- a/tests/script/unique/vnode/commit.sim +++ b/tests/script/unique/vnode/commit.sim @@ -2,8 +2,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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 system sh/exec_up.sh -n dnode1 -s start @@ -148,4 +148,11 @@ if $rows != $remainRows then return -1 endi -system sh/exec_up.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/vnode/many.sim b/tests/script/unique/vnode/many.sim index 57e0d10b7e..0504207c2e 100644 --- a/tests/script/unique/vnode/many.sim +++ b/tests/script/unique/vnode/many.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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 1 system sh/cfg.sh -n dnode2 -c numofMpeers -v 1 system sh/cfg.sh -n dnode3 -c numofMpeers -v 1 @@ -113,4 +113,11 @@ if $x < 5 then goto loop endi - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_basic.sim b/tests/script/unique/vnode/replica2_basic.sim index c71692fa9f..a0ea7085cb 100644 --- a/tests/script/unique/vnode/replica2_basic.sim +++ b/tests/script/unique/vnode/replica2_basic.sim @@ -2,8 +2,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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 system sh/exec_up.sh -n dnode1 -s start @@ -188,5 +188,12 @@ if $rows != $expect then endi print =================== step 12 -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_basic2.sim b/tests/script/unique/vnode/replica2_basic2.sim index 7a387d165e..041db8249a 100644 --- a/tests/script/unique/vnode/replica2_basic2.sim +++ b/tests/script/unique/vnode/replica2_basic2.sim @@ -5,10 +5,10 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 @@ -27,6 +27,7 @@ system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 print ========= start dnodes system sh/exec_up.sh -n dnode1 -s start +sleep 3000 sql connect sql create dnode $hostname2 system sh/exec_up.sh -n dnode2 -s start @@ -89,6 +90,19 @@ if $data2_3 != 4 then return -1 endi +if $data4_1 != ready then + print dnode1 status should ready but is $data4_1 + return -1 +endi + +if $data4_2 != ready then + return -1 +endi + +if $data4_3 != ready then + return -1 +endi + print ========= step2 sql insert into d1.t1 values(now, 2) sql insert into d2.t2 values(now, 2) @@ -202,4 +216,13 @@ endi sql select * from d4.t4 if $rows != 3 then return -1 -endi \ No newline at end of file +endi + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_repeat.sim b/tests/script/unique/vnode/replica2_repeat.sim index 46fe90cfde..f7da1babb7 100644 --- a/tests/script/unique/vnode/replica2_repeat.sim +++ b/tests/script/unique/vnode/replica2_repeat.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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 1 system sh/cfg.sh -n dnode2 -c numofMpeers -v 1 system sh/cfg.sh -n dnode3 -c numofMpeers -v 1 @@ -71,4 +71,11 @@ if $x < 5 then goto loop endi - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_basic.sim b/tests/script/unique/vnode/replica3_basic.sim index 4da26a9349..62910b947a 100644 --- a/tests/script/unique/vnode/replica3_basic.sim +++ b/tests/script/unique/vnode/replica3_basic.sim @@ -3,9 +3,9 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 system sh/cfg.sh -n dnode3 -c numofMpeers -v 3 @@ -149,8 +149,11 @@ if $rows != $expect then return -1 endi -system sh/exec_up.sh -n dnode1 -s stop -system sh/exec_up.sh -n dnode2 -s stop -system sh/exec_up.sh -n dnode3 -s stop - - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_repeat.sim b/tests/script/unique/vnode/replica3_repeat.sim index 67ac673bfc..8c3ed902fb 100644 --- a/tests/script/unique/vnode/replica3_repeat.sim +++ b/tests/script/unique/vnode/replica3_repeat.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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 -system sh/cfg.sh -n dnode4 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 +system sh/cfg.sh -n dnode4 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 1 system sh/cfg.sh -n dnode2 -c numofMpeers -v 1 system sh/cfg.sh -n dnode3 -c numofMpeers -v 1 @@ -80,4 +80,11 @@ if $x < 5 then goto loop endi - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/replica3_vgroup.sim b/tests/script/unique/vnode/replica3_vgroup.sim index 46003a14fa..f63bf1783d 100644 --- a/tests/script/unique/vnode/replica3_vgroup.sim +++ b/tests/script/unique/vnode/replica3_vgroup.sim @@ -3,9 +3,9 @@ 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 clog -v 2 -system sh/cfg.sh -n dnode2 -c clog -v 2 -system sh/cfg.sh -n dnode3 -c clog -v 2 +system sh/cfg.sh -n dnode1 -c wallevel -v 2 +system sh/cfg.sh -n dnode2 -c wallevel -v 2 +system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 system sh/cfg.sh -n dnode3 -c numofMpeers -v 3 @@ -26,7 +26,7 @@ sleep 3000 print =================== step 1 -sql create database $db replica 3 tables 100 +sql create database $db replica 3 maxtables 100 sql use $db sql create table st (ts timestamp, speed int) tags (t1 int) sleep 3001 @@ -61,5 +61,11 @@ endw # return -1 #endi - - +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode4 -s stop -x SIGINT +system sh/exec_up.sh -n dnode5 -s stop -x SIGINT +system sh/exec_up.sh -n dnode6 -s stop -x SIGINT +system sh/exec_up.sh -n dnode7 -s stop -x SIGINT +system sh/exec_up.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/unique/vnode/testSuite.sim b/tests/script/unique/vnode/testSuite.sim index 9cf8ed0fc1..46b01aaa45 100644 --- a/tests/script/unique/vnode/testSuite.sim +++ b/tests/script/unique/vnode/testSuite.sim @@ -1,7 +1,8 @@ +run unique/vnode/commit.sim +run unique/vnode/many.sim +run unique/vnode/replica2_basic.sim run unique/vnode/replica2_basic2.sim -#run unique/vnode/replica2_basic.sim -#run unique/vnode/replica2_repeat.sim +run unique/vnode/replica2_repeat.sim run unique/vnode/replica3_basic.sim -#run unique/vnode/replica3_repeat.sim -#run unique/vnode/commit.sim -#run unique/vnode/many.sim +run unique/vnode/replica3_repeat.sim +run unique/vnode/replica3_vgroup.sim diff --git a/tests/script/windows/account/user_create.sim b/tests/script/windows/account/user_create.sim index aea95b7c5c..6dc9ab05b3 100644 --- a/tests/script/windows/account/user_create.sim +++ b/tests/script/windows/account/user_create.sim @@ -30,10 +30,10 @@ print =============== step3 sql drop user read -x step31 return -1 step31: -sql drop user sys -x step32 +sql drop user _root -x step32 return -1 step32: -sql drop user stream -x step33 +sql drop user monitor -x step33 return -1 step33: @@ -64,11 +64,11 @@ sql alter user read privilege 1 -x step43 return -1 step43: -sql drop user sys -x step41 +sql drop user _root -x step41 return -1 step41: -sql drop user stream -x step42 +sql drop user monitor -x step42 return -1 step42: diff --git a/tests/script/windows/alter/metrics.sim b/tests/script/windows/alter/metrics.sim index 7cfee695d0..ce003a9836 100644 --- a/tests/script/windows/alter/metrics.sim +++ b/tests/script/windows/alter/metrics.sim @@ -763,7 +763,7 @@ endi if $data21 != INT then return -1 endi -if $data30 != null then +if $data30 != NULL then return -1 endi diff --git a/tests/script/windows/alter/table.sim b/tests/script/windows/alter/table.sim index a05b6559dd..155debda0d 100644 --- a/tests/script/windows/alter/table.sim +++ b/tests/script/windows/alter/table.sim @@ -666,7 +666,7 @@ endi if $data11 != INT then return -1 endi -if $data20 != null then +if $data20 != NULL then return -1 endi diff --git a/tests/script/windows/tag/add.sim b/tests/script/windows/tag/add.sim index b734846686..adcff4f62d 100644 --- a/tests/script/windows/tag/add.sim +++ b/tests/script/windows/tag/add.sim @@ -537,7 +537,7 @@ endi if $data04 != false then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi diff --git a/tests/script/windows/tag/change.sim b/tests/script/windows/tag/change.sim index 201c74c0bf..95a767da49 100644 --- a/tests/script/windows/tag/change.sim +++ b/tests/script/windows/tag/change.sim @@ -386,7 +386,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -413,7 +413,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -440,7 +440,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -467,7 +467,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -494,7 +494,7 @@ endi if $data06 != 6 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi diff --git a/tests/script/windows/tag/delete.sim b/tests/script/windows/tag/delete.sim index d671b61abe..75702fe9ee 100644 --- a/tests/script/windows/tag/delete.sim +++ b/tests/script/windows/tag/delete.sim @@ -420,7 +420,7 @@ endi if $data02 != true then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -444,7 +444,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -468,7 +468,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -492,7 +492,7 @@ endi if $data02 != 1.000000000 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi @@ -516,10 +516,10 @@ endi if $data02 != true then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -546,10 +546,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -576,10 +576,10 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -606,10 +606,10 @@ endi if $data02 != 1.000000000 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi @@ -636,13 +636,13 @@ endi if $data02 != 1 then return -1 endi -if $data03 != null then +if $data03 != NULL then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi @@ -675,13 +675,13 @@ endi if $data03 != 4.0000 then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi @@ -714,16 +714,16 @@ endi if $data03 != 4.000000000 then return -1 endi -if $data04 != null then +if $data04 != NULL then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -763,13 +763,13 @@ endi if $data04 != 5.000000000 then return -1 endi -if $data05 != null then +if $data05 != NULL then return -1 endi -if $data06 != null then +if $data06 != NULL then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi diff --git a/tests/script/windows/tag/set.sim b/tests/script/windows/tag/set.sim index 7f8cf3b0a7..b264164604 100644 --- a/tests/script/windows/tag/set.sim +++ b/tests/script/windows/tag/set.sim @@ -330,7 +330,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -357,7 +357,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -384,7 +384,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -411,7 +411,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi @@ -438,7 +438,7 @@ endi if $data06 != 11 then return -1 endi -if $data07 != null then +if $data07 != NULL then return -1 endi diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index d0d798343a..5ea1cb4a1a 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -119,7 +119,7 @@ char *simGetVariable(SScript *script, char *varName, int varLen) { int simExecuteExpression(SScript *script, char *exp) { char *op1, *op2, *var1, *var2, *var3, *rest; int op1Len, op2Len, var1Len, var2Len, var3Len, val0, val1; - char t0[512], t1[512], t2[512], t3[512]; + char t0[512], t1[512], t2[512], t3[1024]; int result; rest = paGetToken(exp, &var1, &var1Len); @@ -310,14 +310,15 @@ void simStoreSystemContentResult(SScript *script, char *filename) { bool simExecuteSystemContentCmd(SScript *script, char *option) { char buf[4096] = {0}; + char buf1[4096 + 512] = {0}; char filename[400] = {0}; sprintf(filename, "%s/%s.tmp", tsScriptDir, script->fileName); sprintf(buf, "cd %s; ", tsScriptDir); simVisuallizeOption(script, option, buf + strlen(buf)); - sprintf(buf, "%s > %s 2>/dev/null", buf, filename); + sprintf(buf1, "%s > %s 2>/dev/null", buf, filename); - sprintf(script->system_exit_code, "%d", system(buf)); + sprintf(script->system_exit_code, "%d", system(buf1)); simStoreSystemContentResult(script, filename); script->linePos++; @@ -414,7 +415,7 @@ void simCloseNativeConnect(SScript *script) { simTrace("script:%s, taos:%p closed", script->fileName, script->taos); taos_close(script->taos); - taosMsleep(1000); + taosMsleep(1200); script->taos = NULL; } @@ -584,7 +585,7 @@ bool simCreateNativeConnect(SScript *script, char *user, char *pass) { void *taos = NULL; taosMsleep(2000); for (int attempt = 0; attempt < 10; ++attempt) { - taos = taos_connect(NULL, user, pass, NULL, tsMnodeShellPort); + taos = taos_connect(NULL, user, pass, NULL, tsDnodeShellPort); if (taos == NULL) { simTrace("script:%s, user:%s connect taosd failed:%s, attempt:%d", script->fileName, user, taos_errstr(NULL), attempt); taosMsleep(1000); @@ -688,7 +689,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { } if (row[i] == 0) { - strcpy(value, "null"); + strcpy(value, TSDB_DATA_NULL_STR); continue; }