Exemple #1
0
def impl(context, seg_type, content):
    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)

    with dbconn.connect(dbconn.DbURL(dbname="template1"),
                        unsetSearchPath=False) as conn:
        dbid, hostname = dbconn.execSQLForSingletonRow(
            conn,
            "SELECT dbid, hostname FROM gp_segment_configuration WHERE content = %s AND preferred_role = '%s'"
            % (content, preferred_role))
    if not hasattr(context, 'old_hostnames'):
        context.old_hostnames = {}
    context.old_hostnames[(content, preferred_role)] = hostname
    change_hostname(content, preferred_role, 'invalid_host')

    if not hasattr(context, 'down_segment_dbids'):
        context.down_segment_dbids = []
    context.down_segment_dbids.append(dbid)

    wait_for_unblocked_transactions(context)
def step_impl(context):
    host, datadir = query_sql("postgres",
        "SELECT hostname, datadir FROM gp_segment_configuration WHERE role='m' AND content=0"
    ).fetchone()

    # NOTE that these commands are manually escaped; beware when adding dollar
    # signs or double-quotes!
    cmd = "ps aux | grep '[p]ostgres .* %s' | awk '{print \$2}' | xargs kill -9" % datadir
    cmd = 'ssh %s "%s"' % (host, cmd)
    run_command(context, cmd)

    # If the kill succeeds, recover the mirror when this test is done.
    def recover():
        run_command(context, "gprecoverseg -a")
    context.add_cleanup(recover)

    wait_for_unblocked_transactions(context)
Exemple #3
0
def step_impl(context):
    run_command(
        context,
        "ps aux | grep dbfast_mirror1 | awk '{print $2}' | xargs kill -9")
    wait_for_unblocked_transactions(context)
Exemple #4
0
def step_impl(context):
    stop_primary(context, 0)
    wait_for_unblocked_transactions(context)
def step_impl(context):
    run_command(context, "ps aux | grep dbfast_mirror1 | awk '{print $2}' | xargs kill -9")
    wait_for_unblocked_transactions(context)
def step_impl(context):
    stop_primary(context, 0)
    wait_for_unblocked_transactions(context)