Esempio n. 1
0
def isSegmentUp(context, dbid):
    qry = """select count(*) from gp_segment_configuration where status='d' and dbid=%s""" % dbid
    row_count = getRows('template1', qry)[0][0]
    if row_count == 0:
        return True
    else:
        return False
Esempio n. 2
0
def isSegmentUp(context, dbid):
    qry = """select count(*) from gp_segment_configuration where status='d' and dbid=%s""" % dbid
    row_count = getRows('template1', qry)[0][0]
    if row_count == 0:
        return True
    else:
        return False
Esempio n. 3
0
def impl(context, cid):
    qry = """select count(*) from gp_segment_configuration where status='d' and content='%s' and role='m'""" % (
        cid)
    row_count = getRows('template1', qry)[0][0]
    if row_count != 1:
        raise Exception(
            'Expected mirror segment cid %s to be down, but it is up.' % cid)
Esempio n. 4
0
def impl(context):
    qry = """select count(*) from gp_segment_configuration where status='d' and hostname='%s' and dbid=%s""" % (
        context.remote_mirror_segdbname, context.remote_mirror_segdbId)
    row_count = getRows('template1', qry)[0][0]
    if row_count != 1:
        raise Exception(
            'Expected mirror segment %s on host %s to be down, but it is running.'
            % (context.remote_mirror_datadir, context.remote_mirror_segdbname))
Esempio n. 5
0
def check_pg_class_lock(dbname):
   seg_count = 1

   query = """select count(*)
            from pg_locks
            where relation in (select oid from pg_class where relname='pg_class')
                  and locktype='relation' and mode='ExclusiveLock'"""
   row_count = getRows(dbname, query)[0][0]
   return row_count
Esempio n. 6
0
def impl(context, role_name, dbname):
    query = "select rolname from pg_roles where rolname = '%s'" % role_name
    conn = dbconn.connect(dbconn.DbURL(dbname=dbname))
    try:
        result = getRows(dbname, query)[0][0]
        if result != role_name:
            raise Exception("Role %s does not exist in database %s." % (role_name, dbname))
    except:
        raise Exception("Role %s does not exist in database %s." % (role_name, dbname))
Esempio n. 7
0
def impl(context, backup_pg, dbname):
    query = """select count(*) 
             from pg_locks 
             where relation in (select oid from pg_class where relname='pg_class') 
                   and locktype='relation' and mode='ExclusiveLock'"""

    row_count = getRows(dbname, query)[0][0]
    if row_count != 0:
        raise Exception("Found a ExclusiveLock on pg_class")
Esempio n. 8
0
def check_pg_class_lock(dbname):
    seg_count = 1

    query = """select count(*)
            from pg_locks
            where relation in (select oid from pg_class where relname='pg_class')
                  and locktype='relation' and mode='ExclusiveLock'"""
    row_count = getRows(dbname, query)[0][0]
    return row_count
Esempio n. 9
0
def impl(context, backup_pg, dbname):
    query = """select count(*) 
             from pg_locks 
             where relation in (select oid from pg_class where relname='pg_class') 
                   and locktype='relation' and mode='ExclusiveLock'"""

    row_count = getRows(dbname, query)[0][0]
    if row_count != 0:
        raise Exception("Found a ExclusiveLock on pg_class")
Esempio n. 10
0
def impl(context, role_name, dbname):
    query = "select rolname from pg_roles where rolname = '%s'" % role_name
    conn = dbconn.connect(dbconn.DbURL(dbname=dbname))
    try:
        result = getRows(dbname, query)[0][0]
        if result != role_name:
            raise Exception("Role %s does not exist in database %s." %
                            (role_name, dbname))
    except:
        raise Exception("Role %s does not exist in database %s." %
                        (role_name, dbname))
Esempio n. 11
0
def impl(context):
    qry = """select count(*) from gp_segment_configuration where status='d' and hostname='%s' and dbid=%s""" % (context.remote_mirror_segdbname, context.remote_mirror_segdbId)
    row_count = getRows('template1', qry)[0][0]
    if row_count != 1:
        raise Exception('Expected mirror segment %s on host %s to be down, but it is running.' % (context.remote_mirror_datadir, context.remote_mirror_segdbname))
Esempio n. 12
0
def impl(context, cid):
    qry = """select count(*) from gp_segment_configuration where status='d' and content='%s' and role='m'""" % (cid)
    row_count = getRows('template1', qry)[0][0]
    if row_count != 1:
        raise Exception('Expected mirror segment cid %s to be down, but it is up.' % cid)