From 81c4f26c59ac74e65671e6b3920bbaa4e77cbba0 Mon Sep 17 00:00:00 2001 From: dmchen Date: Wed, 21 Aug 2024 04:23:42 +0000 Subject: [PATCH] fix/TD-31560 --- source/dnode/mnode/sdb/src/sdbFile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index 6fb395e63f..9073032738 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -52,6 +52,8 @@ static void sdbResetData(SSdb *pSdb) { SHashObj *hash = pSdb->hashObjs[i]; if (hash == NULL) continue; + sdbWriteLock(pSdb, i); + SSdbRow **ppRow = taosHashIterate(hash, NULL); while (ppRow != NULL) { SSdbRow *pRow = *ppRow; @@ -60,15 +62,13 @@ static void sdbResetData(SSdb *pSdb) { sdbFreeRow(pSdb, pRow, true); ppRow = taosHashIterate(hash, ppRow); } - } - - for (ESdbType i = 0; i < SDB_MAX; ++i) { - SHashObj *hash = pSdb->hashObjs[i]; - if (hash == NULL) continue; taosHashClear(pSdb->hashObjs[i]); pSdb->tableVer[i] = 0; pSdb->maxId[i] = 0; + + sdbUnLock(pSdb, i); + mInfo("sdb:%s is reset", sdbTableName(i)); }