From d6319c1959b8cf96953155f423de13583e875772 Mon Sep 17 00:00:00 2001 From: hzcheng Date: Sat, 9 May 2020 02:25:44 +0000 Subject: [PATCH 01/51] add sync function, need to refactor again --- src/inc/tsdb.h | 2 ++ src/tsdb/inc/tsdbMain.h | 7 +++--- src/tsdb/src/tsdbMain.c | 44 ++++++++++++++++++++++++++++++++++++- src/tsdb/src/tsdbMetaFile.c | 4 ++-- src/vnode/src/vnodeMain.c | 5 ++--- 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index f4242fbe1f..ab5d26e0dd 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -109,6 +109,8 @@ int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId); int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg); TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid); +uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size); + // the TSDB repository info typedef struct STsdbRepoInfo { STsdbCfg tsdbCfg; diff --git a/src/tsdb/inc/tsdbMain.h b/src/tsdb/inc/tsdbMain.h index 278463f0d2..f179ef6ef9 100644 --- a/src/tsdb/inc/tsdbMain.h +++ b/src/tsdb/inc/tsdbMain.h @@ -490,9 +490,10 @@ int tsdbWriteCompInfo(SRWHelper *pHelper); int tsdbWriteCompIdx(SRWHelper *pHelper); // --------- Other functions need to further organize -void tsdbFitRetention(STsdbRepo *pRepo); -int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks); -void tsdbAdjustCacheBlocks(STsdbCache *pCache); +void tsdbFitRetention(STsdbRepo *pRepo); +int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks); +void tsdbAdjustCacheBlocks(STsdbCache *pCache); +int32_t tsdbGetMetaFileName(char *rootDir, char *fname); #ifdef __cplusplus } diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 8d570911a9..2b9f1c9fe0 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -7,6 +7,7 @@ #include "tscompression.h" #include "tchecksum.h" #include "ttime.h" +#include int tsdbDebugFlag = 135; @@ -760,7 +761,7 @@ static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) { return -1; } - tsdbError( + tsdbTrace( "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, @@ -1124,4 +1125,45 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) { // TODO +} + +uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size) { + // TODO: need to refactor this function + tsdbError("name:%s index:%d size:%d", name, *index, *size); + + STsdbRepo *pRepo = (STsdbRepo *)repo; + // STsdbMeta *pMeta = pRepo->tsdbMeta; + STsdbFileH *pFileH = pRepo->tsdbFileH; + uint32_t magic = 0; + char fname[256] = "\0"; + + struct stat fState; + + if (name[0] == 0) { + // Map index to the file name + int fid = (*index) / 3; + + if (fid > pFileH->numOfFGroups) { + // return meta data file + if ((*index) % 3 > 0) { // it is finished + return 0; + } else { + tsdbGetMetaFileName(pRepo->rootDir, fname); + } + } else { + // return data file name + strcpy(fname, pFileH->fGroup[fid].files[(*index) % 3].fname); + } + strcpy(name, fname); + } else { + // Name is provided, need to get the file info + sprintf(fname, "%s/%s", pRepo->rootDir, name); + } + + if (stat(fname, &fState) < 0) return 0; + + *size = fState.st_size; + magic = *size; + + return magic; } \ No newline at end of file diff --git a/src/tsdb/src/tsdbMetaFile.c b/src/tsdb/src/tsdbMetaFile.c index 6821fc2d98..f9d10ec579 100644 --- a/src/tsdb/src/tsdbMetaFile.c +++ b/src/tsdb/src/tsdbMetaFile.c @@ -28,7 +28,7 @@ typedef struct { int64_t uid; } SRecordInfo; -static int32_t tsdbGetMetaFileName(char *rootDir, char *fname); +// static int32_t tsdbGetMetaFileName(char *rootDir, char *fname); // static int32_t tsdbCheckMetaHeader(int fd); static int32_t tsdbWriteMetaHeader(int fd); static int tsdbCreateMetaFile(char *fname); @@ -180,7 +180,7 @@ void tsdbCloseMetaFile(SMetaFile *mfh) { tfree(mfh); } -static int32_t tsdbGetMetaFileName(char *rootDir, char *fname) { +int32_t tsdbGetMetaFileName(char *rootDir, char *fname) { if (rootDir == NULL) return -1; sprintf(fname, "%s/%s", rootDir, TSDB_META_FILE_NAME); return 0; diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 6ffac08b4e..4a779cd22d 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -383,9 +383,8 @@ static int vnodeWalCallback(void *arg) { } static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size) { - // SVnodeObj *pVnode = ahandle; - //tsdbGetFileInfo(pVnode->tsdb, name, index, size); - return 0; + SVnodeObj *pVnode = ahandle; + return tsdbGetFileInfo(pVnode->tsdb, name, index, size); } static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index) { From 6a3618b6e4fddb0ad816f96da878f0c0860470e3 Mon Sep 17 00:00:00 2001 From: hzcheng Date: Sat, 9 May 2020 02:39:07 +0000 Subject: [PATCH 02/51] add sync function --- src/tsdb/src/tsdbMain.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 2b9f1c9fe0..59e17edd5e 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -1129,7 +1129,6 @@ static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) { uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size) { // TODO: need to refactor this function - tsdbError("name:%s index:%d size:%d", name, *index, *size); STsdbRepo *pRepo = (STsdbRepo *)repo; // STsdbMeta *pMeta = pRepo->tsdbMeta; @@ -1138,6 +1137,8 @@ uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t * char fname[256] = "\0"; struct stat fState; + char *spath = strdup(pRepo->rootDir); + char *prefixDir = dirname(spath); if (name[0] == 0) { // Map index to the file name @@ -1146,6 +1147,7 @@ uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t * if (fid > pFileH->numOfFGroups) { // return meta data file if ((*index) % 3 > 0) { // it is finished + tfree(spath); return 0; } else { tsdbGetMetaFileName(pRepo->rootDir, fname); @@ -1154,13 +1156,16 @@ uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t * // return data file name strcpy(fname, pFileH->fGroup[fid].files[(*index) % 3].fname); } - strcpy(name, fname); + strcpy(name, fname + strlen(spath)); } else { // Name is provided, need to get the file info - sprintf(fname, "%s/%s", pRepo->rootDir, name); + sprintf(fname, "%s/%s", prefixDir, name); } - if (stat(fname, &fState) < 0) return 0; + if (stat(fname, &fState) < 0) { + tfree(spath); + return 0; + } *size = fState.st_size; magic = *size; From d6640af67c0a66c8297735784831a6bce3d82890 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 11 May 2020 12:02:48 +0800 Subject: [PATCH 03/51] reduce testcase less to reduce smoketest time. --- .travis.yml | 2 +- tests/pytest/smoketest.sh | 71 ----------------------------------- tests/pytest/valgrind-test.sh | 45 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 72 deletions(-) create mode 100755 tests/pytest/valgrind-test.sh diff --git a/.travis.yml b/.travis.yml index 2cb7b8e966..486844a7a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ matrix: ./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $? cd ${TRAVIS_BUILD_DIR}/tests/pytest - ./smoketest.sh -g 2>&1 | tee mem-error-out.txt + ./valgrind-test.sh -g 2>&1 | tee mem-error-out.txt sleep 1 # Color setting diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh index e51e8792ec..853ebe1d76 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -29,88 +29,17 @@ python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f table/db_table.py python3 ./test.py $1 -s && 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/valgrind-test.sh b/tests/pytest/valgrind-test.sh new file mode 100755 index 0000000000..853ebe1d76 --- /dev/null +++ b/tests/pytest/valgrind-test.sh @@ -0,0 +1,45 @@ +#!/bin/bash +python3 ./test.py $1 -f insert/basic.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/int.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/float.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/bigint.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/bool.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/double.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/smallint.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f insert/tinyint.py +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 $1 -s && sleep 1 +python3 ./test.py $1 -f table/column_num.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f table/db_table.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/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/importTail.py +python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importTRestart.py +python3 ./test.py $1 -s && sleep 1 From d7683010760216c8c5682a223fc2095198fff1e5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 12:07:33 +0800 Subject: [PATCH 04/51] change mnode ip list in dnode --- src/dnode/src/dnodeMgmt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 62d22573ff..0e91cc7155 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -266,9 +266,12 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) { return taosCfgDynamicOptions(pCfg->config); } - void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) { - dTrace("mgmt IP list is changed for ufp is called"); + dPrint("mnode IP list is changed for ufp is called, numOfIps:%d inUse:%d", pIpSet->numOfIps, pIpSet->inUse); + for (int i = 0; i < pIpSet->numOfIps; ++i) { + dPrint("mnode index:%d %s:%u", i, pIpSet->fqdn[i], pIpSet->port[i]) + } + tsMnodeIpSet = *pIpSet; } From 8fd8af68940aef3accf73d0f70bc72b2ab5b331b Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 11 May 2020 12:18:36 +0800 Subject: [PATCH 05/51] make fulltest.sh exit after upload coverage report. --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 486844a7a9..b460ad05b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -163,11 +163,9 @@ matrix: cd ${TRAVIS_BUILD_DIR}/tests - ./test-all.sh + ./test-all.sh $TRAVIS_EVENT_TYPE - if [ "$?" -ne "0" ]; then - travis_terminate $? - fi + TEST_RESULT=$? pkill taosd sleep 1 @@ -199,6 +197,9 @@ matrix: echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} " fi + if [ "$TEST_RESULT" -ne "0" ]; then + travis_terminate $? + fi ;; esac From fd9a32b619e82cb8572648e76901512df636c543 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 13:08:52 +0800 Subject: [PATCH 06/51] scripts --- tests/script/general/db/delete_reuse2.sim | 1 + tests/script/jenkins/basic.txt | 23 ++++----- tests/script/sh/deploy.sh | 2 +- .../script/unique/account/account_create.sim | 2 +- .../script/unique/account/account_delete.sim | 2 +- tests/script/unique/account/account_len.sim | 2 +- tests/script/unique/account/authority.sim | 2 +- tests/script/unique/account/basic.sim | 1 + tests/script/unique/account/paras.sim | 1 + tests/script/unique/account/pass_alter.sim | 2 +- tests/script/unique/account/pass_len.sim | 2 +- tests/script/unique/account/usage.sim | 1 + tests/script/unique/account/user_create.sim | 2 +- tests/script/unique/account/user_len.sim | 2 +- tests/script/unique/big/balance.sim | 48 +++++++++---------- tests/script/unique/big/maxvnodes.sim | 5 +- tests/script/unique/big/tcp.sim | 8 ++-- tests/script/unique/mnode/mgmt23.sim | 6 +-- tests/script/unique/mnode/mgmt25.sim | 4 +- tests/script/unique/mnode/mgmt26.sim | 6 +-- tests/script/unique/mnode/mgmt33.sim | 10 ++-- tests/script/unique/mnode/mgmt34.sim | 18 +++---- 22 files changed, 76 insertions(+), 74 deletions(-) diff --git a/tests/script/general/db/delete_reuse2.sim b/tests/script/general/db/delete_reuse2.sim index 0117d87104..d8b2763042 100644 --- a/tests/script/general/db/delete_reuse2.sim +++ b/tests/script/general/db/delete_reuse2.sim @@ -26,6 +26,7 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 print ========= start dnodes +sleep 2000 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index d96a1db2b4..44fda21d33 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -53,7 +53,7 @@ cd ../../../debug; make ./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_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 @@ -253,7 +253,7 @@ cd ../../../debug; make #./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/big/tcp.sim ##./test.sh -u -f unique/cluster/balance1.sim ##./test.sh -u -f unique/cluster/balance2.sim @@ -298,13 +298,13 @@ cd ../../../debug; make #./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 @@ -312,13 +312,10 @@ cd ../../../debug; make ##./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 - #./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_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 diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 5587e3bb8c..bc18479896 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -99,7 +99,7 @@ echo "logDir $LOG_DIR" >> $TAOS_CFG echo "dDebugFlag 199" >> $TAOS_CFG echo "mDebugFlag 199" >> $TAOS_CFG echo "sdbDebugFlag 199" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "rpcDebugFlag 151" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG echo "cDebugFlag 135" >> $TAOS_CFG echo "httpDebugFlag 135" >> $TAOS_CFG diff --git a/tests/script/unique/account/account_create.sim b/tests/script/unique/account/account_create.sim index d1d5ebece0..1966e1a7ce 100644 --- a/tests/script/unique/account/account_create.sim +++ b/tests/script/unique/account/account_create.sim @@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect print ============================ dnode1 start diff --git a/tests/script/unique/account/account_delete.sim b/tests/script/unique/account/account_delete.sim index 71a75a7b35..40075dc1a6 100644 --- a/tests/script/unique/account/account_delete.sim +++ b/tests/script/unique/account/account_delete.sim @@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect print ============= step1 sql create account oroot pass 'taosdata' diff --git a/tests/script/unique/account/account_len.sim b/tests/script/unique/account/account_len.sim index ae2db26d58..81d0f0bfb1 100644 --- a/tests/script/unique/account/account_len.sim +++ b/tests/script/unique/account/account_len.sim @@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect $i = 0 $dbPrefix = aldb diff --git a/tests/script/unique/account/authority.sim b/tests/script/unique/account/authority.sim index fe978a5827..2bb61cb0f2 100644 --- a/tests/script/unique/account/authority.sim +++ b/tests/script/unique/account/authority.sim @@ -4,8 +4,8 @@ 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 -sql connect sleep 3000 +sql connect print ============= step1 diff --git a/tests/script/unique/account/basic.sim b/tests/script/unique/account/basic.sim index d06f7a15d9..adbc84d766 100644 --- a/tests/script/unique/account/basic.sim +++ b/tests/script/unique/account/basic.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec_up.sh -n dnode1 -s start +sleep 3000 sql connect print =============== show accounts diff --git a/tests/script/unique/account/paras.sim b/tests/script/unique/account/paras.sim index b2e540400c..70a423f70f 100644 --- a/tests/script/unique/account/paras.sim +++ b/tests/script/unique/account/paras.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec_up.sh -n dnode1 -s start +sleep 3000 sql connect print =============== show accounts diff --git a/tests/script/unique/account/pass_alter.sim b/tests/script/unique/account/pass_alter.sim index 936611833a..644548be0b 100644 --- a/tests/script/unique/account/pass_alter.sim +++ b/tests/script/unique/account/pass_alter.sim @@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect print ============= step1 sql create user read pass 'taosdata1' diff --git a/tests/script/unique/account/pass_len.sim b/tests/script/unique/account/pass_len.sim index f4f9c04964..370ea94200 100644 --- a/tests/script/unique/account/pass_len.sim +++ b/tests/script/unique/account/pass_len.sim @@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect $i = 0 $dbPrefix = apdb diff --git a/tests/script/unique/account/usage.sim b/tests/script/unique/account/usage.sim index f022380ac4..63c3d49f43 100644 --- a/tests/script/unique/account/usage.sim +++ b/tests/script/unique/account/usage.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec_up.sh -n dnode1 -s start +sleep 3000 sql connect print =============== show accounts diff --git a/tests/script/unique/account/user_create.sim b/tests/script/unique/account/user_create.sim index 789035cfcc..2a64786225 100644 --- a/tests/script/unique/account/user_create.sim +++ b/tests/script/unique/account/user_create.sim @@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect print =============== step1 sql show users diff --git a/tests/script/unique/account/user_len.sim b/tests/script/unique/account/user_len.sim index 918551fa66..1163ac2e4b 100644 --- a/tests/script/unique/account/user_len.sim +++ b/tests/script/unique/account/user_len.sim @@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec_up.sh -n dnode1 -s start -sql connect sleep 3000 +sql connect $i = 0 $dbPrefix = lm_us_db diff --git a/tests/script/unique/big/balance.sim b/tests/script/unique/big/balance.sim index 52199f046e..4b0a6cd0bf 100644 --- a/tests/script/unique/big/balance.sim +++ b/tests/script/unique/big/balance.sim @@ -20,7 +20,7 @@ system sh/cfg.sh -n dnode5 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 1000 print =============== prepare data -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sleep 3000 sql connect @@ -87,7 +87,7 @@ endi print ========== step1 sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start $x = 0 show1: @@ -98,12 +98,12 @@ show1: endi sql show dnodes -print dnode1 freeVnodes $data3_192.168.0.1 -print dnode2 freeVnodes $data3_192.168.0.2 -if $data3_192.168.0.1 != 2 then +print dnode1 openvnodes $data2_1 +print dnode2 openvnodes $data2_2 +if $data2_1 != 2 then goto show1 endi -if $data3_192.168.0.2 != 2 then +if $data2_2 != 2 then goto show1 endi @@ -139,7 +139,7 @@ endi print ========== step2 sql create dnode $hostname3 -system sh/exec.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode3 -s start sleep 10000 print ========== step3 @@ -154,20 +154,20 @@ show3: endi sql show dnodes -print dnode1 freeVnodes $data3_192.168.0.1 -print dnode2 freeVnodes $data3_192.168.0.2 -print dnode3 freeVnodes $data3_192.168.0.3 -if $data3_192.168.0.1 != 2 then +print dnode1 freeVnodes $data2_1 +print dnode2 freeVnodes $data2_2 +print dnode3 freeVnodes $data2_3 +if $data2_1 != 2 then goto show3 endi -if $data3_192.168.0.2 != NULL then +if $data2_2 != NULL then goto show3 endi -if $data3_192.168.0.3 != 2 then +if $data2_3 != 2 then goto show3 endi -system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec_up.sh -n dnode2 -s stop -x SIGINT sql select count(*) from t10 print select count(*) from t10 $data00 expect $rowNum @@ -211,16 +211,16 @@ show4: endi sql show dnodes -print dnode1 freeVnodes $data3_192.168.0.1 -print dnode3 freeVnodes $data3_192.168.0.3 -if $data3_192.168.0.1 != 0 then +print dnode1 freeVnodes $data2_1 +print dnode3 freeVnodes $data2_3 +if $data2_1 != 0 then goto show4 endi -if $data3_192.168.0.3 != NULL then +if $data2_3 != NULL then goto show4 endi -system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec_up.sh -n dnode3 -s stop -x SIGINT sql select count(*) from t10 print select count(*) from t10 $data00 expect $rowNum @@ -255,7 +255,7 @@ endi print ========== step5 sql alter database db replica 2 sql create dnode $hostname4 -system sh/exec.sh -n dnode4 -s start +system sh/exec_up.sh -n dnode4 -s start $x = 0 show5: @@ -266,12 +266,12 @@ show5: endi sql show dnodes -print dnode1 freeVnodes $data3_192.168.0.1 -print dnode4 freeVnodes $data3_192.168.0.4 -if $data3_192.168.0.1 != 0 then +print dnode1 freeVnodes $data2_1 +print dnode4 freeVnodes $data2_4 +if $data2_1 != 0 then goto show5 endi -if $data3_192.168.0.4 != 0 then +if $data2_4 != 0 then goto show5 endi diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim index 00995ba32c..b0a0119ca7 100644 --- a/tests/script/unique/big/maxvnodes.sim +++ b/tests/script/unique/big/maxvnodes.sim @@ -10,7 +10,8 @@ system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000 system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000 print ========== prepare data -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start +sleep 3000 sql connect sql create database db sql use db @@ -49,7 +50,7 @@ system sh/cfg.sh -n dnode2 -c maxMgmtConnections -v 100000 print ========== step2 sql create dnode $hostname2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start $x = 0 show3: diff --git a/tests/script/unique/big/tcp.sim b/tests/script/unique/big/tcp.sim index 1fb414ec74..590035c0f8 100644 --- a/tests/script/unique/big/tcp.sim +++ b/tests/script/unique/big/tcp.sim @@ -14,8 +14,8 @@ system sh/cfg.sh -n dnode1 -c adminDebugFlag -v 131 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/cfg.sh -n dnode1 -c debugFlag -v 131 -system sh/exec.sh -n dnode1 -s start - +system sh/exec_up.sh -n dnode1 -s start +sleep 3000 sql connect print ======================== dnode1 start @@ -52,7 +52,7 @@ while $i < $tbNum endw $i = 0 -while $i < 100 +while $i < 10 print =============== step3 $i sql select count(*) from $mt print ===> $data00 $data01 @@ -83,7 +83,7 @@ while $i < $tbNum endw $i = 0 -while $i < 100 +while $i < 10 print =============== step5 $i sql select count(*) from $mt where tgcol < 20200 print ===> $data00 $data01 diff --git a/tests/script/unique/mnode/mgmt23.sim b/tests/script/unique/mnode/mgmt23.sim index 99d9159573..8c144dd0c4 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 diff --git a/tests/script/unique/mnode/mgmt25.sim b/tests/script/unique/mnode/mgmt25.sim index ba545f9479..8c8eeba466 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,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 diff --git a/tests/script/unique/mnode/mgmt26.sim b/tests/script/unique/mnode/mgmt26.sim index e5ead5bb39..373a0abaed 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,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 diff --git a/tests/script/unique/mnode/mgmt33.sim b/tests/script/unique/mnode/mgmt33.sim index 36b7ba8139..e3a62a2d22 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 diff --git a/tests/script/unique/mnode/mgmt34.sim b/tests/script/unique/mnode/mgmt34.sim index 1139daea1c..4409c825c8 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 From 5883ed6e7344b34018c9c09fb5019a9133cb91e5 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 11 May 2020 13:52:08 +0800 Subject: [PATCH 07/51] sleep 4 sec to wait dnodes start. --- tests/pytest/util/dnodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index e492a35c20..23adab2c47 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -201,8 +201,8 @@ class TDDnode: self.running = 1 tdLog.debug("dnode:%d is running with %s " % (self.index, cmd)) - tdLog.debug("wait 2 seconds for the dnode:%d to start." % (self.index)) - time.sleep(2) + tdLog.debug("wait 4 seconds for the dnode:%d to start." % (self.index)) + time.sleep(4) def stop(self): if self.valgrind == 0: From 14778e6c7558048a73008bc249c23926c37bd94c Mon Sep 17 00:00:00 2001 From: chang Date: Mon, 11 May 2020 14:00:14 +0800 Subject: [PATCH 08/51] feat: add connection test case --- .../script/general/connection/connection.sim | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/script/general/connection/connection.sim diff --git a/tests/script/general/connection/connection.sim b/tests/script/general/connection/connection.sim new file mode 100644 index 0000000000..71db20b285 --- /dev/null +++ b/tests/script/general/connection/connection.sim @@ -0,0 +1,21 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect + +print ============= step1 +sql close +print close1 +sql connect + +print ============= step2 +sql close +sql connect + +print ============= step3 +sql close +sql connect write + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From f1d26db0315d841acd65eca4daefd6897f4d7701 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Mon, 11 May 2020 14:04:41 +0800 Subject: [PATCH 09/51] [td-225] fix bugs for nchar handling --- src/client/src/tscSQLParser.c | 4 +- src/query/src/qast.c | 5 ++- src/query/src/tvariant.c | 10 ++++- src/tsdb/src/tsdbMeta.c | 7 +++- src/tsdb/src/tsdbRead.c | 4 +- src/util/src/tcompare.c | 48 +++++++++++------------ tests/script/general/parser/nchar.sim | 2 + tests/script/general/parser/testSuite.sim | 11 +++--- 8 files changed, 51 insertions(+), 40 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 4ef24e7335..a81ad19e4f 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5563,8 +5563,8 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); } - *(VarDataLenT*)tagVal = pList->a[i].pVar.nLen; - ret = tVariantDump(&(pList->a[i].pVar), tagVal + VARSTR_HEADER_SIZE, pTagSchema[i].type); + ret = tVariantDump(&(pList->a[i].pVar), varDataVal(tagVal), pTagSchema[i].type); + varDataSetLen(tagVal, pList->a[i].pVar.nLen); } else { ret = tVariantDump(&(pList->a[i].pVar), tagVal, pTagSchema[i].type); } diff --git a/src/query/src/qast.c b/src/query/src/qast.c index 01099b2c3b..43bdf57ed7 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -540,8 +540,11 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) { static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) { SSkipListIterator* iter = NULL; + SQueryCond cond = {0}; - setQueryCond(pQueryInfo, &cond); + if (setQueryCond(pQueryInfo, &cond) != TSDB_CODE_SUCCESS) { + //todo handle error + } if (cond.start != NULL) { iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC); diff --git a/src/query/src/tvariant.c b/src/query/src/tvariant.c index 0c4a2b6757..51d3286722 100644 --- a/src/query/src/tvariant.c +++ b/src/query/src/tvariant.c @@ -389,6 +389,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { return 0; } +// todo handle the error static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { char tmpBuf[40] = {0}; @@ -424,7 +425,12 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { pVariant->wpz = (wchar_t *)tmp; } else { - taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE, NULL); + size_t output = -1; + taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE, &output); + + if (pDestSize != NULL) { + *pDestSize = output; + } } return 0; @@ -779,7 +785,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, char type) { } case TSDB_DATA_TYPE_NCHAR: { if (pVariant->nType == TSDB_DATA_TYPE_NULL) { - *(uint32_t *)payload = TSDB_DATA_NCHAR_NULL; + *(uint32_t *) payload = TSDB_DATA_NCHAR_NULL; } else { if (pVariant->nType != TSDB_DATA_TYPE_NCHAR) { toNchar(pVariant, &payload, &pVariant->nLen); diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 107da92965..c7e260ae50 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -8,7 +8,7 @@ #define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here #define TSDB_META_FILE_NAME "META" -const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; +const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; // skip list built based on the first column of tags static int tsdbFreeTable(STable *pTable); static int32_t tsdbCheckTableCfg(STableCfg *pCfg); @@ -548,7 +548,10 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) { STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid); assert(pSTable != NULL); - char* key = dataRowTuple(pTable->tagVal); // key + STSchema* pSchema = tsdbGetTableTagSchema(pMeta, pTable); + STColumn* pCol = &pSchema->columns[DEFAULT_TAG_INDEX_COLUMN]; + + char* key = tdGetRowDataOfCol(pTable->tagVal, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset); bool ret = tSkipListRemove(pSTable->pIndex, key); assert(ret); diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 2f0bc3ecc8..49b6d2984f 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -626,7 +626,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf for(int32_t k = start; k < pQueryHandle->realNumOfRows + start; ++k) { char* p = tdGetColDataOfRow(src, k); memcpy(dst, p, varDataTLen(p)); - dst += varDataTLen(p); + dst += bytes; } } @@ -1311,8 +1311,8 @@ void filterPrepare(void* expr, void* param) { } else { pInfo->q = calloc(1, pSchema->bytes); if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) { - varDataSetLen(pInfo->q, pCond->nLen); tVariantDump(pCond, varDataVal(pInfo->q), pSchema->type); + varDataSetLen(pInfo->q, pCond->nLen); // the length may be changed after dump, so assign its value after dump } else { tVariantDump(pCond, pInfo->q, pSchema->type); } diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 643f54550b..0abf1e6be3 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -67,33 +67,29 @@ int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight) { if (len1 != len2) { return len1 > len2? 1:-1; } else { - return (int32_t) strncmp(varDataVal(pLeft), varDataVal(pRight), len1); + int32_t ret = strncmp(varDataVal(pLeft), varDataVal(pRight), len1); + if (ret == 0) { + return 0; + } else { + return ret > 0 ? 1:-1; + } } } -int32_t compareWStrVal(const void *pLeft, const void *pRight) { - // SSkipListKey *pL = (SSkipListKey *)pLeft; - // SSkipListKey *pR = (SSkipListKey *)pRight; - // - // if (pL->nLen == 0 && pR->nLen == 0) { - // return 0; - // } - // - // // handle only one-side bound compare situation, there is only lower bound or only upper bound - // if (pL->nLen == -1) { - // return 1; // no lower bound, lower bound is minimum, always return -1; - // } else if (pR->nLen == -1) { - // return -1; // no upper bound, upper bound is maximum situation, always return 1; - // } - // - // int32_t ret = wcscmp(((SSkipListKey *)pLeft)->wpz, ((SSkipListKey *)pRight)->wpz); - // - // if (ret == 0) { - // return 0; - // } else { - // return ret > 0 ? 1 : -1; - // } - return 0; +int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight) { + int32_t len1 = varDataLen(pLeft); + int32_t len2 = varDataLen(pRight); + + if (len1 != len2) { + return len1 > len2? 1:-1; + } else { + int32_t ret = wcsncmp(varDataVal(pLeft), varDataVal(pRight), len1); + if (ret == 0) { + return 0; + } else { + return ret > 0 ? 1 : -1; + } + } } /* @@ -284,7 +280,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { if (optr == TSDB_RELATION_LIKE) { comparFn = compareWStrPatternComp; } else { - comparFn = compareWStrVal; + comparFn = compareLenPrefixedWStr; } break; @@ -326,7 +322,7 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) { break; case TSDB_DATA_TYPE_NCHAR: - comparFn = compareWStrVal; + comparFn = compareLenPrefixedWStr; break; default: diff --git a/tests/script/general/parser/nchar.sim b/tests/script/general/parser/nchar.sim index fbdc12446a..2a6bc83b41 100644 --- a/tests/script/general/parser/nchar.sim +++ b/tests/script/general/parser/nchar.sim @@ -194,8 +194,10 @@ sql reset query cache sql select * from $mt where tgcol = '1' step2: if $rows != 100 then + print expect 100, actual: $rows return -1 endi + sql select * from $mt where tgcol > '0' #print rows = $rows if $rows != 100 then diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index 0719d1c330..a2a08097dd 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -35,6 +35,12 @@ run general/parser/first_last.sim sleep 2000 run general/parser/import_file.sim sleep 2000 +run general/parser/lastrow.sim +sleep 2000 +run general/parser/nchar.sim +sleep 2000 +run general/parser/null_char.sim +sleep 2000 run general/parser/fill.sim sleep 2000 run general/parser/fill_stb.sim @@ -42,7 +48,6 @@ 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 @@ -54,10 +59,6 @@ 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 From a539bac6d22fc3582f53ba89f9c90a97e33b468c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 14:51:56 +0800 Subject: [PATCH 10/51] scripts --- tests/script/general/db/testSuite.sim | 3 +- tests/script/general/db/vnodes.sim | 45 +++++++++++++ tests/script/jenkins/basic.txt | 95 +++++++++++++-------------- tests/script/unique/big/maxvnodes.sim | 31 +++++---- 4 files changed, 112 insertions(+), 62 deletions(-) create mode 100644 tests/script/general/db/vnodes.sim diff --git a/tests/script/general/db/testSuite.sim b/tests/script/general/db/testSuite.sim index 2cac8b8fa8..87863001a3 100644 --- a/tests/script/general/db/testSuite.sim +++ b/tests/script/general/db/testSuite.sim @@ -1,4 +1,4 @@ -run general//db/basic.sim +run general/db/basic.sim run general/db/basic1.sim run general/db/basic2.sim run general/db/basic3.sim @@ -13,3 +13,4 @@ run general/db/delete_writing2.sim run general/db/len.sim run general/db/repeat.sim run general/db/tables.sim +run general/db/vnodes.sim diff --git a/tests/script/general/db/vnodes.sim b/tests/script/general/db/vnodes.sim new file mode 100644 index 0000000000..87e821fde3 --- /dev/null +++ b/tests/script/general/db/vnodes.sim @@ -0,0 +1,45 @@ +system sh/stop_dnodes.sh + +$totalVnodes = 100 +$maxTables = 4 +$totalRows = $totalVnodes * $maxTables + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $maxTables +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v $totalVnodes +system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000 +system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000 +system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000 +system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000 + +print ========== prepare data +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect +sql create database db blocks 2 cache 1 maxTables $maxTables +sql use db + +print ========== step1 +sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) + +$x = 0 +while $x < $totalRows + $tb = t . $x + sql create table $tb using mt tags( $x ) + sql insert into $tb values (now, $x ) + $x = $x + 1 +endw + +print ========== step2 +sql select * from mt +if $rows != $totalRows then + return -1 +endi + +sql select count(*) from mt +if $data00 != $totalRows 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/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 44fda21d33..f73a23f184 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -15,12 +15,12 @@ cd ../../../debug; make #./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_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 +#hongze ./test.sh -f general/column/commit.sim +#hongze ./test.sh -f general/column/metrics.sim +#hongze ./test.sh -f general/column/table.sim ./test.sh -f general/compress/commitlog.sim ./test.sh -f general/compress/compress.sim @@ -31,11 +31,11 @@ cd ../../../debug; make ./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 +# liao./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 +# liao./test.sh -f general/compute/interval.sim +# liao./test.sh -f general/compute/last.sim +# liao./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 @@ -57,37 +57,38 @@ cd ../../../debug; make ./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 -u -f general/db/vnodes.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/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/field/bigint.sim +# liao./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 +# jeff ./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 +# jeff ./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 +# jeff ./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 +#hongze ./test.sh -f general/import/replica1.sim ./test.sh -f general/insert/basic.sim -#./test.sh -f general/insert/insert_drop.sim +#hongze ./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 @@ -96,8 +97,6 @@ cd ../../../debug; make ./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 @@ -112,8 +111,8 @@ cd ../../../debug; make ./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/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 @@ -121,9 +120,9 @@ cd ../../../debug; make # ./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_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 @@ -167,7 +166,7 @@ cd ../../../debug; make ./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 +#hongze ./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 @@ -187,7 +186,7 @@ cd ../../../debug; make ./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_len.sim ./test.sh -f general/table/table.sim ./test.sh -f general/table/tinyint.sim ./test.sh -f general/table/vgroup.sim @@ -197,45 +196,45 @@ cd ../../../debug; make #./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/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/bool.sim #./test.sh -f general/tag/change.sim -#./test.sh -f general/tag/column.sim +#liao ./test.sh -f general/tag/column.sim #./test.sh -f general/tag/commit.sim -#./test.sh -f general/tag/create.sim +#liao ./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/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/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/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/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/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 +#liao ./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 -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 ################################# diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim index b0a0119ca7..3015d07b6d 100644 --- a/tests/script/unique/big/maxvnodes.sim +++ b/tests/script/unique/big/maxvnodes.sim @@ -1,9 +1,15 @@ system sh/stop_dnodes.sh +$totalVnodes = 100 +$minVnodes = 48 +$maxVnodes = 52 +$maxTables = 4 +$totalRows = $totalVnodes * $maxTables + system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 100 -system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 256 +system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $maxTables +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v $totalVnodes system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000 system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000 system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000 @@ -13,14 +19,14 @@ print ========== prepare data system sh/exec_up.sh -n dnode1 -s start sleep 3000 sql connect -sql create database db +sql create database db blocks 2 cache 1 maxTables $maxTables sql use db print ========== step1 sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) $x = 0 -while $x < 25600 +while $x < $totalRows $tb = t . $x sql create table $tb using mt tags( $x ) sql insert into $tb values (now, $x ) @@ -29,16 +35,15 @@ endw print ========== step2 sql select * from mt -if $rows != 25600 then +if $rows != $totalRows then return -1 endi sql select count(*) from mt -if $data00 != 25600 then +if $data00 != $totalRows then return -1 endi - system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode2 -c walLevel -v 0 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 100 @@ -61,23 +66,23 @@ show3: endi sql show dnodes -print dnode1 freeVnodes $data3_192.168.0.1 -print dnode2 freeVnodes $data3_192.168.0.2 -if $data3_192.168.0.1 != 126 then +print dnode1 openvnodes $data2_1 +print dnode2 openvnodes $data2_2 +if $data2_1 != $minVnodes then goto show3 endi -if $data3_192.168.0.2 != 130 then +if $data2_2 != $maxVnodes then goto show3 endi print ========== step4 sql select * from mt -if $rows != 25600 then +if $rows != $totalRows then return -1 endi sql select count(*) from mt -if $data00 != 25600 then +if $data00 != $totalRows then return -1 endi From 24aea5d7060573b2d3f295519572d8cea9ca3eff Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 14:54:42 +0800 Subject: [PATCH 11/51] scripts --- tests/script/basicSuite.sim | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index aa0fbf65b7..a99edfd93d 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -1,26 +1,20 @@ -################################# 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/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_name.sim run general/table/int.sim run general/table/vgroup.sim run general/user/basic1.sim run general/user/pass_alter.sim -run general/user/user_len.sim run general/vector/single.sim -################################## From cbd4542120f5bca427622bad23ecdecd0de2ac8b Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 11 May 2020 15:10:17 +0800 Subject: [PATCH 12/51] execute all cases even some failed early. --- .travis.yml | 2 +- tests/test-all.sh | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b460ad05b0..72970bc1e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -163,7 +163,7 @@ matrix: cd ${TRAVIS_BUILD_DIR}/tests - ./test-all.sh $TRAVIS_EVENT_TYPE + ./test-all.sh $TRAVIS_EVENT_TYPE COVER TEST_RESULT=$? diff --git a/tests/test-all.sh b/tests/test-all.sh index 93bfa7a426..e58a6f5132 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -21,11 +21,12 @@ fi echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}" totalFailed=`grep 'failed\|fault' out.txt | wc -l` -echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}" +# echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}" if [ "$totalFailed" -ne "0" ]; then -# echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}" - exit $totalFailed + echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}" + +# exit $totalFailed fi echo "### run Python script ###" @@ -46,6 +47,7 @@ fi totalPyFailed=`grep 'failed\|fault' pytest-out.txt | wc -l` if [ "$totalPyFailed" -ne "0" ]; then echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}" - exit $totalPyFailed +# exit $totalPyFailed fi +exit $(($totalFailed + $totalPyFailed)) From e575daa5cf89eea9918f4459d3d653dc309109fd Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Mon, 11 May 2020 15:33:18 +0800 Subject: [PATCH 13/51] test: add connection test --- tests/script/basicSuite.sim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index 676ac93bf2..e32f3f5bf6 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -22,4 +22,5 @@ run general/table/vgroup.sim run general/user/basic1.sim run general/user/user_len.sim run general/vector/single.sim +run general/connection/connection.sim ################################## From 459c267a2a0d5b30ac9d69da71104f0a78753c66 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 16:04:49 +0800 Subject: [PATCH 14/51] add log for database create --- src/mnode/src/mgmtDb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 4f54a85baa..2f17df92fa 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -297,8 +297,10 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) { if (pDb != NULL) { mgmtDecDbRef(pDb); if (pCreate->ignoreExist) { + mTrace("db:%s, already exist, ignore exist is set", pCreate->db); return TSDB_CODE_SUCCESS; } else { + mError("db:%s, is already exist, ignore exist not set", pCreate->db); return TSDB_CODE_DB_ALREADY_EXIST; } } @@ -751,6 +753,8 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) { code = mgmtCreateDb(pMsg->pUser->pAcct, pCreate); if (code == TSDB_CODE_SUCCESS) { mLPrint("db:%s, is created by %s", pCreate->db, pMsg->pUser->user); + } else { + mError("db:%s, failed to create, reason:%s", pCreate->db, tstrerror(code)); } } From 683869342299e5339e36b4e7affcf3d875baee9b Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 11 May 2020 16:30:14 +0800 Subject: [PATCH 15/51] fixup: fix make command to make coverity_scan work. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b460ad05b0..8696f1afc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -115,7 +115,7 @@ matrix: # The command that will be added as an argument to "cov-build" to compile your project for analysis, # ** likely specific to your build ** - build_command: make > /dev/null + build_command: make # Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'. # Take care in resource usage, and consider the build frequency allowances per From f799232f2574aeeb1f61697bc1070e8b9303a09a Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Mon, 11 May 2020 16:54:50 +0800 Subject: [PATCH 16/51] test: add user/authority --- tests/script/general/user/authority.sim | 72 +++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/script/general/user/authority.sim diff --git a/tests/script/general/user/authority.sim b/tests/script/general/user/authority.sim new file mode 100644 index 0000000000..06f0467626 --- /dev/null +++ b/tests/script/general/user/authority.sim @@ -0,0 +1,72 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect +sleep 3000 + +print ============= step1 +sql create user read pass 'taosdata' +sql create user write pass 'taosdata' +sql show users +if $rows != 5 then + return -1 +endi + +print ============= step2 +sql close +sql connect read +sleep 2000 + +sql create database dread +sql show databases +if $rows != 1 then + return -1 +endi + +print ============= step3 +sql close +sql connect write +sleep 2000 + +sql create database dwrite +sql show databases +if $rows != 1 then + return -1 +endi + +print ============ step4 +sql close +sql connect +sleep 2000 + +sql show databases +if $row != 2 then + return -1 +endi + +print ============ step5 +sql close +sql connect read +sleep 2000 + +sql drop database dread +sql drop database dwrite -x step51 + +step51: + +sql close +sql connect +sql show databases +if $rows != 1 then + return -1 +endi + +sql close +sql connect +sleep 2000 +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 From 706828a1d4d2562b98f0e3c35bcfc1b6fe2b9794 Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Mon, 11 May 2020 16:57:53 +0800 Subject: [PATCH 17/51] test: add user/authority --- tests/script/basicSuite.sim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index e32f3f5bf6..c8b21c6856 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -23,4 +23,5 @@ run general/user/basic1.sim run general/user/user_len.sim run general/vector/single.sim run general/connection/connection.sim +run general/user/authority.sim ################################## From 0f7690b95a9b49d971f701df28c5e4d3b322eeb1 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 11 May 2020 17:32:53 +0800 Subject: [PATCH 18/51] change tables to maxtables according to Dr. Liao [TD-274] --- tests/pytest/import_merge/importToCommit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/import_merge/importToCommit.py b/tests/pytest/import_merge/importToCommit.py index 7a408bcdce..3684dde049 100644 --- a/tests/pytest/import_merge/importToCommit.py +++ b/tests/pytest/import_merge/importToCommit.py @@ -33,7 +33,7 @@ class TDTestCase: tdDnodes.start(1) tdSql.execute('reset query cache') tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512 tables 10') + tdSql.execute('create database db cache 512 maxtables 10') tdSql.execute('use db') tdLog.info("================= step1") From 7b2be379f87929ca6c3b17d5202f295db34c8e95 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 11 May 2020 18:13:30 +0800 Subject: [PATCH 19/51] integer division yields float in python3. [TD-277] --- tests/pytest/import_merge/importDataH2.py | 10 +++++----- tests/pytest/import_merge/importDataSub.py | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/pytest/import_merge/importDataH2.py b/tests/pytest/import_merge/importDataH2.py index 73a412fb80..b5e53d862e 100644 --- a/tests/pytest/import_merge/importDataH2.py +++ b/tests/pytest/import_merge/importDataH2.py @@ -46,16 +46,16 @@ class TDTestCase: self.maxrows) tdLog.info("================= step2") - tdLog.info("import %d sequential data" % (self.maxrows / 2)) + tdLog.info("import %d sequential data" % (self.maxrows // 2)) startTime = self.startTime sqlcmd = ['import into tb1 values'] - for rid in range(1, self.maxrows / 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.maxrows / 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.maxrows / 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.maxrows / 2 + 11) + tdSql.checkRows(self.maxrows // 2 + 11) def stop(self): tdSql.close() diff --git a/tests/pytest/import_merge/importDataSub.py b/tests/pytest/import_merge/importDataSub.py index 2359ca214f..e946a254c2 100644 --- a/tests/pytest/import_merge/importDataSub.py +++ b/tests/pytest/import_merge/importDataSub.py @@ -46,16 +46,17 @@ class TDTestCase: self.maxrows) tdLog.info("================= step2") - tdLog.info("import %d sequential data" % (self.maxrows / 2)) + tdLog.info("import %d sequential data" % (self.maxrows // 2)) startTime = self.startTime sqlcmd = ['import into tb1 values'] - for rid in range(1, self.maxrows / 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.maxrows / 2) + tdSql.checkRows(self.maxrows // 2) tdLog.info("================= step4") tdDnodes.stop(1) @@ -73,7 +74,7 @@ class TDTestCase: tdLog.info("================= step9") tdSql.execute('reset query cache') tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.maxrows / 2) + tdSql.checkRows(self.maxrows // 2) def stop(self): tdSql.close() From c2a9c119688735fcaa11a54206f63c449ab820da Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 19:46:33 +0800 Subject: [PATCH 20/51] [TD-271] fix bug while drop stable --- src/mnode/inc/mgmtDef.h | 3 +- src/mnode/src/mgmtTable.c | 152 +++++++++++++++++++------------------- 2 files changed, 77 insertions(+), 78 deletions(-) diff --git a/src/mnode/inc/mgmtDef.h b/src/mnode/inc/mgmtDef.h index ba71f9373b..3ac2efb83b 100644 --- a/src/mnode/inc/mgmtDef.h +++ b/src/mnode/inc/mgmtDef.h @@ -85,8 +85,7 @@ typedef struct SSuperTableObj { int32_t numOfTables; int16_t nextColId; SSchema * schema; - int32_t vgLen; - int32_t * vgList; + void * vgHash; } SSuperTableObj; typedef struct { diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index bfe357cf7c..d001114bf0 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -24,6 +24,7 @@ #include "tname.h" #include "tidpool.h" #include "tglobal.h" +#include "hash.h" #include "dnode.h" #include "mgmtDef.h" #include "mgmtInt.h" @@ -363,39 +364,35 @@ static void mgmtCleanUpChildTables() { } static void mgmtAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) { - if (pStable->vgLen == 0) { - pStable->vgLen = 8; - pStable->vgList = calloc(pStable->vgLen, sizeof(int32_t)); - } - - bool find = false; - int32_t pos = 0; - for (pos = 0; pos < pStable->vgLen; ++pos) { - if (pStable->vgList[pos] == 0) break; - if (pStable->vgList[pos] == pCtable->vgId) { - find = true; - break; - } - } - - if (!find) { - if (pos >= pStable->vgLen) { - pStable->vgLen *= 2; - pStable->vgList = realloc(pStable->vgList, pStable->vgLen * sizeof(int32_t)); - } - pStable->vgList[pos] = pCtable->vgId; - } - pStable->numOfTables++; + + if (pStable->vgHash == NULL) { + pStable->vgHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false); + } + + if (pStable->vgHash != NULL) { + taosHashPut(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId), &pCtable->vgId, sizeof(pCtable->vgId)); + } } static void mgmtRemoveTableFromStable(SSuperTableObj *pStable, SChildTableObj *pCtable) { pStable->numOfTables--; + + if (pStable->vgHash == NULL) return; + + SVgObj *pVgroup = mgmtGetVgroup(pCtable->vgId); + if (pVgroup != NULL) { + taosHashRemove(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId)); + } + mgmtDecVgroupRef(pVgroup); } static void mgmtDestroySuperTable(SSuperTableObj *pStable) { + if (pStable->vgHash != NULL) { + taosHashCleanup(pStable->vgHash); + pStable->vgHash = NULL; + } tfree(pStable->schema); - tfree(pStable->vgList) tfree(pStable); } @@ -434,7 +431,7 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) { void *oldSchema = pTable->schema; memcpy(pTable, pNew, pOper->rowSize); pTable->schema = pNew->schema; - free(pNew->vgList); + free(pNew->vgHash); free(pNew); free(oldSchema); } @@ -797,26 +794,26 @@ static void mgmtProcessCreateSuperTableMsg(SQueuedMsg *pMsg) { static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) { SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable; if (pStable->numOfTables != 0) { - mgmtDropAllChildTablesInStable(pStable); - for (int32_t vg = 0; vg < pStable->vgLen; ++vg) { - int32_t vgId = pStable->vgList[vg]; - if (vgId == 0) break; - - SVgObj *pVgroup = mgmtGetVgroup(vgId); + SHashMutableIterator *pIter = taosHashCreateIter(pStable->vgHash); + while (taosHashIterNext(pIter)) { + int32_t *pVgId = taosHashIterGet(pIter); + SVgObj *pVgroup = mgmtGetVgroup(*pVgId); if (pVgroup == NULL) break; - + SMDDropSTableMsg *pDrop = rpcMallocCont(sizeof(SMDDropSTableMsg)); pDrop->contLen = htonl(sizeof(SMDDropSTableMsg)); - pDrop->vgId = htonl(vgId); + pDrop->vgId = htonl(pVgroup->vgId); pDrop->uid = htobe64(pStable->uid); mgmtExtractTableName(pStable->info.tableId, pDrop->tableId); - mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, vgId); + mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, pVgroup->vgId); SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; dnodeSendMsgToDnode(&ipSet, &rpcMsg); mgmtDecVgroupRef(pVgroup); } + + mgmtDropAllChildTablesInStable(pStable); } SSdbOper oper = { @@ -1243,59 +1240,62 @@ static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) { static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { SCMSTableVgroupMsg *pInfo = pMsg->pCont; int32_t numOfTable = htonl(pInfo->numOfTables); - - char* name = (char*) pInfo + sizeof(struct SCMSTableVgroupMsg); + SCMSTableVgroupRspMsg *pRsp = NULL; - - // todo set the initial size to be 10, fix me - int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + (sizeof(SCMVgroupInfo) * 10 + sizeof(SVgroupsInfo))*numOfTable; - + int32_t contLen = sizeof(SCMSTableVgroupRspMsg); + for (int32_t i = 0; i < numOfTable; ++i) { + char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; + SSuperTableObj *pTable = mgmtGetSuperTable(stableName); + if (pTable != NULL) { + stableName = (char*)pTable; //hack way + } + + if (pTable->vgHash != NULL) { + contLen += (taosHashGetSize(pTable->vgHash) * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo)); + } + mgmtDecTableRef(pTable); + } + pRsp = rpcMallocCont(contLen); if (pRsp == NULL) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); return; } - + pRsp->numOfTables = htonl(numOfTable); - char* msg = (char*) pRsp + sizeof(SCMSTableVgroupRspMsg); - - for(int32_t i = 0; i < numOfTable; ++i) { - SSuperTableObj *pTable = mgmtGetSuperTable(name); - - pMsg->pTable = (STableObj *)pTable; - if (pMsg->pTable == NULL) { - mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_INVALID_TABLE); - return; - } - - SVgroupsInfo* pVgroup = (SVgroupsInfo*) msg; - - int32_t vg = 0; - for (; vg < pTable->vgLen; ++vg) { - int32_t vgId = pTable->vgList[vg]; - if (vgId == 0) break; - - SVgObj *vgItem = mgmtGetVgroup(vgId); - if (vgItem == NULL) break; - - pVgroup->vgroups[vg].vgId = htonl(vgId); - for (int32_t vn = 0; vn < vgItem->numOfVnodes; ++vn) { - SDnodeObj *pDnode = vgItem->vnodeGid[vn].pDnode; + char *msg = (char *)pRsp + sizeof(SCMSTableVgroupRspMsg); + + for (int32_t i = 0; i < numOfTable; ++i) { + SSuperTableObj *pTable = (SSuperTableObj *)((char *)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN)*i); + SVgroupsInfo * pVgroup = (SVgroupsInfo *)msg; + + SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash); + int32_t vgSize = 0; + while (taosHashIterNext(pIter)) { + int32_t *pVgId = taosHashIterGet(pIter); + SVgObj * pVgItem = mgmtGetVgroup(*pVgId + ); + if (pVgItem == NULL) continue; + + pVgroup->vgroups[vgSize].vgId = htonl(pVgItem->vgId); + for (int32_t vn = 0; vn < pVgItem->numOfVnodes; ++vn) { + SDnodeObj *pDnode = pVgItem->vnodeGid[vn].pDnode; if (pDnode == NULL) break; - - strncpy(pVgroup->vgroups[vg].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); - pVgroup->vgroups[vg].ipAddr[vn].port = htons(tsDnodeShellPort); - - pVgroup->vgroups[vg].numOfIps++; + + strncpy(pVgroup->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); + pVgroup->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort); + + pVgroup->vgroups[vgSize].numOfIps++; } - - mgmtDecVgroupRef(vgItem); + + vgSize++; + mgmtDecVgroupRef(pVgItem); } - - pVgroup->numOfVgroups = htonl(vg); - + + pVgroup->numOfVgroups = htonl(vgSize); + // one table is done, try the next table - msg += sizeof(SVgroupsInfo) + vg * sizeof(SCMVgroupInfo); + msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo); } SRpcMsg rpcRsp = {0}; From feb4bbcde09624343cbed5e8cc58d89c5ffc4e33 Mon Sep 17 00:00:00 2001 From: jtao1735 Date: Mon, 11 May 2020 13:10:56 +0000 Subject: [PATCH 21/51] support RpcIpSet change --- src/client/inc/tsclient.h | 2 +- src/client/src/tscServer.c | 8 +++++++- src/dnode/src/dnodeMgmt.c | 4 ++-- src/dnode/src/dnodePeer.c | 12 ++++++------ src/dnode/src/dnodeShell.c | 4 ++-- src/inc/trpc.h | 5 +---- src/rpc/src/rpcMain.c | 13 ++++++------- src/rpc/test/rclient.c | 13 +++---------- src/rpc/test/rsclient.c | 8 -------- src/rpc/test/rserver.c | 2 +- 10 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 61a5fdd311..6ea1ee6440 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -365,7 +365,7 @@ void tscInitMsgsFp(); int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion); -void tscProcessMsgFromServer(SRpcMsg *rpcMsg); +void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet); int tscProcessSql(SSqlObj *pSql); int tscRenewMeterMeta(SSqlObj *pSql, char *tableId); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 8efe89d28a..98cbe9dbde 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -221,7 +221,7 @@ int tscSendMsgToServer(SSqlObj *pSql) { return TSDB_CODE_SUCCESS; } -void tscProcessMsgFromServer(SRpcMsg *rpcMsg) { +void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) { SSqlObj *pSql = (SSqlObj *)rpcMsg->handle; if (pSql == NULL) { tscError("%p sql is already released", pSql->signature); @@ -245,6 +245,12 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) { return; } + if (pCmd->command < TSDB_SQL_MGMT) { + if (pIpSet) pSql->ipList = *pIpSet; + } else { + if (pIpSet) tscMgmtIpSet = *pIpSet; + } + if (rpcMsg->pCont == NULL) { rpcMsg->code = TSDB_CODE_NETWORK_UNAVAIL; } else { diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 0e91cc7155..36a7c98807 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -266,8 +266,8 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) { return taosCfgDynamicOptions(pCfg->config); } -void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) { - dPrint("mnode IP list is changed for ufp is called, numOfIps:%d inUse:%d", pIpSet->numOfIps, pIpSet->inUse); +void dnodeUpdateIpSet(SRpcIpSet *pIpSet) { + dPrint("mnode IP list is changed, numOfIps:%d inUse:%d", pIpSet->numOfIps, pIpSet->inUse); for (int i = 0; i < pIpSet->numOfIps; ++i) { dPrint("mnode index:%d %s:%u", i, pIpSet->fqdn[i], pIpSet->port[i]) } diff --git a/src/dnode/src/dnodePeer.c b/src/dnode/src/dnodePeer.c index ea21ed0206..51913d80c4 100644 --- a/src/dnode/src/dnodePeer.c +++ b/src/dnode/src/dnodePeer.c @@ -29,11 +29,11 @@ #include "dnodeVWrite.h" #include "mnode.h" -extern void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet); +extern void dnodeUpdateIpSet(SRpcIpSet *pIpSet); static void (*dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); -static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg); +static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *); static void (*dnodeProcessRspMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg); -static void dnodeProcessRspFromDnode(SRpcMsg *pMsg); +static void dnodeProcessRspFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet); static void *tsDnodeServerRpc = NULL; static void *tsDnodeClientRpc = NULL; @@ -81,7 +81,7 @@ void dnodeCleanupServer() { } } -static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg) { +static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) { SRpcMsg rspMsg; rspMsg.handle = pMsg->handle; rspMsg.pCont = NULL; @@ -119,7 +119,6 @@ int32_t dnodeInitClient() { 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; @@ -145,9 +144,10 @@ void dnodeCleanupClient() { } } -static void dnodeProcessRspFromDnode(SRpcMsg *pMsg) { +static void dnodeProcessRspFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) { if (dnodeProcessRspMsgFp[pMsg->msgType]) { + if (pMsg->msgType == TSDB_MSG_TYPE_DM_STATUS_RSP && pIpSet) dnodeUpdateIpSet(pIpSet); (*dnodeProcessRspMsgFp[pMsg->msgType])(pMsg); } else { dError("RPC %p, msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]); diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 28679262fa..dc0efd405f 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -28,7 +28,7 @@ #include "dnodeShell.h" static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); -static void dnodeProcessMsgFromShell(SRpcMsg *pMsg); +static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *); static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey); static void * tsDnodeShellRpc = NULL; static int32_t tsDnodeQueryReqNum = 0; @@ -106,7 +106,7 @@ void dnodeCleanupShell() { } } -void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { +void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *pIpSet) { SRpcMsg rpcMsg; rpcMsg.handle = pMsg->handle; rpcMsg.pCont = NULL; diff --git a/src/inc/trpc.h b/src/inc/trpc.h index 8b082b65b8..eff210433f 100644 --- a/src/inc/trpc.h +++ b/src/inc/trpc.h @@ -66,10 +66,7 @@ typedef struct { char *ckey; // ciphering key // call back to process incoming msg, code shall be ignored by server app - void (*cfp)(SRpcMsg *); - - // call back to process notify the ipSet changes, for client app only - void (*ufp)(void *ahandle, SRpcIpSet *pIpSet); + void (*cfp)(SRpcMsg *, SRpcIpSet *); // call back to retrieve the client auth info, for server app only int (*afp)(char *tableId, char *spi, char *encrypt, char *secret, char *ckey); diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index a2333566f1..ca4b211be8 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -55,9 +55,8 @@ typedef struct { char secret[TSDB_KEY_LEN]; // secret for the link char ckey[TSDB_KEY_LEN]; // ciphering key - void (*cfp)(SRpcMsg *); + void (*cfp)(SRpcMsg *, SRpcIpSet *); int (*afp)(char *user, char *spi, char *encrypt, char *secret, char *ckey); - void (*ufp)(void *ahandle, SRpcIpSet *pIpSet); void *idPool; // handle to ID pool void *tmrCtrl; // handle to timer @@ -222,7 +221,6 @@ void *rpcOpen(const SRpcInit *pInit) { if (pInit->secret) strcpy(pRpc->secret, pInit->secret); if (pInit->ckey) strcpy(pRpc->ckey, pInit->ckey); pRpc->spi = pInit->spi; - pRpc->ufp = pInit->ufp; pRpc->cfp = pInit->cfp; pRpc->afp = pInit->afp; @@ -900,10 +898,11 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) { memcpy(pContext->pRsp, pMsg, sizeof(SRpcMsg)); } else { // for asynchronous API - if (pRpc->ufp && (pContext->ipSet.inUse != pContext->oldInUse || pContext->redirect)) - (*pRpc->ufp)(pContext->ahandle, &pContext->ipSet); // notify the update of ipSet + SRpcIpSet *pIpSet = NULL; + if (pContext->ipSet.inUse != pContext->oldInUse || pContext->redirect) + pIpSet = &pContext->ipSet; - (*pRpc->cfp)(pMsg); + (*pRpc->cfp)(pMsg, pIpSet); } // free the request message @@ -924,7 +923,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) { if ( rpcIsReq(pHead->msgType) ) { rpcMsg.handle = pConn; taosTmrReset(rpcProcessProgressTimer, tsRpcTimer/2, pConn, pRpc->tmrCtrl, &pConn->pTimer); - (*(pRpc->cfp))(&rpcMsg); + (*(pRpc->cfp))(&rpcMsg, NULL); } else { // it's a response SRpcReqContext *pContext = pConn->pContext; diff --git a/src/rpc/test/rclient.c b/src/rpc/test/rclient.c index 2aa1f0e4e9..ea1ebb5974 100644 --- a/src/rpc/test/rclient.c +++ b/src/rpc/test/rclient.c @@ -31,22 +31,16 @@ typedef struct { void *pRpc; } SInfo; -static void processResponse(SRpcMsg *pMsg) { +static void processResponse(SRpcMsg *pMsg, SRpcIpSet *pIpSet) { SInfo *pInfo = (SInfo *)pMsg->handle; tTrace("thread:%d, response is received, type:%d contLen:%d code:0x%x", pInfo->index, pMsg->msgType, pMsg->contLen, pMsg->code); + if (pIpSet) pInfo->ipSet = *pIpSet; + rpcFreeCont(pMsg->pCont); - sem_post(&pInfo->rspSem); } -static void processUpdateIpSet(void *handle, SRpcIpSet *pIpSet) { - SInfo *pInfo = (SInfo *)handle; - - tTrace("thread:%d, ip set is changed, index:%d", pInfo->index, pIpSet->inUse); - pInfo->ipSet = *pIpSet; -} - static int tcount = 0; static void *sendRequest(void *param) { @@ -99,7 +93,6 @@ int main(int argc, char *argv[]) { rpcInit.label = "APP"; rpcInit.numOfThreads = 1; rpcInit.cfp = processResponse; - rpcInit.ufp = processUpdateIpSet; rpcInit.sessions = 100; rpcInit.idleTime = tsShellActivityTimer*1000; rpcInit.user = "michael"; diff --git a/src/rpc/test/rsclient.c b/src/rpc/test/rsclient.c index 683cbb590a..3b19d7a9ea 100644 --- a/src/rpc/test/rsclient.c +++ b/src/rpc/test/rsclient.c @@ -32,12 +32,6 @@ typedef struct { void *pRpc; } SInfo; -static void processUpdateIpSet(void *handle, SRpcIpSet *pIpSet) { - SInfo *pInfo = (SInfo *)handle; - - tTrace("thread:%d, ip set is changed, index:%d", pInfo->index, pIpSet->inUse); - pInfo->ipSet = *pIpSet; -} static int tcount = 0; static int terror = 0; @@ -100,8 +94,6 @@ int main(int argc, char *argv[]) { rpcInit.localPort = 0; rpcInit.label = "APP"; rpcInit.numOfThreads = 1; - // rpcInit.cfp = processResponse; - rpcInit.ufp = processUpdateIpSet; rpcInit.sessions = 100; rpcInit.idleTime = tsShellActivityTimer*1000; rpcInit.user = "michael"; diff --git a/src/rpc/test/rserver.c b/src/rpc/test/rserver.c index 9f781ef276..958d099027 100644 --- a/src/rpc/test/rserver.c +++ b/src/rpc/test/rserver.c @@ -113,7 +113,7 @@ int retrieveAuthInfo(char *meterId, char *spi, char *encrypt, char *secret, char return ret; } -void processRequestMsg(SRpcMsg *pMsg) { +void processRequestMsg(SRpcMsg *pMsg, SRpcIpSet *pIpSet) { SRpcMsg *pTemp; pTemp = taosAllocateQitem(sizeof(SRpcMsg)); From 270e7fc96addc4e20dd5c9639cbc5a0199fc042a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 22:26:02 +0800 Subject: [PATCH 22/51] [TD-271] --- src/mnode/src/mgmtTable.c | 14 ++++----- .../script/general/parser/auto_create_tb.sim | 30 +++++++++---------- tests/script/general/table/fill.sim | 2 +- tests/script/jenkins/basic.txt | 19 ++++-------- 4 files changed, 27 insertions(+), 38 deletions(-) diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index d001114bf0..5f1069026f 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -1242,14 +1242,11 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { int32_t numOfTable = htonl(pInfo->numOfTables); SCMSTableVgroupRspMsg *pRsp = NULL; - int32_t contLen = sizeof(SCMSTableVgroupRspMsg); + int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + 32 * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo); + //reserve space for (int32_t i = 0; i < numOfTable; ++i) { char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; SSuperTableObj *pTable = mgmtGetSuperTable(stableName); - if (pTable != NULL) { - stableName = (char*)pTable; //hack way - } - if (pTable->vgHash != NULL) { contLen += (taosHashGetSize(pTable->vgHash) * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo)); } @@ -1263,11 +1260,12 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { } pRsp->numOfTables = htonl(numOfTable); - char *msg = (char *)pRsp + sizeof(SCMSTableVgroupRspMsg); + char* msg = (char*) pRsp + sizeof(SCMSTableVgroupRspMsg); for (int32_t i = 0; i < numOfTable; ++i) { - SSuperTableObj *pTable = (SSuperTableObj *)((char *)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN)*i); - SVgroupsInfo * pVgroup = (SVgroupsInfo *)msg; + char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; + SSuperTableObj *pTable = mgmtGetSuperTable(stableName); + SVgroupsInfo *pVgroup = (SVgroupsInfo *)msg; SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash); int32_t vgSize = 0; diff --git a/tests/script/general/parser/auto_create_tb.sim b/tests/script/general/parser/auto_create_tb.sim index 8fb0ddae54..54e028a200 100644 --- a/tests/script/general/parser/auto_create_tb.sim +++ b/tests/script/general/parser/auto_create_tb.sim @@ -96,25 +96,25 @@ $ts1 = $ts0 + 1000 $ts2 = $ts0 + 2000 sql insert into tb_1 using $stb tags (-1) values ( $ts1 , 1,1,1,1,'bin',1,1,1,'涛思数据') ( $ts2 , 2,2,2,2,'binar', 1,1,1,'nchar') sql select * from $stb -if $rows != 3 then +if $rows != 5 then return -1 endi -if $data19 != 涛思数据 then +if $data09 != 涛思数据 then return -1 endi -if $data11 != 1 then +if $data01 != 1 then return -1 endi -if $data22 != 2 then +if $data42 != 2 then return -2 endi -if $data23 != 2.00000 then +if $data43 != 2.00000 then return -1 endi -if $data25 != binar then +if $data45 != binar then return -1 endi -if $data29 != nchar then +if $data49 != nchar then return -1 endi sql drop table tb_1 @@ -127,22 +127,22 @@ sql select * from $stb if $rows != 5 then return -1 endi -if $data19 != 涛思数据 then +if $data09 != 涛思数据 then return -1 endi -if $data11 != 1 then +if $data01 != 1 then return -1 endi -if $data22 != 2 then +if $data42 != 2 then return -2 endi -if $data23 != 2.00000 then +if $data43 != 2.00000 then return -1 endi -if $data25 != binar then +if $data45 != binar then return -1 endi -if $data29 != nchar then +if $data49 != nchar then return -1 endi @@ -154,13 +154,13 @@ sql show tables if $rows != 3 then return -1 endi -if $data00 != tb3 then +if $data00 != tb1 then return -1 endi if $data10 != tb2 then return -1 endi -if $data20 != tb1 then +if $data20 != tb3 then return -1 endi diff --git a/tests/script/general/table/fill.sim b/tests/script/general/table/fill.sim index 00048eb025..333573e577 100644 --- a/tests/script/general/table/fill.sim +++ b/tests/script/general/table/fill.sim @@ -42,7 +42,7 @@ sql select count(*), last(ts), min(k), max(k), avg(k) from db.mt where a=0 and t print =================== step2 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 10000 +sleep 5000 system sh/exec.sh -n dnode1 -s start sleep 3000 diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index f73a23f184..005d2db032 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -1,9 +1,6 @@ cd ../../debug; cmake .. -#cd ../../debug; make clean cd ../../debug; make - cd ../../../debug; cmake .. -#cd ../../../debug; make clean cd ../../../debug; make #./test.sh -f general/alter/cached_schema_after_alter.sim @@ -161,8 +158,6 @@ cd ../../../debug; make #./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 @@ -176,12 +171,12 @@ cd ../../../debug; make ./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/delete_reuse1.sim +./test.sh -f general/table/delete_reuse2.sim +#hongze ./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/fill.sim ./test.sh -f general/table/float.sim ./test.sh -f general/table/int.sim ./test.sh -f general/table/limit.sim @@ -236,8 +231,6 @@ cd ../../../debug; make ./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 @@ -307,8 +300,6 @@ cd ../../../debug; make #./test.sh -u -f unique/mnode/mgmtr2.sim #./test.sh -u -f unique/mnode/secondIp.sim -#stream - ##./test.sh -u -f unique/table/delete_part.sim #./test.sh -u -f unique/vnode/commit.sim From 8c0ba3b908eb39663fdc8f22e977b94bbe12676c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 22:27:49 +0800 Subject: [PATCH 23/51] scripts --- tests/script/unique/mnode/mgmt22.sim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/script/unique/mnode/mgmt22.sim b/tests/script/unique/mnode/mgmt22.sim index 37e38fbf66..e4e1235e66 100644 --- a/tests/script/unique/mnode/mgmt22.sim +++ b/tests/script/unique/mnode/mgmt22.sim @@ -8,7 +8,7 @@ system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 print ============== step1 -system sh/exec_up.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start -t sleep 3000 sql connect @@ -20,7 +20,7 @@ if $data2_1 != master then endi print ============== step2 -system sh/exec_up.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start -t sql create dnode $hostname2 $x = 0 @@ -41,6 +41,17 @@ if $data2_2 != slave then goto show2 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 + +return + print ============== step3 sql_error drop dnode $hostname1 -x error1 print should not drop master From aac2a25eb04749a81b8b40c03dea819d96490a89 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 11 May 2020 23:03:04 +0800 Subject: [PATCH 24/51] scripts --- src/mnode/src/mgmtTable.c | 28 +++++++++++++--------------- tests/script/general/db/vnodes.sim | 2 +- tests/script/jenkins/basic.txt | 4 ++-- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 5f1069026f..49311b0112 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -1241,9 +1241,8 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { SCMSTableVgroupMsg *pInfo = pMsg->pCont; int32_t numOfTable = htonl(pInfo->numOfTables); - SCMSTableVgroupRspMsg *pRsp = NULL; + // reserve space int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + 32 * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo); - //reserve space for (int32_t i = 0; i < numOfTable; ++i) { char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; SSuperTableObj *pTable = mgmtGetSuperTable(stableName); @@ -1253,7 +1252,7 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { mgmtDecTableRef(pTable); } - pRsp = rpcMallocCont(contLen); + SCMSTableVgroupRspMsg *pRsp = rpcMallocCont(contLen); if (pRsp == NULL) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); return; @@ -1265,32 +1264,31 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { for (int32_t i = 0; i < numOfTable; ++i) { char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i; SSuperTableObj *pTable = mgmtGetSuperTable(stableName); - SVgroupsInfo *pVgroup = (SVgroupsInfo *)msg; + SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg; SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash); int32_t vgSize = 0; while (taosHashIterNext(pIter)) { int32_t *pVgId = taosHashIterGet(pIter); - SVgObj * pVgItem = mgmtGetVgroup(*pVgId - ); - if (pVgItem == NULL) continue; + SVgObj * pVgroup = mgmtGetVgroup(*pVgId); + if (pVgroup == NULL) continue; - pVgroup->vgroups[vgSize].vgId = htonl(pVgItem->vgId); - for (int32_t vn = 0; vn < pVgItem->numOfVnodes; ++vn) { - SDnodeObj *pDnode = pVgItem->vnodeGid[vn].pDnode; + pVgroupInfo->vgroups[vgSize].vgId = htonl(pVgroup->vgId); + for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) { + SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode; if (pDnode == NULL) break; - strncpy(pVgroup->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); - pVgroup->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort); + strncpy(pVgroupInfo->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); + pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort); - pVgroup->vgroups[vgSize].numOfIps++; + pVgroupInfo->vgroups[vgSize].numOfIps++; } vgSize++; - mgmtDecVgroupRef(pVgItem); + mgmtDecVgroupRef(pVgroup); } - pVgroup->numOfVgroups = htonl(vgSize); + pVgroupInfo->numOfVgroups = htonl(vgSize); // one table is done, try the next table msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo); diff --git a/tests/script/general/db/vnodes.sim b/tests/script/general/db/vnodes.sim index 87e821fde3..684910884b 100644 --- a/tests/script/general/db/vnodes.sim +++ b/tests/script/general/db/vnodes.sim @@ -1,6 +1,6 @@ system sh/stop_dnodes.sh -$totalVnodes = 100 +$totalVnodes = 10 $maxTables = 4 $totalRows = $totalVnodes * $maxTables diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 005d2db032..62bae1c2a5 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -156,7 +156,7 @@ cd ../../../debug; make #./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 +./test.sh -f general/stable/vnode3.sim ./test.sh -f general/table/autocreate.sim ./test.sh -f general/table/basic1.sim @@ -244,7 +244,7 @@ cd ../../../debug; make ./test.sh -u -f unique/account/user_len.sim #./test.sh -u -f unique/big/balance.sim -#./test.sh -u -f unique/big/maxvnodes.sim +#slguan ./test.sh -u -f unique/big/maxvnodes.sim ./test.sh -u -f unique/big/tcp.sim ##./test.sh -u -f unique/cluster/balance1.sim From 01846142fa43d4fdd0d858e55e93fff2e48221f6 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Mon, 11 May 2020 23:47:28 +0800 Subject: [PATCH 25/51] [td-225] fix bugs in tags filter query --- cmake/platform.inc | 2 +- src/client/src/tscUtil.c | 14 +++--- src/query/inc/qast.h | 4 +- src/query/src/qast.c | 26 +++++------ src/query/src/queryExecutor.c | 69 +++++++++++++---------------- src/query/src/queryFilterFunc.c | 20 ++++----- src/tsdb/src/tsdbMeta.c | 2 +- src/tsdb/src/tsdbRead.c | 4 +- src/util/src/tcompare.c | 17 +++++-- tests/script/general/tag/create.sim | 6 ++- 10 files changed, 84 insertions(+), 80 deletions(-) diff --git a/cmake/platform.inc b/cmake/platform.inc index 2e0e2d6af0..1772a83fb2 100755 --- a/cmake/platform.inc +++ b/cmake/platform.inc @@ -62,7 +62,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8) SET(TD_LINUX_64 TRUE) SET(TD_OS_DIR ${TD_COMMUNITY_DIR}/src/os/linux) - ADD_DEFINITIONS(-D_M_X64) + ADD_DEFINITIONS(-D_M_X64 -D_DEBUG_VIEW) MESSAGE(STATUS "The current platform is Linux 64-bit") ELSEIF (${CMAKE_SIZEOF_VOID_P} MATCHES 4) IF (TD_ARM) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 00afb977fd..c25e91a669 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1144,23 +1144,21 @@ SColumn* tscColumnListInsert(SArray* pColumnList, SColumnIndex* pColIndex) { } SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numOfFilters) { - SColumnFilterInfo* pFilter = NULL; - if (numOfFilters > 0) { - pFilter = calloc(1, numOfFilters * sizeof(SColumnFilterInfo)); - } else { + if (numOfFilters == 0) { assert(src == NULL); return NULL; } + SColumnFilterInfo* pFilter = calloc(1, numOfFilters * sizeof(SColumnFilterInfo)); + memcpy(pFilter, src, sizeof(SColumnFilterInfo) * numOfFilters); for (int32_t j = 0; j < numOfFilters; ++j) { + if (pFilter[j].filterstr) { size_t len = (size_t) pFilter[j].len + 1; - - char* pTmp = calloc(1, len); - pFilter[j].pz = (int64_t) pTmp; + pFilter[j].pz = (int64_t) calloc(1, len); - memcpy((char*)pFilter[j].pz, (char*)src->pz, (size_t)len); + memcpy((char*)pFilter[j].pz, (char*)src[j].pz, (size_t)len); } } diff --git a/src/query/inc/qast.h b/src/query/inc/qast.h index 9bc36413de..410b2ac9d2 100644 --- a/src/query/inc/qast.h +++ b/src/query/inc/qast.h @@ -50,11 +50,11 @@ typedef struct tQueryInfo { SSchema sch; // schema of tags char* q; __compar_fn_t compare; // filter function - void* param; // STSchema, + void* param; // STSchema } tQueryInfo; typedef struct SExprTraverseSupp { - __result_filter_fn_t fp; + __result_filter_fn_t nodeFilterFn; __do_filter_suppl_fn_t setupInfoFn; void * pExtInfo; } SExprTraverseSupp; diff --git a/src/query/src/qast.c b/src/query/src/qast.c index 43bdf57ed7..f727acb720 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -760,7 +760,7 @@ static bool filterItem(tExprNode *pExpr, const void *pItem, SExprTraverseSupp *p assert(pLeft->nodeType == TSQL_NODE_COL && pRight->nodeType == TSQL_NODE_VALUE); param->setupInfoFn(pExpr, param->pExtInfo); - return param->fp(pItem, pExpr->_node.info); + return param->nodeFilterFn(pItem, pExpr->_node.info); } /** @@ -801,33 +801,33 @@ static void tSQLBinaryTraverseOnSkipList(tExprNode *pExpr, SArray *pResult, SSki tSkipListDestroyIter(iter); } -static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) { +static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* res, __result_filter_fn_t filterFp) { SSkipListIterator* iter = tSkipListCreateIter(pSkipList); while (tSkipListIterNext(iter)) { bool addToResult = false; SSkipListNode *pNode = tSkipListIterGet(iter); - char* pTable = SL_GET_NODE_DATA(pNode); - - //todo refactor: - tstr* name = ((STableIndexElem*) pTable)->pTable->name; -// char* name = NULL; -// tsdbGetTableName(tsdb, pTable, &name); + char * pData = SL_GET_NODE_DATA(pNode); + + // todo refactor: + tstr *name = ((STableIndexElem *)pData)->pTable->name; + // char* name = NULL; +// tsdbGetTableName(pQueryInfo->, pTable, &name); // todo speed up by using hash if (pQueryInfo->colIndex == TSDB_TBNAME_COLUMN_INDEX) { if (pQueryInfo->optr == TSDB_RELATION_IN) { addToResult = pQueryInfo->compare(name, pQueryInfo->q); - } else if(pQueryInfo->optr == TSDB_RELATION_LIKE) { + } else if (pQueryInfo->optr == TSDB_RELATION_LIKE) { addToResult = !pQueryInfo->compare(name, pQueryInfo->q); } } else { - // TODO: other columns + addToResult = filterFp(pNode, pQueryInfo); } if (addToResult) { - taosArrayPush(result, pTable); + taosArrayPush(res, pData); } } @@ -851,7 +851,7 @@ void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, S param->setupInfoFn(pExpr, param->pExtInfo); if (pSkipList == NULL) { - tArrayTraverse(pExpr, param->fp, result); + tArrayTraverse(pExpr, param->nodeFilterFn, result); return; } @@ -859,7 +859,7 @@ void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, S if (pQueryInfo->colIndex == 0 && pQueryInfo->optr != TSDB_RELATION_LIKE) { tQueryIndexColumn(pSkipList, pQueryInfo, result); } else { - tQueryIndexlessColumn(pSkipList, pQueryInfo, result); + tQueryIndexlessColumn(pSkipList, pQueryInfo, result, param->nodeFilterFn); } return; diff --git a/src/query/src/queryExecutor.c b/src/query/src/queryExecutor.c index 52cfa582d0..5977b8bea7 100644 --- a/src/query/src/queryExecutor.c +++ b/src/query/src/queryExecutor.c @@ -2641,26 +2641,21 @@ static UNUSED_FUNC void printBinaryData(int32_t functionId, char *data, int32_t } } -void UNUSED_FUNC displayInterResult(SData **pdata, SQuery *pQuery, int32_t numOfRows) { -#if 0 +void UNUSED_FUNC displayInterResult(SData **pdata, SQueryRuntimeEnv* pRuntimeEnv, int32_t numOfRows) { + SQuery* pQuery = pRuntimeEnv->pQuery; int32_t numOfCols = pQuery->numOfOutput; printf("super table query intermediate result, total:%d\n", numOfRows); - SQInfo * pQInfo = (SQInfo *)(GET_QINFO_ADDR(pQuery)); - SMeterObj *pMeterObj = pQInfo->pObj; - for (int32_t j = 0; j < numOfRows; ++j) { for (int32_t i = 0; i < numOfCols; ++i) { + switch (pQuery->pSelectExpr[i].type) { case TSDB_DATA_TYPE_BINARY: { - int32_t colIndex = pQuery->pSelectExpr[i].base.colInfo.colIndex; - int32_t type = 0; - - if (TSDB_COL_IS_TAG(pQuery->pSelectExpr[i].base.colInfo.flag)) { - type = pQuery->pSelectExpr[i].type; - } else { - type = pMeterObj->schema[colIndex].type; - } +// int32_t colIndex = pQuery->pSelectExpr[i].base.colInfo.colIndex; + int32_t type = pQuery->pSelectExpr[i].type; +// } else { +// type = pMeterObj->schema[colIndex].type; +// } printBinaryData(pQuery->pSelectExpr[i].base.functionId, pdata[i]->data + pQuery->pSelectExpr[i].bytes * j, type); break; @@ -2682,7 +2677,6 @@ void UNUSED_FUNC displayInterResult(SData **pdata, SQuery *pQuery, int32_t numOf } printf("\n"); } -#endif } typedef struct SCompSupporter { @@ -2950,7 +2944,7 @@ int32_t mergeIntoGroupResultImpl(SQInfo *pQInfo, SArray *pGroup) { int64_t endt = taosGetTimestampMs(); #ifdef _DEBUG_VIEW - displayInterResult(pQuery->sdata, pQuery, pQuery->sdata[0]->num); + displayInterResult(pQuery->sdata, pRuntimeEnv, pQuery->sdata[0]->num); #endif qTrace("QInfo:%p result merge completed, elapsed time:%" PRId64 " ms", GET_QINFO_ADDR(pQuery), endt - startt); @@ -3588,7 +3582,8 @@ void setIntervalQueryRange(SQInfo *pQInfo, TSKEY key) { if (pTableQueryInfo->queryRangeSet) { pTableQueryInfo->lastKey = key; } else { - pQuery->window.skey = key; +// pQuery->window.skey = key; + pTableQueryInfo->win.skey = key; STimeWindow win = {.skey = key, .ekey = pQuery->window.ekey}; // for too small query range, no data in this interval. @@ -3608,7 +3603,7 @@ void setIntervalQueryRange(SQInfo *pQInfo, TSKEY key) { SWindowResInfo *pWindowResInfo = &pTableQueryInfo->windowResInfo; getAlignQueryTimeWindow(pQuery, win.skey, win.skey, win.ekey, &skey1, &ekey1, &w); - pWindowResInfo->startTime = pQuery->window.skey; // windowSKey may be 0 in case of 1970 timestamp + pWindowResInfo->startTime = pTableQueryInfo->win.skey; // windowSKey may be 0 in case of 1970 timestamp if (pWindowResInfo->prevSKey == 0) { if (QUERY_IS_ASC_QUERY(pQuery)) { @@ -3620,8 +3615,8 @@ void setIntervalQueryRange(SQInfo *pQInfo, TSKEY key) { } pTableQueryInfo->queryRangeSet = 1; - pTableQueryInfo->lastKey = pQuery->window.skey; - pTableQueryInfo->win.skey = pQuery->window.skey; + pTableQueryInfo->lastKey = pTableQueryInfo->win.skey; + pTableQueryInfo->win.skey = pTableQueryInfo->win.skey; } } @@ -3726,7 +3721,7 @@ static int32_t doCopyToSData(SQInfo *pQInfo, SWindowResult *result, int32_t orde qTrace("QInfo:%p copy data to query buf completed", pQInfo); #ifdef _DEBUG_VIEW - displayInterResult(pQuery->sdata, pQuery, numOfResult); + displayInterResult(pQuery->sdata, pRuntimeEnv, numOfResult); #endif return numOfResult; } @@ -4766,7 +4761,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) { copyResToQueryResultBuf(pQInfo, pQuery); #ifdef _DEBUG_VIEW - displayInterResult(pQuery->sdata, pQuery, pQuery->sdata[0]->num); + displayInterResult(pQuery->sdata, pRuntimeEnv, pQuery->sdata[0]->num); #endif } else { copyFromWindowResToSData(pQInfo, pRuntimeEnv->windowResInfo.pResult); @@ -4819,7 +4814,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) { copyResToQueryResultBuf(pQInfo, pQuery); #ifdef _DEBUG_VIEW - displayInterResult(pQuery->sdata, pQuery, pQuery->sdata[0]->num); + displayInterResult(pQuery->sdata, pRuntimeEnv, pQuery->sdata[0]->num); #endif } } else { // not a interval query @@ -5276,26 +5271,26 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList, } for (int32_t f = 0; f < numOfFilters; ++f) { - SColumnFilterInfo *pFilterInfo = (SColumnFilterInfo *)pMsg; - SColumnFilterInfo *pDestFilterInfo = &pColInfo->filters[f]; - - pDestFilterInfo->filterstr = htons(pFilterInfo->filterstr); + SColumnFilterInfo *pFilterMsg = (SColumnFilterInfo *)pMsg; + + SColumnFilterInfo *pColFilter = &pColInfo->filters[f]; + pColFilter->filterstr = htons(pFilterMsg->filterstr); pMsg += sizeof(SColumnFilterInfo); - if (pDestFilterInfo->filterstr) { - pDestFilterInfo->len = htobe64(pFilterInfo->len); + if (pColFilter->filterstr) { + pColFilter->len = htobe64(pFilterMsg->len); - pDestFilterInfo->pz = (int64_t) calloc(1, pDestFilterInfo->len); - memcpy((void *)pDestFilterInfo->pz, pMsg, pDestFilterInfo->len); - pMsg += (pDestFilterInfo->len); + pColFilter->pz = (int64_t) calloc(1, pColFilter->len); + memcpy((void *)pColFilter->pz, pMsg, pColFilter->len); + pMsg += (pColFilter->len + 1); } else { - pDestFilterInfo->lowerBndi = htobe64(pFilterInfo->lowerBndi); - pDestFilterInfo->upperBndi = htobe64(pFilterInfo->upperBndi); + pColFilter->lowerBndi = htobe64(pFilterMsg->lowerBndi); + pColFilter->upperBndi = htobe64(pFilterMsg->upperBndi); } - pDestFilterInfo->lowerRelOptr = htons(pFilterInfo->lowerRelOptr); - pDestFilterInfo->upperRelOptr = htons(pFilterInfo->upperRelOptr); + pColFilter->lowerRelOptr = htons(pFilterMsg->lowerRelOptr); + pColFilter->upperRelOptr = htons(pFilterMsg->upperRelOptr); } } @@ -5692,9 +5687,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SSqlGroupbyExpr *pGrou for (int16_t i = 0; i < numOfCols; ++i) { pQuery->colList[i] = pQueryMsg->colList[i]; - - SColumnInfo *pColInfo = &pQuery->colList[i]; - pColInfo->filters = tscFilterInfoClone(pQueryMsg->colList[i].filters, pColInfo->numOfFilters); + pQuery->colList[i].filters = tscFilterInfoClone(pQueryMsg->colList[i].filters, pQuery->colList[i].numOfFilters); } pQuery->tagColList = pTagCols; diff --git a/src/query/src/queryFilterFunc.c b/src/query/src/queryFilterFunc.c index 3218b26179..41a888e92d 100644 --- a/src/query/src/queryFilterFunc.c +++ b/src/query/src/queryFilterFunc.c @@ -183,33 +183,33 @@ bool equal_dd(SColumnFilterElem *pFilter, char *minval, char *maxval) { bool equal_str(SColumnFilterElem *pFilter, char *minval, char *maxval) { // query condition string is greater than the max length of string, not qualified data - if (pFilter->filterInfo.len > pFilter->bytes) { + if (pFilter->filterInfo.len != varDataLen(minval)) { return false; } - return strncmp((char *)pFilter->filterInfo.pz, minval, pFilter->bytes) == 0; + return strncmp((char *)pFilter->filterInfo.pz, varDataVal(minval), varDataLen(minval)) == 0; } bool equal_nchar(SColumnFilterElem *pFilter, char *minval, char *maxval) { // query condition string is greater than the max length of string, not qualified data - if (pFilter->filterInfo.len > pFilter->bytes) { + if (pFilter->filterInfo.len != varDataLen(minval)) { return false; } - return wcsncmp((wchar_t *)pFilter->filterInfo.pz, (wchar_t*) minval, pFilter->bytes/TSDB_NCHAR_SIZE) == 0; + return wcsncmp((wchar_t *)pFilter->filterInfo.pz, varDataVal(minval), varDataLen(minval)/TSDB_NCHAR_SIZE) == 0; } //////////////////////////////////////////////////////////////// bool like_str(SColumnFilterElem *pFilter, char *minval, char *maxval) { SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER; - return patternMatch((char *)pFilter->filterInfo.pz, minval, pFilter->bytes, &info) == TSDB_PATTERN_MATCH; + return patternMatch((char *)pFilter->filterInfo.pz, varDataVal(minval), varDataLen(minval), &info) == TSDB_PATTERN_MATCH; } bool like_nchar(SColumnFilterElem* pFilter, char* minval, char *maxval) { SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER; - - return WCSPatternMatch((wchar_t*) pFilter->filterInfo.pz, (wchar_t*) minval, pFilter->bytes/TSDB_NCHAR_SIZE, &info) == TSDB_PATTERN_MATCH; + + return WCSPatternMatch((wchar_t*) pFilter->filterInfo.pz, varDataVal(minval), varDataLen(minval)/TSDB_NCHAR_SIZE, &info) == TSDB_PATTERN_MATCH; } //////////////////////////////////////////////////////////////// @@ -270,11 +270,11 @@ bool nequal_dd(SColumnFilterElem *pFilter, char *minval, char *maxval) { } bool nequal_str(SColumnFilterElem *pFilter, char *minval, char *maxval) { - if (pFilter->filterInfo.len > pFilter->bytes) { + if (pFilter->filterInfo.len != varDataLen(minval)) { return true; } - return strncmp((char *)pFilter->filterInfo.pz, minval, pFilter->bytes) != 0; + return strncmp((char *)pFilter->filterInfo.pz, varDataVal(minval), varDataLen(minval)) != 0; } bool nequal_nchar(SColumnFilterElem *pFilter, char* minval, char *maxval) { @@ -282,7 +282,7 @@ bool nequal_nchar(SColumnFilterElem *pFilter, char* minval, char *maxval) { return true; } - return wcsncmp((wchar_t *)pFilter->filterInfo.pz, (wchar_t*)minval, pFilter->bytes/TSDB_NCHAR_SIZE) != 0; + return wcsncmp((wchar_t *)pFilter->filterInfo.pz, varDataVal(minval), varDataLen(minval)/TSDB_NCHAR_SIZE) != 0; } //////////////////////////////////////////////////////////////// diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index c7e260ae50..7ae7890695 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -234,7 +234,6 @@ STSchema * tsdbGetTableTagSchema(STsdbMeta *pMeta, STable *pTable) { } } -// todo refactor table name definition int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t* type, int16_t* bytes, char** val) { STsdbMeta* pMeta = tsdbGetMeta(repo); STable* pTable = tsdbGetTableByUid(pMeta, id->uid); @@ -242,6 +241,7 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t STSchema* pSchema = tsdbGetTableTagSchema(pMeta, pTable); STColumn* pCol = NULL; + // todo binary search for(int32_t col = 0; col < schemaNCols(pSchema); ++col) { STColumn* p = schemaColAt(pSchema, col); if (p->colId == colId) { diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 49b6d2984f..84615ff8c2 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -1432,7 +1432,7 @@ SArray* createTableGroup(SArray* pTableList, STSchema* pTagSchema, SColIndex* pC return pTableGroup; } -bool tSkipListNodeFilterCallback(const void* pNode, void* param) { +bool indexedNodeFilterFp(const void* pNode, void* param) { tQueryInfo* pInfo = (tQueryInfo*) param; STableIndexElem* elem = (STableIndexElem*)(SL_GET_NODE_DATA((SSkipListNode*)pNode)); @@ -1497,7 +1497,7 @@ bool tSkipListNodeFilterCallback(const void* pNode, void* param) { static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr) { // query according to the expression tree SExprTraverseSupp supp = { - .fp = (__result_filter_fn_t) tSkipListNodeFilterCallback, + .nodeFilterFn = (__result_filter_fn_t) indexedNodeFilterFp, .setupInfoFn = filterPrepare, .pExtInfo = pSTable->tagSchema, }; diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 0abf1e6be3..43caca3a7c 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -51,12 +51,21 @@ int32_t compareDoubleIntVal(const void *pLeft, const void *pRight) { } } +int32_t compareFloatVal(const void *pLeft, const void *pRight) { + float ret = GET_FLOAT_VAL(pLeft) - GET_FLOAT_VAL(pRight); + if (fabs(ret) < FLT_EPSILON) { + return 0; + } else { + return ret > 0? 1 : -1; + } +} + int32_t compareDoubleVal(const void *pLeft, const void *pRight) { double ret = GET_DOUBLE_VAL(pLeft) - GET_DOUBLE_VAL(pRight); if (fabs(ret) < FLT_EPSILON) { return 0; } else { - return ret > 0 ? 1 : -1; + return ret > 0? 1 : -1; } } @@ -175,7 +184,7 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c wchar_t accept[3] = {towupper(c), towlower(c), 0}; while (1) { - size_t n = wcsspn(str, accept); + size_t n = wcscspn(str, accept); str += n; if (str[0] == 0 || (n >= size - 1)) { @@ -257,7 +266,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { } case TSDB_DATA_TYPE_FLOAT: { - comparFn = compareDoubleVal; break; + comparFn = compareFloatVal; break; } case TSDB_DATA_TYPE_DOUBLE: { @@ -313,6 +322,8 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) { comparFn = compareInt64Val; break; case TSDB_DATA_TYPE_FLOAT: + comparFn = compareFloatVal; + break; case TSDB_DATA_TYPE_DOUBLE: comparFn = compareDoubleVal; break; diff --git a/tests/script/general/tag/create.sim b/tests/script/general/tag/create.sim index c0cdbe87dc..3e16810f91 100644 --- a/tests/script/general/tag/create.sim +++ b/tests/script/general/tag/create.sim @@ -134,7 +134,8 @@ if $data01 != 1 then return -1 endi sql select * from $mt where tgcol = 0 -if $rows != 0 then +if $rows != 0 then + print expect 0, actual: $rows return -1 endi @@ -184,7 +185,8 @@ sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool) sql create table $tb using $mt tags( 1, 2 ) sql insert into $tb values(now, 1) sql select * from $mt where tgcol2 = 2 -if $rows != 1 then +if $rows != 1 then + print expect 1, actual: $rows return -1 endi if $data01 != 1 then From 38c8efd4b34ca989380f8d7d9e31934d1684a3d5 Mon Sep 17 00:00:00 2001 From: hjLiao Date: Tue, 12 May 2020 00:04:15 +0800 Subject: [PATCH 26/51] [td-225] --- tests/script/general/parser/testSuite.sim | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index a2a08097dd..fb56868f1f 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -38,8 +38,16 @@ sleep 2000 run general/parser/lastrow.sim sleep 2000 run general/parser/nchar.sim + sleep 2000 run general/parser/null_char.sim +sleep 2000 +run general/parser/single_row_in_tb.sim +sleep 2000 +run general/parser/select_from_cache_disk.sim +sleep 2000 +run general/parser/limit.sim + sleep 2000 run general/parser/fill.sim sleep 2000 @@ -49,8 +57,6 @@ run general/parser/tags_dynamically_specifiy.sim sleep 2000 run general/parser/interp.sim sleep 2000 -run general/parser/limit.sim -sleep 2000 run general/parser/limit1.sim sleep 2000 run general/parser/limit1_tblocks100.sim @@ -63,12 +69,8 @@ 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/slimit1.sim From dd5be92421a71a1ce77caaa2e319e396931643d2 Mon Sep 17 00:00:00 2001 From: hjLiao Date: Tue, 12 May 2020 00:46:54 +0800 Subject: [PATCH 27/51] [td-225] fix bug in diff query --- src/query/src/queryExecutor.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/query/src/queryExecutor.c b/src/query/src/queryExecutor.c index 5977b8bea7..fb19d0f50c 100644 --- a/src/query/src/queryExecutor.c +++ b/src/query/src/queryExecutor.c @@ -2436,8 +2436,16 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) { // set the pCtx output buffer position pRuntimeEnv->pCtx[i].aOutputBuf = pQuery->sdata[i]->data + pRec->rows * bytes; + + int32_t functionId = pQuery->pSelectExpr[i].base.functionId; + if (functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM || functionId == TSDB_FUNC_DIFF) { + pRuntimeEnv->pCtx[i].ptsOutputBuf = pRuntimeEnv->pCtx[0].aOutputBuf; + } } - + + qTrace("QInfo: %p realloc output buffer, new size: %d rows, old:%d, remain:%d", GET_QINFO_ADDR(pRuntimeEnv), + newSize, pRec->capacity, newSize - pRec->rows); + pRec->capacity = newSize; } } From 3366f4af3ed00a5e13e15917838ede6cf6230886 Mon Sep 17 00:00:00 2001 From: jtao1735 Date: Mon, 11 May 2020 22:43:08 +0000 Subject: [PATCH 28/51] forward to peer only the data packet is from client or CQ --- src/vnode/src/vnodeMain.c | 4 ++-- src/vnode/src/vnodeRead.c | 6 +++--- src/vnode/src/vnodeWrite.c | 15 +++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index d3e9751738..7552428a14 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -405,9 +405,9 @@ static void vnodeNotifyRole(void *ahandle, int8_t role) { static void vnodeNotifyFileSynced(void *ahandle) { SVnodeObj *pVnode = ahandle; - vTrace("pVnode:%p vgId:%d, data file is synced", pVnode, pVnode->vgId); + vTrace("vgId:%d, data file is synced", pVnode->vgId); - // clsoe tsdb, then open tsdb + // close tsdb, then open tsdb } static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index d2dd1811cf..03407a5aa2 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -65,7 +65,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont pRet->len = sizeof(SQueryTableRsp); pRet->rsp = pRsp; - vTrace("vgId:%d QInfo:%p, dnode query msg disposed", pVnode->vgId, pQInfo); + vTrace("vgId:%d, QInfo:%p, dnode query msg disposed", pVnode->vgId, pQInfo); } else { pQInfo = pCont; code = TSDB_CODE_ACTION_IN_PROGRESS; @@ -83,7 +83,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t cont int32_t code = TSDB_CODE_SUCCESS; - vTrace("vgId:%d QInfo:%p, retrieve msg is received", 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 vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t cont } } - vTrace("vgId:%d QInfo:%p, retrieve msg is disposed", 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 3fc079ca13..ec0a3b2f0b 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -51,10 +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 && qtype == TAOS_QTYPE_RPC) - return TSDB_CODE_NOT_ACTIVE_VNODE; - - if (pHead->version == 0) { // from client + if (pHead->version == 0) { // from client or CQ if (pVnode->status != TAOS_VN_STATUS_READY) return TSDB_CODE_NOT_ACTIVE_VNODE; @@ -64,12 +61,10 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { // assign version pVnode->version++; pHead->version = pVnode->version; - } else { + } else { // from wal or forward // for data from WAL or forward, version may be smaller if (pHead->version <= pVnode->version) return 0; } - - // more status and role checking here pVnode->version = pHead->version; @@ -77,9 +72,13 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { code = walWrite(pVnode->wal, pHead); if (code < 0) return code; - int32_t syncCode = syncForwardToPeer(pVnode->sync, pHead, item); + // forward to peers if data is from RPC or CQ + int32_t syncCode = 0; + if (qtype == TAOS_QTYPE_RPC || qtype == TAOS_QTYPE_CQ) + syncCode = syncForwardToPeer(pVnode->sync, pHead, item); if (syncCode < 0) return syncCode; + // write data locally code = (*vnodeProcessWriteMsgFp[pHead->msgType])(pVnode, pHead->cont, item); if (code < 0) return code; From 539f3f0c99841fb1faad1217619ae27bfc89b48c Mon Sep 17 00:00:00 2001 From: Steven Li Date: Mon, 11 May 2020 17:31:27 -0700 Subject: [PATCH 29/51] Additional fix for TD-225 --- src/query/src/qparserImpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/query/src/qparserImpl.c b/src/query/src/qparserImpl.c index b8d1189129..9589be86e4 100644 --- a/src/query/src/qparserImpl.c +++ b/src/query/src/qparserImpl.c @@ -820,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->z != NULL); + pInfo->pDCLInfo->dbOpt.ignoreExists = pIgExists->n; // sql.y has: ifnotexists(X) ::= IF NOT EXISTS. {X.n = 1;} } void setCreateAcctSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pName, SSQLToken *pPwd, SCreateAcctSQL *pAcctInfo) { From 4480dc441442567eab5481178379115e8a537c5a Mon Sep 17 00:00:00 2001 From: hzcheng Date: Tue, 12 May 2020 02:19:14 +0000 Subject: [PATCH 30/51] add log in tsdb --- src/tsdb/inc/tsdbMain.h | 2 -- src/tsdb/src/tsdbMain.c | 29 +++++++++++++++++------------ src/tsdb/src/tsdbMeta.c | 28 ++++++++++++++++++++++++---- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/tsdb/inc/tsdbMain.h b/src/tsdb/inc/tsdbMain.h index 57dd4b9630..fbf6e0f272 100644 --- a/src/tsdb/inc/tsdbMain.h +++ b/src/tsdb/inc/tsdbMain.h @@ -151,8 +151,6 @@ STSchema * tsdbGetTableTagSchema(STsdbMeta *pMeta, STable *pTable); STsdbMeta *tsdbGetMeta(TsdbRepoT *pRepo); -int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg); -int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId); STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId); // int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable); STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid); diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 4ab0149b60..902413927c 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -134,6 +134,7 @@ int32_t tsdbCreateRepo(char *rootDir, STsdbCfg *pCfg, void *limiter /* TODO */) */ int32_t tsdbDropRepo(TsdbRepoT *repo) { STsdbRepo *pRepo = (STsdbRepo *)repo; + int id = pRepo->config.tsdbId; pRepo->state = TSDB_REPO_STATE_CLOSED; @@ -149,6 +150,8 @@ int32_t tsdbDropRepo(TsdbRepoT *repo) { free(pRepo->rootDir); free(pRepo); + tsdbTrace("vgId %d: tsdb repository is dropped!", id); + return 0; } @@ -239,6 +242,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) { pRepo->state = TSDB_REPO_STATE_ACTIVE; + tsdbTrace("vgId %d: open tsdb repository successfully!", pRepo->config.tsdbId); return (TsdbRepoT *)pRepo; } @@ -257,6 +261,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) { int32_t tsdbCloseRepo(TsdbRepoT *repo) { STsdbRepo *pRepo = (STsdbRepo *)repo; if (pRepo == NULL) return 0; + int id = pRepo->config.tsdbId; pRepo->state = TSDB_REPO_STATE_CLOSED; tsdbLockRepo(repo); @@ -290,6 +295,8 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) { tfree(pRepo->rootDir); tfree(pRepo); + tsdbTrace("vgId %d: repository is closed!", id); + return 0; } @@ -350,6 +357,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) { pthread_attr_init(&thattr); pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED); pthread_create(&(pRepo->commitThread), &thattr, tsdbCommitData, (void *)repo); + tsdbTrace("vgId %d: start to commit!", pRepo->config.tsdbId); return 0; } @@ -377,11 +385,6 @@ STsdbRepoInfo *tsdbGetStatus(TsdbRepoT *pRepo) { return NULL; } -int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { - STsdbRepo *pRepo = (STsdbRepo *)repo; - return tsdbCreateTableImpl(pRepo->tsdbMeta, pCfg); -} - int tsdbAlterTable(TsdbRepoT *pRepo, STableCfg *pCfg) { // TODO return 0; @@ -396,13 +399,6 @@ TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid) { return TSDB_GET_TABLE_LAST_KEY(pTable); } -int tsdbDropTable(TsdbRepoT *repo, STableId tableId) { - if (repo == NULL) return -1; - STsdbRepo *pRepo = (STsdbRepo *)repo; - - return tsdbDropTableImpl(pRepo->tsdbMeta, tableId); -} - STableInfo *tsdbGetTableInfo(TsdbRepoT *pRepo, STableId tableId) { // TODO return NULL; @@ -843,6 +839,9 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable pTable->mem->numOfPoints = tSkipListGetSize(pTable->mem->pData); + tsdbTrace("vgId %d, tid %d, uid " PRId64 "a row is inserted to table! key" PRId64, + pRepo->config.tsdbId, pTable->tableId.tid, pTable->tableId.uid, dataRowKey(row)); + return 0; } @@ -1105,11 +1104,14 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK } static void tsdbAlterCompression(STsdbRepo *pRepo, int8_t compression) { + int8_t oldCompRession = pRepo->config.compression; pRepo->config.compression = compression; + tsdbTrace("vgId %d: tsdb compression is changed from %d to %d", oldCompRession, compression); } static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { STsdbCfg *pCfg = &pRepo->config; + int oldKeep = pCfg->keep; int maxFiles = keep / pCfg->maxTables + 3; if (pRepo->config.keep > keep) { @@ -1121,10 +1123,13 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { } pRepo->tsdbFileH->maxFGroups = maxFiles; } + tsdbTrace("id %d: keep is changed from %d to %d", pRepo->config.tsdbId, oldKeep, keep); } static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) { // TODO + int oldMaxTables = pRepo->config.maxTables; + tsdbTrace("vgId %d: tsdb maxTables is changed from %d to %d!", pRepo->config.tsdbId, oldMaxTables, maxTables); } uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size) { diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index c7e260ae50..4c5de4a862 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -283,7 +283,10 @@ char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes) { } } -int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) { +int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { + STsdbRepo *pRepo = (STsdbRepo *)repo; + STsdbMeta *pMeta = pRepo->tsdbMeta; + if (tsdbCheckTableCfg(pCfg) < 0) return -1; STable *super = NULL; @@ -351,8 +354,14 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) { } // Register to meta - if (newSuper) tsdbAddTableToMeta(pMeta, super, true); + if (newSuper) { + tsdbAddTableToMeta(pMeta, super, true); + tsdbTrace("vgId %d: super table is created! uid " PRId64, pRepo->config.tsdbId, + super->tableId.uid); + } tsdbAddTableToMeta(pMeta, table, true); + tsdbTrace("vgId %d: table is created! tid %d, uid " PRId64, pRepo->config.tsdbId, + super->tableId.tid, super->tableId.uid); // Write to meta file int bufLen = 0; @@ -385,13 +394,24 @@ STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId) { return pTable; } -int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId) { +// int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId) { +int tsdbDropTable(TsdbRepoT *repo, STableId tableId) { + STsdbRepo *pRepo = (STsdbRepo *)repo; + if (pRepo == NULL) return -1; + + STsdbMeta *pMeta = pRepo->tsdbMeta; if (pMeta == NULL) return -1; STable *pTable = tsdbGetTableByUid(pMeta, tableId.uid); - if (pTable == NULL) return -1; + if (pTable == NULL) { + tsdbError("vgId %d: failed to drop table since table not exists! tid %d, uid " PRId64, pRepo->config.tsdbId, + tableId.tid, tableId.uid); + return -1; + } + tsdbTrace("vgId %d: table is dropped! tid %s, uid " PRId64, pRepo->config.tsdbId, tableId.tid, tableId.uid); if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1; + return 0; } From 55e4ade713112be1a582ce93efadb373e4d09b4b Mon Sep 17 00:00:00 2001 From: hjLiao Date: Tue, 12 May 2020 10:46:16 +0800 Subject: [PATCH 31/51] [td-225] FIX BUGS IN DIFF --- src/query/tests/patternMatchTest.cpp | 4 ++++ src/util/src/tcompare.c | 4 ++-- tests/script/general/compute/diff2.sim | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/query/tests/patternMatchTest.cpp b/src/query/tests/patternMatchTest.cpp index 41156ce8ff..fa2b58a10b 100644 --- a/src/query/tests/patternMatchTest.cpp +++ b/src/query/tests/patternMatchTest.cpp @@ -76,4 +76,8 @@ TEST(testCase, patternMatchTest) { str = "carzero"; ret = patternMatch("%o", str, strlen(str), &info); EXPECT_EQ(ret, TSDB_PATTERN_MATCH); + + str = "19"; + ret = patternMatch("%9", str, 2, &info); + EXPECT_EQ(ret, TSDB_PATTERN_MATCH); } diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index 43caca3a7c..4bac669dc0 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -136,7 +136,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat size_t n = strcspn(str, next); str += n; - if (str[0] == 0 || (n >= size - 1)) { + if (str[0] == 0 || (n >= size)) { break; } @@ -187,7 +187,7 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c size_t n = wcscspn(str, accept); str += n; - if (str[0] == 0 || (n >= size - 1)) { + if (str[0] == 0 || (n >= size)) { break; } diff --git a/tests/script/general/compute/diff2.sim b/tests/script/general/compute/diff2.sim index 53b508ca6f..0be907c16a 100644 --- a/tests/script/general/compute/diff2.sim +++ b/tests/script/general/compute/diff2.sim @@ -81,7 +81,7 @@ sql_error select diff(c8) from $tb sql_error select diff(c9) from $tb sql_error select diff(ts) from $tb sql_error select diff(c1), diff(c2) from $tb -sql_error select 2+diff(c1) from $tb +#sql_error select 2+diff(c1) from $tb sql_error select diff(c1+2) from $tb sql_error select diff(c1) from $tb where ts > 0 and ts < now + 100m interval(10m) sql_error select diff(c1) from $mt From 08396582d94ab82e14d0600e3e00d7f0c676434c Mon Sep 17 00:00:00 2001 From: hjLiao Date: Tue, 12 May 2020 10:50:20 +0800 Subject: [PATCH 32/51] [td-225] --- cmake/platform.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platform.inc b/cmake/platform.inc index 1772a83fb2..2e0e2d6af0 100755 --- a/cmake/platform.inc +++ b/cmake/platform.inc @@ -62,7 +62,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8) SET(TD_LINUX_64 TRUE) SET(TD_OS_DIR ${TD_COMMUNITY_DIR}/src/os/linux) - ADD_DEFINITIONS(-D_M_X64 -D_DEBUG_VIEW) + ADD_DEFINITIONS(-D_M_X64) MESSAGE(STATUS "The current platform is Linux 64-bit") ELSEIF (${CMAKE_SIZEOF_VOID_P} MATCHES 4) IF (TD_ARM) From c86cc2f40a57bc3fefa9507ac652a22b3e5648b2 Mon Sep 17 00:00:00 2001 From: hzcheng Date: Tue, 12 May 2020 03:19:47 +0000 Subject: [PATCH 33/51] fix drop table coredump --- src/tsdb/src/tsdbMeta.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 4c5de4a862..32913de33a 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -409,7 +409,7 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) { return -1; } - tsdbTrace("vgId %d: table is dropped! tid %s, uid " PRId64, pRepo->config.tsdbId, tableId.tid, tableId.uid); + tsdbTrace("vgId %d: table is dropped! tid %d, uid " PRId64, pRepo->config.tsdbId, tableId.tid, tableId.uid); if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1; return 0; @@ -503,7 +503,9 @@ 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)); + STableIndexElem *pEle = (STableIndexElem *)SL_GET_NODE_DATA(tSkipListIterGet(pIter)); + STable *tTable = pEle->pTable; + ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE); pMeta->tables[tTable->tableId.tid] = NULL; From 035451b010b57d32469360186f8ff3f4cf556dfd Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 12:19:28 +0800 Subject: [PATCH 34/51] [TD-276] add user auth --- src/client/src/tscSystem.c | 1 + src/dnode/src/dnodePeer.c | 9 ++++++++- src/dnode/src/dnodeShell.c | 30 +++++++++++++++++++++++++++- src/inc/dnode.h | 1 + src/inc/mnode.h | 6 ++++-- src/inc/taosmsg.h | 9 +++++++++ src/mnode/src/mgmtShell.c | 24 ---------------------- src/mnode/src/mgmtUser.c | 41 +++++++++++++++++++++++++++++++++++++- 8 files changed, 92 insertions(+), 29 deletions(-) diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 07926306db..5d8652a631 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -63,6 +63,7 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { rpcInit.user = (char*)user; rpcInit.idleTime = 2000; rpcInit.ckey = "key"; + rpcInit.spi = 1; rpcInit.secret = secretEncrypt; *pDnodeConn = rpcOpen(&rpcInit); diff --git a/src/dnode/src/dnodePeer.c b/src/dnode/src/dnodePeer.c index 51913d80c4..c91da4953d 100644 --- a/src/dnode/src/dnodePeer.c +++ b/src/dnode/src/dnodePeer.c @@ -52,7 +52,8 @@ int32_t dnodeInitServer() { dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_CONFIG_VNODE] = mgmtProcessReqMsgFromDnode; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_GRANT] = mgmtProcessReqMsgFromDnode; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_STATUS] = mgmtProcessReqMsgFromDnode; - + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_AUTH] = mgmtProcessReqMsgFromDnode; + SRpcInit rpcInit; memset(&rpcInit, 0, sizeof(rpcInit)); rpcInit.localPort = tsDnodeDnodePort; @@ -163,3 +164,9 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) { void dnodeSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg) { rpcSendRequest(tsDnodeClientRpc, ipSet, rpcMsg); } + +void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp) { + SRpcIpSet ipSet = {0}; + dnodeGetMnodeDnodeIpSet(&ipSet); + rpcSendRecv(tsDnodeClientRpc, &ipSet, rpcMsg, rpcRsp); +} diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index dc0efd405f..52407dc7a4 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -21,6 +21,7 @@ #include "trpc.h" #include "tglobal.h" #include "http.h" +#include "mnode.h" #include "dnode.h" #include "dnodeInt.h" #include "dnodeVRead.h" @@ -138,7 +139,34 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *pIpSet) { } static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) { - return TSDB_CODE_SUCCESS; + int code = mgmtRetriveAuth(user, spi, encrypt, secret, ckey); + if (code != TSDB_CODE_NOT_READY) return code; + + SDMAuthMsg *pMsg = rpcMallocCont(sizeof(SDMAuthMsg)); + strcpy(pMsg->user, user); + + SRpcMsg rpcMsg = {0}; + rpcMsg.pCont = pMsg; + rpcMsg.contLen = sizeof(SDMAuthMsg); + rpcMsg.msgType = TSDB_MSG_TYPE_DM_AUTH; + + dTrace("user:%s, send auth msg to mnode", user); + SRpcMsg rpcRsp = {0}; + dnodeSendMsgToDnodeRecv(&rpcMsg, &rpcRsp); + + if (rpcRsp.code != 0) { + dError("user:%s, auth msg received from mnode, error:%s", user, tstrerror(rpcRsp.code)); + } else { + dTrace("user:%s, auth msg received from mnode", user); + SDMAuthRsp *pRsp = rpcRsp.pCont; + memcpy(secret, pRsp->secret, TSDB_KEY_LEN); + memcpy(ckey, pRsp->ckey, TSDB_KEY_LEN); + *spi = pRsp->spi; + *encrypt = pRsp->encrypt; + } + + rpcFreeCont(rpcRsp.pCont); + return rpcRsp.code; } SDnodeStatisInfo dnodeGetStatisInfo() { diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 5145a46831..9884cf2870 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -52,6 +52,7 @@ 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); +void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp); #ifdef __cplusplus } diff --git a/src/inc/mnode.h b/src/inc/mnode.h index 37fec24c20..48b1ac97bd 100644 --- a/src/inc/mnode.h +++ b/src/inc/mnode.h @@ -26,8 +26,10 @@ void mgmtCleanUpSystem(); void mgmtStopSystem(); void sdbUpdateSync(); -void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg); -void mgmtProcessReqMsgFromDnode(SRpcMsg *rpcMsg); +int32_t mgmtRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey); +void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg); +void mgmtProcessReqMsgFromDnode(SRpcMsg *rpcMsg); + #ifdef __cplusplus } diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 8dac73606d..44980b3912 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -100,6 +100,7 @@ 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_DM_AUTH, "auth" ) 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" ) @@ -737,6 +738,14 @@ typedef struct { char tableId[TSDB_TABLE_ID_LEN + 1]; } SMDAlterStreamMsg; +typedef struct { + char user[TSDB_USER_LEN + 1]; + char spi; + char encrypt; + char secret[TSDB_KEY_LEN + 1]; + char ckey[TSDB_KEY_LEN + 1]; +} SDMAuthMsg, SDMAuthRsp; + #pragma pack(pop) #ifdef __cplusplus diff --git a/src/mnode/src/mgmtShell.c b/src/mnode/src/mgmtShell.c index cd74c166d1..c27dc66dd5 100644 --- a/src/mnode/src/mgmtShell.c +++ b/src/mnode/src/mgmtShell.c @@ -41,7 +41,6 @@ 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 bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg); static void mgmtProcessUnSupportMsg(SRpcMsg *rpcMsg); static void mgmtProcessShowMsg(SQueuedMsg *queuedMsg); @@ -343,29 +342,6 @@ static void mgmtProcessHeartBeatMsg(SQueuedMsg *pMsg) { rpcSendResponse(&rpcRsp); } -/* -static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) { - *spi = 1; - *encrypt = 0; - *ckey = 0; - - if (!sdbIsMaster()) { - *secret = 0; - return TSDB_CODE_NOT_READY; - } - - SUserObj *pUser = mgmtGetUser(user); - if (pUser == NULL) { - *secret = 0; - return TSDB_CODE_INVALID_USER; - } else { - memcpy(secret, pUser->pass, TSDB_KEY_LEN); - mgmtDecUserRef(pUser); - return TSDB_CODE_SUCCESS; - } -} -*/ - static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) { SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0}; SCMConnectMsg *pConnectMsg = pMsg->pCont; diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index 9630ab3d58..350367e0ae 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -37,6 +37,7 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void static void mgmtProcessCreateUserMsg(SQueuedMsg *pMsg); static void mgmtProcessAlterUserMsg(SQueuedMsg *pMsg); static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg); +static void mgmtProcessAuthMsg(SRpcMsg *rpcMsg); static int32_t mgmtUserActionDestroy(SSdbOper *pOper) { tfree(pOper->pObj); @@ -140,7 +141,8 @@ int32_t mgmtInitUsers() { mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_USER, mgmtProcessDropUserMsg); mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_USER, mgmtGetUserMeta); mgmtAddShellShowRetrieveHandle(TSDB_MGMT_TABLE_USER, mgmtRetrieveUsers); - + dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_AUTH, mgmtProcessAuthMsg); + mTrace("table:%s, hash is created", tableDesc.tableName); return 0; } @@ -529,3 +531,40 @@ void mgmtDropAllUsers(SAcctObj *pAcct) { mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers); } + +int32_t mgmtRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) { + if (!sdbIsMaster()) { + *secret = 0; + mTrace("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_NOT_READY)); + return TSDB_CODE_NOT_READY; + } + + SUserObj *pUser = mgmtGetUser(user); + if (pUser == NULL) { + *secret = 0; + mError("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_INVALID_USER)); + return TSDB_CODE_INVALID_USER; + } else { + *spi = 1; + *encrypt = 0; + *ckey = 0; + + memcpy(secret, pUser->pass, TSDB_KEY_LEN); + mgmtDecUserRef(pUser); + mTrace("user:%s, auth info is returned", user); + return TSDB_CODE_SUCCESS; + } +} + +static void mgmtProcessAuthMsg(SRpcMsg *rpcMsg) { + SRpcMsg rpcRsp = {.handle = rpcMsg->handle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0}; + + SDMAuthMsg *pAuthMsg = rpcMsg->pCont; + SDMAuthRsp *pAuthRsp = rpcMallocCont(sizeof(SDMAuthRsp)); + + rpcRsp.code = mgmtRetriveAuth(pAuthMsg->user, &pAuthRsp->spi, &pAuthRsp->encrypt, pAuthRsp->secret, pAuthRsp->ckey); + rpcRsp.pCont = pAuthRsp; + rpcRsp.contLen = sizeof(SDMAuthRsp); + + rpcSendResponse(&rpcRsp); +} From a1b694219c1c77634bb9ece9969a98646490aa1f Mon Sep 17 00:00:00 2001 From: hzcheng Date: Tue, 12 May 2020 04:28:31 +0000 Subject: [PATCH 35/51] fix tsdb log format --- src/tsdb/src/tsdbCache.c | 2 +- src/tsdb/src/tsdbMain.c | 20 ++++++++++---------- src/tsdb/src/tsdbMeta.c | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/tsdb/src/tsdbCache.c b/src/tsdb/src/tsdbCache.c index 84f8a81eea..08970eab3e 100644 --- a/src/tsdb/src/tsdbCache.c +++ b/src/tsdb/src/tsdbCache.c @@ -164,7 +164,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) { } tsdbUnLockRepo((TsdbRepoT *)pRepo); - tsdbTrace("tsdbId %d: tsdb total cache blocks changed from %d to %d", pRepo->config.tsdbId, oldNumOfBlocks, totalBlocks); + tsdbTrace("vgId: %d tsdb total cache blocks changed from %d to %d", pRepo->config.tsdbId, oldNumOfBlocks, totalBlocks); return 0; } diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index 902413927c..a353f54353 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -150,7 +150,7 @@ int32_t tsdbDropRepo(TsdbRepoT *repo) { free(pRepo->rootDir); free(pRepo); - tsdbTrace("vgId %d: tsdb repository is dropped!", id); + tsdbTrace("vgId: %d tsdb repository is dropped!", id); return 0; } @@ -242,7 +242,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) { pRepo->state = TSDB_REPO_STATE_ACTIVE; - tsdbTrace("vgId %d: open tsdb repository successfully!", pRepo->config.tsdbId); + tsdbTrace("vgId: %d open tsdb repository successfully!", pRepo->config.tsdbId); return (TsdbRepoT *)pRepo; } @@ -295,7 +295,7 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) { tfree(pRepo->rootDir); tfree(pRepo); - tsdbTrace("vgId %d: repository is closed!", id); + tsdbTrace("vgId: %d repository is closed!", id); return 0; } @@ -357,7 +357,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) { pthread_attr_init(&thattr); pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED); pthread_create(&(pRepo->commitThread), &thattr, tsdbCommitData, (void *)repo); - tsdbTrace("vgId %d: start to commit!", pRepo->config.tsdbId); + tsdbTrace("vgId: %d start to commit!", pRepo->config.tsdbId); return 0; } @@ -753,12 +753,12 @@ static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) { 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)); + tsdbError("vgId: %d failed to create repository directory! reason %s", pRepo->config.tsdbId, strerror(errno)); return -1; } tsdbTrace( - "id %d: set up tsdb environment succeed! cacheBlockSize %d, totalBlocks %d, maxTables %d, daysPerFile %d, keep " + "vgId: %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); @@ -839,7 +839,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable pTable->mem->numOfPoints = tSkipListGetSize(pTable->mem->pData); - tsdbTrace("vgId %d, tid %d, uid " PRId64 "a row is inserted to table! key" PRId64, + tsdbTrace("vgId: %d, tid: %d, uid: " PRId64 "a row is inserted to table! key" PRId64, pRepo->config.tsdbId, pTable->tableId.tid, pTable->tableId.uid, dataRowKey(row)); return 0; @@ -1106,7 +1106,7 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK static void tsdbAlterCompression(STsdbRepo *pRepo, int8_t compression) { int8_t oldCompRession = pRepo->config.compression; pRepo->config.compression = compression; - tsdbTrace("vgId %d: tsdb compression is changed from %d to %d", oldCompRession, compression); + tsdbTrace("vgId: %d tsdb compression is changed from %d to %d", oldCompRession, compression); } static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { @@ -1123,13 +1123,13 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { } pRepo->tsdbFileH->maxFGroups = maxFiles; } - tsdbTrace("id %d: keep is changed from %d to %d", pRepo->config.tsdbId, oldKeep, keep); + tsdbTrace("vgId: %d keep is changed from %d to %d", pRepo->config.tsdbId, oldKeep, keep); } static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) { // TODO int oldMaxTables = pRepo->config.maxTables; - tsdbTrace("vgId %d: tsdb maxTables is changed from %d to %d!", pRepo->config.tsdbId, oldMaxTables, maxTables); + tsdbTrace("vgId: %d tsdb maxTables is changed from %d to %d!", pRepo->config.tsdbId, oldMaxTables, maxTables); } uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size) { diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 32913de33a..483df74b6f 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -356,12 +356,12 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { // Register to meta if (newSuper) { tsdbAddTableToMeta(pMeta, super, true); - tsdbTrace("vgId %d: super table is created! uid " PRId64, pRepo->config.tsdbId, + tsdbTrace("vgId: %d super table is created! uid " PRId64, pRepo->config.tsdbId, super->tableId.uid); } tsdbAddTableToMeta(pMeta, table, true); - tsdbTrace("vgId %d: table is created! tid %d, uid " PRId64, pRepo->config.tsdbId, - super->tableId.tid, super->tableId.uid); + tsdbTrace("vgId: %d table is created! tid %d, uid " PRId64, pRepo->config.tsdbId, table->tableId.tid, + table->tableId.uid); // Write to meta file int bufLen = 0; @@ -409,7 +409,7 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) { return -1; } - tsdbTrace("vgId %d: table is dropped! tid %d, uid " PRId64, pRepo->config.tsdbId, tableId.tid, tableId.uid); + tsdbTrace("vgId: %d table is dropped! tid %d, uid " PRId64, pRepo->config.tsdbId, tableId.tid, tableId.uid); if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1; return 0; From f397aa467881bb1cfc672ffe97b171050ab138d2 Mon Sep 17 00:00:00 2001 From: hzcheng Date: Tue, 12 May 2020 05:41:03 +0000 Subject: [PATCH 36/51] restart TSDB when sync finished --- src/vnode/inc/vnodeInt.h | 1 + src/vnode/src/vnodeMain.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/vnode/inc/vnodeInt.h b/src/vnode/inc/vnodeInt.h index d4842fdf7f..b2dd69df37 100644 --- a/src/vnode/inc/vnodeInt.h +++ b/src/vnode/inc/vnodeInt.h @@ -49,6 +49,7 @@ typedef struct { STsdbCfg tsdbCfg; SSyncCfg syncCfg; SWalCfg walCfg; + char * rootDir; } SVnodeObj; int vnodeWriteToQueue(void *param, void *pHead, int type); diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 7d7a3e0bc8..c6fa840c1a 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -182,6 +182,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { pVnode->refCount = 1; pVnode->version = 0; pVnode->tsdbCfg.tsdbId = pVnode->vgId; + pVnode->rootDir = strdup(rootDir); taosAddIntHash(tsDnodeVnodesHash, pVnode->vgId, (char *)(&pVnode)); int32_t code = vnodeReadCfg(pVnode); @@ -271,6 +272,7 @@ void vnodeRelease(void *pVnodeRaw) { return; } + tfree(pVnode->rootDir); // remove read queue dnodeFreeRqueue(pVnode->rqueue); pVnode->rqueue = NULL; @@ -406,7 +408,15 @@ static void vnodeNotifyFileSynced(void *ahandle) { SVnodeObj *pVnode = ahandle; vTrace("pVnode:%p vgId:%d, data file is synced", pVnode, pVnode->vgId); + char rootDir[128] = "\0"; + sprintf(rootDir, "%s/tsdb", pVnode->rootDir); // clsoe tsdb, then open tsdb + tsdbCloseRepo(pVnode->tsdb); + STsdbAppH appH = {0}; + appH.appH = (void *)pVnode; + appH.walCallBack = vnodeWalCallback; + appH.cqH = pVnode->cq; + pVnode->tsdb = tsdbOpenRepo(rootDir, &appH); } static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { From 6d7b5f28225f8b2515ae9fbc34e566ac3da6e701 Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Tue, 12 May 2020 14:41:33 +0800 Subject: [PATCH 37/51] test: fix delete_reuse --- tests/script/general/db/delete_reuse2.sim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/script/general/db/delete_reuse2.sim b/tests/script/general/db/delete_reuse2.sim index 0117d87104..73a9dae442 100644 --- a/tests/script/general/db/delete_reuse2.sim +++ b/tests/script/general/db/delete_reuse2.sim @@ -29,6 +29,7 @@ print ========= start dnodes system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect +sql reset query cache print ======== step1 sql create database d1 replica 1 From 4214f526b388c86c6fab83a033b95ea6bbfa0757 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 14:43:41 +0800 Subject: [PATCH 38/51] [TD-292] fix bug while columns too large --- src/mnode/src/mgmtTable.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 49311b0112..2130a8c134 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -195,7 +195,7 @@ static int32_t mgmtChildTableActionUpdate(SSdbOper *pOper) { } static int32_t mgmtChildTableActionEncode(SSdbOper *pOper) { - const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS; + const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16); SChildTableObj *pTable = pOper->pObj; assert(pTable != NULL && pOper->rowData != NULL); @@ -337,7 +337,7 @@ static int32_t mgmtInitChildTables() { .tableId = SDB_TABLE_CTABLE, .tableName = "ctables", .hashSessions = tsMaxTables, - .maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS, + .maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16), .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, .insertFp = mgmtChildTableActionInsert, @@ -440,7 +440,7 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) { } static int32_t mgmtSuperTableActionEncode(SSdbOper *pOper) { - const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS; + const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16); SSuperTableObj *pStable = pOper->pObj; assert(pOper->pObj != NULL && pOper->rowData != NULL); @@ -491,7 +491,7 @@ static int32_t mgmtInitSuperTables() { .tableId = SDB_TABLE_STABLE, .tableName = "stables", .hashSessions = TSDB_MAX_SUPER_TABLES, - .maxRowSize = tsSuperTableUpdateSize + sizeof(SSchema) * TSDB_MAX_COLUMNS, + .maxRowSize = tsSuperTableUpdateSize + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16), .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, .insertFp = mgmtSuperTableActionInsert, @@ -1216,7 +1216,7 @@ static int32_t mgmtSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTa static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) { SSuperTableObj *pTable = (SSuperTableObj *)pMsg->pTable; - STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * TSDB_MAX_COLUMNS); + STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)); pMeta->uid = htobe64(pTable->uid); pMeta->sversion = htons(pTable->sversion); pMeta->precision = pMsg->pDb->cfg.precision; @@ -1731,7 +1731,7 @@ static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) { } static void mgmtGetChildTableMeta(SQueuedMsg *pMsg) { - STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * TSDB_MAX_COLUMNS); + STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)); if (pMeta == NULL) { mError("table:%s, failed to get table meta, no enough memory", pMsg->pTable->tableId); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); @@ -1979,7 +1979,7 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { if (pMsg->pDb == NULL) continue; int availLen = totalMallocLen - pMultiMeta->contLen; - if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * TSDB_MAX_COLUMNS) { + if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)) { //TODO realloc //totalMallocLen *= 2; //pMultiMeta = rpcReMalloc(pMultiMeta, totalMallocLen); From cf4ad7133b9b54b4f51f199d8be838ad6450bf1d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 14:45:28 +0800 Subject: [PATCH 39/51] [TD-292] scripts --- tests/script/general/column/commit.sim | 27 +++++++++++--------------- tests/script/test.sh | 2 +- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/tests/script/general/column/commit.sim b/tests/script/general/column/commit.sim index 7bc62619f3..decc3e51d3 100644 --- a/tests/script/general/column/commit.sim +++ b/tests/script/general/column/commit.sim @@ -26,21 +26,16 @@ endi print =============== step2 -sql insert into d3.t1 values (now -300d,0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 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9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 , 9 ); print =============== step3 @@ -95,7 +90,7 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 4000 -system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode1 -s start -t sleep 3000 print =============== step5 diff --git a/tests/script/test.sh b/tests/script/test.sh index 8e3959a680..96ab3c5808 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -93,7 +93,7 @@ echo "numOfLogLines 100000000" >> $TAOS_CFG echo "dDebugFlag 135" >> $TAOS_CFG echo "mDebugFlag 135" >> $TAOS_CFG echo "sdbDebugFlag 135" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "rpcDebugFlag 151" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG echo "cDebugFlag 135" >> $TAOS_CFG echo "httpDebugFlag 135" >> $TAOS_CFG From 1469b9e3511eeb73bdb5b2ced3a4c4bbd618a5d8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 14:55:27 +0800 Subject: [PATCH 40/51] [TD-292] client may crash if column too log --- src/client/src/tscServer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 98cbe9dbde..f30a494ee0 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -562,15 +562,15 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) { size_t numOfExprs = tscSqlExprNumOfExprs(pQueryInfo); int32_t exprSize = sizeof(SSqlFuncMsg) * numOfExprs; - STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + //STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - // meter query without tags values - if (!UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { - return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + exprSize; - } + // table query without tags values + //if (!UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { + return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + exprSize + 4096; + //} - int32_t size = 4096; - return size; + //int32_t size = 4096; + //return size; } static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char *pMsg) { From a9d767324d05d5a7a450b5831032c1ccfcd09f3b Mon Sep 17 00:00:00 2001 From: hzcheng Date: Tue, 12 May 2020 07:13:20 +0000 Subject: [PATCH 41/51] fix column/metircs.sim --- src/tsdb/src/tsdbRead.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 84615ff8c2..6576e7d7f1 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -414,6 +414,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheck static int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order); static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock, STableCheckInfo* pCheckInfo) { + STsdbRepo *pRepo = pQueryHandle->pTsdb; SCompData* data = calloc(1, sizeof(SCompData) + sizeof(SCompCol) * pBlock->numOfCols); data->numOfCols = pBlock->numOfCols; @@ -423,7 +424,7 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo SArray* sa = getDefaultLoadColumns(pQueryHandle, true); if (pCheckInfo->pDataCols == NULL) { - pCheckInfo->pDataCols = tdNewDataCols(1000, 100, 4096); //todo fix me + pCheckInfo->pDataCols = tdNewDataCols(pRepo->tsdbMeta->maxRowBytes, pRepo->tsdbMeta->maxCols, pRepo->config.maxRowsPerFileBlock); } tdInitDataCols(pCheckInfo->pDataCols, tsdbGetTableSchema(tsdbGetMeta(pQueryHandle->pTsdb), pCheckInfo->pTableObj)); From 294b42661f49cd550906ade13d44d3bb3ad92511 Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Tue, 12 May 2020 15:30:47 +0800 Subject: [PATCH 42/51] test: add del stable case --- tests/pytest/fulltest.sh | 5 +++- tests/pytest/table/del_stable.py | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/pytest/table/del_stable.py diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 6aec67f9ce..e37dc6748a 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -84,4 +84,7 @@ 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 +python3 ./test.py $1 -f user/pass_len.py + +# table +#python3 ./test.py $1 -f table/del_stable.py \ No newline at end of file diff --git a/tests/pytest/table/del_stable.py b/tests/pytest/table/del_stable.py new file mode 100644 index 0000000000..c81d598638 --- /dev/null +++ b/tests/pytest/table/del_stable.py @@ -0,0 +1,50 @@ +################################################################### +# 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): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + print("==============step1") + tdSql.execute("create database db") + tdSql.execute("create table db.st (ts timestamp, i int) tags(j int)") + tdSql.execute("create table db.tb using st tags(1)") + tdSql.execute("insert into db.tb values(now, 1)") + + print("==============step2") + try: + tdSql.execute("drop table db.st") + except Exception as e: + tdLog.exit(e) + tdSql.execute("select * from db.st") + tdSql.checkRows(1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From c7fa3506da91636e53ef14713fe8ade2fe7f9eef Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 12 May 2020 15:52:05 +0800 Subject: [PATCH 43/51] increase valgrind threshold to 12, definitely lost theshold to 13. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a86f2463e9..979b7588e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,7 @@ matrix: for memError in `cat uniq-mem-error-out.txt | awk '{print $4}'` do if [ -n "$memError" ]; then - if [ "$memError" -gt 5 ]; then + if [ "$memError" -gt 12 ]; then echo -e "${RED} ## Memory errors number valgrind reports is $memError.\ More than our threshold! ## ${NC}" travis_terminate $memError @@ -76,7 +76,7 @@ matrix: for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'` do if [ -n "$defiMemError" ]; then - if [ "$defiMemError" -gt 3 ]; then + if [ "$defiMemError" -gt 13 ]; then echo -e "${RED} ## Memory errors number valgrind reports \ Definitely lost is $defiMemError. More than our threshold! ## ${NC}" travis_terminate $defiMemError From 95df099a89274c652bbf27641aa5a76f6e1b9aa6 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 15:54:23 +0800 Subject: [PATCH 44/51] scripts --- tests/script/general/column/commit.sim | 2 +- tests/script/general/insert/insert_drop.sim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/script/general/column/commit.sim b/tests/script/general/column/commit.sim index decc3e51d3..035d28d3e5 100644 --- a/tests/script/general/column/commit.sim +++ b/tests/script/general/column/commit.sim @@ -90,7 +90,7 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 4000 -system sh/exec.sh -n dnode1 -s start -t +system sh/exec.sh -n dnode1 -s start sleep 3000 print =============== step5 diff --git a/tests/script/general/insert/insert_drop.sim b/tests/script/general/insert/insert_drop.sim index 5655576e20..c688a35557 100644 --- a/tests/script/general/insert/insert_drop.sim +++ b/tests/script/general/insert/insert_drop.sim @@ -43,7 +43,7 @@ print ====== tables created print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 2000 +sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed @@ -69,7 +69,7 @@ endw print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 2000 +sleep 4000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed From 08c18e577376b2e8bc5c12c5b624ca9ff1ba0f1e Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 12 May 2020 16:18:48 +0800 Subject: [PATCH 45/51] reduce test case to accelerate valgrind time. --- tests/pytest/valgrind-test.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/pytest/valgrind-test.sh b/tests/pytest/valgrind-test.sh index 853ebe1d76..1d65830fa3 100755 --- a/tests/pytest/valgrind-test.sh +++ b/tests/pytest/valgrind-test.sh @@ -33,13 +33,3 @@ 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/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/importTail.py -python3 ./test.py $1 -s && sleep 1 -python3 ./test.py $1 -f import_merge/importTRestart.py -python3 ./test.py $1 -s && sleep 1 From 3791b44188d2e28358ca893e503998f4418ff165 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 16:52:37 +0800 Subject: [PATCH 46/51] [TD-275] fix drop table error while query from super table --- src/mnode/src/mgmtTable.c | 2 +- src/vnode/src/vnodeMain.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 2130a8c134..624833c6e4 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -381,7 +381,7 @@ static void mgmtRemoveTableFromStable(SSuperTableObj *pStable, SChildTableObj *p if (pStable->vgHash == NULL) return; SVgObj *pVgroup = mgmtGetVgroup(pCtable->vgId); - if (pVgroup != NULL) { + if (pVgroup == NULL) { taosHashRemove(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId)); } mgmtDecVgroupRef(pVgroup); diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 61d0552923..8d35be9640 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -290,7 +290,7 @@ void vnodeRelease(void *pVnodeRaw) { free(pVnode); int32_t count = atomic_sub_fetch_32(&tsOpennedVnodes, 1); - vTrace("vgId:%d, vnode is released, vnodes:%d", pVnode, vgId, count); + vTrace("vgId:%d, vnode is released, vnodes:%d", vgId, count); if (count <= 0) { taosCleanUpIntHash(tsDnodeVnodesHash); From 825dc0943366c9849aee749d3da66faf5e551717 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 12 May 2020 17:23:13 +0800 Subject: [PATCH 47/51] fixup: typo. --- tests/pytest/import_merge/importDataHO.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pytest/import_merge/importDataHO.py b/tests/pytest/import_merge/importDataHO.py index 0fe6ab71d5..f6d65a5c53 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.maxwrows = 200 + self.maxrows = 200 self.rowsPerTable = 20 tdDnodes.stop(1) From d3107ca0372fa01b1e19736ec32699824c563a14 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 17:26:11 +0800 Subject: [PATCH 48/51] scripts --- tests/script/general/http/grafana.sim | 8 +- .../script/general/parser/auto_create_tb.sim | 5 +- .../general/parser/auto_create_tb_drop_tb.sim | 2 +- .../script/general/parser/import_commit1.sim | 2 +- .../script/general/parser/import_commit2.sim | 2 +- .../script/general/parser/import_commit3.sim | 2 +- tests/script/jenkins/basic.txt | 106 +++++++++--------- 7 files changed, 64 insertions(+), 63 deletions(-) diff --git a/tests/script/general/http/grafana.sim b/tests/script/general/http/grafana.sim index a5cc7b3237..a08c07a841 100644 --- a/tests/script/general/http/grafana.sim +++ b/tests/script/general/http/grafana.sim @@ -157,25 +157,25 @@ endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query print 16-> $system_content -if $system_content != @[{"refId":"A","target":"1","datapoints":[[5,"-"]]},{"refId":"A","target":"2","datapoints":[[4,"-"]]},{"refId":"A","target":"3","datapoints":[[3,"-"]]},{"refId":"B","target":"a","datapoints":[[5,"-"]]},{"refId":"B","target":"b","datapoints":[[8,"-"]]},{"refId":"B","target":"c","datapoints":[[9,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"{b:c}","datapoints":[[9,"-"]]}]@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query print 17-> $system_content -if $system_content != @[{"refId":"A","target":"count1","datapoints":[[5,"-"]]},{"refId":"A","target":"count2","datapoints":[[4,"-"]]},{"refId":"A","target":"count3","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-a","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-b","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-c","datapoints":[[9,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"count{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"count{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-{b:c}","datapoints":[[9,"-"]]}]@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:6020/grafana/query print 18-> $system_content -if $system_content != @[{"refId":"A","target":"count1","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count2","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count3","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then +if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count{a:2,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count{a:3,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then return -1 endi system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query print 19-> $system_content -if $system_content != @[{"refId":"A","target":"3","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"15.299999714","datapoints":[[3,"-"]]}]@ then +if $system_content != @[{"refId":"A","target":"{count(v1):3}","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"{sum(v2):15.299999714}","datapoints":[[3,"-"]]}]@ then return -1 endi diff --git a/tests/script/general/parser/auto_create_tb.sim b/tests/script/general/parser/auto_create_tb.sim index 54e028a200..bcbf5474ad 100644 --- a/tests/script/general/parser/auto_create_tb.sim +++ b/tests/script/general/parser/auto_create_tb.sim @@ -222,13 +222,13 @@ sql show tables if $rows != 3 then return -1 endi -if $data00 != tb3 then +if $data00 != tb1 then return -1 endi if $data10 != tb2 then return -1 endi -if $data20 != tb1 then +if $data20 != tb3 then return -1 endi @@ -301,6 +301,7 @@ sql_error create table txu using tu tags(0) values(now, 1); #[TBASE-675] sql insert into tu values(1565971200000, 1) (1565971200000,2) (1565971200001, 3)(1565971200001, 4) +sql select * from tu if $rows != 2 then return -1 endi 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 aa14d2fdfb..e3a3b0c7a0 100644 --- a/tests/script/general/parser/auto_create_tb_drop_tb.sim +++ b/tests/script/general/parser/auto_create_tb_drop_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 walLevel -v 1 -system sh/cfg.sh -n dnode1 -c commitTime -v 30 +system sh/cfg.sh -n dnode1 -c ctime -v 30 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 fde0698c33..d88e6e986a 100644 --- a/tests/script/general/parser/import_commit1.sim +++ b/tests/script/general/parser/import_commit1.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 walLevel -v 1 -system sh/cfg.sh -n dnode1 -c commitTime -v 30 +system sh/cfg.sh -n dnode1 -c ctime -v 30 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/import_commit2.sim b/tests/script/general/parser/import_commit2.sim index 2c49aa7eca..9ed8ac0ea4 100644 --- a/tests/script/general/parser/import_commit2.sim +++ b/tests/script/general/parser/import_commit2.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 walLevel -v 1 -system sh/cfg.sh -n dnode1 -c commitTime -v 30 +system sh/cfg.sh -n dnode1 -c ctime -v 30 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/general/parser/import_commit3.sim b/tests/script/general/parser/import_commit3.sim index 7ed5045b9a..ee71e03182 100644 --- a/tests/script/general/parser/import_commit3.sim +++ b/tests/script/general/parser/import_commit3.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 walLevel -v 1 -system sh/cfg.sh -n dnode1 -c commitTime -v 30 +system sh/cfg.sh -n dnode1 -c ctime -v 30 system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 62bae1c2a5..cbf83f68c7 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -3,21 +3,21 @@ cd ../../debug; make cd ../../../debug; cmake .. 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 +#unsupport ./test.sh -f general/alter/cached_schema_after_alter.sim +#unsupport ./test.sh -f general/alter/count.sim +#unsupport ./test.sh -f general/alter/import.sim +#unsupport ./test.sh -f general/alter/insert1.sim +#unsupport ./test.sh -f general/alter/insert2.sim +#unsupport ./test.sh -f general/alter/metrics.sim +#unsupport ./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 +#jeff ./test.sh -f general/cache/restart_metrics.sim +#jeff ./test.sh -f general/cache/restart_table.sim #hongze ./test.sh -f general/column/commit.sim -#hongze ./test.sh -f general/column/metrics.sim -#hongze ./test.sh -f general/column/table.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 @@ -28,11 +28,11 @@ cd ../../../debug; make ./test.sh -f general/compute/bottom.sim ./test.sh -f general/compute/count.sim ./test.sh -f general/compute/diff.sim -# liao./test.sh -f general/compute/diff2.sim +./test.sh -f general/compute/diff2.sim ./test.sh -f general/compute/first.sim -# liao./test.sh -f general/compute/interval.sim -# liao./test.sh -f general/compute/last.sim -# liao./test.sh -f general/compute/leastsquare.sim +# liao ./test.sh -f general/compute/interval.sim +./test.sh -f general/compute/last.sim +# liao ./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 @@ -54,30 +54,30 @@ cd ../../../debug; make ./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 -u -f general/db/vnodes.sim +#liao ./test.sh -f general/db/vnodes.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 +#liao ./test.sh -f general/field/3.sim +#liao? ./test.sh -f general/field/4.sim +#liao? ./test.sh -f general/field/5.sim +#liao? ./test.sh -f general/field/6.sim ./test.sh -f general/field/bigint.sim -# liao./test.sh -f general/field/binary.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 -# jeff ./test.sh -f general/http/restful.sim +./test.sh -f general/http/restful.sim ./test.sh -f general/http/restful_insert.sim ./test.sh -f general/http/restful_limit.sim -# jeff ./test.sh -f general/http/restful_full.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 -# jeff ./test.sh -f general/http/grafana.sim +./test.sh -f general/http/grafana.sim ./test.sh -f general/import/basic.sim ./test.sh -f general/import/commit.sim @@ -94,10 +94,10 @@ cd ../../../debug; make ./test.sh -f general/insert/query_multi_file.sim ./test.sh -f general/insert/tcp.sim -# ./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 +#unsupport ./test.sh -f general/parser/alter.sim +#unsupport ./test.sh -f general/parser/alter1.sim +#unsupport ./test.sh -f general/parser/alter_stable.sim +#rpc error? ./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 @@ -145,23 +145,23 @@ cd ../../../debug; make # ./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/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/disk.sim +./test.sh -f general/stable/metrics.sim +#liao? ./test.sh -f general/stable/values.sim ./test.sh -f general/stable/vnode3.sim ./test.sh -f general/table/autocreate.sim ./test.sh -f general/table/basic1.sim ./test.sh -f general/table/basic2.sim -#hongze ./test.sh -f general/table/basic3.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 @@ -186,29 +186,29 @@ cd ../../../debug; make ./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 +#liao ./test.sh -f general/tag/3.sim +#liao? ./test.sh -f general/tag/4.sim +#liao? ./test.sh -f general/tag/5.sim +#liao? ./test.sh -f general/tag/6.sim +#unsupport ./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/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 -#liao ./test.sh -f general/tag/column.sim -#./test.sh -f general/tag/commit.sim -#liao ./test.sh -f general/tag/create.sim -#./test.sh -f general/tag/delete.sim +#unsupport ./test.sh -f general/tag/change.sim +./test.sh -f general/tag/column.sim +#unsupport ./test.sh -f general/tag/commit.sim +./test.sh -f general/tag/create.sim +#unsupport ./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 +#liao? ./test.sh -f general/tag/float.sim +#liao? ./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 +#unsupport ./test.sh -f general/tag/set.sim ./test.sh -f general/tag/smallint.sim ./test.sh -f general/tag/tinyint.sim @@ -224,7 +224,7 @@ cd ../../../debug; make ./test.sh -f general/vector/metrics_query.sim ./test.sh -f general/vector/metrics_tag.sim ./test.sh -f general/vector/metrics_time.sim -#liao ./test.sh -f general/vector/multi.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 From 6bfcf33658767c093a75e7c057a8dfd6cd9434c5 Mon Sep 17 00:00:00 2001 From: jtao1735 Date: Tue, 12 May 2020 10:14:27 +0000 Subject: [PATCH 49/51] if link is new, server force the client to do authentication --- src/inc/taoserror.h | 1 + src/rpc/src/rpcMain.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index b5ab4412a9..f9bc1404fe 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -74,6 +74,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_OPTION, 0, 26, "invalid option") TAOS_DEFINE_ERROR(TSDB_CODE_NOT_CONFIGURED, 0, 27, "not configured") TAOS_DEFINE_ERROR(TSDB_CODE_NODE_OFFLINE, 0, 28, "node offline") TAOS_DEFINE_ERROR(TSDB_CODE_NETWORK_UNAVAIL, 0, 29, "network unavailable") +TAOS_DEFINE_ERROR(TSDB_CODE_AUTH_REQUIRED, 0, 30, "auth required") // db TAOS_DEFINE_ERROR(TSDB_CODE_DB_NOT_SELECTED, 0, 100, "db not selected") diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index ca4b211be8..3e638eb3d3 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -612,7 +612,12 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) { pConn->ownId = htonl(pConn->sid); pConn->linkUid = pHead->linkUid; if (pRpc->afp) { - terrno = (*pRpc->afp)(pConn->user, &pConn->spi, &pConn->encrypt, pConn->secret, pConn->ckey); + if (pConn->user[0] == 0) { + terrno = TSDB_CODE_AUTH_REQUIRED; + } else { + terrno = (*pRpc->afp)(pConn->user, &pConn->spi, &pConn->encrypt, pConn->secret, pConn->ckey); + } + if (terrno != 0) { tWarn("%s %p, user not there or server not ready", pRpc->label, pConn); taosFreeId(pRpc->idPool, sid); // sid shall be released @@ -930,6 +935,12 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) { rpcMsg.handle = pContext->ahandle; pConn->pContext = NULL; + if (pHead->code == TSDB_CODE_AUTH_REQUIRED) { + pConn->secured = 0; + rpcSendReqToServer(pRpc, pContext); + return; + } + // 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); From 80f0a880634bc17f532f3794b380208404667317 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 18:28:00 +0800 Subject: [PATCH 50/51] scripts --- tests/script/basicSuite.sim | 3 +- tests/script/general/parser/alter.sim | 2 + tests/script/general/parser/alter_stable.sim | 2 +- .../script/general/parser/auto_create_tb.sim | 4 +- .../general/parser/auto_create_tb_drop_tb.sim | 3 +- .../general/parser/binary_escapeCharacter.sim | 7 +-- tests/script/general/parser/bug.sim | 1 - .../parser/col_arithmetic_operation.sim | 2 + tests/script/general/parser/columnValue.sim | 12 +---- tests/script/general/parser/commit.sim | 2 + tests/script/general/parser/create_db.sim | 2 + tests/script/general/parser/create_mt.sim | 2 + tests/script/general/parser/create_tb.sim | 2 + .../general/parser/dbtbnameValidate.sim | 3 +- tests/script/general/parser/fill.sim | 2 + tests/script/general/parser/fill_stb.sim | 2 + tests/script/general/parser/first_last.sim | 1 + tests/script/general/parser/groupby.sim | 4 +- .../script/general/parser/import_commit1.sim | 1 + .../script/general/parser/import_commit2.sim | 1 + .../script/general/parser/import_commit3.sim | 1 + tests/script/general/parser/import_file.sim | 4 +- tests/script/general/parser/insert_tb.sim | 1 + tests/script/general/parser/interp.sim | 2 + tests/script/general/parser/join.sim | 2 + .../script/general/parser/join_multivnode.sim | 4 +- tests/script/general/parser/lastrow.sim | 2 + tests/script/general/parser/limit.sim | 2 + tests/script/general/parser/limit1.sim | 2 + .../general/parser/limit1_tblocks100.sim | 2 + tests/script/general/parser/limit2.sim | 2 + tests/script/general/parser/mixed_blocks.sim | 2 + tests/script/general/parser/nchar.sim | 2 + tests/script/general/parser/null_char.sim | 1 + .../parser/projection_limit_offset.sim | 2 +- tests/script/general/parser/repeatAlter.sim | 2 + tests/script/general/parser/repeatStream.sim | 2 + tests/script/general/parser/selectResNum.sim | 2 + .../general/parser/select_across_vnodes.sim | 2 + .../general/parser/select_from_cache_disk.sim | 2 + .../general/parser/select_with_tags.sim | 2 + tests/script/general/parser/set_tag_vals.sim | 2 + .../general/parser/single_row_in_tb.sim | 2 + tests/script/general/parser/slimit.sim | 2 + tests/script/general/parser/slimit1.sim | 2 + .../general/parser/slimit_alter_tags.sim | 2 + tests/script/general/parser/stream.sim | 2 + tests/script/general/parser/stream_on_sys.sim | 2 + .../parser/tags_dynamically_specifiy.sim | 4 +- tests/script/general/parser/tbnameIn.sim | 2 + tests/script/general/parser/testSuite.sim | 5 +++ tests/script/general/parser/where.sim | 2 + tests/script/jenkins/basic.txt | 45 +++++++++---------- 53 files changed, 117 insertions(+), 56 deletions(-) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index d0bb58ec20..420b08c1e1 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -9,7 +9,6 @@ run general/import/basic.sim run general/import/commit.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/column_name.sim @@ -18,5 +17,5 @@ run general/table/vgroup.sim run general/user/basic1.sim run general/user/pass_alter.sim run general/vector/single.sim -run general/connection/connection.sim +#run general/connection/connection.sim run general/user/authority.sim diff --git a/tests/script/general/parser/alter.sim b/tests/script/general/parser/alter.sim index f97581c5f5..e57b1f43d2 100644 --- a/tests/script/general/parser/alter.sim +++ b/tests/script/general/parser/alter.sim @@ -238,3 +238,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/parser/alter_stable.sim b/tests/script/general/parser/alter_stable.sim index 6715c44b96..b64c919042 100644 --- a/tests/script/general/parser/alter_stable.sim +++ b/tests/script/general/parser/alter_stable.sim @@ -39,4 +39,4 @@ sql alter table tb1 set tag len = 379 # test end sql drop database $db - +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/auto_create_tb.sim b/tests/script/general/parser/auto_create_tb.sim index bcbf5474ad..a29d917244 100644 --- a/tests/script/general/parser/auto_create_tb.sim +++ b/tests/script/general/parser/auto_create_tb.sim @@ -1,6 +1,4 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 @@ -305,3 +303,5 @@ sql select * from tu if $rows != 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/parser/auto_create_tb_drop_tb.sim b/tests/script/general/parser/auto_create_tb_drop_tb.sim index e3a3b0c7a0..9d38b40ab3 100644 --- a/tests/script/general/parser/auto_create_tb_drop_tb.sim +++ b/tests/script/general/parser/auto_create_tb_drop_tb.sim @@ -1,5 +1,4 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c ctime -v 30 @@ -81,3 +80,5 @@ while $x < 100 $x = $x + 1 print loop $x endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/binary_escapeCharacter.sim b/tests/script/general/parser/binary_escapeCharacter.sim index 5f7d98a75a..c3c867795a 100644 --- a/tests/script/general/parser/binary_escapeCharacter.sim +++ b/tests/script/general/parser/binary_escapeCharacter.sim @@ -95,9 +95,4 @@ if $data41 != @udp005@ then endi - - - - - - +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/bug.sim b/tests/script/general/parser/bug.sim index 0233b2ee04..0e97acb453 100644 --- a/tests/script/general/parser/bug.sim +++ b/tests/script/general/parser/bug.sim @@ -42,4 +42,3 @@ sql select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:6020/restful/sql system sh/exec.sh -n dnode1 -s stop -x SIGINT - diff --git a/tests/script/general/parser/col_arithmetic_operation.sim b/tests/script/general/parser/col_arithmetic_operation.sim index 9ea8492907..132ecf4342 100644 --- a/tests/script/general/parser/col_arithmetic_operation.sim +++ b/tests/script/general/parser/col_arithmetic_operation.sim @@ -90,3 +90,5 @@ endi #### illegal operations sql_error select max(c2*2) from $tb sql_error select max(c1-c2) from $tb + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/columnValue.sim b/tests/script/general/parser/columnValue.sim index aa5c5f72c8..e905f61215 100644 --- a/tests/script/general/parser/columnValue.sim +++ b/tests/script/general/parser/columnValue.sim @@ -22,15 +22,5 @@ run general/parser/columnValue_bigint.sim run general/parser/columnValue_float.sim run general/parser/columnValue_double.sim - - - - - - - - - - - +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/commit.sim b/tests/script/general/parser/commit.sim index 2b69b1ab8c..f1c980f3db 100644 --- a/tests/script/general/parser/commit.sim +++ b/tests/script/general/parser/commit.sim @@ -107,3 +107,5 @@ while $loop <= $loops endi $loop = $loop + 1 endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/create_db.sim b/tests/script/general/parser/create_db.sim index 8048770198..817d712aa6 100644 --- a/tests/script/general/parser/create_db.sim +++ b/tests/script/general/parser/create_db.sim @@ -188,3 +188,5 @@ sql show databases if $rows != 0 then return -1 endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/create_mt.sim b/tests/script/general/parser/create_mt.sim index 76fb486f1e..5b951b7b35 100644 --- a/tests/script/general/parser/create_mt.sim +++ b/tests/script/general/parser/create_mt.sim @@ -258,3 +258,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/parser/create_tb.sim b/tests/script/general/parser/create_tb.sim index 7df7d8a4da..7bb329396c 100644 --- a/tests/script/general/parser/create_tb.sim +++ b/tests/script/general/parser/create_tb.sim @@ -188,3 +188,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/parser/dbtbnameValidate.sim b/tests/script/general/parser/dbtbnameValidate.sim index 5dea4a09c5..cf72f3ae61 100644 --- a/tests/script/general/parser/dbtbnameValidate.sim +++ b/tests/script/general/parser/dbtbnameValidate.sim @@ -127,5 +127,4 @@ if $rows != 7 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/parser/fill.sim b/tests/script/general/parser/fill.sim index 459bc7611e..4dfee222cc 100644 --- a/tests/script/general/parser/fill.sim +++ b/tests/script/general/parser/fill.sim @@ -849,3 +849,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/parser/fill_stb.sim b/tests/script/general/parser/fill_stb.sim index 113f4b68a4..402b79d6b5 100644 --- a/tests/script/general/parser/fill_stb.sim +++ b/tests/script/general/parser/fill_stb.sim @@ -430,3 +430,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/parser/first_last.sim b/tests/script/general/parser/first_last.sim index d2586ce04a..48288daeca 100644 --- a/tests/script/general/parser/first_last.sim +++ b/tests/script/general/parser/first_last.sim @@ -83,3 +83,4 @@ sleep 3000 run general/parser/first_last_query.sim +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/groupby.sim b/tests/script/general/parser/groupby.sim index 5bf41772ed..9788e4d484 100644 --- a/tests/script/general/parser/groupby.sim +++ b/tests/script/general/parser/groupby.sim @@ -406,4 +406,6 @@ endi if $data97 != @group_tb0@ 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/parser/import_commit1.sim b/tests/script/general/parser/import_commit1.sim index d88e6e986a..a929c1846b 100644 --- a/tests/script/general/parser/import_commit1.sim +++ b/tests/script/general/parser/import_commit1.sim @@ -53,3 +53,4 @@ if $data00 != $res 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/parser/import_commit2.sim b/tests/script/general/parser/import_commit2.sim index 9ed8ac0ea4..c93b3168f1 100644 --- a/tests/script/general/parser/import_commit2.sim +++ b/tests/script/general/parser/import_commit2.sim @@ -52,3 +52,4 @@ if $data00 != $res 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/parser/import_commit3.sim b/tests/script/general/parser/import_commit3.sim index ee71e03182..916bf6d05e 100644 --- a/tests/script/general/parser/import_commit3.sim +++ b/tests/script/general/parser/import_commit3.sim @@ -59,3 +59,4 @@ if $data00 != $res 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/parser/import_file.sim b/tests/script/general/parser/import_file.sim index cd63612a0e..6b4dd07c79 100644 --- a/tests/script/general/parser/import_file.sim +++ b/tests/script/general/parser/import_file.sim @@ -34,4 +34,6 @@ endi #system rm -f $inFileName # invalid shell -system rm -f ~/data.csv \ No newline at end of file +system rm -f ~/data.csv + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/insert_tb.sim b/tests/script/general/parser/insert_tb.sim index 4f2c5fcc78..4ba455c244 100644 --- a/tests/script/general/parser/insert_tb.sim +++ b/tests/script/general/parser/insert_tb.sim @@ -233,3 +233,4 @@ endi #endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/interp.sim b/tests/script/general/parser/interp.sim index c7c633d422..4033d1c735 100644 --- a/tests/script/general/parser/interp.sim +++ b/tests/script/general/parser/interp.sim @@ -65,3 +65,5 @@ system sh/exec.sh -n dnode1 -s start print ================== server restart completed run general/parser/interp_test.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/join.sim b/tests/script/general/parser/join.sim index 6addcb1ac1..2524fbe631 100644 --- a/tests/script/general/parser/join.sim +++ b/tests/script/general/parser/join.sim @@ -444,3 +444,5 @@ sql insert into um1 using m2 tags(1) values(1000001, 10)(2000000, 20); sql insert into um2 using m2 tags(9) values(1000001, 10)(2000000, 20); sql_error select count(*) from m1,m2 where m1.a=m2.a and m1.ts=m2.ts; + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/join_multivnode.sim b/tests/script/general/parser/join_multivnode.sim index 86488ea844..3e32064f3b 100644 --- a/tests/script/general/parser/join_multivnode.sim +++ b/tests/script/general/parser/join_multivnode.sim @@ -127,4 +127,6 @@ sql select join_mt0.ts, join_mt1.t1 from join_mt0, join_mt1 where join_mt0.ts=jo sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbname from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1 -sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbname from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1 limit 1 \ No newline at end of file +sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbname from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1 limit 1 + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/lastrow.sim b/tests/script/general/parser/lastrow.sim index 5eb3b144a6..29f535942d 100644 --- a/tests/script/general/parser/lastrow.sim +++ b/tests/script/general/parser/lastrow.sim @@ -68,3 +68,5 @@ sql connect sleep 3000 run general/parser/lastrow_query.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/limit.sim b/tests/script/general/parser/limit.sim index 8f00912a59..e3e952bdd3 100644 --- a/tests/script/general/parser/limit.sim +++ b/tests/script/general/parser/limit.sim @@ -69,3 +69,5 @@ sleep 3000 run general/parser/limit_tb.sim run general/parser/limit_stb.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/limit1.sim b/tests/script/general/parser/limit1.sim index 040b6303de..48fb6aaede 100644 --- a/tests/script/general/parser/limit1.sim +++ b/tests/script/general/parser/limit1.sim @@ -67,3 +67,5 @@ print ================== server restart completed run general/parser/limit1_tb.sim run general/parser/limit1_stb.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/limit1_tblocks100.sim b/tests/script/general/parser/limit1_tblocks100.sim index a776459640..af4d3eda85 100644 --- a/tests/script/general/parser/limit1_tblocks100.sim +++ b/tests/script/general/parser/limit1_tblocks100.sim @@ -67,3 +67,5 @@ print ================== server restart completed run general/parser/limit1_tb.sim run general/parser/limit1_stb.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/limit2.sim b/tests/script/general/parser/limit2.sim index cc9334db36..61f817644a 100644 --- a/tests/script/general/parser/limit2.sim +++ b/tests/script/general/parser/limit2.sim @@ -74,3 +74,5 @@ system sh/exec.sh -n dnode1 -s start print ================== server restart completed run general/parser/limit2_query.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/mixed_blocks.sim b/tests/script/general/parser/mixed_blocks.sim index 77838774df..569decaa14 100644 --- a/tests/script/general/parser/mixed_blocks.sim +++ b/tests/script/general/parser/mixed_blocks.sim @@ -142,3 +142,5 @@ endi if $data03 != 319 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/parser/nchar.sim b/tests/script/general/parser/nchar.sim index 2a6bc83b41..2c86748f21 100644 --- a/tests/script/general/parser/nchar.sim +++ b/tests/script/general/parser/nchar.sim @@ -310,3 +310,5 @@ endi # 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/parser/null_char.sim b/tests/script/general/parser/null_char.sim index e4f6c5f849..d395b4c8ba 100644 --- a/tests/script/general/parser/null_char.sim +++ b/tests/script/general/parser/null_char.sim @@ -488,3 +488,4 @@ sql_error alter table st51 set tag tag_tinyint = abc379 #sql drop database $db +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/projection_limit_offset.sim b/tests/script/general/parser/projection_limit_offset.sim index 4b10694190..52be50c032 100644 --- a/tests/script/general/parser/projection_limit_offset.sim +++ b/tests/script/general/parser/projection_limit_offset.sim @@ -375,4 +375,4 @@ sql_error select 'abc'; #=============================tbase-1205 sql select count(*) from tm1 where ts= now -1d interval(1h) fill(NULL); - +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/repeatAlter.sim b/tests/script/general/parser/repeatAlter.sim index 5f6a8e6a2a..3695206f90 100644 --- a/tests/script/general/parser/repeatAlter.sim +++ b/tests/script/general/parser/repeatAlter.sim @@ -5,3 +5,5 @@ while $i <= $loops run general/parser/alter.sim $i = $i + 1 endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/repeatStream.sim b/tests/script/general/parser/repeatStream.sim index bd631e36a1..616679e78b 100644 --- a/tests/script/general/parser/repeatStream.sim +++ b/tests/script/general/parser/repeatStream.sim @@ -5,3 +5,5 @@ while $i <= $repeats run general/parser/stream.sim $i = $i + 1 endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/selectResNum.sim b/tests/script/general/parser/selectResNum.sim index 0a4eafc8a0..a0adc46d5f 100644 --- a/tests/script/general/parser/selectResNum.sim +++ b/tests/script/general/parser/selectResNum.sim @@ -182,3 +182,5 @@ while $loop <= $loops endw $loop = $loop + 1 endw + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/select_across_vnodes.sim b/tests/script/general/parser/select_across_vnodes.sim index 883d4d59cd..65e8cbb7b1 100644 --- a/tests/script/general/parser/select_across_vnodes.sim +++ b/tests/script/general/parser/select_across_vnodes.sim @@ -80,3 +80,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/parser/select_from_cache_disk.sim b/tests/script/general/parser/select_from_cache_disk.sim index 04cc68c310..9ffdf817d7 100644 --- a/tests/script/general/parser/select_from_cache_disk.sim +++ b/tests/script/general/parser/select_from_cache_disk.sim @@ -68,3 +68,5 @@ endi if $data12 != 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/parser/select_with_tags.sim b/tests/script/general/parser/select_with_tags.sim index 181d7f312a..329787b69c 100644 --- a/tests/script/general/parser/select_with_tags.sim +++ b/tests/script/general/parser/select_with_tags.sim @@ -838,3 +838,5 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group #sql select first(ts), tbname from select_tags_mt0 group by tbname; #sql select count(c1) from select_tags_mt0 where c1=99 group by tbname; #sql select count(*),tbname from select_tags_mt0 group by tbname + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/set_tag_vals.sim b/tests/script/general/parser/set_tag_vals.sim index de29c28ba3..a684fd5406 100644 --- a/tests/script/general/parser/set_tag_vals.sim +++ b/tests/script/general/parser/set_tag_vals.sim @@ -225,3 +225,5 @@ endi if $data04 != 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/parser/single_row_in_tb.sim b/tests/script/general/parser/single_row_in_tb.sim index 5ee65e3b10..52bdad2065 100644 --- a/tests/script/general/parser/single_row_in_tb.sim +++ b/tests/script/general/parser/single_row_in_tb.sim @@ -36,3 +36,5 @@ system sh/exec.sh -n dnode1 -s start print ================== server restart completed run general/parser/single_row_in_tb_query.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/slimit.sim b/tests/script/general/parser/slimit.sim index 017e8d4d2e..161463a7c1 100644 --- a/tests/script/general/parser/slimit.sim +++ b/tests/script/general/parser/slimit.sim @@ -105,3 +105,5 @@ sql connect sleep 3000 run general/parser/slimit_query.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/slimit1.sim b/tests/script/general/parser/slimit1.sim index 3dbe9f0a06..b987a6852b 100644 --- a/tests/script/general/parser/slimit1.sim +++ b/tests/script/general/parser/slimit1.sim @@ -64,3 +64,5 @@ sql connect sleep 3000 run general/parser/slimit1_query.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/slimit_alter_tags.sim b/tests/script/general/parser/slimit_alter_tags.sim index 5c62482802..b8397f950c 100644 --- a/tests/script/general/parser/slimit_alter_tags.sim +++ b/tests/script/general/parser/slimit_alter_tags.sim @@ -255,3 +255,5 @@ endi #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/parser/stream.sim b/tests/script/general/parser/stream.sim index c4be6efa1c..8e5dad1595 100644 --- a/tests/script/general/parser/stream.sim +++ b/tests/script/general/parser/stream.sim @@ -220,3 +220,5 @@ sql create database $db sql use $db sql create table stb (ts timestamp, c1 int) tags(t1 int) sql create table tb1 using stb tags(1) + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/stream_on_sys.sim b/tests/script/general/parser/stream_on_sys.sim index b7bf7a8900..5170ddb036 100644 --- a/tests/script/general/parser/stream_on_sys.sim +++ b/tests/script/general/parser/stream_on_sys.sim @@ -58,3 +58,5 @@ sql select * from iostrm 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/parser/tags_dynamically_specifiy.sim b/tests/script/general/parser/tags_dynamically_specifiy.sim index af514d1a07..6e1766a91d 100644 --- a/tests/script/general/parser/tags_dynamically_specifiy.sim +++ b/tests/script/general/parser/tags_dynamically_specifiy.sim @@ -55,4 +55,6 @@ endi #if $data06 != 100.90000 then # print "expect: 100.90000, act: $data06" # 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/parser/tbnameIn.sim b/tests/script/general/parser/tbnameIn.sim index 548560e945..16302888d0 100644 --- a/tests/script/general/parser/tbnameIn.sim +++ b/tests/script/general/parser/tbnameIn.sim @@ -73,3 +73,5 @@ system sh/exec.sh -n dnode1 -s start print ================== server restart completed run general/parser/tbnameIn_query.sim + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index fb56868f1f..0b7d705688 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -98,3 +98,8 @@ sleep 2000 run general/parser/select_with_tags.sim sleep 2000 run general/parser/groupby.sim + +sleep 2000 +run general/parser/binary_escapeCharacter.sim +sleep 2000 +#run general/parser/bug.sim \ No newline at end of file diff --git a/tests/script/general/parser/where.sim b/tests/script/general/parser/where.sim index fb3a0a69e7..de2312f2b9 100644 --- a/tests/script/general/parser/where.sim +++ b/tests/script/general/parser/where.sim @@ -272,3 +272,5 @@ sql select * from tb_where_NULL where c2 <> "nUll" if $rows != 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/jenkins/basic.txt b/tests/script/jenkins/basic.txt index cbf83f68c7..5a5793f069 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -41,6 +41,8 @@ cd ../../../debug; make ./test.sh -f general/compute/sum.sim ./test.sh -f general/compute/top.sim +#jeff ./test.sh -f general/connection/connection.sim + ./test.sh -f general/db/basic.sim ./test.sh -f general/db/basic1.sim ./test.sh -f general/db/basic2.sim @@ -97,61 +99,54 @@ cd ../../../debug; make #unsupport ./test.sh -f general/parser/alter.sim #unsupport ./test.sh -f general/parser/alter1.sim #unsupport ./test.sh -f general/parser/alter_stable.sim -#rpc error? ./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/auto_create_tb.sim +#slguan ./test.sh -f general/parser/auto_create_tb_drop_tb.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/first_last.sim +# ./test.sh -f general/parser/import_file.sim +# ./test.sh -f general/parser/lastrow.sim +# ./test.sh -f general/parser/nchar.sim +# ./test.sh -f general/parser/null_char.sim +# ./test.sh -f general/parser/single_row_in_tb.sim +./test.sh -f general/parser/select_from_cache_disk.sim +# ./test.sh -f general/parser/limit.sim +# ./test.sh -f general/parser/fill.sim +# ./test.sh -f general/parser/fill_stb.sim # ./test.sh -f general/parser/tags_dynamically_specifiy.sim # ./test.sh -f general/parser/interp.sim -# ./test.sh -f general/parser/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 +#unsupport ./test.sh -f general/parser/slimit_alter_tags.sim +#unsupport ./test.sh -f general/parser/stream_on_sys.sim +#unsupport ./test.sh -f general/parser/stream.sim # ./test.sh -f general/parser/tbnameIn.sim # ./test.sh -f general/parser/where.sim # ./test.sh -f general/parser/repeatAlter.sim -# ./test.sh -f general/parser/repeatStream.sim +#unsupport ./test.sh -f general/parser/repeatStream.sim # ./test.sh -f general/parser/join.sim # ./test.sh -f general/parser/join_multivnode.sim # ./test.sh -f general/parser/projection_limit_offset.sim # ./test.sh -f general/parser/select_with_tags.sim # ./test.sh -f general/parser/groupby.sim +./test.sh -f general/parser/binary_escapeCharacter.sim +#./test.sh -f general/parser/bug.sim ./test.sh -f general/stable/disk.sim ./test.sh -f general/stable/metrics.sim From d2b7acdde7fdd53488547ed521b2e51b785abaf5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 12 May 2020 18:33:49 +0800 Subject: [PATCH 51/51] scripts --- tests/script/general/parser/auto_create_tb_drop_tb.sim | 2 +- tests/script/jenkins/basic.txt | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) 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 9d38b40ab3..f739f42a6e 100644 --- a/tests/script/general/parser/auto_create_tb_drop_tb.sim +++ b/tests/script/general/parser/auto_create_tb_drop_tb.sim @@ -21,7 +21,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db maxrows 200 cache 2048 maxTables 4 +sql create database $db maxrows 200 cache 2 maxTables 4 print ====== create tables sql use $db diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 5a5793f069..6b1902f590 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -12,8 +12,8 @@ cd ../../../debug; make #unsupport ./test.sh -f general/alter/table.sim ./test.sh -f general/cache/new_metrics.sim -#jeff ./test.sh -f general/cache/restart_metrics.sim -#jeff ./test.sh -f general/cache/restart_table.sim +./test.sh -f general/cache/restart_metrics.sim +./test.sh -f general/cache/restart_table.sim #hongze ./test.sh -f general/column/commit.sim ./test.sh -f general/column/metrics.sim @@ -41,8 +41,6 @@ cd ../../../debug; make ./test.sh -f general/compute/sum.sim ./test.sh -f general/compute/top.sim -#jeff ./test.sh -f general/connection/connection.sim - ./test.sh -f general/db/basic.sim ./test.sh -f general/db/basic1.sim ./test.sh -f general/db/basic2.sim