fix: stop sync after queue is empty

This commit is contained in:
Shengliang Guan 2022-05-23 18:15:31 +08:00
parent 8bfbc0f315
commit 5ec450d01c
1 changed files with 6 additions and 1 deletions

View File

@ -109,11 +109,15 @@ int32_t mndInitSync(SMnode *pMnode) {
return -1; return -1;
} }
mDebug("mnode sync is opened, id:%" PRId64, pMgmt->sync);
return 0; return 0;
} }
void mndCleanupSync(SMnode *pMnode) { void mndCleanupSync(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt; SSyncMgmt *pMgmt = &pMnode->syncMgmt;
syncStop(pMgmt->sync);
mDebug("sync:%" PRId64 " is stopped", pMgmt->sync);
tsem_destroy(&pMgmt->syncSem); tsem_destroy(&pMgmt->syncSem);
if (pMgmt->pWal != NULL) { if (pMgmt->pWal != NULL) {
walClose(pMgmt->pWal); walClose(pMgmt->pWal);
@ -163,9 +167,10 @@ void mndSyncStart(SMnode *pMnode) {
} }
pMnode->syncMgmt.restored = true; pMnode->syncMgmt.restored = true;
mDebug("sync:%" PRId64 " is started", pMnode->syncMgmt.sync);
} }
void mndSyncStop(SMnode *pMnode) { syncStop(pMnode->syncMgmt.sync); } void mndSyncStop(SMnode *pMnode) {}
bool mndIsMaster(SMnode *pMnode) { bool mndIsMaster(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt; SSyncMgmt *pMgmt = &pMnode->syncMgmt;