diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index 598f449738..18da1d638c 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -56,25 +56,23 @@ static void *dmStatusThreadFp(void *param) { SDmNotifyHandle dmNotifyHdl = {.state = 0}; static void *dmNotifyThreadFp(void *param) { SDnodeMgmt *pMgmt = param; - int64_t lastTime = taosGetTimestampMs(); setThreadName("dnode-notify"); if (tsem_init(&dmNotifyHdl.sem, 0, 0) != 0) { return NULL; } + bool wait = true; while (1) { if (pMgmt->pData->dropped || pMgmt->pData->stopped) break; - - _wait: - tsem_wait(&dmNotifyHdl.sem); - _send: + if (wait) tsem_wait(&dmNotifyHdl.sem); atomic_store_8(&dmNotifyHdl.state, 1); dmSendNotifyReq(pMgmt); if (1 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 0)) { - goto _wait; + wait = true; + continue; } - goto _send; + wait = false; } return NULL; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index cbbee06e34..16bffce784 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -199,7 +199,7 @@ static inline void metaTimeSeriesNotifyCheck(SMeta *pMeta) { int64_t nTimeSeries = metaGetTimeSeriesNum(pMeta, 0); int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries; if (deltaTS > tsTimeSeriesThreshold) { - if (1 != atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 2)) { + if (0 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 2)) { tsem_post(&dmNotifyHdl.sem); } }