当前位置: 首页>>代码示例>>Python>>正文


Python GpinitStandby.initstand_by_with_default方法代码示例

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


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

示例1: GpinitStandsbyTestCase

# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpinitstandby import GpinitStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpinitstandby.GpinitStandby import initstand_by_with_default [as 别名]

#.........这里部分代码省略.........
        

    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_gpinitstandby_new_host_new_port(self):
        self.create_directory(self.mdd)
        self.assertTrue(self.gp.run(option = '-P %s -s %s' % (self.standby_port, self.standby)))
        self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))

    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_gpinitstandby_new_host_new_mdd(self):
        self.create_directory(self.standby_loc)
        self.assertTrue(self.gp.run(option = '-F pg_system:%s -s %s' % (self.standby_loc, self.standby)))
        self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))
    

    def test_gpinitstandby_to_same_with_filespaces(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)
        filespace_loc = self.gp.get_filespace_location() 
        filespace_loc = os.path.join(os.path.split(filespace_loc)[0], 'newstandby')
        filespaces = "pg_system:%s,fs_walrepl_a:%s" %(self.standby_loc , filespace_loc)
        self.assertTrue(self.gp.run(option = '-F %s -s %s -P %s' % (filespaces, self.host, self.standby_port)))
        self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))
    
    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_gpinitstandby_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)
        filespace_loc = self.gp.get_filespace_location()
        self.create_directory(filespace_loc)
        filespaces = "pg_system:%s,fs_walrepl_a:%s" % (self.mdd, filespace_loc)
        self.assertTrue(self.gp.run(option = '-F %s -s %s -P %s' % (filespaces, self.standby, self.standby_port)))
        self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))
    
    def test_gpinitstandby_remove_from_same_host(self):
        #self.gp.create_dir_on_standby(self.host, self.standby_loc)
        pgutil.clean_dir(self.host,self.standby_loc)
        self.gp.run(option = '-P %s -s %s -F pg_system:%s' % (self.standby_port, self.host, self.standby_loc))
        self.assertTrue(self.gp.run(option = '-r'))

    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_gpinitstandby_remove_from_new_host(self):
        self.create_directory(self.mdd)
        self.gp.run(option = '-s %s' % self.standby)
        self.assertTrue(self.gp.run(option = '-r'))
   
    def test_gpinitstandby_n_with_no_standby_stop(self):
        pgutil.clean_dir(self.host,self.standby_loc)
        self.gp.run(option = '-P %s -s %s -F pg_system:%s' % (self.standby_port, self.host, self.standby_loc))
        (rc,out) = pgutil.run(command='gpinitstandby -n')
        self.assertTrue('Standy master is already up and running' in out)

    def test_gpinitstandby_n_with_standby_stop(self):
        pgutil.clean_dir(self.host,self.standby_loc)
        self.gp.run(option = '-P %s -s %s -F pg_system:%s' % (self.standby_port, self.host, self.standby_loc))
        self.standby = Standby(self.standby_loc,
                                        self.standby_port)

        self.standby.stop()
        (rc,out) = pgutil.run(command='gpinitstandby -n')
        self.assertTrue('Successfully started standby master' in out)

    def test_gpinitstandby_with_no_default_path(self):
        self.assertTrue(self.gp.initstand_by_with_default())
    
    @unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
    def test_gpinitstandby_prompt_for_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)
        filespace_loc = self.gp.get_filespace_location()
        self.create_directory(filespace_loc)
        self.assertTrue(self.gp.init_with_prompt(filespace_loc))

    def test_gpinistandby_with_M(self):
        '''
        @product_version gpdb: [4.3.1.0-MAIN]
        '''
        pgutil.clean_dir(self.host,self.standby_loc)
        self.assertTrue(self.gp.run(option = '-P %s -s %s -F pg_system:%s -M smart' % (self.standby_port, self.host, self.standby_loc)))
        self.assertTrue(self.gp.run(option = '-r'))

    def test_gpinitstandby_to_same_host_new_port_and_new_mdd_with_error(self):
        '''
        @product_version gpdb: [4.3.6.2 - 4.3.99.0)
        '''
        pgutil.clean_dir(self.host,self.standby_loc)
        try:
            self.create_unmodifiable_file('foo')
            (rc, out) = pgutil.run(command='gpinitstandby -a -P %s -s %s -F pg_system:%s' % (self.standby_port, self.host, self.standby_loc))
            self.assertTrue('ERROR:  could not open file "./foo": Permission denied' in out)
            self.assertFalse('server closed the connection unexpectedly' in out)
        finally:
            self.remove_unmodifiable_file('foo')
            pgutil.clean_dir(self.host,self.standby_loc)
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:104,代码来源:test_gpinitstandby.py


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