def test_the_same_order_as_in_NodeInBox_after_vc_continued(pre_vc_strategy):
    replica = pre_vc_strategy.replica
    pre_vc_strategy.view_changer.view_no = 1
    m1 = (InstanceChange(3, 25), "Beta")
    m2 = (InstanceChange(3, 25), "Gamma")
    pre_vc_strategy.stashedNodeInBox.append(m1)
    pre_vc_strategy.stashedNodeInBox.append(m2)
    assert len(pre_vc_strategy.node.nodeInBox) == 0
    pre_vc_strategy.on_view_change_continued(replica, ViewChangeContinueMessage(2))
    assert len(pre_vc_strategy.node.nodeInBox) > 0
    assert pre_vc_strategy.node.nodeInBox.popleft() == m1
    assert pre_vc_strategy.node.nodeInBox.popleft() == m2
 async def on_view_change_started(node, msg: ViewChangeStartMessage, frm):
     strategy = node.view_changer.pre_vc_strategy
     proposed_view_no = msg.proposed_view_no
     if proposed_view_no > node.view_changer.view_no:
         vcc_msg = ViewChangeContinueMessage(proposed_view_no)
         quota = Quota(
             count=node.config.EXTENDED_QUOTA_MULTIPLIER_BEFORE_VC * node.quota_control.node_quota.count,
             size=node.config.EXTENDED_QUOTA_MULTIPLIER_BEFORE_VC * node.quota_control.node_quota.size)
         await node.nodestack.service(limit=None,
                                      quota=quota)
         strategy.stashedNodeInBox = await VCStartMsgStrategy._process_node_inbox_3PC(node)
         node.master_replica.inBox.append(vcc_msg)
Example #3
0
 async def on_view_change_started(node, msg: ViewChangeStartMessage, frm):
     strategy = node.view_changer.pre_vc_strategy
     proposed_view_no = msg.proposed_view_no
     logger.info(
         "VCStartMsgStrategy: got ViewChangeStartMessage with proposed_view_no: {}"
         .format(proposed_view_no))
     if proposed_view_no > node.view_changer.view_no:
         vcc_msg = ViewChangeContinueMessage(proposed_view_no)
         quota = Quota(
             count=node.config.EXTENDED_QUOTA_MULTIPLIER_BEFORE_VC *
             node.quota_control.node_quota.count,
             size=node.config.EXTENDED_QUOTA_MULTIPLIER_BEFORE_VC *
             node.quota_control.node_quota.size)
         msgs_count = await node.nodestack.service(limit=None, quota=quota)
         logger.info(
             "VCStartMsgStrategy: Got {} messages from nodestack".format(
                 msgs_count))
         strategy.stashedNodeInBox = await VCStartMsgStrategy._process_node_inbox_3PC(
             node)
         logger.info(
             "VCStartMsgStrategy: {} not 3PC msgs was stashed".format(
                 len(strategy.stashedNodeInBox)))
         node.master_replica.inBox.append(vcc_msg)
def test_is_preparing_to_False_after_vc_continue(pre_vc_strategy):
    replica = pre_vc_strategy.replica
    pre_vc_strategy.is_preparing = True
    pre_vc_strategy.on_view_change_continued(replica, ViewChangeContinueMessage(2))
    assert pre_vc_strategy.is_preparing == False