From 4f9fa3bb3e7e52896ecd77c148763b0725214981 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Wed, 6 Nov 2024 11:05:59 +0800 Subject: [PATCH 01/11] fix alter wal level from 0 to 1or2 and restart failed --- source/libs/wal/src/walMeta.c | 3 - source/libs/wal/src/walMgmt.c | 58 +++++-- source/libs/wal/src/walWrite.c | 6 +- tests/pytest/util/dnodes.py | 3 +- tests/system-test/0-others/wal_level_skip.py | 172 +++++++++++++++++++ 5 files changed, 224 insertions(+), 18 deletions(-) create mode 100644 tests/system-test/0-others/wal_level_skip.py diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 6d52c8d6cb..da26ddae3a 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -424,9 +424,6 @@ static void printFileSet(int32_t vgId, SArray* fileSet, const char* str) { int32_t walCheckAndRepairMeta(SWal* pWal) { // load log files, get first/snapshot/last version info - if (pWal->cfg.level == TAOS_WAL_SKIP) { - return TSDB_CODE_SUCCESS; - } int32_t code = 0; const char* logPattern = "^[0-9]+.log$"; const char* idxPattern = "^[0-9]+.idx$"; diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index d8a58efe4e..ce213ca8e2 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -90,6 +90,29 @@ static int32_t walInitLock(SWal *pWal) { return 0; } +int32_t walInitWriteFileForSkip(SWal *pWal) { + TdFilePtr pIdxTFile, pLogTFile; + int64_t fileFirstVer = 0; + + char fnameStr[WAL_FILE_LEN]; + walBuildIdxName(pWal, fileFirstVer, fnameStr); + pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); + if (pIdxTFile == NULL) { + TAOS_RETURN(terrno); + } + walBuildLogName(pWal, fileFirstVer, fnameStr); + pLogTFile = taosOpenFile(fnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); + if (pLogTFile == NULL) { + TAOS_RETURN(terrno); + } + // switch file + pWal->pIdxFile = pIdxTFile; + pWal->pLogFile = pLogTFile; + pWal->writeCur = taosArrayGetSize(pWal->fileInfoSet) - 1; + + TAOS_RETURN(TSDB_CODE_SUCCESS); +} + SWal *walOpen(const char *path, SWalCfg *pCfg) { int32_t code = 0; SWal *pWal = taosMemoryCalloc(1, sizeof(SWal)); @@ -165,17 +188,24 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) { if (code < 0) { wWarn("vgId:%d, failed to load meta since %s", pWal->cfg.vgId, tstrerror(code)); } + if (pWal->cfg.level != TAOS_WAL_SKIP) { + code = walCheckAndRepairMeta(pWal); + if (code < 0) { + wError("vgId:%d, cannot open wal since repair meta file failed since %s", pWal->cfg.vgId, tstrerror(code)); + goto _err; + } - code = walCheckAndRepairMeta(pWal); - if (code < 0) { - wError("vgId:%d, cannot open wal since repair meta file failed since %s", pWal->cfg.vgId, tstrerror(code)); - goto _err; - } - - code = walCheckAndRepairIdx(pWal); - if (code < 0) { - wError("vgId:%d, cannot open wal since repair idx file failed since %s", pWal->cfg.vgId, tstrerror(code)); - goto _err; + code = walCheckAndRepairIdx(pWal); + if (code < 0) { + wError("vgId:%d, cannot open wal since repair idx file failed since %s", pWal->cfg.vgId, tstrerror(code)); + goto _err; + } + } else { + code = walInitWriteFileForSkip(pWal); + if (code < 0) { + wError("vgId:%d, cannot open wal since init write file for wal_level = 0 failed since %s", pWal->cfg.vgId, tstrerror(code)); + goto _err; + } } // add ref @@ -217,6 +247,14 @@ int32_t walAlter(SWal *pWal, SWalCfg *pCfg) { pWal->cfg.vgId, pWal->cfg.level, pWal->cfg.fsyncPeriod, pWal->cfg.retentionPeriod, pWal->cfg.retentionSize, pCfg->level, pCfg->fsyncPeriod, pCfg->retentionPeriod, pCfg->retentionSize); + if (pWal->cfg.level == TAOS_WAL_SKIP && pCfg->level != TAOS_WAL_SKIP) { + wInfo("vgId:%d, remove all wals, path:%s", pWal->cfg.vgId, pWal->path); + taosRemoveDir(pWal->path); + if (taosMkDir(pWal->path) != 0) { + wError("vgId:%d, path:%s, failed to create directory since %s", pWal->cfg.vgId, pWal->path, tstrerror(terrno)); + } + } + pWal->cfg.level = pCfg->level; pWal->cfg.fsyncPeriod = pCfg->fsyncPeriod; pWal->cfg.retentionPeriod = pCfg->retentionPeriod; diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 1a9652b3bb..4c2cc85986 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -294,9 +294,9 @@ int32_t walRollback(SWal *pWal, int64_t ver) { static int32_t walRollImpl(SWal *pWal) { int32_t code = 0, lino = 0; - if (pWal->cfg.level == TAOS_WAL_SKIP && pWal->pIdxFile != NULL && pWal->pLogFile != NULL) { - TAOS_RETURN(TSDB_CODE_SUCCESS); - } + // if (pWal->cfg.level == TAOS_WAL_SKIP && pWal->pIdxFile != NULL && pWal->pLogFile != NULL) { + // TAOS_RETURN(TSDB_CODE_SUCCESS); + // } if (pWal->pIdxFile != NULL) { if ((code = taosFsyncFile(pWal->pIdxFile)) != 0) { TAOS_CHECK_GOTO(terrno, &lino, _exit); diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 3832530218..29fb52e124 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -594,8 +594,7 @@ class TDDnode: def forcestop(self): if self.asan: - stopCmd = "%s -s stop -n dnode%d -x SIGKILL" + \ - (self.execPath, self.index) + stopCmd = "%s -s stop -n dnode%d -x SIGKILL" % (self.execPath, self.index) tdLog.info("execute script: " + stopCmd) os.system(stopCmd) return diff --git a/tests/system-test/0-others/wal_level_skip.py b/tests/system-test/0-others/wal_level_skip.py new file mode 100644 index 0000000000..30210a135e --- /dev/null +++ b/tests/system-test/0-others/wal_level_skip.py @@ -0,0 +1,172 @@ + + +import sys +import taos +import os +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + + def init(self, conn, logSql,replicaVar=1): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files or "taosd.exe" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def preData(self): + tdSql.execute("drop database if exists db0;") + tdSql.execute("create database db0 KEEP 30 vgroups 1 buffer 3 wal_level 0;") + tdSql.execute("create table if not exists db0.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);") + tdSql.execute("create table db0.ct1 using db0.stb tags(1000);") + tdSql.execute("create table db0.ct2 using db0.stb tags(2000);") + tdSql.execute("create table if not exists db0.ntb (ts timestamp, c1 int, c2 float, c3 double) ;") + tdSql.query("show db0.stables;") + tdSql.execute("insert into db0.ct1 values(now+0s, 10, 2.0, 3.0);") + tdSql.execute("insert into db0.ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, 12, 2.2, 3.2)(now+3s, 13, 2.3, 3.3);") + tdSql.execute("insert into db0.ntb values(now+2s, 10, 2.0, 3.0);") + + def insertData(self): + tdSql.execute("insert into db0.ct1 values(now+0s, 10, 2.0, 3.0);") + tdSql.execute("insert into db0.ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, 12, 2.2, 3.2)(now+3s, 13, 2.3, 3.3);") + tdSql.execute("insert into db0.ntb values(now+2s, 10, 2.0, 3.0);") + + def createSubTableAndInsertData(self): + tdSql.execute("create table db0.ct1 using db0.stb tags(1000);") + tdSql.execute("create table db0.ct2 using db0.stb tags(2000);") + tdSql.execute("create table if not exists db0.ntb (ts timestamp, c1 int, c2 float, c3 double) ;") + tdSql.execute("insert into db0.ct1 values(now+0s, 10, 2.0, 3.0);") + tdSql.execute("insert into db0.ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, 12, 2.2, 3.2)(now+3s, 13, 2.3, 3.3);") + tdSql.execute("insert into db0.ntb values(now+2s, 10, 2.0, 3.0);") + + + def alterWalLevel(self,level): + tdSql.execute("alter database db0 wal_level %d;"%level) + + def run(self): + tdSql.prepare() + + tdLog.info("-----------test for stop taosd before alter wal level-----------") + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdDnodes.stop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + tdLog.info(" alter wal level from 0 to 1") + self.alterWalLevel(1) + self.insertData() + tdDnodes.stop(1) + tdDnodes.start(1) + + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdDnodes.stop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + tdLog.info(" alter wal level from 0 to 2") + self.alterWalLevel(2) + self.insertData() + tdDnodes.forcestop(1) + tdDnodes.start(1) + + + tdLog.info("-----------test for kill taosd before alter wal level-----------") + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdDnodes.forcestop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + tdLog.info(" alter wal level from 0 to 1") + self.alterWalLevel(1) + tdDnodes.forcestop(1) + tdDnodes.start(1) + + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdDnodes.forcestop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + tdLog.info(" alter wal level from 0 to 2") + self.alterWalLevel(2) + tdDnodes.forcestop(1) + tdDnodes.start(1) + + tdLog.info("-----------test for stop taosd after alter wal level-----------") + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdLog.info(" alter wal level from 0 to 1") + self.alterWalLevel(1) + time.sleep(1) + self.insertData() + tdDnodes.stop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdLog.info(" alter wal level from 0 to 2") + self.alterWalLevel(2) + time.sleep(1) + self.insertData() + tdDnodes.stop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + tdLog.info("-----------test for kill taosd after alter wal level-----------") + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdLog.info(" alter wal level from 0 to 1") + self.alterWalLevel(1) + time.sleep(1) + self.insertData() + tdDnodes.forcestop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + + tdLog.info("create database wal_level = 0 and insert data") + self.preData() + tdLog.info(" alter wal level from 0 to 2") + self.alterWalLevel(2) + time.sleep(1) + self.insertData() + tdDnodes.forcestop(1) + time.sleep(2) + tdLog.info("restart taosd") + tdDnodes.start(1) + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From badc1037a94a5eb34dcf32e785935493b04e3a27 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Thu, 7 Nov 2024 17:44:25 +0800 Subject: [PATCH 02/11] Remove the wrong comments. --- source/libs/wal/src/walWrite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 4c2cc85986..1a9652b3bb 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -294,9 +294,9 @@ int32_t walRollback(SWal *pWal, int64_t ver) { static int32_t walRollImpl(SWal *pWal) { int32_t code = 0, lino = 0; - // if (pWal->cfg.level == TAOS_WAL_SKIP && pWal->pIdxFile != NULL && pWal->pLogFile != NULL) { - // TAOS_RETURN(TSDB_CODE_SUCCESS); - // } + if (pWal->cfg.level == TAOS_WAL_SKIP && pWal->pIdxFile != NULL && pWal->pLogFile != NULL) { + TAOS_RETURN(TSDB_CODE_SUCCESS); + } if (pWal->pIdxFile != NULL) { if ((code = taosFsyncFile(pWal->pIdxFile)) != 0) { TAOS_CHECK_GOTO(terrno, &lino, _exit); From 0178d734cb50139d6f97bd97e5dbaa0ec65d2c3d Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Fri, 8 Nov 2024 10:17:42 +0800 Subject: [PATCH 03/11] fix ci crash --- source/libs/wal/src/walMgmt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index ce213ca8e2..41adbf6e11 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -108,7 +108,7 @@ int32_t walInitWriteFileForSkip(SWal *pWal) { // switch file pWal->pIdxFile = pIdxTFile; pWal->pLogFile = pLogTFile; - pWal->writeCur = taosArrayGetSize(pWal->fileInfoSet) - 1; + pWal->writeCur = 0; TAOS_RETURN(TSDB_CODE_SUCCESS); } @@ -203,7 +203,8 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) { } else { code = walInitWriteFileForSkip(pWal); if (code < 0) { - wError("vgId:%d, cannot open wal since init write file for wal_level = 0 failed since %s", pWal->cfg.vgId, tstrerror(code)); + wError("vgId:%d, cannot open wal since init write file for wal_level = 0 failed since %s", pWal->cfg.vgId, + tstrerror(code)); goto _err; } } From 689c0f52549a40556553c7c442355bb6a42aa57f Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Fri, 8 Nov 2024 14:34:31 +0800 Subject: [PATCH 04/11] fix ci crash. --- source/libs/wal/src/walMgmt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 41adbf6e11..f9c0f05250 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -108,8 +108,12 @@ int32_t walInitWriteFileForSkip(SWal *pWal) { // switch file pWal->pIdxFile = pIdxTFile; pWal->pLogFile = pLogTFile; + SWalFileInfo fileInfo; + (void)memset(&fileInfo, -1, sizeof(SWalFileInfo)); + if (!taosArrayPush(pWal->fileInfoSet, &fileInfo)) { + TAOS_RETURN(TSDB_CODE_FAILED); + } pWal->writeCur = 0; - TAOS_RETURN(TSDB_CODE_SUCCESS); } From 164eeeecb5b469083f485bd1e047a9843098ef40 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Mon, 11 Nov 2024 09:06:54 +0800 Subject: [PATCH 05/11] add wal level 0 case --- tests/system-test/0-others/wal_level_skip.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/system-test/0-others/wal_level_skip.py b/tests/system-test/0-others/wal_level_skip.py index 30210a135e..2105ad0ada 100644 --- a/tests/system-test/0-others/wal_level_skip.py +++ b/tests/system-test/0-others/wal_level_skip.py @@ -1,5 +1,3 @@ - - import sys import taos import os From 5d66a2e239db042b4e7daa453051643df59e02b1 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Mon, 11 Nov 2024 11:21:25 +0800 Subject: [PATCH 06/11] add wal level 0 case --- tests/parallel_test/cases.task | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 151358aec3..38d298ba78 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -360,6 +360,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 -N 3 -f 0-others/wal_level_skip.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 1 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/splitVGroupWal.py -N 3 -n 1 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 3 From e930b1d2a6818057758177e4c05d0f4186ae0244 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Mon, 11 Nov 2024 13:47:05 +0800 Subject: [PATCH 07/11] fix ci 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 38d298ba78..ab98f0f119 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -360,7 +360,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 -N 3 -f 0-others/wal_level_skip.py +,,n,system-test,python3 ./test.py -f 0-others/wal_level_skip.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 1 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/splitVGroupWal.py -N 3 -n 1 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 3 From 9c24db5d03f79de5ddf836634a4999f34bea9455 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Tue, 12 Nov 2024 17:28:46 +0800 Subject: [PATCH 08/11] Add error log and close wal file. --- source/libs/wal/src/walMgmt.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index f9c0f05250..067e53223c 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -93,17 +93,22 @@ static int32_t walInitLock(SWal *pWal) { int32_t walInitWriteFileForSkip(SWal *pWal) { TdFilePtr pIdxTFile, pLogTFile; int64_t fileFirstVer = 0; + int32_t code = 0; char fnameStr[WAL_FILE_LEN]; walBuildIdxName(pWal, fileFirstVer, fnameStr); pIdxTFile = taosOpenFile(fnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); if (pIdxTFile == NULL) { - TAOS_RETURN(terrno); + wError("vgId:%d, failed to open file since %s", pWal->cfg.vgId, tstrerror(terrno)); + code = terrno; + goto _exit; } walBuildLogName(pWal, fileFirstVer, fnameStr); pLogTFile = taosOpenFile(fnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); if (pLogTFile == NULL) { - TAOS_RETURN(terrno); + wError("vgId:%d, failed to open file since %s", pWal->cfg.vgId, tstrerror(terrno)); + code = terrno; + goto _exit; } // switch file pWal->pIdxFile = pIdxTFile; @@ -111,10 +116,15 @@ int32_t walInitWriteFileForSkip(SWal *pWal) { SWalFileInfo fileInfo; (void)memset(&fileInfo, -1, sizeof(SWalFileInfo)); if (!taosArrayPush(pWal->fileInfoSet, &fileInfo)) { - TAOS_RETURN(TSDB_CODE_FAILED); + wError("vgId:%d, failed to push fileInfo into array since %s", pWal->cfg.vgId, tstrerror(terrno)); + code = terrno; + goto _exit; } pWal->writeCur = 0; - TAOS_RETURN(TSDB_CODE_SUCCESS); +_exit: + (void)taosCloseFile(&pIdxTFile); + (void)taosCloseFile(&pLogTFile); + TAOS_RETURN(code); } SWal *walOpen(const char *path, SWalCfg *pCfg) { From 095ad14bc8b45ccc77201b5d960aea7e613dd99d Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Tue, 12 Nov 2024 17:44:53 +0800 Subject: [PATCH 09/11] fix init ptr = NULL --- source/libs/wal/src/walMgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 067e53223c..12d9b170fb 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -91,7 +91,7 @@ static int32_t walInitLock(SWal *pWal) { } int32_t walInitWriteFileForSkip(SWal *pWal) { - TdFilePtr pIdxTFile, pLogTFile; + TdFilePtr pIdxTFile = NULL, pLogTFile = NULL; int64_t fileFirstVer = 0; int32_t code = 0; From bd9d85916278a23e37ce2f6cee60d5f7e56c9144 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Wed, 13 Nov 2024 09:45:57 +0800 Subject: [PATCH 10/11] fix ci error. --- source/libs/wal/src/walMgmt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 12d9b170fb..edf702b948 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -122,6 +122,10 @@ int32_t walInitWriteFileForSkip(SWal *pWal) { } pWal->writeCur = 0; _exit: + if (code != TSDB_CODE_SUCCESS) { + if (pIdxTFile) (void)taosCloseFile(&pIdxTFile); + if (pLogTFile) (void)taosCloseFile(&pLogTFile); + } (void)taosCloseFile(&pIdxTFile); (void)taosCloseFile(&pLogTFile); TAOS_RETURN(code); From 27f489fadfe5d64f0f3073fafe9e65d46c017465 Mon Sep 17 00:00:00 2001 From: xiao-77 Date: Wed, 13 Nov 2024 11:01:11 +0800 Subject: [PATCH 11/11] fix ci error. --- source/libs/wal/src/walMgmt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index edf702b948..e2c5e66158 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -123,11 +123,9 @@ int32_t walInitWriteFileForSkip(SWal *pWal) { pWal->writeCur = 0; _exit: if (code != TSDB_CODE_SUCCESS) { - if (pIdxTFile) (void)taosCloseFile(&pIdxTFile); - if (pLogTFile) (void)taosCloseFile(&pLogTFile); + (void)taosCloseFile(&pIdxTFile); + (void)taosCloseFile(&pLogTFile); } - (void)taosCloseFile(&pIdxTFile); - (void)taosCloseFile(&pLogTFile); TAOS_RETURN(code); }