| 465 | } |
| 466 | |
| 467 | void Learner :: OnSendLearnValue(const PaxosMsg & oPaxosMsg) |
| 468 | { |
| 469 | BP->GetLearnerBP()->OnSendLearnValue(); |
| 470 | |
| 471 | PLGHead("START Msg.InstanceID %lu Now.InstanceID %lu Msg.ballot_proposalid %lu Msg.ballot_nodeid %lu Msg.ValueSize %zu", |
| 472 | oPaxosMsg.instanceid(), GetInstanceID(), oPaxosMsg.proposalid(), |
| 473 | oPaxosMsg.nodeid(), oPaxosMsg.value().size()); |
| 474 | |
| 475 | if (oPaxosMsg.instanceid() > GetInstanceID()) |
| 476 | { |
| 477 | PLGDebug("[Latest Msg] i can't learn"); |
| 478 | return; |
| 479 | } |
| 480 | |
| 481 | if (oPaxosMsg.instanceid() < GetInstanceID()) |
| 482 | { |
| 483 | PLGDebug("[Lag Msg] no need to learn"); |
| 484 | } |
| 485 | else |
| 486 | { |
| 487 | //learn value |
| 488 | BallotNumber oBallot(oPaxosMsg.proposalid(), oPaxosMsg.proposalnodeid()); |
| 489 | int ret = m_oLearnerState.LearnValue(oPaxosMsg.instanceid(), oBallot, oPaxosMsg.value(), GetLastChecksum()); |
| 490 | if (ret != 0) |
| 491 | { |
| 492 | PLGErr("LearnState.LearnValue fail, ret %d", ret); |
| 493 | return; |
| 494 | } |
| 495 | |
| 496 | PLGHead("END LearnValue OK, proposalid %lu proposalid_nodeid %lu valueLen %zu", |
| 497 | oPaxosMsg.proposalid(), oPaxosMsg.nodeid(), oPaxosMsg.value().size()); |
| 498 | } |
| 499 | |
| 500 | if (oPaxosMsg.flag() == PaxosMsgFlagType_SendLearnValue_NeedAck) |
| 501 | { |
| 502 | //every time' when receive valid need ack learn value, reset noop timeout. |
| 503 | Reset_AskforLearn_Noop(); |
| 504 | |
| 505 | SendLearnValue_Ack(oPaxosMsg.nodeid()); |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | void Learner :: SendLearnValue_Ack(const nodeid_t iSendNodeID) |
| 510 | { |
nothing calls this directly
no test coverage detected