From d47fe255aebe00e1d67571cd415c3d85a2c84711 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 14 Jun 2024 17:09:48 +0800 Subject: [PATCH] remova level 0's empty wals when closing vnode --- source/libs/parser/src/parTranslater.c | 4 ++-- source/libs/wal/src/walMgmt.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 89d256fce0..2bdee5e3bf 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -7275,7 +7275,7 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm "Invalid option, wal_level 0 should be used with replica 1"); } } - /* +#if 0 if (pStmt->pOptions->replica > 1 && pStmt->pOptions->walLevel < 1) { SDbCfgInfo dbCfg = {0}; dbCfg.walLevel = -1; @@ -7285,7 +7285,7 @@ static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStm "Invalid option, wal_level 0 should be used with replica 1"); } } - */ +#endif int32_t code = checkDatabaseOptions(pCxt, pStmt->dbName, pStmt->pOptions); if (TSDB_CODE_SUCCESS != code) { return code; diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 54e6abd85a..219bbd9664 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -233,6 +233,12 @@ void walClose(SWal *pWal) { taosThreadMutexUnlock(&pWal->mutex); taosRemoveRef(tsWal.refSetId, pWal->refId); + + if (pWal->cfg.level == TAOS_WAL_SKIP) { + wInfo("vgId:%d, remove all wals, path:%s", pWal->cfg.vgId, pWal->path); + taosRemoveDir(pWal->path); + taosMkDir(pWal->path); + } } static void walFreeObj(void *wal) {