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

Method SendNowInstanceID

src/algorithm/learner.cpp:312–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312void Learner :: SendNowInstanceID(const uint64_t llInstanceID, const nodeid_t iSendNodeID)
313{
314 BP->GetLearnerBP()->SendNowInstanceID();
315
316 PaxosMsg oPaxosMsg;
317 oPaxosMsg.set_instanceid(llInstanceID);
318 oPaxosMsg.set_nodeid(m_poConfig->GetMyNodeID());
319 oPaxosMsg.set_msgtype(MsgType_PaxosLearner_SendNowInstanceID);
320 oPaxosMsg.set_nowinstanceid(GetInstanceID());
321 oPaxosMsg.set_minchoseninstanceid(m_poCheckpointMgr->GetMinChosenInstanceID());
322
323 if ((GetInstanceID() - llInstanceID) > 50)
324 {
325 //instanceid too close not need to send vsm/master checkpoint.
326 string sSystemVariablesCPBuffer;
327 int ret = m_poConfig->GetSystemVSM()->GetCheckpointBuffer(sSystemVariablesCPBuffer);
328 if (ret == 0)
329 {
330 oPaxosMsg.set_systemvariables(sSystemVariablesCPBuffer);
331 }
332
333 string sMasterVariablesCPBuffer;
334 if (m_poConfig->GetMasterSM() != nullptr)
335 {
336 int ret = m_poConfig->GetMasterSM()->GetCheckpointBuffer(sMasterVariablesCPBuffer);
337 if (ret == 0)
338 {
339 oPaxosMsg.set_mastervariables(sMasterVariablesCPBuffer);
340 }
341 }
342 }
343
344 SendMessage(iSendNodeID, oPaxosMsg);
345}
346
347void Learner :: OnSendNowInstanceID(const PaxosMsg & oPaxosMsg)
348{

Callers

nothing calls this directly

Calls 1

SendNowInstanceIDMethod · 0.80

Tested by

no test coverage detected