Tencent / phxpaxos

The Paxos library implemented in C++ that has been used in the WeChat production environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

提案通过后,为啥leader节点先执行状态机

ziyinweixiao opened this issue · comments

为什么提案通过后,leader 先执行状态机,这个优化点算是优化在哪里
void Learner :: ProposerSendSuccess(
const uint64_t llLearnInstanceID,
const uint64_t llProposalID)
{
BP->GetLearnerBP()->ProposerSendSuccess();

PaxosMsg oPaxosMsg;

oPaxosMsg.set_msgtype(MsgType_PaxosLearner_ProposerSendSuccess);
oPaxosMsg.set_instanceid(llLearnInstanceID);

NodeIDMsg * oNodeIDMsg = oPaxosMsg.mutable_nodeid();
NodeID2NodeIDMsg(m_poConfig->GetMyNodeID(), oNodeIDMsg);

oPaxosMsg.set_proposalid(llProposalID);
oPaxosMsg.set_lastchecksum(GetLastChecksum());

//run self first
BroadcastMessage(oPaxosMsg, BroadcastMessage_Type_RunSelf_First);

}