提交 0dfa6c0c 编写于 作者: S Shengliang Guan

fix: condition of syncIsReady is wrong

上级 34b6ecaf
...@@ -263,13 +263,15 @@ void mndSyncStart(SMnode *pMnode) { ...@@ -263,13 +263,15 @@ void mndSyncStart(SMnode *pMnode) {
void mndSyncStop(SMnode *pMnode) { void mndSyncStop(SMnode *pMnode) {
if (pMnode->syncMgmt.transId != 0) { if (pMnode->syncMgmt.transId != 0) {
tsem_post(&pMnode->syncMgmt.syncSem); tsem_post(&pMnode->syncMgmt.syncSem);
pMnode->syncMgmt.transId = 0;
} }
} }
bool mndIsMaster(SMnode *pMnode) { bool mndIsMaster(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt; 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; terrno = TSDB_CODE_SYN_NOT_LEADER;
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册