Tencent / phxpaxos

The Paxos library implemented in C++ that has been used in the WeChat production environment.
Other
3.36k stars 863 forks source link

请问夺主时,BeforePropose起到什么作用? #191

Open liuliuwd opened 3 years ago

liuliuwd commented 3 years ago

请问LearnMaster方法中,下面这段逻辑什么情况下会成立? if (oMasterOper.lastversion() != 0 && llInstanceID > m_llMasterVersion && oMasterOper.lastversion() != m_llMasterVersion) { BP->GetMasterBP()->MasterSMInconsistent(); PLG1Err("other last version %lu not same to my last version %lu, instanceid %lu", oMasterOper.lastversion(), m_llMasterVersion, llInstanceID);

    PLG1Err("try to fix, set my master version %lu as other last version %lu, instanceid %lu",
            m_llMasterVersion, oMasterOper.lastversion(), llInstanceID);
    m_llMasterVersion = oMasterOper.lastversion();
}