| 545 | } |
| 546 | |
| 547 | int Instance :: ReceiveMsgForProposer(const PaxosMsg & oPaxosMsg) |
| 548 | { |
| 549 | if (m_poConfig->IsIMFollower()) |
| 550 | { |
| 551 | PLGErr("I'm follower, skip this message"); |
| 552 | return 0; |
| 553 | } |
| 554 | |
| 555 | /////////////////////////////////////////////////////////////// |
| 556 | |
| 557 | if (oPaxosMsg.instanceid() != m_oProposer.GetInstanceID()) |
| 558 | { |
| 559 | if (oPaxosMsg.instanceid() + 1 == m_oProposer.GetInstanceID()) |
| 560 | { |
| 561 | //Exipred reply msg on last instance. |
| 562 | //If the response of a node is always slower than the majority node, |
| 563 | //then the message of the node is always ignored even if it is a reject reply. |
| 564 | //In this case, if we do not deal with these reject reply, the node that |
| 565 | //gave reject reply will always give reject reply. |
| 566 | //This causes the node to remain in catch-up state. |
| 567 | // |
| 568 | //To avoid this problem, we need to deal with the expired reply. |
| 569 | if (oPaxosMsg.msgtype() == MsgType_PaxosPrepareReply) |
| 570 | { |
| 571 | m_oProposer.OnExpiredPrepareReply(oPaxosMsg); |
| 572 | } |
| 573 | else if (oPaxosMsg.msgtype() == MsgType_PaxosAcceptReply) |
| 574 | { |
| 575 | m_oProposer.OnExpiredAcceptReply(oPaxosMsg); |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | BP->GetInstanceBP()->OnReceivePaxosProposerMsgInotsame(); |
| 580 | //PLGErr("InstanceID not same, skip msg"); |
| 581 | return 0; |
| 582 | } |
| 583 | |
| 584 | if (oPaxosMsg.msgtype() == MsgType_PaxosPrepareReply) |
| 585 | { |
| 586 | m_oProposer.OnPrepareReply(oPaxosMsg); |
| 587 | } |
| 588 | else if (oPaxosMsg.msgtype() == MsgType_PaxosAcceptReply) |
| 589 | { |
| 590 | m_oProposer.OnAcceptReply(oPaxosMsg); |
| 591 | } |
| 592 | |
| 593 | return 0; |
| 594 | } |
| 595 | |
| 596 | int Instance :: ReceiveMsgForAcceptor(const PaxosMsg & oPaxosMsg, const bool bIsRetry) |
| 597 | { |
nothing calls this directly
no test coverage detected