MCPcopy Create free account
hub / github.com/Tencent/phxpaxos / OnSendCheckpoint_End

Method OnSendCheckpoint_End

src/algorithm/learner.cpp:771–826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769}
770
771int Learner :: OnSendCheckpoint_End(const CheckpointMsg & oCheckpointMsg)
772{
773 if (!m_oCheckpointReceiver.IsReceiverFinish(oCheckpointMsg.nodeid(),
774 oCheckpointMsg.uuid(), oCheckpointMsg.sequence()))
775 {
776 PLGErr("receive end msg but receiver not finish");
777 return -1;
778 }
779
780 BP->GetCheckpointBP()->ReceiveCheckpointDone();
781
782 std::vector<StateMachine *> vecSMList = m_poSMFac->GetSMList();
783 for (auto & poSM : vecSMList)
784 {
785 if (poSM->SMID() == SYSTEM_V_SMID
786 || poSM->SMID() == MASTER_V_SMID)
787 {
788 //system variables sm no checkpoint
789 //master variables sm no checkpoint
790 continue;
791 }
792
793 string sTmpDirPath = m_oCheckpointReceiver.GetTmpDirPath(poSM->SMID());
794 std::vector<std::string> vecFilePathList;
795
796 int ret = FileUtils :: IterDir(sTmpDirPath, vecFilePathList);
797 if (ret != 0)
798 {
799 PLGErr("IterDir fail, dirpath %s", sTmpDirPath.c_str());
800 }
801
802 if (vecFilePathList.size() == 0)
803 {
804 PLGImp("this sm %d have no checkpoint", poSM->SMID());
805 continue;
806 }
807
808 ret = poSM->LoadCheckpointState(
809 m_poConfig->GetMyGroupIdx(),
810 sTmpDirPath,
811 vecFilePathList,
812 oCheckpointMsg.checkpointinstanceid());
813 if (ret != 0)
814 {
815 BP->GetCheckpointBP()->ReceiveCheckpointAndLoadFail();
816 return ret;
817 }
818
819 }
820
821 BP->GetCheckpointBP()->ReceiveCheckpointAndLoadSucc();
822 PLGImp("All sm load state ok, start to exit process");
823 exit(-1);
824
825 return 0;
826}
827
828void Learner :: OnSendCheckpoint(const CheckpointMsg & oCheckpointMsg)

Callers

nothing calls this directly

Calls 6

ReceiveCheckpointDoneMethod · 0.80
sizeMethod · 0.80
SMIDMethod · 0.45
LoadCheckpointStateMethod · 0.45

Tested by

no test coverage detected