예제 #1
0
파일: Config.py 프로젝트: weinan003/TPCH
    def getSegHostNames(self):
        
        (ok, out) = psql.run(flag='-q -t', cmd="select distinct hostname from gp_segment_configuration where role = 'p' order by hostname;", ofile='-', dbname='template1') 

        if not ok:
            sys.exit('Unable to select gp_segment_configuration')
        hostlist = psql.list_out(out)
        return hostlist
예제 #2
0
파일: Config.py 프로젝트: weinan003/TPCH
 def isMasterMirrorSynchronized(self):
     (ok, out) = psql.run(dbname='template1',
              cmd='select summary_state from gp_master_mirroring',
              ofile='-',
              flag='-q -t')
     if ok:
         for line in out:
             line = line.strip()
             if line == 'Synchronized':
                 return True
     return False
예제 #3
0
파일: Config.py 프로젝트: weinan003/TPCH
 def fill(self):
     self.record = []
     # Use psql to get gp_configuration instead of pyODB
     # Bug: Solaris pyODB, -1 is 4294967295 
     #(ok, out) = psql.run(flag = '-q -t', cmd = 'select dbid, content, role, preferred_role, mode, status, hostname, address, port, fselocation as datadir, replication_port, san_mounts from gp_segment_configuration LEFT JOIN pg_catalog.pg_filespace_entry on (dbid = fsedbid) LEFT JOIN pg_catalog.pg_filespace fs on (fsefsoid = fs.oid and fsname=\'pg_system\') ORDER BY content, preferred_role', ofile = '-', isODBC = False, dbname='template1') 
 
     # Anu : commented out the above query since it was returning the full config of the system (including the filespace entry) Hence changed the query to return only the cluster configuration
     #(ok, out) = psql.run(flag='-q -t', cmd='select dbid, content, role, preferred_role, mode, status, hostname, address, port, fselocation as datadir, replication_port, san_mounts from gp_segment_configuration, pg_filespace_entry, pg_catalog.pg_filespace fs where fsefsoid = fs.oid and fsname=\'pg_system\' and gp_segment_configuration.dbid=pg_filespace_entry.fsedbid ORDER BY content, preferred_role', ofile='-',dbname='template1') 
     (ok, out) = psql.run(flag='-q -t', cmd='select role, status, hostname, address, port from gp_segment_configuration ORDER by role;', ofile='-',  dbname='template1')
     if not ok:
         sys.exit('Unable to select gp_segment_configuration')
     for line in out:
         if line.find("NOTICE") < 0:
             line = line.strip()
             if line:
                 self.record.append(Config.Record(line))
예제 #4
0
파일: Config.py 프로젝트: weinan003/TPCH
 def getCountSegments(self):
     (ok, out) = psql.run(dbname='template1', cmd="select count(*) from gp_segment_configuration where role = 'p';",
                          ofile='-', flag='-q -t')
     for line in out:
         return line