diff --git a/Jenkinsfile b/Jenkinsfile index 882d224407c27a06bacd96ff246dfc8d84e264a8..6109e4811a34fb159e6b17c3bf7c5af3c884ea3d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -265,12 +265,12 @@ pipeline { } } timeout(time: 60, unit: 'MINUTES'){ - sh ''' - cd ${WKC}/tests/pytest - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - ./handle_crash_gen_val_log.sh - ''' + // sh ''' + // cd ${WKC}/tests/pytest + // rm -rf /var/lib/taos/* + // rm -rf /var/log/taos/* + // ./handle_crash_gen_val_log.sh + // ''' sh ''' cd ${WKC}/tests/pytest rm -rf /var/lib/taos/* diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index edb673d1670ca758f087ab9f83dec7d780531b6b..c5ec2c270d41c724066fb25082bdc0e92d85ea99 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1778,6 +1778,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow } _error: + pParentSql->res.code = code; tfree(tokenBuf); tfree(line); taos_free_result(pSql); diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index b9e13865f8ea0d4aaf143c4e47fde8ec69e9855e..0864095a2175a6686f7caed7bc31aa2fc6b352c8 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2609,6 +2609,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col SColumnIndex indexTS = {.tableIndex = index.tableIndex, .columnIndex = 0}; SExprInfo* pExpr = tscExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &indexTS, TSDB_DATA_TYPE_TIMESTAMP, TSDB_KEYSIZE, getNewResColId(pCmd), TSDB_KEYSIZE, false); + tstrncpy(pExpr->base.aliasName, aAggs[TSDB_FUNC_TS_DUMMY].name, sizeof(pExpr->base.aliasName)); SColumnList ids = createColumnList(1, 0, 0); insertResultField(pQueryInfo, colIndex, &ids, TSDB_KEYSIZE, TSDB_DATA_TYPE_TIMESTAMP, aAggs[TSDB_FUNC_TS_DUMMY].name, pExpr); @@ -8449,6 +8450,7 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS pSub->udfCopy = true; pSub->pDownstream = pQueryInfo; + taosArrayPush(pQueryInfo->pUpstream, &pSub); int32_t code = validateSqlNode(pSql, p, pSub); if (code != TSDB_CODE_SUCCESS) { return code; @@ -8472,8 +8474,6 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS tstrncpy(pTableMetaInfo1->aliasName, subInfo->aliasName.z, subInfo->aliasName.n + 1); } - taosArrayPush(pQueryInfo->pUpstream, &pSub); - // NOTE: order mix up in subquery not support yet. pQueryInfo->order = pSub->order; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 38ae56eb241139cf33b56213832c8c6797ba4d1c..c0e94eb921688246bac1067a48fb77c10acdb3bb 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -84,7 +84,7 @@ int8_t tsTscEnableRecordSql = 0; // the maximum number of results for projection query on super table that are returned from // one virtual node, to order according to timestamp -int32_t tsMaxNumOfOrderedResults = 100000; +int32_t tsMaxNumOfOrderedResults = 1000000; // 10 ms for sliding time, the value will changed in case of time precision changed int32_t tsMinSlidingTime = 10; @@ -1017,8 +1017,8 @@ static void doInitGlobalConfig(void) { cfg.ptr = &tsMaxNumOfOrderedResults; cfg.valType = TAOS_CFG_VTYPE_INT32; cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW; - cfg.minValue = TSDB_MAX_SQL_LEN; - cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN; + cfg.minValue = 100000; + cfg.maxValue = 100000000; cfg.ptrLength = 0; cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); @@ -1217,10 +1217,10 @@ static void doInitGlobalConfig(void) { cfg.unitType = TAOS_CFG_UTYPE_NONE; taosInitConfigOption(cfg); - cfg.option = "topicBianryLen"; + cfg.option = "topicBinaryLen"; cfg.ptr = &tsTopicBianryLen; cfg.valType = TAOS_CFG_VTYPE_INT32; - cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG; + cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW; cfg.minValue = 16; cfg.maxValue = 16000; cfg.ptrLength = 0; diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 30d8a1e67524e692ef468bd34bc2240fdaed7991..282a5d64ab0e631a4d165a942205f56d69239c66 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -102,7 +102,7 @@ extern char configDir[]; #define NOTE_BUFF_LEN (SMALL_BUFF_LEN*16) #define DEFAULT_TIMESTAMP_STEP 1 - +#define DEFAULT_CHILDTABLES 10000 enum TEST_MODE { INSERT_TEST, // 0 @@ -625,7 +625,7 @@ SArguments g_args = { 0, // interlace_rows; 30000, // num_of_RPR (1024*1024), // max_sql_len - 10000, // num_of_tables + DEFAULT_CHILDTABLES, // num_of_tables 10000, // num_of_DPT 0, // abort 0, // disorderRatio @@ -639,7 +639,7 @@ SArguments g_args = { static SDbs g_Dbs; -static int64_t g_totalChildTables = 0; +static int64_t g_totalChildTables = DEFAULT_CHILDTABLES; static int64_t g_actualChildTables = 0; static SQueryMetaInfo g_queryInfo; static FILE * g_fpOfInsertResult = NULL; @@ -9154,6 +9154,7 @@ int main(int argc, char *argv[]) { debugPrint("meta file: %s\n", g_args.metaFile); if (g_args.metaFile) { + g_totalChildTables = 0; initOfInsertMeta(); initOfQueryMeta(); diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index 30b5d91b10d3c67ad00d6be9716e81ac4ae581af..16ba1da47c0a9555a7ca0d88f1f45fca79f794c6 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -232,9 +232,9 @@ static struct argp_option options[] = { {"inpath", 'i', "INPATH", 0, "Input file path.", 1}, {"resultFile", 'r', "RESULTFILE", 0, "DumpOut/In Result file path and name.", 1}, #ifdef _TD_POWER_ - {"config", 'c', "CONFIG_DIR", 0, "Configure directory. Default is /etc/power/taos.cfg.", 1}, + {"config-dir", 'c', "CONFIG_DIR", 0, "Configure directory. Default is /etc/power/taos.cfg.", 1}, #else - {"config", 'c', "CONFIG_DIR", 0, "Configure directory. Default is /etc/taos/taos.cfg.", 1}, + {"config-dir", 'c', "CONFIG_DIR", 0, "Configure directory. Default is /etc/taos/taos.cfg.", 1}, #endif {"encode", 'e', "ENCODE", 0, "Input file encoding.", 1}, // dump unit options @@ -370,6 +370,15 @@ struct arguments g_args = { false // performance_print }; +static void errorPrintReqArg3(char *program, char *wrong_arg) +{ + fprintf(stderr, + "%s: option '%s' requires an argument\n", + program, wrong_arg); + fprintf(stderr, + "Try `taosdump --help' or `taosdump --usage' for more information.\n"); +} + /* Parse a single option. */ static error_t parse_opt(int key, char *arg, struct argp_state *state) { /* Get the input argument from argp_parse, which we @@ -430,9 +439,13 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { g_args.resultFile = arg; break; case 'c': + if (0 == strlen(arg)) { + errorPrintReqArg3("taosdump", "-c or --config-dir"); + exit(EXIT_FAILURE); + } if (wordexp(arg, &full_path, 0) != 0) { errorPrint("Invalid path %s\n", arg); - return -1; + exit(EXIT_FAILURE); } tstrncpy(configDir, full_path.we_wordv[0], MAX_FILE_NAME_LEN); wordfree(&full_path); diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index 9019a01eeff87414e917923666d2e4d842e3d12c..1db8f8233e487d47d4af8bab51767e22b6e42fe6 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -4032,11 +4032,23 @@ static void irate_function(SQLFunctionCtx *pCtx) { double v = 0; GET_TYPED_DATA(v, double, pCtx->inputType, pData); - if ((INT64_MIN == pRateInfo->lastKey) || primaryKey[i] > pRateInfo->lastKey) { + if (INT64_MIN == pRateInfo->lastKey) { pRateInfo->lastValue = v; pRateInfo->lastKey = primaryKey[i]; continue; } + + if (primaryKey[i] > pRateInfo->lastKey) { + if ((INT64_MIN == pRateInfo->firstKey) || pRateInfo->lastKey > pRateInfo->firstKey) { + pRateInfo->firstValue = pRateInfo->lastValue; + pRateInfo->firstKey = pRateInfo->lastKey; + } + + pRateInfo->lastValue = v; + pRateInfo->lastKey = primaryKey[i]; + + continue; + } if ((INT64_MIN == pRateInfo->firstKey) || primaryKey[i] > pRateInfo->firstKey) { pRateInfo->firstValue = v; diff --git a/src/query/src/qPercentile.c b/src/query/src/qPercentile.c index e9022db503f005ae6713e66e47bbde440bb4aaf7..024ba77de13086b7ff8e32ab2c4c7340d8806b6b 100644 --- a/src/query/src/qPercentile.c +++ b/src/query/src/qPercentile.c @@ -67,10 +67,18 @@ static int32_t setBoundingBox(MinMaxEntry* range, int16_t type, double minval, d if (IS_SIGNED_NUMERIC_TYPE(type)) { range->i64MinVal = (int64_t) minval; - range->i64MaxVal = (int64_t) maxval; + if (maxval > INT64_MAX || (int64_t)maxval == INT64_MIN) { + range->i64MaxVal = INT64_MAX; + } else { + range->i64MaxVal = (int64_t) maxval; + } } else if (IS_UNSIGNED_NUMERIC_TYPE(type)){ range->u64MinVal = (uint64_t) minval; - range->u64MaxVal = (uint64_t) maxval; + if ((uint64_t)maxval > UINT64_MAX) { + range->u64MaxVal = UINT64_MAX; + } else { + range->u64MaxVal = (uint64_t) maxval; + } } else { range->dMinVal = minval; range->dMaxVal = maxval; @@ -127,8 +135,8 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) { index = (delta % pBucket->numOfSlots); } else { double slotSpan = (double)span / pBucket->numOfSlots; - index = (int32_t)((v - pBucket->range.i64MinVal) / slotSpan); - if (v == pBucket->range.i64MaxVal) { + index = (int32_t)(((double)v - pBucket->range.i64MinVal) / slotSpan); + if (index == pBucket->numOfSlots) { index -= 1; } } diff --git a/src/query/src/qTsbuf.c b/src/query/src/qTsbuf.c index 4cf05dd2c7703c7879410faa2632e17a16d595fd..99572f6e9345b933434e3685ecb79750a04388fc 100644 --- a/src/query/src/qTsbuf.c +++ b/src/query/src/qTsbuf.c @@ -375,6 +375,16 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) { sz = fread(pBlock->payload, (size_t)pBlock->compLen, 1, pTSBuf->f); if (decomp) { + if (pBlock->numOfElem * TSDB_KEYSIZE > pTSBuf->tsData.allocSize) { + pTSBuf->tsData.rawBuf = realloc(pTSBuf->tsData.rawBuf, pBlock->numOfElem * TSDB_KEYSIZE); + pTSBuf->tsData.allocSize = pBlock->numOfElem * TSDB_KEYSIZE; + } + + if (pBlock->numOfElem * TSDB_KEYSIZE > pTSBuf->bufSize) { + pTSBuf->assistBuf = realloc(pTSBuf->assistBuf, pBlock->numOfElem * TSDB_KEYSIZE); + pTSBuf->bufSize = pBlock->numOfElem * TSDB_KEYSIZE; + } + pTSBuf->tsData.len = tsDecompressTimestamp(pBlock->payload, pBlock->compLen, pBlock->numOfElem, pTSBuf->tsData.rawBuf, pTSBuf->tsData.allocSize, TWO_STAGE_COMP, pTSBuf->assistBuf, pTSBuf->bufSize); @@ -471,7 +481,7 @@ void tsBufAppend(STSBuf* pTSBuf, int32_t id, tVariant* tag, const char* pData, i // the size of raw data exceeds the size of the default prepared buffer, so // during getBufBlock, the output buffer needs to be large enough. - if (ptsData->len >= ptsData->threshold) { + if (ptsData->len >= ptsData->threshold - TSDB_KEYSIZE) { writeDataToDisk(pTSBuf); shrinkBuffer(ptsData); } @@ -603,6 +613,10 @@ static void tsBufGetBlock(STSBuf* pTSBuf, int32_t groupIndex, int32_t blockIndex expandBuffer(&pTSBuf->tsData, (int32_t)s); } + if (s > pTSBuf->bufSize) { + pTSBuf->assistBuf = realloc(pTSBuf->assistBuf, s); + pTSBuf->bufSize = (int32_t)s; + } pTSBuf->tsData.len = tsDecompressTimestamp(pBlock->payload, pBlock->compLen, pBlock->numOfElem, pTSBuf->tsData.rawBuf, pTSBuf->tsData.allocSize, TWO_STAGE_COMP, pTSBuf->assistBuf, pTSBuf->bufSize); diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 0f4919ba96771804e2a3027f76c5a718ff1e9573..cd720ab62d4d71661a214ef24df8df81164fd71b 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -125,7 +125,7 @@ class TDDnode: "charset":"UTF-8", "asyncLog":"0", "anyIp":"0", - "tsEnableTelemetryReporting":"0", + "telemetryReporting":"0", "dDebugFlag":"135", "tsdbDebugFlag":"135", "mDebugFlag":"135", diff --git a/tests/script/general/parser/function.sim b/tests/script/general/parser/function.sim index 556292b21b218f4df2aaa034d8babe35903a23b8..48e52cc7d7f946a18c366fc1ba667daf3fcf55eb 100644 --- a/tests/script/general/parser/function.sim +++ b/tests/script/general/parser/function.sim @@ -941,6 +941,17 @@ if $data32 != 0.000144445 then return -1 endi +sql insert into t1 values('2015-09-18 00:30:00', 3.0); +sql select irate(k) from t1 +if $rows != 1 then + return -1 +endi + +if $data00 != 0.000000354 then + return -1 +endi + + print ===========================> derivative sql drop table t1 sql drop table tx;