提交 fa6705df 编写于 作者: S Shengliang Guan

Merge branch '3.0' into fix/TD-20458

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
IF (DEFINED VERNUMBER) IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER}) SET(TD_VER_NUMBER ${VERNUMBER})
ELSE () ELSE ()
SET(TD_VER_NUMBER "3.0.1.6") SET(TD_VER_NUMBER "3.0.1.7")
ENDIF () ENDIF ()
IF (DEFINED VERCOMPATIBLE) IF (DEFINED VERCOMPATIBLE)
......
...@@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w ...@@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 3.0.1.7
<Release type="tdengine" version="3.0.1.7" />
## 3.0.1.6 ## 3.0.1.6
<Release type="tdengine" version="3.0.1.6" /> <Release type="tdengine" version="3.0.1.6" />
......
...@@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat ...@@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 2.2.9
<Release type="tools" version="2.2.9" />
## 2.2.7 ## 2.2.7
<Release type="tools" version="2.2.7" /> <Release type="tools" version="2.2.7" />
......
...@@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do ...@@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 3.0.1.7
<Release type="tdengine" version="3.0.1.7" />
## 3.0.1.6 ## 3.0.1.6
<Release type="tdengine" version="3.0.1.6" /> <Release type="tdengine" version="3.0.1.6" />
......
...@@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: ...@@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下:
import Release from "/components/ReleaseV3"; import Release from "/components/ReleaseV3";
## 2.2.9
<Release type="tools" version="2.2.9" />
## 2.2.7 ## 2.2.7
<Release type="tools" version="2.2.7" /> <Release type="tools" version="2.2.7" />
......
...@@ -1277,9 +1277,11 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans) ...@@ -1277,9 +1277,11 @@ static int32_t mndTransExecuteRedoActionsSerial(SMnode *pMnode, STrans *pTrans)
pAction->id); pAction->id);
code = mndTransSync(pMnode, pTrans); code = mndTransSync(pMnode, pTrans);
if (code != 0) { if (code != 0) {
pTrans->redoActionPos--;
pTrans->code = terrno; pTrans->code = terrno;
mError("trans:%d, %s:%d is executed and failed to sync to other mnodes since %s", pTrans->id, mError("trans:%d, %s:%d is executed and failed to sync to other mnodes since %s", pTrans->id,
mndTransStr(pAction->stage), pAction->id, terrstr()); mndTransStr(pAction->stage), pAction->id, terrstr());
break;
} }
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) { } 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); mInfo("trans:%d, %s:%d is in progress and wait it finish", pTrans->id, mndTransStr(pAction->stage), pAction->id);
......
...@@ -1739,6 +1739,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj ...@@ -1739,6 +1739,7 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
code = 0; code = 0;
_OVER: _OVER:
taosArrayDestroy(pArray);
mndTransDrop(pTrans); mndTransDrop(pTrans);
sdbFreeRaw(pRaw); sdbFreeRaw(pRaw);
return code; return code;
......
...@@ -337,9 +337,13 @@ static void doSetTagColumnData(STableScanInfo* pTableScanInfo, SSDataBlock* pBlo ...@@ -337,9 +337,13 @@ static void doSetTagColumnData(STableScanInfo* pTableScanInfo, SSDataBlock* pBlo
int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pBlock, rows, int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pBlock, rows,
GET_TASKID(pTaskInfo), &pTableScanInfo->metaCache); 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); T_LONG_JMP(pTaskInfo->env, code);
} }
// reset the error code.
terrno = 0;
} }
} }
...@@ -513,6 +517,21 @@ static void freeTableCachedVal(void* param) { ...@@ -513,6 +517,21 @@ static void freeTableCachedVal(void* param) {
taosMemoryFree(pVal); 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 // const void *key, size_t keyLen, void *value
static void freeCachedMetaItem(const void* key, size_t keyLen, void* value) { freeTableCachedVal(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 ...@@ -540,7 +559,11 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
metaReaderInit(&mr, pHandle->meta, 0); metaReaderInit(&mr, pHandle->meta, 0);
code = metaGetTableEntryByUid(&mr, pBlock->info.uid); code = metaGetTableEntryByUid(&mr, pBlock->info.uid);
if (code != TSDB_CODE_SUCCESS) { 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); metaReaderClear(&mr);
return terrno; return terrno;
} }
...@@ -559,23 +582,18 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int ...@@ -559,23 +582,18 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
metaReaderInit(&mr, pHandle->meta, 0); metaReaderInit(&mr, pHandle->meta, 0);
code = metaGetTableEntryByUid(&mr, pBlock->info.uid); code = metaGetTableEntryByUid(&mr, pBlock->info.uid);
if (code != TSDB_CODE_SUCCESS) { 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); metaReaderClear(&mr);
return terrno; return terrno;
} }
metaReaderReleaseLock(&mr); metaReaderReleaseLock(&mr);
STableCachedVal* pVal = taosMemoryMalloc(sizeof(STableCachedVal)); STableCachedVal* pVal = createTableCacheVal(&mr);
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);
}
val = *pVal; val = *pVal;
freeReader = true; freeReader = true;
...@@ -590,6 +608,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int ...@@ -590,6 +608,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
pCache->cacheHit += 1; pCache->cacheHit += 1;
STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h); STableCachedVal* pVal = taosLRUCacheValue(pCache->pTableMetaEntryCache, h);
val = *pVal; val = *pVal;
taosLRUCacheRelease(pCache->pTableMetaEntryCache, h, false); taosLRUCacheRelease(pCache->pTableMetaEntryCache, h, false);
} }
......
...@@ -38,7 +38,7 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { ...@@ -38,7 +38,7 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) {
} }
// pLogStore->pCache = taosLRUCacheInit(10 * 1024 * 1024, 1, .5); // 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) { if (pLogStore->pCache == NULL) {
taosMemoryFree(pLogStore); taosMemoryFree(pLogStore);
terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; terrno = TSDB_CODE_WAL_OUT_OF_MEMORY;
......
...@@ -35,30 +35,30 @@ ...@@ -35,30 +35,30 @@
,,y,script,./test.sh -f tsim/db/show_create_table.sim ,,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/tables.sim
,,y,script,./test.sh -f tsim/db/taosdlog.sim ,,y,script,./test.sh -f tsim/db/taosdlog.sim
,,,script,./test.sh -f tsim/dnode/balance_replica1.sim ,,y,script,./test.sh -f tsim/dnode/balance_replica1.sim
,,,script,./test.sh -f tsim/dnode/balance_replica3.sim ,,y,script,./test.sh -f tsim/dnode/balance_replica3.sim
,,,script,./test.sh -f tsim/dnode/balance1.sim ,,y,script,./test.sh -f tsim/dnode/balance1.sim
,,,script,./test.sh -f tsim/dnode/balance2.sim ,,y,script,./test.sh -f tsim/dnode/balance2.sim
,,,script,./test.sh -f tsim/dnode/balance3.sim ,,y,script,./test.sh -f tsim/dnode/balance3.sim
,,,script,./test.sh -f tsim/dnode/balancex.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/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_mnode.sim
,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.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 ,,y,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim
,,,script,./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim ,,y,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 ,,y,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_multi_vnode_replica3.sim
,,,script,./test.sh -f tsim/dnode/drop_dnode_force.sim ,,,script,./test.sh -f tsim/dnode/drop_dnode_force.sim
,,y,script,./test.sh -f tsim/dnode/offline_reason.sim ,,y,script,./test.sh -f tsim/dnode/offline_reason.sim
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim ,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim ,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim ,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim ,,y,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v2.sim
,,,script,./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v3.sim ,,y,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/vnode_clean.sim
,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim ,,,script,./test.sh -f tsim/dnode/use_dropped_dnode.sim
,,,script,./test.sh -f tsim/dnode/split_vgroup_replica1.sim ,,y,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_replica3.sim
,,y,script,./test.sh -f tsim/import/basic.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/commit.sim
,,y,script,./test.sh -f tsim/import/large.sim ,,y,script,./test.sh -f tsim/import/large.sim
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim ,,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_many.sim
,,y,script,./test.sh -f tsim/vnode/replica3_import.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_stop.sim
,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim
,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim ,,y,script,./test.sh -f tsim/vnode/stable_dnode3.sim
......
...@@ -10,7 +10,8 @@ else ...@@ -10,7 +10,8 @@ else
fi fi
today=`date +"%Y%m%d"` 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 TDENGINE_COVERAGE_REPORT=$TDENGINE_DIR/tests/coverage-report-$today.log
# Color setting # Color setting
...@@ -20,7 +21,7 @@ GREEN_DARK='\033[0;32m' ...@@ -20,7 +21,7 @@ GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE='\033[4;32m' GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m' NC='\033[0m'
function buildTDengine { function buildTDengine() {
echo "check if TDengine need build" echo "check if TDengine need build"
cd $TDENGINE_DIR cd $TDENGINE_DIR
git remote prune origin > /dev/null git remote prune origin > /dev/null
...@@ -33,159 +34,145 @@ function buildTDengine { ...@@ -33,159 +34,145 @@ function buildTDengine {
# reset counter # reset counter
lcov -d . --zerocounters lcov -d . --zerocounters
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
echo "repo up-to-date" echo "repo up-to-date"
else else
echo "repo need to pull" echo "repo need to pull"
fi fi
git reset --hard git reset --hard
git checkout -- . git checkout -- .
git checkout $branch git checkout $branch
git checkout -- .
git clean -dfx git clean -dfx
git pull git pull
git submodule update --init --recursive -f
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug [ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
cd $TDENGINE_DIR/debug cd $TDENGINE_DIR/debug
echo "rebuild.." echo "rebuild.."
LOCAL_COMMIT=`git rev-parse --short @` LOCAL_COMMIT=`git rev-parse --short @`
rm -rf * rm -rf *
if [ "$branch" == "3.0" ]; then if [ "$branch" == "3.0" ]; then
echo "3.0 =============" echo "3.0 ============="
cmake -DCOVER=true -DBUILD_TEST=true .. cmake -DCOVER=true -DBUILD_TEST=true -DBUILD_HTTP=false -DBUILD_TOOLS=true ..
else else
cmake -DCOVER=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null cmake -DCOVER=true -DBUILD_TOOLS=true -DBUILD_HTTP=false .. > /dev/null
fi fi
make -j4 make -j
make install make install
} }
function runGeneralCaseOneByOne { function runCasesOneByOne () {
while read -r line; do while read -r line; do
if [[ $line =~ ^./test.sh* ]]; then cmd=`echo $line | cut -d',' -f 5`
case=`echo $line | grep sim$ | awk '{print $NF}'` if [[ "$2" == "sim" ]] && [[ $cmd == *"test.sh"* ]]; then
case=`echo $cmd | cut -d' ' -f 3`
if [ -n "$case" ]; then start_time=`date +%s`
date +%F\ %T | tee -a $TDENGINE_COVERAGE_REPORT && ./test.sh -f $case > /dev/null 2>&1 && \ 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 "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT \
|| echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
fi 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 fi
done < $1 done < $1
} }
function runTestNGCaseOneByOne { function runUnitTest() {
while read -r line; do echo "=== Run unit test case ==="
if [[ $line =~ ^taostest* ]]; then echo " $TDENGINE_DIR/debug"
case=`echo $line | cut -d' ' -f 3 | cut -d'=' -f 2` cd $TDENGINE_DIR/debug
yaml=`echo $line | cut -d' ' -f 2` ctest -j12
echo "3.0 unit test done"
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 runTest { function runSimCases() {
echo "run Test" echo "=== Run sim cases ==="
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
cd $TDENGINE_DIR/tests/script cd $TDENGINE_DIR/tests/script
runCasesOneByOne ../parallel_test/cases.task sim
totalSuccess=`grep 'sim success' $TDENGINE_COVERAGE_REPORT | wc -l`
if [ "$totalSuccess" -gt "0" ]; then
echo "### Total $totalSuccess SIM test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
fi
[ -d ../../sim ] && rm -rf ../../sim totalFailed=`grep 'sim failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l`
[ -f $TDENGINE_COVERAGE_REPORT ] && rm $TDENGINE_COVERAGE_REPORT if [ "$totalFailed" -ne "0" ]; then
echo "### Total $totalFailed SIM test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
fi
}
runGeneralCaseOneByOne jenkins/basic.txt function runPythonCases() {
echo "=== Run python cases ==="
cd $TDENGINE_DIR/tests/system-test
runCasesOneByOne ../parallel_test/cases.task system-test
sed -i "1i\SIM cases test result" $TDENGINE_COVERAGE_REPORT cd $TDENGINE_DIR/tests/develop-test
runCasesOneByOne ../parallel_test/cases.task develop-test
totalSuccess=`grep 'success' $TDENGINE_COVERAGE_REPORT | wc -l` totalSuccess=`grep 'py success' $TDENGINE_COVERAGE_REPORT | wc -l`
if [ "$totalSuccess" -gt "0" ]; then if [ "$totalSuccess" -gt "0" ]; then
sed -i -e "2i\ ### Total $totalSuccess SIM test case(s) succeed! ###" $TDENGINE_COVERAGE_REPORT echo "### Total $totalSuccess python test case(s) succeed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
fi fi
totalFailed=`grep 'failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l` totalFailed=`grep 'py failed\|fault' $TDENGINE_COVERAGE_REPORT | wc -l`
if [ "$totalFailed" -ne "0" ]; then if [ "$totalFailed" -ne "0" ]; then
sed -i "3i\### Total $totalFailed SIM test case(s) failed! ###" $TDENGINE_COVERAGE_REPORT echo "### Total $totalFailed python test case(s) failed! ###" | tee -a $TDENGINE_COVERAGE_REPORT
fi fi
sed "3G" $TDENGINE_COVERAGE_REPORT }
stopTaosd function runJDBCCases() {
echo "run TestNG cases" echo "=== Run JDBC 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"
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
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 cd $JDBC_DIR
mvn clean package > /dev/null 2>&1 git checkout -- .
mvn test > jdbc-out.log 2>&1 git reset --hard HEAD
tail -n 20 jdbc-out.log 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT git checkout main
git pull
# Test C Demo
stopTaosd stopTaosd
$TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null & stopTaosadapter
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
fi
# run Unit Test taosd -c /etc/taos >> /dev/null 2>&1 &
echo "Run Unit Test: utilTest, queryTest and cliTest" taosadapter >> /dev/null 2>&1 &
#$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!"
stopTaosd 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 cd $TDENGINE_DIR/tests/script
find . -name '*.sql' | xargs rm -f find . -name '*.sql' | xargs rm -f
...@@ -203,15 +190,18 @@ function lcovFunc { ...@@ -203,15 +190,18 @@ function lcovFunc {
# remove exclude paths # remove exclude paths
if [ "$branch" == "3.0" ]; then if [ "$branch" == "3.0" ]; then
lcov --remove coverage.info \ lcov --remove coverage.info \
'*/contrib/*' '*/tests/*' '*/test/*'\ '*/contrib/*' '*/tests/*' '*/test/*' '*/tools/*' '*/libs/sync/*'\
'*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c'\ '*/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'\ '*/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'\ '*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/tidpool.c' '*/tmempool.c'\
'*/tthread.c' '*/tversion.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 --rc lcov_branch_coverage=1 -o coverage.info
else else
lcov --remove coverage.info \ 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 --rc lcov_branch_coverage=1 -o coverage.info
fi fi
...@@ -257,35 +247,33 @@ function stopTaosd { ...@@ -257,35 +247,33 @@ function stopTaosd {
echo "Stop tasod end" echo "Stop tasod end"
} }
function runTestRandomFail { function stopTaosadapter {
exec_random_fail_sh=$1 echo "Stop taosadapter"
default_exec_sh=$TDENGINE_DIR/tests/script/sh/exec.sh systemctl stop taosadapter.service
[ -f $exec_random_fail_sh ] && cp $exec_random_fail_sh $default_exec_sh || exit 1 PID=`ps -ef|grep -w taosadapter | grep -v grep | awk '{print $2}'`
while [ -n "$PID" ]
dnodes_random_fail_py=$TDENGINE_DIR/tests/pytest/util/dnodes-no-random-fail.py do
default_dnodes_py=$TDENGINE_DIR/tests/pytest/util/dnodes.py pkill -TERM -x taosadapter
[ -f $dnodes_random_fail_py ] && cp $dnodes_random_fail_py $default_dnodes_py || exit 1 sleep 1
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
done
echo "Stop tasoadapter end"
runTest NoRandomFail
} }
WORK_DIR=/root/pxiao WORK_DIR=/root/
date >> $WORK_DIR/cron.log date >> $WORK_DIR/cron.log
echo "Run Coverage Test" | tee -a $WORK_DIR/cron.log echo "Run Coverage Test" | tee -a $WORK_DIR/cron.log
stopTaosd 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
buildTDengine
runTest runTest
lcovFunc lcovFunc
#sendReport
sendReport
stopTaosd stopTaosd
date >> $WORK_DIR/cron.log 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
...@@ -192,7 +192,7 @@ if $data(5)[4] != ready then ...@@ -192,7 +192,7 @@ if $data(5)[4] != ready then
goto step5 goto step5
endi endi
print =============== step5: drop dnode 2 print =============== step5a: drop dnode 2
sql_error drop dnode 2 sql_error drop dnode 2
sql drop dnode 2 force sql drop dnode 2 force
...@@ -204,15 +204,23 @@ if $rows != 4 then ...@@ -204,15 +204,23 @@ if $rows != 4 then
return -1 return -1
endi 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; print select * from information_schema.ins_mnodes;
sql 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[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] print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
if $rows != 2 then if $rows != 2 then
return -1 goto step5a
endi endi
if $data(1)[2] != leader then if $data(1)[2] != leader then
return -1 goto step5a
endi endi
sql select * from information_schema.ins_qnodes sql select * from information_schema.ins_qnodes
......
...@@ -206,7 +206,6 @@ endi ...@@ -206,7 +206,6 @@ endi
print =============== step8: stop mnode1 and drop it print =============== step8: stop mnode1 and drop it
system sh/exec.sh -n dnode1 -s stop -x SIGKILL system sh/exec.sh -n dnode1 -s stop -x SIGKILL
sql_error drop mnode on dnode 1
$x = 0 $x = 0
step81: step81:
...@@ -234,42 +233,100 @@ if $leaderNum != 1 then ...@@ -234,42 +233,100 @@ if $leaderNum != 1 then
endi endi
print =============== step9: start mnode1 and wait it dropped print =============== step9: start mnode1 and wait it dropped
system sh/exec.sh -n dnode1 -s start print check mnode has leader step9a
sql drop mnode on dnode 1 -x step90 $x = 0
step90: step9a:
$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 step9a
endi
print start dnode1 step9b
system sh/exec.sh -n dnode1 -s start
$x = 0 $x = 0
step91: step9b:
$x = $x + 1 $x = $x + 1
sleep 1000 sleep 1000
if $x == 10 then if $x == 10 then
return -1 return -1
endi endi
print check dnode1 ready
sql select * from information_schema.ins_dnodes sql select * from information_schema.ins_dnodes
print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25 print ===> $data20 $data21 $data22 $data23 $data24 $data25
print ===> $data30 $data31 $data32 $data33 $data34 $data35 print ===> $data30 $data31 $data32 $data33 $data34 $data35
if $data(1)[4] != ready then if $data(1)[4] != ready then
goto step91 goto step9b
endi endi
if $data(2)[4] != ready then if $data(2)[4] != ready then
goto step91 goto step9b
endi endi
if $data(3)[4] != ready then if $data(3)[4] != ready then
goto step91 goto step9b
endi endi
if $data(4)[4] != ready then if $data(4)[4] != ready then
goto step91 goto step9b
endi 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 $x = 0
step92: step9d:
$x = $x + 1 $x = $x + 1
sleep 1000 sleep 1000
if $x == 20 then if $x == 20 then
return -1 return -1
endi endi
print check mnode leader
sql select * from information_schema.ins_mnodes sql select * from information_schema.ins_mnodes
print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15 print ===> $data10 $data11 $data12 $data13 $data14 $data15
...@@ -285,10 +342,10 @@ if $data(3)[2] == leader then ...@@ -285,10 +342,10 @@ if $data(3)[2] == leader then
$leaderNum = 1 $leaderNum = 1
endi endi
if $leaderNum != 1 then if $leaderNum != 1 then
goto step92 goto step9d
endi endi
if $rows != 2 then if $rows != 2 then
goto step92 goto step9d
endi endi
print =============== stepa: create mnode1 again print =============== stepa: create mnode1 again
......
...@@ -135,12 +135,21 @@ class TDTestCase: ...@@ -135,12 +135,21 @@ class TDTestCase:
if rows != len(topicNameList): if rows != len(topicNameList):
tdLog.exit("show consumers rows error") tdLog.exit("show consumers rows error")
tdLog.info("check show subscriptions") for i in range(0, 10, 1):
tdSql.query("show subscriptions") tdLog.info("check show subscriptions")
tdLog.debug(tdSql.queryResult) tdSql.query("show subscriptions")
rows = tdSql.getRows() tdLog.debug(tdSql.queryResult)
expectSubscriptions = paraDict['vgroups'] * len(topicNameList) rows = tdSql.getRows()
tdLog.info("show subscriptions rows: %d, expect Subscriptions: %d"%(rows,expectSubscriptions)) 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: if rows != expectSubscriptions:
tdLog.exit("show subscriptions rows error") tdLog.exit("show subscriptions rows error")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册