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

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

Open ziyinweixiao opened 4 years ago

ziyinweixiao commented 4 years ago

为什么提案通过后,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);

}