• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python gpinitstandby.GpinitStandby类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mpp.gpdb.tests.storage.walrepl.gpinitstandby.GpinitStandby的典型用法代码示例。如果您正苦于以下问题:Python GpinitStandby类的具体用法?Python GpinitStandby怎么用?Python GpinitStandby使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了GpinitStandby类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: LoadTestCase

class LoadTestCase(ScenarioTestCase):
    ''' Skip Checkpoint, Run workload, then init standby'''

    def __init__(self, methodName):
        self.gp = GpinitStandby()
        super(LoadTestCase,self).__init__(methodName)

    def setUp(self):
        #Remove standby if present
        self.gp.run(option='-r')
       
    @unittest.skipIf(os.uname()[0] == 'Darwin', "Skipping this test on OSX")   
    def Dtest_load_with_skip_checkpoint(self):
        test_case_list0 = []
        test_case_list0.append('mpp.gpdb.tests.storage.walrepl.load.LoadClass.skip_checkpoint')
        self.test_case_scenario.append(test_case_list0)

        test_case_list1 = []
        test_case_list1.append('mpp.gpdb.tests.storage.walrepl.load.sql.runsql.RunWorkload')
        self.test_case_scenario.append(test_case_list1)

        test_case_list2 = []
        test_case_list2.append('mpp.gpdb.tests.storage.walrepl.load.LoadClass.init_standby')
        self.test_case_scenario.append(test_case_list2)

        test_case_list3 = []
        test_case_list3.append('mpp.gpdb.tests.storage.walrepl.load.LoadClass.cleanup')
        self.test_case_scenario.append(test_case_list3)
开发者ID:50wu,项目名称:gpdb,代码行数:28,代码来源:test_load.py


示例2: BackupRestoreTestCase

class BackupRestoreTestCase(BkupRestore):
    ''' gpcrondump from the primary master, gpdbrestore from the standby master'''

    def __init__(self, methodName):
        super(BackupRestoreTestCase,self).__init__(methodName)

    def setUp(self):
        self.gp = GpinitStandby()
        self.gp.run(option='-r')

    def tearDown(self):
        self.failback()

    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_backup_restore(self):
        # Create standby if not present
        Command('createdb bkdb','dropdb bkdb; createdb bkdb').run()
        self.create_standby()
        # Run workload
        self.run_workload('sql')
        # Create backup
        self.assertTrue(self.run_backup())
        # Activate standby
        gpac = GpactivateStandby()
        gpac.activate()        
        # Restore from new master
        self.assertTrue(self.run_restore())
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:27,代码来源:test_backup_restore.py


示例3: LoadClass

class LoadClass(MPPTestCase):
    

    def __init__(self,methodName):
        self.gp =GpinitStandby()
        super(LoadClass,self).__init__(methodName)

    def run_skip(self, type):
        tinctest.logger.info("skipping checkpoint")
        cmd_str = 'gpfaultinjector -p %s -m async -H ALL -r primary -f checkpoint -y %s -o 0' % (os.getenv('PGPORT'), type)
        cmd = Command('skip_chkpoint', cmd_str)
        cmd.run(validateAfter =False)
        
    def skip_checkpoint(self):
        ''' Routine to inject fault that skips checkpointing '''
        self.run_skip('reset')
        self.run_skip('suspend')

    def init_standby(self):
        pg = GpUtility() 
        pg.install_standby()

    def cleanup(self):
        # Remove standby and reset the checkpoint fault
        self.gp.run(option='-r')
        self.run_skip('reset')
开发者ID:50wu,项目名称:gpdb,代码行数:26,代码来源:__init__.py


示例4: SwitchXlogTestCase

class SwitchXlogTestCase(ScenarioTestCase):
    ''' Initiate standby with old pg_basebackup and new xlog'''

    def __init__(self, methodName):
        self.gp = GpinitStandby()
        super(SwitchXlogTestCase,self).__init__(methodName)

    def setUp(self):
        #Remove standby if present
        self.gp.run(option='-r')
       
    def tearDown(self):
        #Remove standby 
        self.gp.run(option='-r')
    
    @unittest.skipIf(os.uname()[0] == 'Darwin', "Skipping this test on OSX")   
    def test_switch_xlog_after_basebackup(self):
        test_case_list0 = []
        test_case_list0.append('mpp.gpdb.tests.storage.walrepl.basebackup.SwitchClass.run_pg_basebackup')
        self.test_case_scenario.append(test_case_list0)

        test_case_list1 = []
        test_case_list1.append('mpp.gpdb.tests.storage.walrepl.basebackup.switch.runsql.RunWorkload')
        self.test_case_scenario.append(test_case_list1)

        test_case_list2 = []
        test_case_list2.append('mpp.gpdb.tests.storage.walrepl.basebackup.SwitchClass.start_standby')
        self.test_case_scenario.append(test_case_list2)
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:28,代码来源:test_switch_xlog.py


示例5: WalRecTestCase

class WalRecTestCase(MPPTestCase):
    ''' Testcases for SIGTERM on wal receiver'''

    def __init__(self, methodName):
        self.gp = GpinitStandby()
        self.mdd = os.environ.get('MASTER_DATA_DIRECTORY')
        self.pgutil = GpUtility()
        super(WalRecTestCase,self).__init__(methodName)

    def setUp(self):
        #Remove standby if present
        self.gp.run(option='-r')
       
    def invoke_sigterm_and_verify(self):
        ''' Invoke sigterm on wal receiver and verify that a new process is spawned after '''
        gpact_stdby = GpactivateStandby()
        standby_host = gpact_stdby.get_current_standby()
        standby_port = gpact_stdby.get_standby_port()
        wal_rec_pid_1 = self.pgutil.get_pid_by_keyword(host=standby_host, pgport=standby_port, keyword='wal receiver process', option='')
        sig_cmd = "gpssh -h %s -e 'kill -15 %s'" % (standby_host, wal_rec_pid_1)
        cmd = Command('Issue SIGTERM to wam receiver process', cmdStr=sig_cmd)
        tinctest.logger.info ('%s' % cmd)
        cmd.run(validateAfter=True)
        result = cmd.get_results()
        if result.rc != 0:
            return False        
        wal_rec_pid_2 = self.pgutil.get_pid_by_keyword(host=standby_host, pgport=standby_port, keyword='wal receiver process', option='')
        if wal_rec_pid_1 == wal_rec_pid_2:
            return False
        return True

    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_sigterm_on_walreceiver(self):
        self.pgutil.install_standby()
        self.assertTrue(self.invoke_sigterm_and_verify())
开发者ID:50wu,项目名称:gpdb,代码行数:35,代码来源:test_sigterm.py


示例6: check_stdby_stop

 def check_stdby_stop(self):
     gpstdby = GpinitStandby()
     stdby_host = gpstdby.get_standbyhost()
     activate_stdby = GpactivateStandby()
     stdby_port = activate_stdby.get_standby_port()     
     master_pid = self.pgutil.get_pid_by_keyword(host=stdby_host, pgport=stdby_port, keyword="master", option = "bin")
     if int(master_pid) != -1:
         raise Exception("standby should stop but failed!")        
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:8,代码来源:__init__.py


示例7: start_stdby

 def start_stdby(self):
     gpstdby = GpinitStandby()
     stdby_host = gpstdby.get_standbyhost()
     stdby_dbid = self.get_standby_dbid()
     activate_stdby = GpactivateStandby()
     stdby_mdd = activate_stdby.get_standby_dd()
     stdby_port = activate_stdby.get_standby_port()
     cmd="pg_ctl -D %s -o '-p %s --gp_dbid=%s --gp_num_contents_in_cluster=2 --silent-mode=true -i -M master --gp_contentid=-1 -x 0 -E' start &"%(stdby_mdd, stdby_port, stdby_dbid)
     self.run_remote(stdby_host,cmd,stdby_port,stdby_mdd)
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:9,代码来源:__init__.py


示例8: setUp

 def setUp(self):
     super(WalReplKillProcessScenarioTestCase, self).setUp()
     pgutil.check_and_start_gpdb()
     # We should forcibly recreate standby, as it might has been promoted.
     pgutil.remove_standby()
     pgutil.install_standby()
     gpact_stdby = GpactivateStandby()
     gpinit_stdb = GpinitStandby()
     WalReplKillProcessTestCase.stdby_port = gpact_stdby.get_standby_port()
     WalReplKillProcessTestCase.stdby_host = gpinit_stdb.get_standbyhost()
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:10,代码来源:test_kill_process.py


示例9: setUp

 def setUp(self):
     pgutil.check_and_start_gpdb()
     # We should forcibly recreate standby, as it might has been promoted.
     # here we need to install locally, otherwise can not run remote sql
     pgutil.remove_standby()
     pgutil.install_standby(new_stdby_host=socket.gethostname())
     gpact_stdby = GpactivateStandby()
     gpinit_stdb = GpinitStandby()
     WalReplKillProcessTestCase.stdby_port = gpact_stdby.get_standby_port()
     WalReplKillProcessTestCase.stdby_host = gpinit_stdb.get_standbyhost()
     self.standby_dir = gpact_stdby.get_standby_dd()
开发者ID:50wu,项目名称:gpdb,代码行数:11,代码来源:test_failover_recovery_mode.py


示例10: test_gpactivatestandby_on_new_host

 def test_gpactivatestandby_on_new_host(self):
     gputil.install_standby()
     initstdby = GpinitStandby()
     gpact_stdby = GpactivateStandby()
     self.mdd = gpact_stdby.get_standby_dd()
     self.host = initstdby.get_standbyhost()
     self.port = gpact_stdby.get_standby_port()
     self.standby_pid = gpact_stdby.get_standby_pid(self.host, self.port, self.mdd)
     PSQL.run_sql_file(local_path('create_tables.sql'), dbname = self.db_name)
     self.assertTrue(gpact_stdby.activate())
     self.assertTrue(gpact_stdby.verify_gpactivatestandby(self.standby_pid, self.host, self.port, self.mdd)) 
     gputil.failback_to_original_master(self.origin_mdd,self.host,self.mdd,self.port) 
开发者ID:50wu,项目名称:gpdb,代码行数:12,代码来源:test_gpactivatestandby.py


示例11: start_stdby

 def start_stdby(self):
     gpstdby = GpinitStandby()
     stdby_host = gpstdby.get_standbyhost()
     stdby_dbid = self.get_standby_dbid()
     activate_stdby = GpactivateStandby()
     stdby_mdd = activate_stdby.get_standby_dd()
     stdby_port = activate_stdby.get_standby_port()
     cmd = "pg_ctl -D %s -o '-p %s -b %s -z 2 --silent-mode=true -i -M master -C -1 -x 0 -E' start &" % (
         stdby_mdd,
         stdby_port,
         stdby_dbid,
     )
     self.run_remote(stdby_host, cmd, stdby_port, stdby_mdd)
开发者ID:kaknikhil,项目名称:gpdb,代码行数:13,代码来源:__init__.py


示例12: kill_walreceiver

 def kill_walreceiver(self):
     gpstdby = GpinitStandby()
     stdby_host = gpstdby.get_standbyhost()
     activate_stdby = GpactivateStandby()
     stdby_port = activate_stdby.get_standby_port()
     pid_list = []
     walreceiver_pid = self.pgutil.get_pid_by_keyword(host=stdby_host, pgport=stdby_port, keyword="wal receiver process")
     if int(walreceiver_pid) == -1:
         tinctest.logger.error("error: wal receiver process does not exist!")
         return False
     else:  
         pid_list.append(walreceiver_pid)
         self.killProcess_byPid(pid_toKill=pid_list, host=stdby_host)
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:13,代码来源:__init__.py


示例13: test_promote_incomplete_stdby

 def test_promote_incomplete_stdby(self):
     ''' 
     remove the standby base dir, try promote and check if fail       
     '''
     gpactivate_stdby = GpactivateStandby()
     gpinit_stdby = GpinitStandby()
     stdby_mdd = gpactivate_stdby.get_standby_dd()
     stdby_host = gpinit_stdby.get_standbyhost()
     stdby_port = gpactivate_stdby.get_standby_port()
     destDir = os.path.join(stdby_mdd, 'base')
     self.pgutil.clean_dir(stdby_host,destDir)
     promote_cmd = "pg_ctl promote -D %s"%stdby_mdd       
     (rc, output) = gpactivate_stdby.run_remote(stdby_host,promote_cmd ,stdby_port,stdby_mdd)
     self.assertEqual(rc, 0)
     pid = self.pgutil.get_pid_by_keyword(host=stdby_host, pgport=stdby_port, keyword='master', option='bin')
     self.assertTrue(int(pid) == -1, 'incomplete standby data directory promote succeeds.')
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:16,代码来源:test_promote_negative.py


示例14: test_gpactivatestandby_new_host_with_filespace

 def test_gpactivatestandby_new_host_with_filespace(self):
     from mpp.lib.gpfilespace import Gpfilespace
     gpfile = Gpfilespace()
     gpfile.create_filespace('fs_walrepl_a')
     PSQL.run_sql_file(local_path('filespace.sql'), dbname= self.db_name)
     gputil.install_standby()
     initstdby = GpinitStandby()
     gpact_stdby = GpactivateStandby()
     self.mdd = gpact_stdby.get_standby_dd()
     self.host = initstdby.get_standbyhost()
     self.port = gpact_stdby.get_standby_port()
     self.standby_pid = gpact_stdby.get_standby_pid(self.host, self.port, self.mdd)
     PSQL.run_sql_file(local_path('create_tables.sql'), dbname = self.db_name)
     self.assertTrue(gpact_stdby.activate())
     self.assertTrue(gpact_stdby.verify_gpactivatestandby(self.standby_pid, self.host, self.port, self.mdd)) 
     gputil.failback_to_original_master(self.origin_mdd,self.host,self.mdd,self.port)
开发者ID:50wu,项目名称:gpdb,代码行数:16,代码来源:test_gpactivatestandby.py


示例15: setUp

 def setUp(self):
     # For each test case we create a fresh standby and start it.
     self.db_name = self.__class__.db_name
     self.createdb(self.db_name)
     gputil.remove_standby()
     gputil.install_standby(new_stdby_host=socket.gethostname()) 
     self.gpinit_stdby = GpinitStandby()
     self.activatestdby = GpactivateStandby()
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:8,代码来源:test_gpactivatestandby.py


示例16: __init__

 def __init__(self, methodName):
     self.gp = GpinitStandby()
     self.host = socket.gethostname()
     self.mdd = os.environ.get('MASTER_DATA_DIRECTORY')
     self.standby = self.gp.get_standbyhostnode()
     self.standby_loc = os.path.join(os.path.split(self.mdd)[0],
                                     self.standby_dirname)
     self.primary_pid = 0 
     super(GpinitStandsbyTestCase,self).__init__(methodName)
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:9,代码来源:test_gpinitstandby.py


示例17: __init__

 def __init__(self):
     self.gpinit = GpinitStandby()
     self.mdd = os.environ.get("MASTER_DATA_DIRECTORY")
     self.config = GPDBConfig()
     self.pgutil = GpUtility()
     self.verify = StandbyVerify()
     self.host = socket.gethostname()
     self.standby_loc = os.path.join(os.path.split(self.mdd)[0], self.standby_dirname)
     self.standby = Standby(self.standby_loc, self.standby_port)
开发者ID:xuegang,项目名称:gpdb,代码行数:9,代码来源:__init__.py


示例18: OODTestCase

class OODTestCase(ScenarioTestCase):
    ''' Standby OOD when transactions in progress, standby need to be restaerted'''

    def __init__(self, methodName):
        self.gp = GpinitStandby()
        super(OODTestCase,self).__init__(methodName)

    def setUp(self):
        #Remove standby if present
        self.gp.run(option='-r')
        
       
    def tearDown(self):
        #Remove standby 
        self.gp.run(option='-r')
        
    
    @unittest.skipIf(os.uname()[0] == 'Darwin', "Skipping this test on OSX")   
    def Dtest_ood_on_standby(self):
        
        
        test_case_list0 = []
        test_case_list0.append('mpp.gpdb.tests.storage.walrepl.ood.OODClass.initiate_standby')
        self.test_case_scenario.append(test_case_list0)

        test_case_list1 = []
        test_case_list1.append('mpp.gpdb.tests.storage.walrepl.ood.OODClass.filldisk')
        self.test_case_scenario.append(test_case_list1)

        test_case_list2 = []
        test_case_list2.append('mpp.gpdb.tests.storage.walrepl.ood.sql.runsql.RunWorkload')
        self.test_case_scenario.append(test_case_list2)

        test_case_list3 = []
        test_case_list3.append('mpp.gpdb.tests.storage.walrepl.ood.OODClass.check_standby')
        self.test_case_scenario.append(test_case_list3)

        test_case_list4 = []
        test_case_list4.append('mpp.gpdb.tests.storage.walrepl.ood.OODClass.restart_standby')
        self.test_case_scenario.append(test_case_list4)
        
        test_case_list5 = []
        test_case_list5.append('mpp.gpdb.tests.storage.walrepl.ood.OODClass.cleanup')
        self.test_case_scenario.append(test_case_list5)
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:44,代码来源:test_ood.py


示例19: __init__

 def __init__(self,methodName):
     self.gpact = GpactivateStandby()
     self.gpinit = GpinitStandby()
     self.runmixin = StandbyRunMixin()
     self.runmixin.createdb(dbname=self.dbname)
     self.bkup_timestamp = ""
     self.gphome = os.environ.get('GPHOME')
     self.mdd = os.environ.get('MASTER_DATA_DIRECTORY')
     self.pgport = os.environ.get('PGPORT')
     self.host = socket.gethostname()
     self.standby_loc = os.path.split(self.mdd)[0]+self.standby_dirname
     super(BkupRestore,self).__init__(methodName)
开发者ID:50wu,项目名称:gpdb,代码行数:12,代码来源:__init__.py


示例20: OOMGpstartTestCase

class OOMGpstartTestCase(MPPTestCase):
    ''' Simulating oom on standby master , gpstart fails to start standby'''
    
    # Setup OOM env
    oom.setup_oom()

    def __init__(self, methodName):
        self.gpinitstandby= GpinitStandby()
        self.gputil = GpUtility()
        super(OOMGpstartTestCase,self).__init__(methodName)

    def setUp(self):
        self.gpinitstandby.run(option='-r')

    def tearDown(self):
        self.gpinitstandby.run(option='-r')

    def test_oom_with_gpstart(self):
        # Create standby
        oom.create_standby()
        # Stop cluster
        self.gputil.run('gpstop -a')
        # Run gpstart after creaitng the flag file- Presence of this flag file will return NULL for malloc simulating a no  memory scenario
        oom.touch_malloc()
        self.assertFalse(oom.startdb(), 'Standby start is expected to fail with no memory error')
        # Restart after removing the flag file
        self.assertTrue(oom.restartdb(), 'Expected a successful start of standby')

    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_oom_with_psql_con(self):
        # Create standby
        oom.create_standby()
        # Stop cluster
        self.gputil.run('gpstop -a')
        # Run gpstart with wrapper
        oom.startdb()
        # OOM with psql- after adding the flag file to the standby directory to simulate OOM
        self.assertTrue(oom.psql_and_oom())
        # Start standby after free up memory
        self.assertTrue(oom.start_standby())
开发者ID:50wu,项目名称:gpdb,代码行数:40,代码来源:test_oom.py



注:本文中的mpp.gpdb.tests.storage.walrepl.gpinitstandby.GpinitStandby类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pg_util.GpUtility类代码示例发布时间:2022-05-27
下一篇:
Python gpactivatestandby.GpactivateStandby类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap