From f7a2e0cdab7e44e12476af7a87d4ebe6777f6ab7 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 4 Aug 2023 15:21:23 +0800 Subject: [PATCH 01/12] fix: ins_indexes vgroup_id using null value instead of -1 for invalid value --- source/dnode/mnode/impl/src/mndIndex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndIndex.c b/source/dnode/mnode/impl/src/mndIndex.c index efaff7ffc4..2157804559 100644 --- a/source/dnode/mnode/impl/src/mndIndex.c +++ b/source/dnode/mnode/impl/src/mndIndex.c @@ -515,7 +515,6 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i if (pDb == NULL) return 0; } SSmaAndTagIter *pIter = pShow->pIter; - int invalid = -1; while (numOfRows < rows) { pIter->pIdxIter = sdbFetch(pSdb, SDB_IDX, pIter->pIdxIter, (void **)&pIdx); if (pIter->pIdxIter == NULL) break; @@ -552,7 +551,7 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)&invalid, false); + colDataSetVal(pColInfo, numOfRows, NULL, true); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false); From 9f3af66ae06501db3bcd7e3de60d4f0182035005 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 4 Aug 2023 16:03:06 +0800 Subject: [PATCH 02/12] fix: fix tsort crash caused by not enough disk space --- source/libs/executor/src/tsort.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 0a8d7ee376..7226e98323 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -995,7 +995,12 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) { SArray* aExtSrc = taosArrayInit(nSrc, POINTER_BYTES); size_t maxBufSize = pHandle->numOfPages * pHandle->pageSize; - createPageBuf(pHandle); + + int32_t code = createPageBuf(pHandle); + if (code != TSDB_CODE_SUCCESS) { + taosArrayDestroy(aExtSrc); + return code; + } SSortSource* pSrc = taosArrayGetP(pHandle->pOrderedSource, 0); int32_t szSort = 0; @@ -1070,7 +1075,7 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) { taosArrayDestroy(aExtSrc); pHandle->type = SORT_SINGLESOURCE_SORT; - return 0; + return TSDB_CODE_SUCCESS; } static int32_t createBlocksQuickSortInitialSources(SSortHandle* pHandle) { From d508fad945713602dca5fee0e5ba0e9acf2528e3 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 4 Aug 2023 17:02:16 +0800 Subject: [PATCH 03/12] open split vgroup case --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 747eb909a0..fb67ee51cd 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -161,7 +161,7 @@ ,,n,system-test,python3 ./test.py -f 0-others/tag_index_basic.py ,,n,system-test,python3 ./test.py -f 0-others/udfpy_main.py ,,n,system-test,python3 ./test.py -N 3 -f 0-others/walRetention.py -#,,n,system-test,python3 ./test.py -f 0-others/splitVGroup.py -N 5 +,,n,system-test,python3 ./test.py -f 0-others/splitVGroup.py -N 5 ,,n,system-test,python3 ./test.py -f 0-others/timeRangeWise.py -N 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_replica.py -N 3 From 84bf3e591fc97efef7e8057243446d6069644e73 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 4 Aug 2023 17:08:10 +0800 Subject: [PATCH 04/12] fix test cases --- tests/system-test/0-others/show_tag_index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/0-others/show_tag_index.py b/tests/system-test/0-others/show_tag_index.py index 6c19dbce0d..663426b7ff 100644 --- a/tests/system-test/0-others/show_tag_index.py +++ b/tests/system-test/0-others/show_tag_index.py @@ -64,7 +64,7 @@ class TDTestCase: tdSql.checkData(0, 0, 'idx1') tdSql.checkData(0, 1, 'db') tdSql.checkData(0, 2, 'stb') - tdSql.checkData(0, 3, -1) + tdSql.checkData(0, 3, None) tdSql.checkData(0, 5, 't1') tdSql.checkData(0, 6, 'tag_index') From 0e4f1942f1933dbe85c895698012cfab13ec8805 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Mon, 7 Aug 2023 11:13:52 +0800 Subject: [PATCH 05/12] fix: resolve Vgroup refcount leak in drop topic --- source/dnode/mnode/impl/src/mndTopic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 85e6f1caf6..621a80338d 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -799,6 +799,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) { mndTransDrop(pTrans); return -1; } + sdbRelease(pSdb, pVgroup); } } From 1d4abc33e529047ebfcea27b961d2e6cd4b59b3a Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 7 Aug 2023 11:18:47 +0800 Subject: [PATCH 06/12] update packaging script --- packaging/tools/install.sh | 54 +++++++++++++++++++++----------------- packaging/tools/makepkg.sh | 5 ++++ 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 2741291f34..f9a11f5540 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -613,6 +613,11 @@ function install_examples() { fi } +function install_web() { + if [ -d "${script_dir}/share" ]; then + ${csudo}cp -rf ${script_dir}/share/* ${install_main_dir}/share > /dev/null 2>&1 ||: + fi +} function clean_service_on_sysvinit() { if ps aux | grep -v grep | grep ${serverName2} &>/dev/null; then @@ -888,6 +893,7 @@ function updateProduct() { fi install_examples + install_web if [ -z $1 ]; then install_bin install_service @@ -898,29 +904,29 @@ function updateProduct() { openresty_work=false echo - echo -e "${GREEN_DARK}To configure ${productName2} ${NC}: edit ${cfg_install_dir}/${configFile2}" + echo -e "${GREEN_DARK}To configure ${productName2} ${NC}\t: edit ${cfg_install_dir}/${configFile2}" [ -f ${configDir}/${clientName2}adapter.toml ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To configure ${clientName2}Adapter ${NC}: edit ${configDir}/${clientName2}adapter.toml" + echo -e "${GREEN_DARK}To configure ${clientName2}Adapter ${NC}\t: edit ${configDir}/${clientName2}adapter.toml" if ((${service_mod} == 0)); then - echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}systemctl start ${serverName2}${NC}" + echo -e "${GREEN_DARK}To start ${productName2} ${NC}\t: ${csudo}systemctl start ${serverName2}${NC}" [ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}: ${csudo}systemctl start ${clientName2}adapter ${NC}" + echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}\t: ${csudo}systemctl start ${clientName2}adapter ${NC}" elif ((${service_mod} == 1)); then - echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}service ${serverName2} start${NC}" + echo -e "${GREEN_DARK}To start ${productName2} ${NC}\t: ${csudo}service ${serverName2} start${NC}" [ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}: ${csudo}service ${clientName2}adapter start${NC}" + echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}\t: ${csudo}service ${clientName2}adapter start${NC}" else - echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ./${serverName2}${NC}" + echo -e "${GREEN_DARK}To start ${productName2} ${NC}\t: ./${serverName2}${NC}" [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}: ${clientName2}adapter ${NC}" + echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}\t: ${clientName2}adapter ${NC}" fi - echo -e "${GREEN_DARK}To enable ${clientName2}keeper ${NC}: sudo systemctl enable ${clientName2}keeper ${NC}" + echo -e "${GREEN_DARK}To enable ${clientName2}keeper ${NC}\t: sudo systemctl enable ${clientName2}keeper ${NC}" if [ ${openresty_work} = 'true' ]; then - echo -e "${GREEN_DARK}To access ${productName2} ${NC}: use ${GREEN_UNDERLINE}${clientName2} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${web_port}${NC}" + echo -e "${GREEN_DARK}To access ${productName2} ${NC}\t: use ${GREEN_UNDERLINE}${clientName2} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${web_port}${NC}" else - echo -e "${GREEN_DARK}To access ${productName2} ${NC}: use ${GREEN_UNDERLINE}${clientName2} -h $serverFqdn${NC} in shell${NC}" + echo -e "${GREEN_DARK}To access ${productName2} ${NC}\t: use ${GREEN_UNDERLINE}${clientName2} -h $serverFqdn${NC} in shell${NC}" fi if ((${prompt_force} == 1)); then @@ -968,7 +974,7 @@ function installProduct() { install_connector fi install_examples - + install_web if [ -z $1 ]; then # install service and client # For installing new install_bin @@ -982,24 +988,24 @@ function installProduct() { # Ask if to start the service echo - echo -e "${GREEN_DARK}To configure ${productName2} ${NC}: edit ${cfg_install_dir}/${configFile2}" + echo -e "${GREEN_DARK}To configure ${productName2} ${NC}\t: edit ${cfg_install_dir}/${configFile2}" [ -f ${configDir}/${clientName2}adapter.toml ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To configure ${clientName2}Adapter ${NC}: edit ${configDir}/${clientName2}adapter.toml" + echo -e "${GREEN_DARK}To configure ${clientName2}Adapter ${NC}\t: edit ${configDir}/${clientName2}adapter.toml" if ((${service_mod} == 0)); then - echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}systemctl start ${serverName2}${NC}" + echo -e "${GREEN_DARK}To start ${productName2} ${NC}\t: ${csudo}systemctl start ${serverName2}${NC}" [ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}: ${csudo}systemctl start ${clientName2}adapter ${NC}" + echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}\t: ${csudo}systemctl start ${clientName2}adapter ${NC}" elif ((${service_mod} == 1)); then - echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${csudo}service ${serverName2} start${NC}" + echo -e "${GREEN_DARK}To start ${productName2} ${NC}\t: ${csudo}service ${serverName2} start${NC}" [ -f ${service_config_dir}/${clientName2}adapter.service ] && [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}: ${csudo}service ${clientName2}adapter start${NC}" + echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}\t: ${csudo}service ${clientName2}adapter start${NC}" else - echo -e "${GREEN_DARK}To start ${productName2} ${NC}: ${serverName2}${NC}" + echo -e "${GREEN_DARK}To start ${productName2} ${NC}\t: ${serverName2}${NC}" [ -f ${installDir}/bin/${clientName2}adapter ] && \ - echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}: ${clientName2}adapter ${NC}" + echo -e "${GREEN_DARK}To start ${clientName2}Adapter ${NC}\t: ${clientName2}adapter ${NC}" fi - echo -e "${GREEN_DARK}To enable ${clientName2}keeper ${NC}: sudo systemctl enable ${clientName2}keeper ${NC}" + echo -e "${GREEN_DARK}To enable ${clientName2}keeper ${NC}\t: sudo systemctl enable ${clientName2}keeper ${NC}" if [ ! -z "$firstEp" ]; then tmpFqdn=${firstEp%%:*} @@ -1010,14 +1016,14 @@ function installProduct() { tmpPort="" fi if [[ "$tmpPort" != "" ]]; then - echo -e "${GREEN_DARK}To access ${productName2} ${NC}: ${clientName2} -h $tmpFqdn -P $tmpPort${GREEN_DARK} to login into cluster, then${NC}" + echo -e "${GREEN_DARK}To access ${productName2} ${NC}\t: ${clientName2} -h $tmpFqdn -P $tmpPort${GREEN_DARK} to login into cluster, then${NC}" else - echo -e "${GREEN_DARK}To access ${productName2} ${NC}: ${clientName2} -h $tmpFqdn${GREEN_DARK} to login into cluster, then${NC}" + echo -e "${GREEN_DARK}To access ${productName2} ${NC}\t: ${clientName2} -h $tmpFqdn${GREEN_DARK} to login into cluster, then${NC}" fi echo -e "${GREEN_DARK}execute ${NC}: create dnode 'newDnodeFQDN:port'; ${GREEN_DARK}to add this new node${NC}" echo elif [ ! -z "$serverFqdn" ]; then - echo -e "${GREEN_DARK}To access ${productName2} ${NC}: ${clientName2} -h $serverFqdn${GREEN_DARK} to login into ${productName2} server${NC}" + echo -e "${GREEN_DARK}To access ${productName2} ${NC}\t: ${clientName2} -h $serverFqdn${GREEN_DARK} to login into ${productName2} server${NC}" echo fi diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index a48d264d5d..ad64ca431e 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -319,6 +319,11 @@ if [[ $dbName == "taos" ]]; then mkdir -p ${install_dir}/examples/taosbenchmark-json && cp ${examples_dir}/../tools/taos-tools/example/* ${install_dir}/examples/taosbenchmark-json fi + if [ "$verMode" == "cluster" ] || [ "$verMode" == "cloud" ]; then + mkdir -p ${install_dir}/share/ + cp -rf ${build_dir}/share/{etc,srv} ${install_dir}/share ||: + fi + fi # Copy driver From 661f2aca9869df48a123bb42672862169616c713 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 7 Aug 2023 14:13:44 +0800 Subject: [PATCH 07/12] fix: memory leak --- source/dnode/vnode/src/tsdb/tsdbFS2.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 6e7595c6ef..afa294d3b0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -780,19 +780,20 @@ static int32_t tsdbFSRunBgTask(void *arg) { return 0; } -static int32_t tsdbFSScheduleBgTaskImpl(STFileSystem *fs, EFSBgTaskT type, int32_t (*run)(void *), void (*free)(void *), - void *arg, int64_t *taskid) { +static int32_t tsdbFSScheduleBgTaskImpl(STFileSystem *fs, EFSBgTaskT type, int32_t (*run)(void *), + void (*destroy)(void *), void *arg, int64_t *taskid) { if (fs->stop) { + if (destroy) { + destroy(arg); + } return 0; // TODO: use a better error code } - // check if same task is on - // if (fs->bgTaskRunning && fs->bgTaskRunning->type == type) { - // return 0; - // } - for (STFSBgTask *task = fs->bgTaskQueue->next; task != fs->bgTaskQueue; task = task->next) { if (task->type == type) { + if (destroy) { + destroy(arg); + } return 0; } } @@ -804,7 +805,7 @@ static int32_t tsdbFSScheduleBgTaskImpl(STFileSystem *fs, EFSBgTaskT type, int32 task->type = type; task->run = run; - task->free = free; + task->free = destroy; task->arg = arg; task->scheduleTime = taosGetTimestampMs(); task->taskid = ++fs->taskid; From a545d45b5e9c85eb4e6d8f246d8c578d8b7cd86a Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 7 Aug 2023 16:12:03 +0800 Subject: [PATCH 08/12] fix: snapshot invalid read --- source/dnode/vnode/src/tsdb/tsdbSnapshot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 011b9bd5a4..bdcf4a87c1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -342,18 +342,18 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* reader, uint8_t** data) { int32_t code = 0; int32_t lino = 0; - int64_t size = sizeof(SSnapDataHdr); + int64_t size = 0; for (int32_t i = 0; i < ARRAY_SIZE(reader->tombBlock->dataArr); i++) { size += TARRAY2_DATA_LEN(reader->tombBlock->dataArr + i); } - data[0] = taosMemoryMalloc(size); + data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr)); if (data[0] == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; TSDB_CHECK_CODE(code, lino, _exit); } - SSnapDataHdr* hdr = (SSnapDataHdr*)data[0]; + SSnapDataHdr* hdr = (SSnapDataHdr*)(data[0]); hdr->type = SNAP_DATA_DEL; hdr->size = size; @@ -938,7 +938,7 @@ static int32_t tsdbSnapWriteDecmprTombBlock(SSnapDataHdr* hdr, STombBlock* tombB int32_t code = 0; int32_t lino = 0; - int64_t size = hdr->size - sizeof(*hdr); + int64_t size = hdr->size; ASSERT(size % TOMB_RECORD_ELEM_NUM == 0); size = size / TOMB_RECORD_ELEM_NUM; ASSERT(size % sizeof(int64_t) == 0); From 2da67392c6af1838a4bb649e4066936335282f56 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 7 Aug 2023 19:30:23 +0800 Subject: [PATCH 09/12] fix(stream): commit the update to make sure the new state of tasks will be persistent to disk. --- source/libs/stream/src/streamRecover.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index df45ff2759..35612eb180 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -495,11 +495,13 @@ int32_t streamProcessScanHistoryFinishRsp(SStreamTask* pTask) { taosWLockLatch(&pMeta->lock); streamMetaSaveTask(pMeta, pTask); + streamMetaCommit(pMeta); taosWUnLockLatch(&pMeta->lock); // history data scan in the stream time window finished, now let's enable the pause streamTaskEnablePause(pTask); + // for source tasks, let's continue execute. if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { streamSchedExec(pTask); } From 9f83719559c1e926dc44f79e053cb93a2ff35c71 Mon Sep 17 00:00:00 2001 From: danielclow <106956386+danielclow@users.noreply.github.com> Date: Tue, 8 Aug 2023 09:34:58 +0800 Subject: [PATCH 10/12] docs: add upgrade notes to releases page (#22354) --- docs/en/28-releases/01-tdengine.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index 6eaa395087..31484dc1c5 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -12,6 +12,11 @@ import Release from "/components/ReleaseV3"; ## 3.1.0.0 +:::note IMPORTANT +- Once you upgrade to TDengine 3.1.0.0, you cannot roll back to any previous version of TDengine. Upgrading to 3.1.0.0 will alter your data such that it cannot be read by previous versions. +- You must remove all streams before upgrading to TDengine 3.1.0.0. If you upgrade a deployment that contains streams, the upgrade will fail and your deployment will become nonoperational. +::: + ## 3.0.7.1 From c8f106106a0c43d453a1f701adbc621d2f30bfdd Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 8 Aug 2023 14:49:05 +0800 Subject: [PATCH 11/12] fix: update assert issue --- source/dnode/vnode/src/tsdb/tsdbCommit2.c | 63 ++++++++++++----------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index 0639cd91a5..d4fa4de510 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -49,7 +49,7 @@ typedef struct { } ctx[1]; // reader - SSttFileReader *sttReader; + TSttFileReaderArray sttReaderArray[1]; // iter TTsdbIterArray dataIterArray[1]; @@ -226,7 +226,7 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { int32_t code = 0; int32_t lino = 0; - ASSERT(committer->sttReader == NULL); + ASSERT(TARRAY2_SIZE(committer->sttReaderArray) == 0); if (committer->ctx->fset == NULL // || committer->sttTrigger > 1 // @@ -241,31 +241,32 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) { ASSERT(lvl->level == 0); - if (TARRAY2_SIZE(lvl->fobjArr) == 0) { - return 0; + STFileObj *fobj = NULL; + TARRAY2_FOREACH(lvl->fobjArr, fobj) { + SSttFileReader *sttReader; + + SSttFileReaderConfig config = { + .tsdb = committer->tsdb, + .szPage = committer->szPage, + .file = fobj->f[0], + }; + + code = tsdbSttFileReaderOpen(fobj->fname, &config, &sttReader); + TSDB_CHECK_CODE(code, lino, _exit); + + code = TARRAY2_APPEND(committer->sttReaderArray, sttReader); + TSDB_CHECK_CODE(code, lino, _exit); + + STFileOp op = { + .optype = TSDB_FOP_REMOVE, + .fid = fobj->f->fid, + .of = fobj->f[0], + }; + + code = TARRAY2_APPEND(committer->fopArray, op); + TSDB_CHECK_CODE(code, lino, _exit); } - ASSERT(TARRAY2_SIZE(lvl->fobjArr) == 1); - - STFileObj *fobj = TARRAY2_FIRST(lvl->fobjArr); - - SSttFileReaderConfig config = { - .tsdb = committer->tsdb, - .szPage = committer->szPage, - .file = fobj->f[0], - }; - code = tsdbSttFileReaderOpen(fobj->fname, &config, &committer->sttReader); - TSDB_CHECK_CODE(code, lino, _exit); - - STFileOp op = { - .optype = TSDB_FOP_REMOVE, - .fid = fobj->f->fid, - .of = fobj->f[0], - }; - - code = TARRAY2_APPEND(committer->fopArray, op); - TSDB_CHECK_CODE(code, lino, _exit); - _exit: if (code) { TSDB_ERROR_LOG(TD_VID(committer->tsdb->pVnode), lino, code); @@ -273,7 +274,10 @@ _exit: return code; } -static int32_t tsdbCommitCloseReader(SCommitter2 *committer) { return tsdbSttFileReaderClose(&committer->sttReader); } +static int32_t tsdbCommitCloseReader(SCommitter2 *committer) { + TARRAY2_CLEAR(committer->sttReaderArray, tsdbSttFileReaderClose); + return 0; +} static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { int32_t code = 0; @@ -310,10 +314,11 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { TSDB_CHECK_CODE(code, lino, _exit); // STT - if (committer->sttReader) { + SSttFileReader *sttReader; + TARRAY2_FOREACH(committer->sttReaderArray, sttReader) { // data iter config.type = TSDB_ITER_TYPE_STT; - config.sttReader = committer->sttReader; + config.sttReader = sttReader; code = tsdbIterOpen(&config, &iter); TSDB_CHECK_CODE(code, lino, _exit); @@ -323,7 +328,7 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) { // tomb iter config.type = TSDB_ITER_TYPE_STT_TOMB; - config.sttReader = committer->sttReader; + config.sttReader = sttReader; code = tsdbIterOpen(&config, &iter); TSDB_CHECK_CODE(code, lino, _exit); From 90008bf17c7d8cc872657c8e4fe615599a2398ed Mon Sep 17 00:00:00 2001 From: sunpeng Date: Tue, 8 Aug 2023 16:58:04 +0800 Subject: [PATCH 12/12] docs: fix connection param in taosws in python connector --- docs/en/14-reference/03-connector/07-python.mdx | 2 +- docs/zh/08-connector/30-python.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/14-reference/03-connector/07-python.mdx b/docs/en/14-reference/03-connector/07-python.mdx index 831e79eeb7..5067c33e2d 100644 --- a/docs/en/14-reference/03-connector/07-python.mdx +++ b/docs/en/14-reference/03-connector/07-python.mdx @@ -373,7 +373,7 @@ conn.execute("CREATE STABLE weather(ts TIMESTAMP, temperature FLOAT) TAGS (locat ```python -conn = taosws.connect(url="ws://localhost:6041") +conn = taosws.connect("taosws://localhost:6041") # Execute a sql, ignore the result set, just get affected rows. It's useful for DDL and DML statement. conn.execute("DROP DATABASE IF EXISTS test") conn.execute("CREATE DATABASE test") diff --git a/docs/zh/08-connector/30-python.mdx b/docs/zh/08-connector/30-python.mdx index 15c11d05c3..ab98b5b8de 100644 --- a/docs/zh/08-connector/30-python.mdx +++ b/docs/zh/08-connector/30-python.mdx @@ -375,7 +375,7 @@ conn.execute("CREATE STABLE weather(ts TIMESTAMP, temperature FLOAT) TAGS (locat ```python -conn = taosws.connect(url="ws://localhost:6041") +conn = taosws.connect("taosws://localhost:6041") # Execute a sql, ignore the result set, just get affected rows. It's useful for DDL and DML statement. conn.execute("DROP DATABASE IF EXISTS test") conn.execute("CREATE DATABASE test")