diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 31f2ef037aed0b2bb90248b932ba687a2f7c4bd3..629451a7223cb0530f775a550151d3aaf07468eb 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -68,9 +68,12 @@ int32_t walInit() { } void walCleanUp() { + int old = atomic_val_compare_exchange_8(&tsWal.inited, 1, 0); + if(old == 0) { + return; + } walStopThread(); taosCloseRef(tsWal.refSetId); - atomic_store_8(&tsWal.inited, 0); wInfo("wal module is cleaned up"); }