def test_removed_replica_restored_on_view_change(
        looper, txnPoolNodeSet, sdk_pool_handle, sdk_wallet_client,
        tconf, tdir, allPluginsPath, chkFreqPatched, view_change):
    """
    1. Remove replica on some node which is not master primary
    2. Reconnect the node which was master primary so far
    3. Check that nodes and replicas correctly added
    """
    ensureElectionsDone(looper=looper, nodes=txnPoolNodeSet)
    node = get_last_master_non_primary_node(txnPoolNodeSet)
    start_replicas_count = node.replicas.num_replicas
    instance_id = start_replicas_count - 1

    node.replicas.remove_replica(instance_id)
    check_replica_removed(node, start_replicas_count, instance_id)

    # trigger view change on all nodes
    master_primary = get_master_primary_node(txnPoolNodeSet)
    disconnect_node_and_ensure_disconnected(looper, txnPoolNodeSet, master_primary)
    txnPoolNodeSet.remove(master_primary)
    looper.removeProdable(master_primary)
    looper.runFor(tconf.ToleratePrimaryDisconnection + 2)

    restarted_node = start_stopped_node(master_primary, looper, tconf, tdir, allPluginsPath)
    txnPoolNodeSet.append(restarted_node)
    looper.run(checkNodesConnected(txnPoolNodeSet))

    waitForViewChange(looper, txnPoolNodeSet, expectedViewNo=1,
                      customTimeout=2 * tconf.VIEW_CHANGE_TIMEOUT)
    ensureElectionsDone(looper=looper, nodes=txnPoolNodeSet)

    assert start_replicas_count == node.replicas.num_replicas
 def check_replica_removed_on_all_nodes(inst_id=instance_to_remove):
     for n in txnPoolNodeSet:
         check_replica_removed(n,
                               start_replicas_count,
                               inst_id)
         assert not n.monitor.isMasterDegraded()
         assert len(n.requests) == 0
def test_replica_removal(looper, txnPoolNodeSet, sdk_pool_handle,
                         sdk_wallet_client, chkFreqPatched, view_change):

    node = txnPoolNodeSet[0]
    start_replicas_count = node.replicas.num_replicas
    instance_id = start_replicas_count - 1

    node.replicas.remove_replica(instance_id)

    check_replica_removed(node, start_replicas_count, instance_id)
def test_replica_removal(looper,
                         txnPoolNodeSet,
                         sdk_pool_handle,
                         sdk_wallet_client,
                         chkFreqPatched,
                         view_change):

    node = txnPoolNodeSet[0]
    start_replicas_count = node.replicas.num_replicas
    instance_id = start_replicas_count - 1

    node.replicas.remove_replica(instance_id)

    check_replica_removed(node, start_replicas_count, instance_id)
Example #5
0
def test_removed_replica_restored_on_view_change(looper, txnPoolNodeSet,
                                                 sdk_pool_handle,
                                                 sdk_wallet_client, tconf,
                                                 tdir, allPluginsPath,
                                                 chkFreqPatched, view_change):
    """
    1. Remove replica on some node which is not master primary
    2. Reconnect the node which was master primary so far
    3. Check that nodes and replicas correctly added
    """
    ensureElectionsDone(looper=looper, nodes=txnPoolNodeSet)
    node = get_last_master_non_primary_node(txnPoolNodeSet)
    start_replicas_count = node.replicas.num_replicas
    instance_id = start_replicas_count - 1

    node.replicas.remove_replica(instance_id)
    check_replica_removed(node, start_replicas_count, instance_id)

    # trigger view change on all nodes
    master_primary = get_master_primary_node(txnPoolNodeSet)
    disconnect_node_and_ensure_disconnected(looper, txnPoolNodeSet,
                                            master_primary)
    txnPoolNodeSet.remove(master_primary)
    looper.removeProdable(master_primary)
    looper.runFor(tconf.ToleratePrimaryDisconnection + 2)

    restarted_node = start_stopped_node(master_primary, looper, tconf, tdir,
                                        allPluginsPath)
    txnPoolNodeSet.append(restarted_node)
    looper.run(checkNodesConnected(txnPoolNodeSet))

    waitForViewChange(looper,
                      txnPoolNodeSet,
                      expectedViewNo=1,
                      customTimeout=2 * tconf.VIEW_CHANGE_TIMEOUT)
    ensureElectionsDone(looper=looper, nodes=txnPoolNodeSet)

    assert start_replicas_count == node.replicas.num_replicas
    ensure_all_nodes_have_same_data(looper, txnPoolNodeSet)
Example #6
0
 def check_replica_removed_on_all_nodes():
     for node in txnPoolNodeSet:
         check_replica_removed(node, start_replicas_count,
                               instance_to_remove)
 def check_replica_removed_on_all_nodes(inst_id=instance_to_remove):
     for node in txnPoolNodeSet:
         check_replica_removed(node, start_replicas_count, inst_id)
         assert not node.monitor.isMasterDegraded()
         assert len(node.requests) == 0
 def check_replica_removed_on_all_nodes():
     for node in txnPoolNodeSet:
         check_replica_removed(node,
                               start_replicas_count,
                               instance_to_remove)