Esempio n. 1
0
    def setUp(self):
        # Set GUC gp_vmem_protect_limit
        self.prd = "_hawq"
        if self.gp_version() == "gpdb":
            self.prd = ""

        gpconfig = GpConfig()

        expected_vmem = '20'
        expected_runaway_perc = '0'

        restart_db = False

        if self.name == "OOMTestCase.test_07_OOM_abort_query":
            gpconfig.setParameter('gp_vmem_limit_per_query', '2MB', '2MB', '--skipvalidation')
            restart_db = True

        (vmem, _) = gpconfig.getParameter('gp_vmem_protect_limit')
        (runaway_perc, _) = GpConfig().getParameter('runaway_detector_activation_percent')

        if runaway_perc == expected_runaway_perc and vmem == expected_vmem:
            tinctest.logger.info('gp_vmem_protect_limit and runaway_detector_activation_percent GUCs already set correctly')
        else:
            tinctest.logger.info('Setting GUC and restarting DB')
            gpconfig.setParameter('runaway_detector_activation_percent', expected_runaway_perc, expected_runaway_perc)
            gpconfig.setParameter('gp_vmem_protect_limit', expected_vmem, expected_vmem)
            restart_db = True

        if restart_db:
            # Restart DB
            Command('Restart database for GUCs to take effect',
                    'source $GPHOME/greenplum_path.sh && gpstop -ar').run(validateAfter=True)

        super(OOMTestCase, self).setUp()
Esempio n. 2
0
    def __init__(self, host, usr, db, entry_type="host", authmethod="password", password=None):
        """ 
        Constructor for GpUserRole 
        @param host: which host to be tested;
        @param usr: user name to login host and login database;
        @param db: database name
        @change: Ritesh Jaltare
        @param entry_type: if a user is created, then we need the type of entry for pg_hba.conf for authen eg host, local, hostssl
        @param authmethod: denotes the authentication method used, eg: trust , password, md5
        @param address: denotes the IP address of the host. it can be both IPV4 or IPV6
        """
        self.gpstop = GpStop()
        self.host = host
        if password is None:
	  self.password = r"'password'"
        else:
          self.password = password
        self.usr = usr
        self.db = db
        if self.db is "all":
            self.pgpassdb = "*"
        else:
            self.pgpassdb=self.db    
        gpconfig = GpConfig()
        masterSSLValue = gpconfig.getParameterMasterOnly("ssl")
        if masterSSLValue is "on" and entry_type is "host":
            self.entry_type = "hostssl"
        else:
            self.entry_type = entry_type    
        
        self.authmethod = authmethod
        if os.path.exists(PGPASSFILE) is False:
            file = open(PGPASSFILE, 'w')
            os.chmod(PGPASSFILE,0600)
Esempio n. 3
0
 def __init__(self):
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     self.config = GpConfig()
     self.port = os.getenv('PGPORT')
     self.gphome = (os.getenv('GPHOME'))
     self.base_dir = os.path.dirname(
         sys.modules[self.__class__.__module__].__file__)
Esempio n. 4
0
 def __init__(self, methodName):
     self.pgport = os.environ.get('PGPORT')
     self.util = Filerepe2e_Util()
     self.gpconfig = GpConfig()
     self.config = GPDBConfig()
     self.gpr = GpRecover(self.config)
     self.dbstate = DbStateClass('run_validation', self.config)
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     super(FilerepTestCase, self).__init__(methodName)
Esempio n. 5
0
 def setUpClass(cls):
     super(AppendOnlyEOFTests, cls).setUpClass()
     gpconfig = GpConfig()
     (cls.master_value, cls.segment_value) = gpconfig.getParameter('max_appendonly_tables')
     tinctest.logger.debug("Original max_appendonly_tables values - Master Value: %s Segment Value: %s" %(cls.master_value, cls.segment_value))
     gpconfig.setParameter('max_appendonly_tables', '3', '3')
     GpStop().run_gpstop_cmd(restart=True)
     (master_value, segment_value) = gpconfig.getParameter('max_appendonly_tables')
     tinctest.logger.debug("Set max_appendonly_tables to Master Value: %s  Segment Value: %s " %(master_value, segment_value))
     if master_value != '3' or segment_value != '3':
         raise Exception("Failed to set max_appendonly_tables to the required values")
Esempio n. 6
0
    def tearDownClass(cls):
        gpconfig = GpConfig()
        if (not cls.master_value) or (not cls.segment_value):
            raise Exception("Original max_appendonly_tables value is None")

        gpconfig.setParameter('max_appendonly_tables', cls.master_value, cls.segment_value)
        GpStop().run_gpstop_cmd(restart=True)
        # Make sure the values are reset properly
        (master_value, segment_value) = gpconfig.getParameter('max_appendonly_tables')
        try:
            if master_value != cls.master_value or segment_value != cls.segment_value:
                raise Exception("Failed to reset max_appendonly_tables to the required values")
        finally:
            super(AppendOnlyEOFTests, cls).tearDownClass()
Esempio n. 7
0
 def __init__(self):
     self.fileutil = Filerepe2e_Util()
     self.gprecover = GpRecover()
     self.config = GpConfig()
     self.base_dir = os.path.dirname(sys.modules[self.__class__.__module__].__file__)
Esempio n. 8
0
 def setUp(self):
     self.gp_config = GpConfig()