コード例 #1
0
 def getGUCvalue(self, name):
     if (len(name) < 1):
         return -1
     cmd = "show " + name
     out = PSQL.run_sql_command(cmd)
     result = out.split('\n')
     return result[3].strip()
コード例 #2
0
    def test_gp_interconnect_fc_ard_142(self):
        if (self.cluster_platform.lower().find('red hat enterprise linux server') < 0):
            self.skipTest('Test only applies to RHEL platform.')
        try:
            out = self.checkGUC(self.gp_interconnect_min_retries_before_timeout)
            self.assertTrue(len(out) > 4)
            out = self.checkGUC(self.gp_interconnect_transmit_timeout)
            self.assertTrue(len(out) > 4)
            out = self.checkGUC(self.gp_interconnect_fc_method)
            self.assertTrue(len(out) > 4)
        except:
            self.skipTest("GUC " + self.gp_interconnect_min_retries_before_timeout + " or " + self.gp_interconnect_transmit_timeout + " or " +  self.gp_interconnect_fc_method + " not defined")


        result = runShellCommand('gpssh ' + self.hoststr +  ' \"export PATH=$PATH:/sbin; \
                                              sudo insmod ickm.ko ict_type=0x101 seq_array=2 drop_times=80\"')
        self.assertTrue(result)
        
        sql_file = local_path(self.common_sql + str(self._testMethodName) + '.sql');
        self.assertTrue(PSQL.run_sql_file(local_path(sql_file)))        
        out_file = sql_file.replace(".sql",".out")
        test_ret = "Failed to send packet (seq 2) to" in open(out_file).read() and "retries in 40 seconds" in open(out_file).read()
        ret_log = runShellCommand(self.log_str + self._testMethodName + '.log' )
        result = runShellCommand('gpssh ' + self.hoststr +  ' \"export PATH=$PATH:/sbin;sudo rmmod ickm.ko \"')

        self.assertTrue(result)  
        self.assertTrue(ret_log)
        self.assertTrue(test_ret)
コード例 #3
0
ファイル: test_ic_fc_guc_check.py プロジェクト: 50wu/gpdb
 def getGUCvalue(self, name):
     if(len(name) < 1):
         return -1
     cmd = "show " + name 
     out = PSQL.run_sql_command(cmd)
     result = out.split('\n')
     return result[3].strip()
コード例 #4
0
    def getHostProcess(self, searchStr):

        # Get one segment name after searching pg_catalog
        cmdsql = 'SELECT hostname, port FROM pg_catalog.gp_segment_configuration WHERE content > -1 AND role=\'p\' AND status=\'u\' ORDER BY dbid DESC LIMIT 1;'
        out = PSQL.run_sql_command(cmdsql)        
        result = out.split('\n')
    
        (hostname,port) = result[3].strip().split('|')
        hostname = hostname.strip()
        port = port.strip()

        # find the target process id
        cmdshell = "gpssh -h " + hostname + " 'ps -ef | grep " + searchStr + "'"
        (out, rc) = runShellCommand(cmdshell)

        print(out)

        result = out.split('\n')

	processID = "" 
        for line in result:
            if(line.find("primary") != -1):
                processID = line.split()[2].strip()
                break                
       
        return (hostname, processID)
コード例 #5
0
    def getHostProcess(self, searchStr):

        # Get one segment name after searching pg_catalog
        cmdsql = 'SELECT hostname, port FROM pg_catalog.gp_segment_configuration WHERE content > -1 AND role=\'p\' AND status=\'u\' ORDER BY dbid DESC LIMIT 1;'
        out = PSQL.run_sql_command(cmdsql)
        result = out.split('\n')

        (hostname, port) = result[3].strip().split('|')
        hostname = hostname.strip()
        port = port.strip()

        # find the target process id
        cmdshell = "gpssh -h " + hostname + " 'ps -ef | grep " + searchStr + "'"
        (out, rc) = runShellCommand(cmdshell)

        print(out)

        result = out.split('\n')

        processID = ""
        for line in result:
            if (line.find("primary") != -1):
                processID = line.split()[2].strip()
                break

        return (hostname, processID)
コード例 #6
0
    def setUpClass(cls):
        cmdsql = 'SELECT hostname FROM pg_catalog.gp_segment_configuration WHERE content > -1 AND status = \'u\' GROUP BY hostname ORDER by hostname;'
        ret = PSQL.run_sql_command(cmdsql)
        hostlist = ret.split('\n') 
        if (len(hostlist) < 5):
            raise AssertionError('Get segment host list failed') 
        for i in range(3, len(hostlist)):
            if (hostlist[i].find('(') >= 0):
                break
            cls.hostlist.append(hostlist[i].strip()) 
        for host in cls.hostlist:
            cls.hoststr = cls.hoststr + ' -h ' + host

        '''
コード例 #7
0
    def _run_sql_file(self, sql_file, ans_file = None):
        """
        Given a sql file and an ans file, this adds the specified gucs (self.gucs) to the sql file , runs the sql
        against the test case databse (self.db_name) and verifies the output with the ans file.
        """
        result = True
        
        self.test_artifacts.append(sql_file)
        out_file = os.path.join(self.get_out_dir(), os.path.basename(sql_file).replace('.sql','.out'))
        self.test_artifacts.append(out_file)

        PSQL.run_sql_file(sql_file, dbname = self.db_name, out_file = out_file)

        if out_file[-2:] == '.t':
            out_file = out_file[:-2]
        
        if ans_file is not None:
            self.test_artifacts.append(ans_file)
            result = Gpdiff.are_files_equal(out_file, ans_file)
            if result == False:
                self.test_artifacts.append(out_file.replace('.out', '.diff'))

        return result
コード例 #8
0
    def run_sql_under_KM_dropMore(self,suffix):
        
        result = runShellCommand('gpssh' + self.hoststr +  ' \"sudo dmesg -c\"')
        self.assertTrue(result)
        runShellCommand('gpssh ' + self.hoststr +  ' \"export PATH=$PATH:/sbin; \
                                            sudo rmmod ickm.ko\"')
        result = runShellCommand('gpssh' + self.hoststr +  ' \"export PATH=$PATH:/sbin;sudo insmod ickm.ko ict_type=0x101 seq_array=2 drop_times=80\"') 
        self.assertTrue(result)
        
        sql_file = local_path(self.gucCheck_sql + str(self._testMethodName) + suffix + '.sql')
        self.assertTrue(PSQL.run_sql_file(sql_file))        

        result = runShellCommand('gpssh' + self.hoststr +  ' \"export PATH=$PATH:/sbin;sudo rmmod ickm.ko \"') 
        self.assertTrue(result)        

        out_file = sql_file.replace(".sql",".out")

        return out_file
コード例 #9
0
    def test_gp_interconnect_fc_ard_142(self):
        if (self.cluster_platform.lower().find(
                'red hat enterprise linux server') < 0):
            self.skipTest('Test only applies to RHEL platform.')
        try:
            out = self.checkGUC(
                self.gp_interconnect_min_retries_before_timeout)
            self.assertTrue(len(out) > 4)
            out = self.checkGUC(self.gp_interconnect_transmit_timeout)
            self.assertTrue(len(out) > 4)
            out = self.checkGUC(self.gp_interconnect_fc_method)
            self.assertTrue(len(out) > 4)
        except:
            self.skipTest("GUC " +
                          self.gp_interconnect_min_retries_before_timeout +
                          " or " + self.gp_interconnect_transmit_timeout +
                          " or " + self.gp_interconnect_fc_method +
                          " not defined")

        result = runShellCommand('gpssh ' + self.hoststr +
                                 ' \"export PATH=$PATH:/sbin; \
                                              sudo insmod ickm.ko ict_type=0x101 seq_array=2 drop_times=80\"'
                                 )
        self.assertTrue(result)

        sql_file = local_path(self.common_sql + str(self._testMethodName) +
                              '.sql')
        self.assertTrue(PSQL.run_sql_file(local_path(sql_file)))
        out_file = sql_file.replace(".sql", ".out")
        test_ret = "Failed to send packet (seq 2) to" in open(out_file).read(
        ) and "retries in 40 seconds" in open(out_file).read()
        ret_log = runShellCommand(self.log_str + self._testMethodName + '.log')
        result = runShellCommand(
            'gpssh ' + self.hoststr +
            ' \"export PATH=$PATH:/sbin;sudo rmmod ickm.ko \"')

        self.assertTrue(result)
        self.assertTrue(ret_log)
        self.assertTrue(test_ret)
コード例 #10
0
    def getHostNIC(self):

        # Get one segment name after searching pg_catalog
        cmdsql = 'SELECT hostname, port FROM pg_catalog.gp_segment_configuration WHERE content > -1 AND role=\'p\' AND status=\'u\' ORDER BY dbid ASC LIMIT 1;'
        out = PSQL.run_sql_command(cmdsql)
        result = out.split('\n')

        (hostname, port) = result[3].strip().split('|')
        hostname = hostname.strip()
        port = port.strip()
        print(hostname)

        # Get the interface IP through /etc/hosts file
        cmd_str = "cat /etc/hosts"
        (out, rc) = runShellCommand(cmd_str)
        result = out.split('\n')
        for line in result:
            if ((line.find(hostname) != -1)
                    and (line.find(hostname + "-cm") == -1)):
                ipAddress = line.split()[0].strip()

        # ipAddress contain the last interface ic use
        cmd_str = "gpssh -h " + hostname + " 'ifconfig'"
        (out, rc) = runShellCommand(cmd_str)
        result = out.split('\n')

        # find the nic name through the ip address
        for line in result:
            if (len(line) < 10):
                continue
            if (line.split()[1].find("eth") != -1):
                ethname = line.split()[1].strip()
            if (line.find(ipAddress) != -1):
                break
        print(ethname)

        return (hostname, ethname)
コード例 #11
0
    def getHostNIC(self):

        # Get one segment name after searching pg_catalog
        cmdsql = 'SELECT hostname, port FROM pg_catalog.gp_segment_configuration WHERE content > -1 AND role=\'p\' AND status=\'u\' ORDER BY dbid ASC LIMIT 1;'
        out = PSQL.run_sql_command(cmdsql)        
        result = out.split('\n')
    
        (hostname,port) = result[3].strip().split('|')
        hostname = hostname.strip()
        port = port.strip()
        print(hostname)

        # Get the interface IP through /etc/hosts file
        cmd_str = "cat /etc/hosts"
        (out, rc) = runShellCommand(cmd_str)
        result = out.split('\n')
        for line in result:
            if((line.find(hostname) != -1) and (line.find(hostname + "-cm")==-1)):
                ipAddress = line.split()[0].strip() 
        
        # ipAddress contain the last interface ic use
        cmd_str = "gpssh -h " + hostname + " 'ifconfig'"
        (out, rc) = runShellCommand(cmd_str)
        result = out.split('\n')
      
        # find the nic name through the ip address 
        for line in result:
            if(len(line) < 10):
                continue
            if(line.split()[1].find("eth") != -1):
                ethname = line.split()[1].strip()
            if(line.find(ipAddress) != -1):
                break
        print(ethname)

        return (hostname, ethname)
コード例 #12
0
 def setGUCvalue(self, name, value):
     if (len(name) < 1):
         return -1
     cmd = "set " + name + " = " + value
     out = PSQL.run_sql_command(cmd)
コード例 #13
0
 def checkGUC(self, name):
     if (len(name) < 1):
         return -1
     cmd = "show " + name
     out = PSQL.run_sql_command(cmd)
     return out.split('\n')
コード例 #14
0
ファイル: test_ic_fc_guc_check.py プロジェクト: 50wu/gpdb
 def checkGUC(self, name):
     if (len(name) <1):
         return -1
     cmd = "show " + name
     out = PSQL.run_sql_command(cmd)
     return out.split('\n')
コード例 #15
0
ファイル: test_ic_fc_guc_check.py プロジェクト: 50wu/gpdb
 def setGUCvalue(self, name, value):
     if(len(name) < 1):
         return -1
     cmd = "set " + name + " = " + value
     out = PSQL.run_sql_command(cmd)