| 769 | } |
| 770 | |
| 771 | int 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 | |
| 828 | void Learner :: OnSendCheckpoint(const CheckpointMsg & oCheckpointMsg) |
nothing calls this directly
no test coverage detected