Beispiel #1
0
def impl(context, seg_type, content, expected_status):
    if seg_type == "primary":
        preferred_role = 'p'
    elif seg_type == "mirror":
        preferred_role = 'm'
    else:
        raise Exception(
            "Invalid segment type %s (options are primary and mirror)" %
            seg_type)

    # it takes gp_fts_mark_mirror_down_grace_period seconds between fts probes
    # for fts to mark a mirror as down.  That guc is not settable per session;
    # it must be changed for the database.
    timeout = 3
    if preferred_role == 'm':
        orig = get_guc_value("gp_fts_mark_mirror_down_grace_period")
        set_guc_value(context, "gp_fts_mark_mirror_down_grace_period", timeout)
        utils.trigger_fts_probe()
        for i in range(1, 4):
            time.sleep(
                timeout + 1
            )  # Sleep an extra second since the timing isn't necessarily exact
            utils.trigger_fts_probe()
            if has_expected_status(content, preferred_role, expected_status):
                break
        set_guc_value(context, "gp_fts_mark_mirror_down_grace_period", orig)

    must_have_expected_status(content, preferred_role, expected_status)
def step_impl(context):
    trigger_fts_probe()
    run_gprecoverseg()

    ensure_primary_mirror_switched_roles()
def step_impl(context):
    trigger_fts_probe()
    run_gprecoverseg()

    ensure_primary_mirror_switched_roles()