fix: condition of syncIsReady is wrong

This commit is contained in:
Shengliang Guan 2022-06-16 19:46:57 +08:00
parent 34b6ecafba
commit 0dfa6c0c6a
1 changed files with 3 additions and 1 deletions

View File

@ -263,13 +263,15 @@ void mndSyncStart(SMnode *pMnode) {
void mndSyncStop(SMnode *pMnode) {
if (pMnode->syncMgmt.transId != 0) {
tsem_post(&pMnode->syncMgmt.syncSem);
pMnode->syncMgmt.transId = 0;
}
}
bool mndIsMaster(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
if (!syncIsReady(pMgmt->sync)) {
ESyncState state = syncGetMyRole(pMgmt->sync);
if (state != TAOS_SYNC_STATE_LEADER) {
terrno = TSDB_CODE_SYN_NOT_LEADER;
return false;
}