fix/TD-31560

This commit is contained in:
dmchen 2024-08-21 04:23:42 +00:00
parent 641fccaa93
commit 81c4f26c59
1 changed files with 5 additions and 5 deletions

View File

@ -52,6 +52,8 @@ static void sdbResetData(SSdb *pSdb) {
SHashObj *hash = pSdb->hashObjs[i]; SHashObj *hash = pSdb->hashObjs[i];
if (hash == NULL) continue; if (hash == NULL) continue;
sdbWriteLock(pSdb, i);
SSdbRow **ppRow = taosHashIterate(hash, NULL); SSdbRow **ppRow = taosHashIterate(hash, NULL);
while (ppRow != NULL) { while (ppRow != NULL) {
SSdbRow *pRow = *ppRow; SSdbRow *pRow = *ppRow;
@ -60,15 +62,13 @@ static void sdbResetData(SSdb *pSdb) {
sdbFreeRow(pSdb, pRow, true); sdbFreeRow(pSdb, pRow, true);
ppRow = taosHashIterate(hash, ppRow); 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]); taosHashClear(pSdb->hashObjs[i]);
pSdb->tableVer[i] = 0; pSdb->tableVer[i] = 0;
pSdb->maxId[i] = 0; pSdb->maxId[i] = 0;
sdbUnLock(pSdb, i);
mInfo("sdb:%s is reset", sdbTableName(i)); mInfo("sdb:%s is reset", sdbTableName(i));
} }