ehn: remove sync ref
This commit is contained in:
parent
c9509acf22
commit
72bc32af1e
|
@ -393,11 +393,6 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
|
||||||
return TAOS_SYNC_OTHER_ERROR;
|
return TAOS_SYNC_OTHER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndAcquireSyncRef(pMnode) != 0) {
|
|
||||||
mError("failed to process sync msg:%p type:%s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr());
|
|
||||||
return TAOS_SYNC_OTHER_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
char logBuf[512] = {0};
|
char logBuf[512] = {0};
|
||||||
char *syncNodeStr = sync2SimpleStr(pMgmt->sync);
|
char *syncNodeStr = sync2SimpleStr(pMgmt->sync);
|
||||||
snprintf(logBuf, sizeof(logBuf), "==vnodeProcessSyncReq== msgType:%d, syncNode: %s", pMsg->msgType, syncNodeStr);
|
snprintf(logBuf, sizeof(logBuf), "==vnodeProcessSyncReq== msgType:%d, syncNode: %s", pMsg->msgType, syncNodeStr);
|
||||||
|
@ -501,7 +496,6 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mndReleaseSyncRef(pMnode);
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,24 +748,3 @@ void mndSetStop(SMnode *pMnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mndGetStop(SMnode *pMnode) { return pMnode->stopped; }
|
bool mndGetStop(SMnode *pMnode) { return pMnode->stopped; }
|
||||||
|
|
||||||
int32_t mndAcquireSyncRef(SMnode *pMnode) {
|
|
||||||
int32_t code = 0;
|
|
||||||
taosThreadRwlockRdlock(&pMnode->lock);
|
|
||||||
if (pMnode->stopped) {
|
|
||||||
terrno = TSDB_CODE_APP_NOT_READY;
|
|
||||||
code = -1;
|
|
||||||
} else {
|
|
||||||
int32_t ref = atomic_add_fetch_32(&pMnode->syncRef, 1);
|
|
||||||
// mTrace("mnode sync is acquired, ref:%d", ref);
|
|
||||||
}
|
|
||||||
taosThreadRwlockUnlock(&pMnode->lock);
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mndReleaseSyncRef(SMnode *pMnode) {
|
|
||||||
taosThreadRwlockRdlock(&pMnode->lock);
|
|
||||||
int32_t ref = atomic_sub_fetch_32(&pMnode->syncRef, 1);
|
|
||||||
// mTrace("mnode sync is released, ref:%d", ref);
|
|
||||||
taosThreadRwlockUnlock(&pMnode->lock);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue