diff --git a/cmake/cmake.version b/cmake/cmake.version index 03598519ed..5c5abe79bb 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.1.6") + SET(TD_VER_NUMBER "3.0.1.7") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index eee2f94ee1..8bfdf72cc7 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.1.7 + + + ## 3.0.1.6 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index 6e8a040f8b..2bc22a4450 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.2.9 + + + ## 2.2.7 diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index 4108212c55..fd2be899eb 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.1.7 + + + ## 3.0.1.6 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 28e0d4bca9..3f73b53fab 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.2.9 + + + ## 2.2.7 diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index db878d72b9..27c58dfba1 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -1277,9 +1277,11 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans) pAction->id); code = mndTransSync(pMnode, pTrans); if (code != 0) { + pTrans->redoActionPos--; pTrans->code = terrno; mError("trans:%d, %s:%d is executed and failed to sync to other mnodes since %s", pTrans->id, mndTransStr(pAction->stage), pAction->id, terrstr()); + break; } } else if (code == TSDB_CODE_ACTION_IN_PROGRESS) { mInfo("trans:%d, %s:%d is in progress and wait it finish", pTrans->id, mndTransStr(pAction->stage), pAction->id); diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index 9d3b86c79b..7901093315 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -1739,6 +1739,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj code = 0; _OVER: + taosArrayDestroy(pArray); mndTransDrop(pTrans); sdbFreeRaw(pRaw); return code; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 05ccda26c6..2a3bfdd948 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -337,9 +337,13 @@ static void doSetTagColumnData(STableScanInfo* pTableScanInfo, SSDataBlock* pBlo int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pBlock, rows, GET_TASKID(pTaskInfo), &pTableScanInfo->metaCache); - if (code != TSDB_CODE_SUCCESS) { + // ignore the table not exists error, since this table may have been dropped during the scan procedure. + if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_PAR_TABLE_NOT_EXIST) { T_LONG_JMP(pTaskInfo->env, code); } + + // reset the error code. + terrno = 0; } } @@ -513,6 +517,21 @@ static void freeTableCachedVal(void* param) { taosMemoryFree(pVal); } +static STableCachedVal* createTableCacheVal(const SMetaReader* pMetaReader) { + STableCachedVal* pVal = taosMemoryMalloc(sizeof(STableCachedVal)); + pVal->pName = strdup(pMetaReader->me.name); + pVal->pTags = NULL; + + // only child table has tag value + if (pMetaReader->me.type == TSDB_CHILD_TABLE) { + STag* pTag = (STag*) pMetaReader->me.ctbEntry.pTags; + pVal->pTags = taosMemoryMalloc(pTag->len); + memcpy(pVal->pTags, pTag, pTag->len); + } + + return pVal; +} + // const void *key, size_t keyLen, void *value static void freeCachedMetaItem(const void* key, size_t keyLen, void* value) { freeTableCachedVal(value); } @@ -540,7 +559,11 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int metaReaderInit(&mr, pHandle->meta, 0); code = metaGetTableEntryByUid(&mr, pBlock->info.uid); if (code != TSDB_CODE_SUCCESS) { - qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr); + if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) { + qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr); + } else { + qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr); + } metaReaderClear(&mr); return terrno; } @@ -559,23 +582,18 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int metaReaderInit(&mr, pHandle->meta, 0); code = metaGetTableEntryByUid(&mr, pBlock->info.uid); if (code != TSDB_CODE_SUCCESS) { - qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr); + if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) { + qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr); + } else { + qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr); + } metaReaderClear(&mr); return terrno; } metaReaderReleaseLock(&mr); - STableCachedVal* pVal = taosMemoryMalloc(sizeof(STableCachedVal)); - pVal->pName = strdup(mr.me.name); - pVal->pTags = NULL; - - // only child table has tag value - if (mr.me.type == TSDB_CHILD_TABLE) { - STag* pTag = (STag*)mr.me.ctbEntry.pTags; - pVal->pTags = taosMemoryMalloc(pTag->len); - memcpy(pVal->pTags, mr.me.ctbEntry.pTags, pTag->len); - } + STableCachedVal* pVal = createTableCacheVal(&mr); val = *pVal; freeReader = true; @@ -590,6 +608,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int pCache->cacheHit += 1; STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h); val = *pVal; + taosLRUCacheRelease(pCache->pTableMetaEntryCache, h, false); } diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index 2b1cee51d7..db0b6d1d02 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -38,7 +38,7 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { } // pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5); - pLogStore->pCache = taosLRUCacheInit(100 * 1024 * 1024, 1, .5); + pLogStore->pCache = taosLRUCacheInit(30 * 1024 * 1024, 1, .5); if (pLogStore->pCache == NULL) { taosMemoryFree(pLogStore); terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 7115e12252..2aac64d045 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -35,30 +35,30 @@ ,,y,script,./test.sh -f tsim/db/show_create_table.sim ,,y,script,./test.sh -f tsim/db/tables.sim ,,y,script,./test.sh -f tsim/db/taosdlog.sim -,,,script,./test.sh -f tsim/dnode/balance_replica1.sim -,,,script,./test.sh -f tsim/dnode/balance_replica3.sim -,,,script,./test.sh -f tsim/dnode/balance1.sim -,,,script,./test.sh -f tsim/dnode/balance2.sim -,,,script,./test.sh -f tsim/dnode/balance3.sim -,,,script,./test.sh -f tsim/dnode/balancex.sim +,,y,script,./test.sh -f tsim/dnode/balance_replica1.sim +,,y,script,./test.sh -f tsim/dnode/balance_replica3.sim +,,y,script,./test.sh -f tsim/dnode/balance1.sim +,,y,script,./test.sh -f tsim/dnode/balance2.sim +,,y,script,./test.sh -f tsim/dnode/balance3.sim +,,y,script,./test.sh -f tsim/dnode/balancex.sim ,,y,script,./test.sh -f tsim/dnode/create_dnode.sim ,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim ,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim -,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim -,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim -,,,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim -,,,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim +,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim +,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim +,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim +,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim ,,,script,./test.sh -f tsim/dnode/drop_dnode_force.sim ,,y,script,./test.sh -f tsim/dnode/offline_reason.sim -,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim -,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim -,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim -,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim -,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim -,,,script,./test.sh -f tsim/dnode/vnode_clean.sim +,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim +,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim +,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim +,,y,script,./test.sh -f tsim/dnode/vnode_clean.sim ,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim -,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim -,,,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim +,,y,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim +,,y,script,./test.sh -f tsim/dnode/split_vgroup_replica3.sim ,,y,script,./test.sh -f tsim/import/basic.sim ,,y,script,./test.sh -f tsim/import/commit.sim ,,y,script,./test.sh -f tsim/import/large.sim @@ -296,7 +296,7 @@ ,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim ,,y,script,./test.sh -f tsim/vnode/replica3_many.sim ,,y,script,./test.sh -f tsim/vnode/replica3_import.sim -,,,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim +,,y,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim diff --git a/tests/script/coverage_test.sh b/tests/script/coverage_test.sh index 457c9eae20..3983f533da 100755 --- a/tests/script/coverage_test.sh +++ b/tests/script/coverage_test.sh @@ -10,7 +10,8 @@ else fi today=`date +"%Y%m%d"` -TDENGINE_DIR=/root/pxiao/TDengine +TDENGINE_DIR=/root/TDengine +JDBC_DIR=/root/taos-connector-jdbc TDENGINE_COVERAGE_REPORT=$TDENGINE_DIR/tests/coverage-report-$today.log # Color setting @@ -20,7 +21,7 @@ GREEN_DARK='\033[0;32m' GREEN_UNDERLINE='\033[4;32m' NC='\033[0m' -function buildTDengine { +function buildTDengine() { echo "check if TDengine need build" cd $TDENGINE_DIR git remote prune origin > /dev/null @@ -33,159 +34,145 @@ function buildTDengine { # reset counter lcov -d . --zerocounters - if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then echo "repo up-to-date" else echo "repo need to pull" fi - git reset --hard - git checkout -- . - git checkout $branch + git reset --hard + git checkout -- . + git checkout $branch + git checkout -- . git clean -dfx - git pull - git submodule update --init --recursive -f + git pull [ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug cd $TDENGINE_DIR/debug - echo "rebuild.." + echo "rebuild.." LOCAL_COMMIT=`git rev-parse --short @` rm -rf * if [ "$branch" == "3.0" ]; then echo "3.0 =============" - cmake -DCOVER=true -DBUILD_TEST=true .. + cmake -DCOVER=true -DBUILD_TEST=true -DBUILD_HTTP=false -DBUILD_TOOLS=true .. else cmake -DCOVER=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null fi - make -j4 + make -j make install } -function runGeneralCaseOneByOne { +function runCasesOneByOne () { while read -r line; do - if [[ $line =~ ^./test.sh* ]]; then - case=`echo $line | grep sim$ | awk '{print $NF}'` - - if [ -n "$case" ]; then - date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && ./test.sh -f $case > /dev/null 2>&1 && \ - echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ - || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT - fi + cmd=`echo $line | cut -d',' -f 5` + if [[ "$2" == "sim" ]] && [[ $cmd == *"test.sh"* ]]; then + case=`echo $cmd | cut -d' ' -f 3` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ + || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT + elif [[ "$2" == "system-test" ]] && [[ $line == *"system-test"* ]]; then + case=`echo $cmd | cut -d' ' -f 4` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ + echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT + elif [[ "$2" == "develop-test" ]] && [[ $line == *"develop-test"* ]]; then + case=`echo $cmd | cut -d' ' -f 4` + start_time=`date +%s` + date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && $cmd > /dev/null 2>&1 && \ + echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \ + echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT + end_time=`date +%s` + echo execution time of $case was `expr $end_time - $start_time`s. | tee -a $TDENGINE_COVERAGE_REPORT fi done < $1 } -function runTestNGCaseOneByOne { - while read -r line; do - if [[ $line =~ ^taostest* ]]; then - case=`echo $line | cut -d' ' -f 3 | cut -d'=' -f 2` - yaml=`echo $line | cut -d' ' -f 2` - - if [ -n "$case" ]; then - date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && taostest $yaml --case=$case --keep --disable_collection > /dev/null 2>&1 && \ - echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \ - || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT - fi - fi - done < $1 +function runUnitTest() { + echo "=== Run unit test case ===" + echo " $TDENGINE_DIR/debug" + cd $TDENGINE_DIR/debug + ctest -j12 + echo "3.0 unit test done" } -function runTest { - echo "run Test" - - if [ "$branch" == "3.0" ]; then - echo "start run unit test case ................" - echo " $TDENGINE_DIR/debug " - cd $TDENGINE_DIR/debug - ctest -j12 - echo "3.0 unit test done" - fi - +function runSimCases() { + echo "=== Run sim cases ===" + cd $TDENGINE_DIR/tests/script - - [ -d ../../sim ] && rm -rf ../../sim - [ -f $TDENGINE_COVERAGE_REPORT ] && rm $TDENGINE_COVERAGE_REPORT - - runGeneralCaseOneByOne jenkins/basic.txt - - sed -i "1i\SIM cases test result" $TDENGINE_COVERAGE_REPORT - - totalSuccess=`grep 'success' $TDENGINE_COVERAGE_REPORT | wc -l` + runCasesOneByOne ../parallel_test/cases.task sim + + totalSuccess=`grep 'sim success' $TDENGINE_COVERAGE_REPORT | wc -l` if [ "$totalSuccess" -gt "0" ]; then - sed -i -e "2i\ ### Total $totalSuccess SIM test case(s) succeed! ###" $TDENGINE_COVERAGE_REPORT + echo "### Total $totalSuccess SIM test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT fi - totalFailed=`grep 'failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l` + totalFailed=`grep 'sim failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l` if [ "$totalFailed" -ne "0" ]; then - sed -i "3i\### Total $totalFailed SIM test case(s) failed! ###" $TDENGINE_COVERAGE_REPORT + echo "### Total $totalFailed SIM test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT fi - sed "3G" $TDENGINE_COVERAGE_REPORT +} - stopTaosd - echo "run TestNG cases" - rm -rf /var/lib/taos/* - rm -rf /var/log/taos/* - nohup $TDENGINE_DIR/debug/build/bin/taosd -c /etc/taos > /dev/null 2>&1 & - sleep 10 - cd $TDENGINE_DIR/../TestNG/cases - runTestNGCaseOneByOne ../scripts/cases.txt - echo "TestNG cases done" +function runPythonCases() { + echo "=== Run python cases ===" + + cd $TDENGINE_DIR/tests/system-test + runCasesOneByOne ../parallel_test/cases.task system-test - cd $TDENGINE_DIR/tests - rm -rf ../sim - /root/pxiao/test-all-coverage.sh full python $branch | tee -a $TDENGINE_COVERAGE_REPORT - - - sed -i "4i\Python cases test result" $TDENGINE_COVERAGE_REPORT - totalPySuccess=`grep 'python case(s) succeed!' $TDENGINE_COVERAGE_REPORT | awk '{print $4}'` - if [ "$totalPySuccess" -gt "0" ]; then - sed -i -e "5i\ ### Total $totalPySuccess Python test case(s) succeed! ###" $TDENGINE_COVERAGE_REPORT - fi + cd $TDENGINE_DIR/tests/develop-test + runCasesOneByOne ../parallel_test/cases.task develop-test - totalPyFailed=`grep 'python case(s) failed!' $TDENGINE_COVERAGE_REPORT | awk '{print $4}'` - if [ -z $totalPyFailed ]; then - sed -i "6i\\n" $TDENGINE_COVERAGE_REPORT - else - sed -i "6i\### Total $totalPyFailed Python test case(s) failed! ###" $TDENGINE_COVERAGE_REPORT - fi - - echo "### run JDBC test cases ###" | tee -a $TDENGINE_COVERAGE_REPORT - # Test Connector - stopTaosd - nohup $TDENGINE_DIR/debug/build/bin/taosd -c /etc/taos > /dev/null 2>&1 & - sleep 10 - - cd $TDENGINE_DIR/src/connector/jdbc - mvn clean package > /dev/null 2>&1 - mvn test > jdbc-out.log 2>&1 - tail -n 20 jdbc-out.log 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT - - # Test C Demo - stopTaosd - $TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null & - sleep 10 - yes | $TDENGINE_DIR/debug/build/bin/demo 127.0.0.1 > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT - - # Test waltest - dataDir=`grep dataDir $TDENGINE_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'` - walDir=`find $dataDir -name "wal"|head -n1` - echo "dataDir: $dataDir" | tee -a $TDENGINE_COVERAGE_REPORT - echo "walDir: $walDir" | tee -a $TDENGINE_COVERAGE_REPORT - if [ -n "$walDir" ]; then - yes | $TDENGINE_DIR/debug/build/bin/waltest -p $walDir > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT + totalSuccess=`grep 'py success' $TDENGINE_COVERAGE_REPORT | wc -l` + if [ "$totalSuccess" -gt "0" ]; then + echo "### Total $totalSuccess python test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT fi - # run Unit Test - echo "Run Unit Test: utilTest, queryTest and cliTest" - #$TDENGINE_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!" - #$TDENGINE_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!" - #$TDENGINE_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!" + totalFailed=`grep 'py failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l` + if [ "$totalFailed" -ne "0" ]; then + echo "### Total $totalFailed python test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT + fi +} + +function runJDBCCases() { + echo "=== Run JDBC cases ===" + + cd $JDBC_DIR + git checkout -- . + git reset --hard HEAD + git checkout main + git pull stopTaosd + stopTaosadapter + taosd -c /etc/taos >> /dev/null 2>&1 & + taosadapter >> /dev/null 2>&1 & + + mvn clean test > result.txt 2>&1 + summary=`grep "Tests run:" result.txt | tail -n 1` + echo -e "### JDBC test result: $summary ###" | tee -a $TDENGINE_COVERAGE_REPORT +} + +function runTest() { + echo "run Test" + + cd $TDENGINE_DIR + [ -d sim ] && rm -rf sim + [ -f $TDENGINE_COVERAGE_REPORT ] && rm $TDENGINE_COVERAGE_REPORT + + runUnitTest + runSimCases + runPythonCases + runJDBCCases + + stopTaosd cd $TDENGINE_DIR/tests/script find . -name '*.sql' | xargs rm -f @@ -203,15 +190,18 @@ function lcovFunc { # remove exclude paths if [ "$branch" == "3.0" ]; then lcov --remove coverage.info \ - '*/contrib/*' '*/tests/*' '*/test/*'\ - '*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c'\ + '*/contrib/*' '*/tests/*' '*/test/*' '*/tools/*' '*/libs/sync/*'\ + '*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c' '*/tsdbDiskData.c'\ '*/texpr.c' '*/runUdf.c' '*/schDbg.c' '*/syncIO.c' '*/tdbOs.c' '*/pushServer.c' '*/osLz4.c'\ - '*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/tidpool.c' '*/tmempool.c'\ - '*/tthread.c' '*/tversion.c'\ + '*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/tidpool.c' '*/tmempool.c'\ + '*/clientJniConnector.c' '*/clientTmqConnector.c' '*/version.c' '*/shellAuto.c' '*/shellTire.c'\ + '*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' '*/catalog.c'\ + '*/tqSnapshot.c' '*/tsdbSnapshot.c''*/metaSnapshot.c' '*/smaSnapshot.c' '*/tqOffsetSnapshot.c'\ + '*/vnodeSnapshot.c' '*/metaSnapshot.c' '*/tsdbSnapshot.c' '*/mndGrant.c' '*/mndSnode.c' '*/streamRecover.c'\ --rc lcov_branch_coverage=1 -o coverage.info else lcov --remove coverage.info \ - '*/tests/*' '*/test/*' '*/deps/*' '*/plugins/*' '*/taosdef.h' '*/ttype.h' '*/tarithoperator.c' '*/TSDBJNIConnector.c' '*/taosdemo.c'\ + '*/tests/*' '*/test/*' '*/deps/*' '*/plugins/*' '*/taosdef.h' '*/ttype.h' '*/tarithoperator.c' '*/TSDBJNIConnector.c' '*/taosdemo.c' '*/clientJniConnector.c'\ --rc lcov_branch_coverage=1 -o coverage.info fi @@ -257,35 +247,33 @@ function stopTaosd { echo "Stop tasod end" } -function runTestRandomFail { - exec_random_fail_sh=$1 - default_exec_sh=$TDENGINE_DIR/tests/script/sh/exec.sh - [ -f $exec_random_fail_sh ] && cp $exec_random_fail_sh $default_exec_sh || exit 1 +function stopTaosadapter { + echo "Stop taosadapter" + systemctl stop taosadapter.service + PID=`ps -ef|grep -w taosadapter | grep -v grep | awk '{print $2}'` + while [ -n "$PID" ] + do + pkill -TERM -x taosadapter + sleep 1 + PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + done + echo "Stop tasoadapter end" - dnodes_random_fail_py=$TDENGINE_DIR/tests/pytest/util/dnodes-no-random-fail.py - default_dnodes_py=$TDENGINE_DIR/tests/pytest/util/dnodes.py - [ -f $dnodes_random_fail_py ] && cp $dnodes_random_fail_py $default_dnodes_py || exit 1 - - runTest NoRandomFail } -WORK_DIR=/root/pxiao +WORK_DIR=/root/ date >> $WORK_DIR/cron.log echo "Run Coverage Test" | tee -a $WORK_DIR/cron.log stopTaosd + buildTDengine - -#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-random-fail.sh -#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-default.sh -#runTestRandomFail $TDENGINE_DIR/tests/script/sh/exec-no-random-fail.sh - runTest - lcovFunc -#sendReport + +sendReport stopTaosd date >> $WORK_DIR/cron.log -echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log +echo "End of Coverage Test" | tee -a $WORK_DIR/cron.log \ No newline at end of file diff --git a/tests/script/tsim/dnode/drop_dnode_force.sim b/tests/script/tsim/dnode/drop_dnode_force.sim index 10edacf3aa..26e48933be 100644 --- a/tests/script/tsim/dnode/drop_dnode_force.sim +++ b/tests/script/tsim/dnode/drop_dnode_force.sim @@ -192,7 +192,7 @@ if $data(5)[4] != ready then goto step5 endi -print =============== step5: drop dnode 2 +print =============== step5a: drop dnode 2 sql_error drop dnode 2 sql drop dnode 2 force @@ -204,15 +204,23 @@ if $rows != 4 then return -1 endi +$x = 0 +step5a: + $ = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not online! + return -1 + endi print select * from information_schema.ins_mnodes; sql select * from information_schema.ins_mnodes print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] if $rows != 2 then - return -1 + goto step5a endi if $data(1)[2] != leader then - return -1 + goto step5a endi sql select * from information_schema.ins_qnodes diff --git a/tests/script/tsim/mnode/basic5.sim b/tests/script/tsim/mnode/basic5.sim index e96b193b83..5bb1f41230 100644 --- a/tests/script/tsim/mnode/basic5.sim +++ b/tests/script/tsim/mnode/basic5.sim @@ -206,7 +206,6 @@ endi print =============== step8: stop mnode1 and drop it system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sql_error drop mnode on dnode 1 $x = 0 step81: @@ -234,42 +233,15 @@ if $leaderNum != 1 then endi print =============== step9: start mnode1 and wait it dropped -system sh/exec.sh -n dnode1 -s start -sql drop mnode on dnode 1 -x step90 -step90: - +print check mnode has leader step9a $x = 0 -step91: +step9a: $x = $x + 1 sleep 1000 if $x == 10 then return -1 endi -sql select * from information_schema.ins_dnodes -print ===> $data00 $data01 $data02 $data03 $data04 $data05 -print ===> $data10 $data11 $data12 $data13 $data14 $data15 -print ===> $data20 $data21 $data22 $data23 $data24 $data25 -print ===> $data30 $data31 $data32 $data33 $data34 $data35 -if $data(1)[4] != ready then - goto step91 -endi -if $data(2)[4] != ready then - goto step91 -endi -if $data(3)[4] != ready then - goto step91 -endi -if $data(4)[4] != ready then - goto step91 -endi - -$x = 0 -step92: - $x = $x + 1 - sleep 1000 - if $x == 20 then - return -1 - endi +print check mnode leader sql select * from information_schema.ins_mnodes print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 @@ -285,10 +257,95 @@ if $data(3)[2] == leader then $leaderNum = 1 endi if $leaderNum != 1 then - goto step92 + goto step9a +endi + +print start dnode1 step9b +system sh/exec.sh -n dnode1 -s start +$x = 0 +step9b: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi +print check dnode1 ready +sql select * from information_schema.ins_dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +print ===> $data30 $data31 $data32 $data33 $data34 $data35 +if $data(1)[4] != ready then + goto step9b +endi +if $data(2)[4] != ready then + goto step9b +endi +if $data(3)[4] != ready then + goto step9b +endi +if $data(4)[4] != ready then + goto step9b +endi + +sleep 4000 +print check mnode has leader step9c +$x = 0 +step9c: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi +print check mnode leader +sql select * from information_schema.ins_mnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +$leaderNum = 0 +if $data(1)[2] == leader then + $leaderNum = 1 +endi +if $data(2)[2] == leader then + $leaderNum = 1 +endi +if $data(3)[2] == leader then + $leaderNum = 1 +endi +if $leaderNum != 1 then + goto step9c +endi + +print drop mnode step9d +sql drop mnode on dnode 1 + +$x = 0 +step9d: + $x = $x + 1 + sleep 1000 + if $x == 20 then + return -1 + endi +print check mnode leader +sql select * from information_schema.ins_mnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +$leaderNum = 0 +if $data(1)[2] == leader then + $leaderNum = 1 +endi +if $data(2)[2] == leader then + $leaderNum = 1 +endi +if $data(3)[2] == leader then + $leaderNum = 1 +endi +if $leaderNum != 1 then + goto step9d endi if $rows != 2 then - goto step92 + goto step9d endi print =============== stepa: create mnode1 again diff --git a/tests/system-test/7-tmq/tmqShow.py b/tests/system-test/7-tmq/tmqShow.py index 5e79f17459..8ec5e62ad9 100644 --- a/tests/system-test/7-tmq/tmqShow.py +++ b/tests/system-test/7-tmq/tmqShow.py @@ -135,12 +135,21 @@ class TDTestCase: if rows != len(topicNameList): tdLog.exit("show consumers rows error") - tdLog.info("check show subscriptions") - tdSql.query("show subscriptions") - tdLog.debug(tdSql.queryResult) - rows = tdSql.getRows() - expectSubscriptions = paraDict['vgroups'] * len(topicNameList) - tdLog.info("show subscriptions rows: %d, expect Subscriptions: %d"%(rows,expectSubscriptions)) + for i in range(0, 10, 1): + tdLog.info("check show subscriptions") + tdSql.query("show subscriptions") + tdLog.debug(tdSql.queryResult) + rows = tdSql.getRows() + expectSubscriptions = paraDict['vgroups'] * len(topicNameList) + tdLog.info("show subscriptions rows: %d, expect Subscriptions: %d"%(rows,expectSubscriptions)) + if rows != expectSubscriptions: + # tdLog.exit("show subscriptions rows error") + tdLog.info("continue retry[%d] to show subscriptions"%(i)) + time.sleep(1) + continue + else: + break + if rows != expectSubscriptions: tdLog.exit("show subscriptions rows error")