예제 #1
0
def impl(context, dbname):
    if hasattr(context, 'backup_timestamp'):
        ts = context.backup_timestamp
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    command = 'gp_restore -i --gp-k %s --gp-d db_dumps/%s --gp-i --gp-r db_dumps/%s --gp-l=p -d %s --gp-c --gp-nostats --netbackup-service-host %s' % (ts, context.backup_subdir, context.backup_subdir, dbname, netbackup_service_host)
    run_gpcommand(context, command)
예제 #2
0
def impl(context):
    if hasattr(context, 'backup_timestamp'):
        ts = context.backup_timestamp
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    command = 'gpdbrestore -e -a -t ' + ts + " --netbackup-service-host " + netbackup_service_host
    run_gpcommand(context, command)
예제 #3
0
def impl(context):
    if hasattr(context, 'backup_timestamp'):
        ts = context.backup_timestamp
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    command = 'gpdbrestore -e -a -t ' + ts + " --netbackup-service-host " + netbackup_service_host
    run_gpcommand(context, command)
예제 #4
0
def impl(context, dbname):
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    command = 'gp_restore -i --gp-k %s --gp-d db_dumps/%s --gp-i --gp-r db_dumps/%s --gp-l=p -d %s --gp-c --netbackup-service-host %s' % (
        context.backup_timestamp, context.backup_subdir, context.backup_subdir,
        dbname, netbackup_service_host)
    run_gpcommand(context, command)
예제 #5
0
def impl(context, options):
    if hasattr(context, 'backup_timestamp'):
        ts = context.backup_timestamp
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    command = 'gpdbrestore -t %s %s --list-backup --netbackup-service-host %s' % (ts, options, netbackup_service_host)
    run_gpcommand(context, command)
예제 #6
0
def impl(context, cmd_str):
    if hasattr(context, "netbackup_service_host"):
        netbackup_service_host = context.netbackup_service_host
    if hasattr(context, "netbackup_policy"):
        netbackup_policy = context.netbackup_policy
    if hasattr(context, "netbackup_schedule"):
        netbackup_schedule = context.netbackup_schedule
    bnr_tool = cmd_str.split()[0].strip()
    if bnr_tool == "gpcrondump":
        command_str = (
            cmd_str
            + " --netbackup-service-host "
            + netbackup_service_host
            + " --netbackup-policy "
            + netbackup_policy
            + " --netbackup-schedule "
            + netbackup_schedule
        )
    elif bnr_tool == "gpdbrestore":
        command_str = cmd_str + " --netbackup-service-host " + netbackup_service_host
    elif bnr_tool == "gp_dump":
        command_str = (
            cmd_str
            + " --netbackup-service-host "
            + netbackup_service_host
            + " --netbackup-policy "
            + netbackup_policy
            + " --netbackup-schedule "
            + netbackup_schedule
        )
    elif bnr_tool == "gp_restore":
        command_str = cmd_str + " --netbackup-service-host " + netbackup_service_host

    run_gpcommand(context, command_str)
예제 #7
0
def impl(context, dbname):
    if hasattr(context, 'backup_timestamp'):
        ts = context.backup_timestamp
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    command = 'gp_restore -i --gp-k %s --gp-d db_dumps/%s --gp-i --gp-r db_dumps/%s --gp-l=p -d %s --gp-c -s db_dumps/%s/gp_dump_1_1_%s.gz --netbackup-service-host %s' % \
                            (ts, context.backup_subdir, context.backup_subdir, dbname, context.backup_subdir, ts, netbackup_service_host)
    run_gpcommand(context, command)
예제 #8
0
def impl(context, dbname):
    if hasattr(context, "netbackup_service_host"):
        netbackup_service_host = context.netbackup_service_host
    command = (
        "gp_restore -i --gp-k %s --gp-d db_dumps/%s --gp-i --gp-r db_dumps/%s --gp-l=p -d %s --gp-c --netbackup-service-host %s"
        % (context.backup_timestamp, context.backup_subdir, context.backup_subdir, dbname, netbackup_service_host)
    )
    run_gpcommand(context, command)
예제 #9
0
def before_feature(context, feature):
    drop_database_if_exists(context, 'testdb')
    drop_database_if_exists(context, 'bkdb')
    drop_database_if_exists(context, 'fullbkdb')
    drop_database_if_exists(context, 'schematestdb')

    # enable postgis when running test cases for postgis
    if 'postgis' in feature.tags:
        drop_database_if_exists(context, 'opengeo')
        create_database(context, 'opengeo')
        enable_postgis_and_load_test_data(context)

    if 'postgis_14' in feature.tags:
        drop_database_if_exists(context, 'opengeo')
        create_database(context, 'opengeo')
        enable_postgis_and_load_test_data_for_postgis_1(context)

    if 'gpperfmon' in feature.tags:
        drop_database_if_exists(context, 'gpperfmon')
        pgport = os.getenv('PGPORT', 5432)
        command = "gpperfmon_install --enable --password changeme --port %s" % pgport
        run_gpcommand(context, command)
        run_gpcommand(context, "gpstop -ar")

    if 'analyzedb' in feature.tags:
        start_database_if_not_started(context)
        drop_database_if_exists(context, 'incr_analyze')
        create_database(context, 'incr_analyze')
        drop_database_if_exists(context, 'incr_analyze_2')
        create_database(context, 'incr_analyze_2')
        context.conn = dbconn.connect(dbconn.DbURL(dbname='incr_analyze'))
        context.dbname = 'incr_analyze'

        # setting up the tables that will be used
        context.execute_steps(u"""
        Given there is a regular "ao" table "t1_ao" with column name list "x,y,z" and column type list "int,text,real" in schema "public"
        And there is a regular "heap" table "t2_heap" with column name list "x,y,z" and column type list "int,text,real" in schema "public"
        And there is a regular "ao" table "t3_ao" with column name list "a,b,c" and column type list "int,text,real" in schema "public"
        And there is a hard coded ao partition table "sales" with 4 child partitions in schema "public"
        """)

    if 'minirepro' in feature.tags:
        start_database_if_not_started(context)
        minirepro_db = 'minireprodb'
        drop_database_if_exists(context, minirepro_db)
        create_database(context, minirepro_db)
        context.conn = dbconn.connect(dbconn.DbURL(dbname=minirepro_db))
        context.dbname = minirepro_db
        dbconn.execSQL(context.conn, 'create table t1(a integer, b integer)')
        dbconn.execSQL(context.conn, 'create table t2(c integer, d integer)')
        dbconn.execSQL(context.conn, 'create table t3(e integer, f integer)')
        dbconn.execSQL(context.conn, 'create view v1 as select a, b from t1, t3 where t1.a=t3.e')
        dbconn.execSQL(context.conn, 'create view v2 as select c, d from t2, t3 where t2.c=t3.f')
        dbconn.execSQL(context.conn, 'create view v3 as select a, d from v1, v2 where v1.a=v2.c')
        dbconn.execSQL(context.conn, 'insert into t1 values(1, 2)')
        dbconn.execSQL(context.conn, 'insert into t2 values(1, 3)')
        dbconn.execSQL(context.conn, 'insert into t3 values(1, 4)')
        context.conn.commit()
예제 #10
0
def impl(context, opt, path):
    if hasattr(context, "netbackup_service_host"):
        netbackup_service_host = context.netbackup_service_host
    command = "gpdbrestore -e -a %s localhost:%s/db_dumps/%s --netbackup-service-host %s" % (
        opt,
        path,
        context.backup_subdir,
        netbackup_service_host,
    )
    run_gpcommand(context, command)
예제 #11
0
def impl(context, dbname):
    if hasattr(context, 'db_timestamps'):
        db_timestamps = context.db_timestamps
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host

    ts = db_timestamps[dbname]

    command = 'gpdbrestore -e -a -t ' + ts + " --netbackup-service-host " + netbackup_service_host
    run_gpcommand(context, command)
예제 #12
0
def impl(context, options):
    if hasattr(context, "backup_timestamp"):
        ts = context.backup_timestamp
    if hasattr(context, "netbackup_service_host"):
        netbackup_service_host = context.netbackup_service_host
    if options == "-b":
        command = "gpdbrestore -e -b %s -a --netbackup-service-host %s" % (ts[0:8], netbackup_service_host)
    else:
        command = "gpdbrestore -e -t %s %s -a --netbackup-service-host %s" % (ts, options, netbackup_service_host)
    run_gpcommand(context, command)
예제 #13
0
def impl(context, options):
    if hasattr(context, 'backup_timestamp'):
        ts = context.backup_timestamp
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    if options == '-b':
        command = 'gpdbrestore -b %s -a --netbackup-service-host %s' % (context.backup_timestamp[0:8], netbackup_service_host)
    else:
        command = 'gpdbrestore -t %s %s -a --netbackup-service-host %s' % (context.backup_timestamp, options, netbackup_service_host)
    run_gpcommand(context, command)
예제 #14
0
def impl(context, dbname):
    if hasattr(context, 'db_timestamps'):
        db_timestamps = context.db_timestamps
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host

    ts = db_timestamps[dbname]

    command = 'gpdbrestore -e -a -t ' + ts + " --netbackup-service-host " + netbackup_service_host
    run_gpcommand(context, command)
예제 #15
0
def impl(context, cmd_str):
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    if hasattr(context, 'netbackup_policy'):
        netbackup_policy = context.netbackup_policy
    if hasattr(context, 'netbackup_schedule'):
        netbackup_schedule = context.netbackup_schedule
    bnr_tool = cmd_str.split()[0].strip()
    if bnr_tool == 'gpcrondump':
        command_str = cmd_str + " --netbackup-service-host " + netbackup_service_host + " --netbackup-policy " + netbackup_policy + " --netbackup-schedule " + netbackup_schedule
    elif bnr_tool == 'gpdbrestore':
        command_str = cmd_str + " --netbackup-service-host " + netbackup_service_host
    elif bnr_tool == 'gp_dump':
        command_str = cmd_str + " --netbackup-service-host " + netbackup_service_host + " --netbackup-policy " + netbackup_policy + " --netbackup-schedule " + netbackup_schedule
    elif bnr_tool == 'gp_restore':
        command_str = cmd_str + " --netbackup-service-host " + netbackup_service_host

    run_gpcommand(context, command_str)
예제 #16
0
def impl(context, cmd_str):
    netbackup_service_host = ""
    netbackup_policy = ""
    netbackup_schedule = ""
    if "--netbackup-service-host" not in cmd_str:
        netbackup_service_host = " --netbackup-service-host netbackup-service-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa127 "
    if "--netbackup-policy" not in cmd_str:
        netbackup_policy = " --netbackup-policy netbackup-policy-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa127 "
    if "--netbackup-schedule" not in cmd_str:
        netbackup_schedule = " --netbackup-schedule netbackup-schedule-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa127 "
    bnr_tool = cmd_str.split()[0].strip()
    if bnr_tool == 'gpcrondump':
        command_str = cmd_str + netbackup_service_host + netbackup_policy + netbackup_schedule
    elif bnr_tool == 'gpdbrestore':
        command_str = cmd_str + netbackup_service_host
    elif bnr_tool == 'gp_dump':
        command_str = cmd_str + netbackup_service_host + netbackup_policy + netbackup_schedule
    elif bnr_tool == 'gp_restore':
        command_str = cmd_str + netbackup_service_host

    run_gpcommand(context, command_str)
예제 #17
0
def before_feature(context, feature):
    drop_database_if_exists(context, 'testdb')
    drop_database_if_exists(context, 'bkdb')
    drop_database_if_exists(context, 'fullbkdb')
    drop_database_if_exists(context, 'schematestdb')

    # enable postgis when running test cases for postgis
    if 'postgis' in feature.tags:
        drop_database_if_exists(context, 'opengeo')
        create_database(context, 'opengeo')
        enable_postgis_and_load_test_data(context)

    if 'postgis_14' in feature.tags:
        drop_database_if_exists(context, 'opengeo')
        create_database(context, 'opengeo')
        enable_postgis_and_load_test_data_for_postgis_1(context)

    if 'gpperfmon' in feature.tags:
        drop_database_if_exists(context, 'gpperfmon')
        pgport = os.getenv('PGPORT', 5432)
        command = "gpperfmon_install --enable --password changeme --port %s" % pgport
        run_gpcommand(context, command)
        run_gpcommand(context, "gpstop -ar")

    if 'analyzedb' in feature.tags:
        start_database_if_not_started(context)
        drop_database_if_exists(context, 'incr_analyze')
        create_database(context, 'incr_analyze')
        drop_database_if_exists(context, 'incr_analyze_2')
        create_database(context, 'incr_analyze_2')
        context.conn = dbconn.connect(dbconn.DbURL(dbname='incr_analyze'))
        context.dbname = 'incr_analyze'

        # setting up the tables that will be used
        context.execute_steps(u"""
        Given there is a regular "ao" table "t1_ao" with column name list "x,y,z" and column type list "int,text,real" in schema "public"
        And there is a regular "heap" table "t2_heap" with column name list "x,y,z" and column type list "int,text,real" in schema "public"
        And there is a regular "ao" table "t3_ao" with column name list "a,b,c" and column type list "int,text,real" in schema "public"
        And there is a hard coded ao partition table "sales" with 4 child partitions in schema "public"
        """)
예제 #18
0
def before_feature(context, feature):
    drop_database_if_exists(context, 'testdb')
    drop_database_if_exists(context, 'bkdb')
    drop_database_if_exists(context, 'fullbkdb')
    drop_database_if_exists(context, 'schematestdb')

    # enable postgis when running test cases for postgis
    if 'postgis' in feature.tags:
        drop_database_if_exists(context, 'opengeo')
        create_database(context, 'opengeo')
        enable_postgis_and_load_test_data(context)

    if 'postgis_14' in feature.tags:
        drop_database_if_exists(context, 'opengeo')
        create_database(context, 'opengeo')
        enable_postgis_and_load_test_data_for_postgis_1(context)

    if 'gpperfmon' in feature.tags:
        drop_database_if_exists(context, 'gpperfmon')
        pgport = os.getenv('PGPORT', 5432)
        command = "gpperfmon_install --enable --password changeme --port %s" % pgport
        run_gpcommand(context, command)
        run_gpcommand(context, "gpstop -ar")

    if 'analyzedb' in feature.tags:
        start_database_if_not_started(context)
        drop_database_if_exists(context, 'incr_analyze')
        create_database(context, 'incr_analyze')
        drop_database_if_exists(context, 'incr_analyze_2')
        create_database(context, 'incr_analyze_2')
        context.conn = dbconn.connect(dbconn.DbURL(dbname='incr_analyze'))
        context.dbname = 'incr_analyze'

        # setting up the tables that will be used
        context.execute_steps(u"""
        Given there is a regular "ao" table "t1_ao" with column name list "x,y,z" and column type list "int,text,real" in schema "public"
        And there is a regular "heap" table "t2_heap" with column name list "x,y,z" and column type list "int,text,real" in schema "public"
        And there is a regular "ao" table "t3_ao" with column name list "a,b,c" and column type list "int,text,real" in schema "public"
        And there is a hard coded ao partition table "sales" with 4 child partitions in schema "public"
        """)
예제 #19
0
def impl(context, opt, path):
    if hasattr(context, 'netbackup_service_host'):
        netbackup_service_host = context.netbackup_service_host
    command = 'gpdbrestore -e -a %s localhost:%s/db_dumps/%s --netbackup-service-host %s' % (
        opt, path, context.backup_subdir, netbackup_service_host)
    run_gpcommand(context, command)