Example #1
0
def cleanup(context):

    utils.stop_database_if_started(context)

    subprocess.check_call(['gpstart', '-am'])
    _run_sql(
        """
        SET allow_system_table_mods='true';
        UPDATE gp_segment_configuration
           SET hostname = coordinator.hostname,
                address = coordinator.address
          FROM (
                 SELECT hostname, address
                   FROM gp_segment_configuration
                  WHERE content = -1 and role = 'p'
               ) coordinator
         WHERE content = -1 AND role = 'm'
    """, {'gp_role': 'utility'})
    subprocess.check_call(['gpstop', '-am'])
Example #2
0
    def cleanup(context):
        """
        Reverses the above SQL by starting up in coordinator-only utility mode. Since
        the standby host is incorrect, a regular gpstart call won't work.
        """
        utils.stop_database_if_started(context)

        subprocess.check_call(['gpstart', '-am'])
        _run_sql("""
            SET allow_system_table_mods='true';
            UPDATE gp_segment_configuration
               SET hostname = coordinator.hostname,
                    address = coordinator.address
              FROM (
                     SELECT hostname, address
                       FROM gp_segment_configuration
                      WHERE content = -1 and role = 'p'
                   ) coordinator
             WHERE content = -1 AND role = 'm'
        """, {'gp_role': 'utility'})
        subprocess.check_call(['gpstop', '-am'])
Example #3
0
    def cleanup(context):
        """
        Reverses the above SQL by starting up in master-only utility mode. Since
        the standby host is incorrect, a regular gpstart call won't work.
        """

        utils.stop_database_if_started(context)

        subprocess.check_call(['gpstart', '-am'])
        _run_sql("""
            UPDATE gp_segment_configuration
               SET hostname = master.hostname,
                    address = master.address
              FROM (
                     SELECT hostname, address
                       FROM gp_segment_configuration
                      WHERE content = -1 and role = 'p'
                   ) master
             WHERE content = -1 AND role = 'm'
        """,
                 opts=opts)
        subprocess.check_call(['gpstop', '-am'])