Exemplo n.º 1
0
 def tearDown(self):
     try:
         Filerepe2e_Util().inject_fault(f='all', y='reset', H='ALL', r='primary')
         Filerepe2e_Util().inject_fault(f='all', y='reset', seg_id='1')
     except:
         pass
     super(vacuumFaultsTest, self).tearDown()
Exemplo n.º 2
0
 def tearDown(self):
     Filerepe2e_Util().inject_fault(f='all',
                                    y='reset',
                                    H='ALL',
                                    r='primary')
     Filerepe2e_Util().inject_fault(f='all', y='reset', seg_id='1')
     super(test_crossexec, self).tearDown()
Exemplo n.º 3
0
    def reset_all_faults(self):
        ''''
        @summary : Reset all faults on primary and mirror 
        '''
        tinctest.logger.info("[STLRTest] Running reset_all_faults")
        self.util = Filerepe2e_Util()

        (ok1, out1) = self.util.inject_fault(f='all',
                                             m='async',
                                             y='reset',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done resetting all faults on primary")

        (ok1, out1) = self.util.inject_fault(f='all',
                                             m='async',
                                             y='reset',
                                             r='mirror',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info(
            "[STLRTest]Done resetting all faults fault on mirror")
Exemplo n.º 4
0
 def tearDown(self):
     self.standby.remove_catalog_standby("")
     super(xansrep, self).tearDown()
     fault_injector = Filerepe2e_Util()
     fault_injector.inject_fault(f='transaction_abort_after_distributed_prepared',
                              y='reset', seg_id=1)
     fault_injector.inject_fault(f='dtm_broadcast_commit_prepared', y='reset', seg_id=1)
Exemplo n.º 5
0
    def suspend_faults(self, fault_name):
        '''
        @summary : Suspend the specified fault: reset it before issuing suspend 
        @param fault_name : Name of the fault to suspend
        '''
        tinctest.logger.info("[STLRTest] Running suspend_faults")

        self.util = Filerepe2e_Util()

        (ok1, out1) = self.util.inject_fault(f=fault_name,
                                             m='async',
                                             y='reset',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done resetting the %s fault" %
                             (fault_name))

        (ok1, out1) = self.util.inject_fault(f=fault_name,
                                             m='async',
                                             y='suspend',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done suspending the %s fault" %
                             (fault_name))
Exemplo n.º 6
0
    def skip_checkpoint(self):
        ''' 
        @summary : Routine to inject fault that skips checkpointing 
        '''

        self.util = Filerepe2e_Util()

        tinctest.logger.info("[STLRTest] Running skip_checkpoint")

        (ok1, out1) = self.util.inject_fault(f='checkpoint',
                                             m='async',
                                             y='reset',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done resetting the checkpoint fault")

        (ok1, out1) = self.util.inject_fault(f='checkpoint',
                                             m='async',
                                             y='skip',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done skipping the checkpoint fault")
Exemplo n.º 7
0
    def skip_checkpoint(self):
        ''' 
        @summary : Routine to inject fault that skips checkpointing 
        '''

        self.util = Filerepe2e_Util()

        tinctest.logger.info("[STLRTest] Running skip_checkpoint")

        (ok1,out1) = self.util.inject_fault(f='checkpoint', m = 'async', y = 'reset', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done resetting the checkpoint fault")

        (ok1,out1) = self.util.inject_fault(f='checkpoint', m = 'async', y = 'skip', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done skipping the checkpoint fault")
Exemplo n.º 8
0
    def test_with_fault_injection(self):
        """
        add new mirrors run workload to verify if cluster functioning correctly, and 
        inject the mirror to bring cluster into change tracking, then recoverseg
        """
        filerepUtil = Filerepe2e_Util()
        gprecover = GpRecover()
        self._setup_gpaddmirrors()
        self._cleanup_segment_data_dir(self.host_file, self.mirror_data_dir)

        res = {'rc': 0, 'stdout' : '', 'stderr': ''}
        run_shell_command("gpaddmirrors -a -i %s -d %s --verbose" % (self.mirror_config_file, self.mdd), 'run gpaddmirrros with fault injection', res)
        gprecover.wait_till_insync_transition()
        self.assertEqual(0, res['rc'])
        self.run_simple_ddl_dml()

        # after adding new mirrors, check the intergrity between primary and mirror
        self.check_mirror_seg()
        out_file = local_path('inject_fault_into_ct')
        filerepUtil.inject_fault(f='filerep_consumer', m='async', y='fault', r='mirror', H='ALL', outfile=out_file)
        # trigger the transtion to change tracking
        PSQL.run_sql_command('drop table if exists foo;', dbname = 'template1')
        filerepUtil.wait_till_change_tracking_transition()
        gprecover.incremental()
        gprecover.wait_till_insync_transition()
        out_file=local_path('reset_fault')
        filerepUtil.inject_fault(f='filerep_consumer', m='async', y='reset', r='mirror', H='ALL', outfile=out_file)
Exemplo n.º 9
0
    def test_insert_commit_before_truncate(self):
        '''
        @description We suspend the vacuum on master after the first
                     transaction, and connect to segment.  Modify the
                     relation in vacuum and commit the segment local
                     transaction before the truncate transaction starts.
        '''
        fault_name = 'vacuum_relation_end_of_first_round'

        gpdbconfig = GPDBConfig()
        seghost, segport = gpdbconfig.get_hostandport_of_segment(0, 'p')
        filereputil = Filerepe2e_Util()
        filereputil.inject_fault(f=fault_name, y='suspend', seg_id='1')

        # run vacuum in background, it'll be blocked.
        sql_file1, ans_file1, out_file1 = self.get_file_names('conn1')
        psql1 = PSQL(sql_file=sql_file1, out_file=out_file1)
        thread1 = threading.Thread(target=self.run_psql, args=(psql1,))
        thread1.start()

        self.check_fault_triggered(fault_name)

        sql_file2, ans_file2, out_file2 = self.get_file_names('conn2')
        # utility to seg0
        psql2 = PSQL(sql_file=sql_file2, out_file=out_file2,
                     host=seghost, port=segport,
                     PGOPTIONS='-c gp_session_role=utility')
        self.run_psql(psql2)

        # resume vacuum
        filereputil.inject_fault(f=fault_name, y='reset', seg_id='1')
        thread1.join()
        self.assertTrue(Gpdiff.are_files_equal(out_file1, ans_file1))
        self.assertTrue(Gpdiff.are_files_equal(out_file2, ans_file2))
Exemplo n.º 10
0
    def reset_faults(self,fault_name,current_cluster_state):
        ''''
        @summary : Reset the faults at the end of test 
        '''
        self.util = Filerepe2e_Util()
        tinctest.logger.info("[STLRTest] Running reset_faults")   

        tinctest.logger.info("[STLRTest] Resetting fault before ending test")

        (ok1,out1) = self.util.inject_fault(f=fault_name, m = 'async', y = 'reset', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")   
        tinctest.logger.info("[STLRTest]Done resetting %s fault" %(fault_name))

        if current_cluster_state == 'resync':
            tinctest.logger.info("[STLRTest] printing gp segment configuration")
            (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
            tinctest.logger.info(gp_seg_conf)

            (ok1,out1) = self.util.inject_fault(f='filerep_resync', m = 'async', y = 'reset', r = 'primary', H ='ALL')
            if not ok1:
                raise Exception("[STLRTest]Fault injection failed")   
            tinctest.logger.info("[STLRTest]Done filerep_resync fault")

        (ok1,out1) = self.util.inject_fault(f='checkpoint', m = 'async', y = 'reset', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)
        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")   
        tinctest.logger.info("[STLRTest]Done resetting checkpoint fault" )
Exemplo n.º 11
0
    def resume_faults(self, fault_name, trans_state):
        ''''
        @summary : Resume the fault and check status
        '''
        self.util = Filerepe2e_Util()

        tinctest.logger.info("[STLRTest] Running resume_faults")

        if not trans_state == 'failover_to_mirror':
            tinctest.logger.info("[STLRTest] fault for %s resume" % fault_name)
            (ok1, out1) = self.util.inject_fault(f=fault_name,
                                                 m='async',
                                                 y='resume',
                                                 r='primary',
                                                 H='ALL')
            if not ok1:
                raise Exception("[STLRTest]Fault resume failed")
            tinctest.logger.info("[STLRTest]Done fault for %s resume" %
                                 fault_name)

        if trans_state == 'postmaster_reset':
            (ok1, out1) = self.util.inject_fault(f=fault_name,
                                                 m='async',
                                                 y='resume',
                                                 r='mirror',
                                                 H='ALL')
            if not ok1:
                tinctest.logger.info(
                    "[STLRTest]Failed fault for %s resume on mirror" %
                    fault_name)

        if trans_state == 'failover_to_primary':
            self.check_fault_status(fault_name, 'completed')
Exemplo n.º 12
0
    def check_fault_status(self,fault_name = None, status = None, max_cycle=10):
        ''' 
        Check whether a fault is triggered. Poll till the fault is triggered
        @param name : Fault name
        @param status : Status to be checked - triggered/completed
        '''
        self.util = Filerepe2e_Util()

        tinctest.logger.info("[STLRTest] Running check_fault_status %s", status)   

        if (not fault_name) or (not status) :
            raise Exception("[STLRTest]Need a value for fault_name and status to continue")

        poll =0
        while(poll < max_cycle):
            (ok1,out1) = self.util.inject_fault(f=fault_name, m = 'async', y = 'status', r = 'primary', H ='ALL')
            poll +=1
            for line in out1.splitlines():
                if line.find(fault_name) > 0 and line.find(status) > 0 :
                    tinctest.logger.info("[STLRTest]Fault %s is %s " % (fault_name,status))
                    poll = 0
                    tinctest.logger.info("[STLRTest] Running check_fault_status %s TRUE", status)
                    return True
            tinctest.logger.info("[STLRTest] printing gp segment configuration")
            (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
            tinctest.logger.info(gp_seg_conf)

            #sleep a while before start polling again
            sleep(10)
        tinctest.logger.info("[STLRTest] Running check_fault_status %s FALSE", status)
        return False
Exemplo n.º 13
0
 def __init__(self, methodName):
     self.pgport = os.environ.get('PGPORT')
     self.fileutil = Filerepe2e_Util()
     self.gpstate = Gpstate()
     self.gpprimarymirror = Gpprimarymirror()
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     super(FtsTransitions,self).__init__(methodName)
Exemplo n.º 14
0
 def setUp(self):
     self.fileutil = Filerepe2e_Util()
     self.fileutil.inject_fault(f='all',
                                m='async',
                                y='reset',
                                r='primary_mirror',
                                H='ALL')
     super(FTSTestCase, self).setUp()
 def __init__(self, methodName):
     tinctest.logger.info(
         "\n =====================In __init__ method =========================="
     )
     self.gpfile = Gpfilespace()
     self.filereputil = Filerepe2e_Util()
     super(SuspendcheckpointCrashrecoveryTestCase,
           self).__init__(methodName)
Exemplo n.º 16
0
    def test_insert_unlock_before_truncate(self):
        '''
        @description This is rather complicated.  We suspend the vacuum on
                     master after the first transaction, and connect to
                     segment, modify the relation in question, and release the
                     lock, keep the transaction.  To release the lock, we need
                     a special UDF.  Vacuum is supposed to skip truncate if it
                     sees such in-progress transaction.  Usually this should
                     not happen, but it rather simulates catalog DDL.
        '''
        fault_name = 'vacuum_relation_end_of_first_round'

        gpdbconfig = GPDBConfig()
        seghost, segport = gpdbconfig.get_hostandport_of_segment(0, 'p')
        filereputil = Filerepe2e_Util()
        filereputil.inject_fault(f=fault_name, y='suspend', seg_id='1')

        PSQL.run_sql_command(
            sql_cmd=
            'drop table if exists sync_table; create table sync_table(a int)')
        # Use pygresql to keep the connection and issue commands seprately.
        # thread2 will wait on sync_table before finish its work, so we
        # can keep the transaction open until the vacuum completes its work.
        conn = pygresql.pg.connect(host=seghost,
                                   port=int(segport),
                                   opt='-c gp_session_role=utility')
        conn.query('begin')
        conn.query('lock sync_table in access exclusive mode')

        # run vacuum background, it'll be blocked.
        sql_file1, ans_file1, out_file1 = self.get_file_names('conn1')
        psql1 = PSQL(sql_file=sql_file1, out_file=out_file1)
        thread1 = threading.Thread(target=self.run_psql, args=(psql1, ))
        thread1.start()

        self.check_fault_triggered(fault_name)

        sql_file2, ans_file2, out_file2 = self.get_file_names('conn2')
        # utility to seg0
        psql2 = PSQL(sql_file=sql_file2,
                     out_file=out_file2,
                     host=seghost,
                     port=segport,
                     PGOPTIONS='-c gp_session_role=utility')
        thread2 = threading.Thread(target=self.run_psql, args=(psql2, ))
        thread2.start()

        # resume vacuum
        filereputil.inject_fault(f=fault_name, y='reset', seg_id='1')

        # Once thread1 finishes, we can now release the lock on sync_table,
        # so that thread2 can proceed.
        thread1.join()
        conn.query('commit')
        thread2.join()

        self.assertTrue(Gpdiff.are_files_equal(out_file1, ans_file1))
        self.assertTrue(Gpdiff.are_files_equal(out_file2, ans_file2))
Exemplo n.º 17
0
 def __init__(self, methodName):
     self.pgport = os.environ.get('PGPORT')
     self.fileutil = Filerepe2e_Util()
     self.gpconfig = GPDBConfig()
     self.gprecover = GpRecover(self.gpconfig)
     self.gpstate = Gpstate()
     self.gpprimarymirror = Gpprimarymirror()
     self.base = GPDBStorageBaseTestCase(self.gpconfig)
     super(FtsTransitions, self).__init__(methodName)
Exemplo n.º 18
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)
Exemplo n.º 19
0
 def __init__(self, methodName):
     self.filereputil = Filerepe2e_Util()
     self.config = GPDBConfig()
     self.gprecover = GpRecover(self.config)
     self.gpstop = GpStop()
     self.gpstart = GpStart()
     self.gpverify = GpdbVerify(config=self.config)
     self.dbstate = DbStateClass('run_validation', self.config)
     self.port = os.getenv('PGPORT')
     super(PgtwoPhaseClass, self).__init__(methodName)
Exemplo n.º 20
0
 def run_gp_inject_fault(self,
                         fault_type,
                         fault_name,
                         s_occurrence=1,
                         e_occurrence=1):
     fault_injector = Filerepe2e_Util()
     fault_injector.inject_fault(f=fault_name,
                                 y=fault_type,
                                 seg_id=1,
                                 s_o=s_occurrence,
                                 e_o=e_occurrence)
Exemplo n.º 21
0
 def __init__(self,methodName):
     self.fileutil = Filerepe2e_Util()
     self.config = GPDBConfig()
     self.gprecover = GpRecover(self.config)
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     self.gpfile = Gpfilespace(self.config)
     self.dbstate = DbStateClass('run_validation', self.config)
     self.port = os.getenv('PGPORT')
     self.base = GPDBStorageBaseTestCase()
     super(SuspendCheckpointCrashRecovery,self).__init__(methodName)
Exemplo n.º 22
0
    def __init__(self, config=None):
        if config is not None:
            self.config = config
        else:
            self.config = GPDBConfig()

        self.filereputil = Filerepe2e_Util()
        self.gprecover = GpRecover(self.config)
        self.gpstop = GpStop()
        self.gpstart = GpStart()
        self.gpverify = GpdbVerify(config=self.config)
        self.dbstate = DbStateClass('run_validation', self.config)
        self.port = os.getenv('PGPORT')
Exemplo n.º 23
0
 def check_fault_triggered(self, fault_name, status='triggered'):
     # TODO Filerepe2e_Util.check_status should take seg_id parameter to work with master
     poll = 0
     triggered = False
     filereputil = Filerepe2e_Util()
     while poll < 10 and not triggered:
         status = 'triggered'
         (ok, out) = filereputil.inject_fault(f=fault_name, y='status', seg_id='1')
         for line in out.splitlines():
             if line.find(fault_name) > 0 and line.find(status) > 0:
                 poll = 0
                 triggered = True
                 break
         time.sleep(1)
     self.assertTrue(triggered, 'fault should be ' + status)
Exemplo n.º 24
0
    def resume_filerep_resync(self):
        self.util = Filerepe2e_Util()

        tinctest.logger.info("[STLRTest] Running resume_filerep_resync")   

        tinctest.logger.info("[STLRTest] fault for failover_to_mirror resume")
        (ok1,out1) = self.util.inject_fault(f='filerep_resync', m = 'async', y = 'resume', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")   
        tinctest.logger.info("[STLRTest]Done fault for failover_to_mirror resume")
        sleep(10)
Exemplo n.º 25
0
    def resume_filerep_resync(self):
        self.util = Filerepe2e_Util()

        tinctest.logger.info("[STLRTest] Running resume_filerep_resync")

        tinctest.logger.info("[STLRTest] fault for failover_to_mirror resume")
        (ok1, out1) = self.util.inject_fault(f='filerep_resync',
                                             m='async',
                                             y='resume',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info(
            "[STLRTest]Done fault for failover_to_mirror resume")
        sleep(10)
Exemplo n.º 26
0
    def filerep_fault(self, trans_state):
        '''
        @summary : Inject the filerep fault supplied
        @param trans_state : type of transition 
        '''
        tinctest.logger.info("[STLRTest] Running filerep_fault")
        self.util = Filerepe2e_Util()

        if trans_state == 'failover_to_primary':
            tinctest.logger.info("[STLRTest] primary failover")
            (ok1, out1) = self.util.inject_fault(f='filerep_consumer',
                                                 m='async',
                                                 y='fault',
                                                 r='mirror',
                                                 H='ALL')

            if not ok1:
                raise Exception("[STLRTest]Fault injection failed")
            tinctest.logger.info("[STLRTest]Done primary failover fault")

        elif trans_state == 'failover_to_mirror':
            tinctest.logger.info("[STLRTest] fault for postmaster panic")
            (ok1, out1) = self.util.inject_fault(f='postmaster',
                                                 m='async',
                                                 y='panic',
                                                 r='primary',
                                                 H='ALL')

            if not ok1:
                raise Exception("[STLRTest]Fault injection failed")
            tinctest.logger.info("[STLRTest]Done postmaster panic fault")

        elif trans_state == 'postmaster_reset':
            tinctest.logger.info("[STLRTest] fault for filerep_sender panic")
            (ok1, out1) = self.util.inject_fault(f='filerep_sender',
                                                 m='async',
                                                 y='panic',
                                                 r='primary',
                                                 H='ALL')

            if not ok1:
                raise Exception("[STLRTest]Fault injection failed")
            tinctest.logger.info("[STLRTest]Done filerep_sender panic fault")

        tinctest.logger.info("[STLRTest] Done Injecting Fault")
Exemplo n.º 27
0
    def reset_all_faults(self):
        ''''
        @summary : Reset all faults on primary and mirror 
        '''
        tinctest.logger.info("[STLRTest] Running reset_all_faults")   
        self.util = Filerepe2e_Util()

        (ok1,out1) = self.util.inject_fault(f='all', m = 'async', y = 'reset', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)
        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")   
        tinctest.logger.info("[STLRTest]Done resetting all faults on primary")

        (ok1,out1) = self.util.inject_fault(f='all', m = 'async', y = 'reset', r = 'mirror', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)
        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")   
        tinctest.logger.info("[STLRTest]Done resetting all faults fault on mirror") 
Exemplo n.º 28
0
    def reset_faults(self, fault_name, current_cluster_state):
        ''''
        @summary : Reset the faults at the end of test 
        '''
        self.util = Filerepe2e_Util()
        tinctest.logger.info("[STLRTest] Running reset_faults")

        tinctest.logger.info("[STLRTest] Resetting fault before ending test")

        (ok1, out1) = self.util.inject_fault(f=fault_name,
                                             m='async',
                                             y='reset',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done resetting %s fault" %
                             (fault_name))

        if current_cluster_state == 'resync':
            (ok1, out1) = self.util.inject_fault(f='filerep_resync',
                                                 m='async',
                                                 y='reset',
                                                 r='primary',
                                                 H='ALL')
            if not ok1:
                raise Exception("[STLRTest]Fault injection failed")
            tinctest.logger.info("[STLRTest]Done filerep_resync fault")

        (ok1, out1) = self.util.inject_fault(f='checkpoint',
                                             m='async',
                                             y='reset',
                                             r='primary',
                                             H='ALL')

        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")
        tinctest.logger.info("[STLRTest]Done resetting checkpoint fault")
Exemplo n.º 29
0
    def suspend_faults(self,fault_name):
        '''
        @summary : Suspend the specified fault: reset it before issuing suspend 
        @param fault_name : Name of the fault to suspend
        '''
        tinctest.logger.info("[STLRTest] Running suspend_faults")   

        self.util = Filerepe2e_Util()

        (ok1,out1) = self.util.inject_fault(f=fault_name, m = 'async', y = 'reset', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)
        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")   
        tinctest.logger.info("[STLRTest]Done resetting the %s fault"%(fault_name))      

        (ok1,out1) = self.util.inject_fault(f=fault_name, m = 'async', y = 'suspend', r = 'primary', H ='ALL')
        tinctest.logger.info("[STLRTest] printing gp segment configuration")
        (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
        tinctest.logger.info(gp_seg_conf)
        if not ok1:
            raise Exception("[STLRTest]Fault injection failed")   
        tinctest.logger.info("[STLRTest]Done suspending the %s fault"%(fault_name))
Exemplo n.º 30
0
    def test_mpp23395(self):
        """
        
        @description Test MPP-20964, uncleaned lock table by pg_terminate_backend
        @product_version gpdb: [4.3.3.1-],[4.2.8.5-4.2.99.99]
        """
        self.util = Filerepe2e_Util()

        (ok, out) = self.util.inject_fault(f='dtm_broadcast_commit_prepared',
                                           y='reset',
                                           seg_id=1)
        if not ok:
            raise Exception(
                "Failed to reset the fault dtm_broadcast_commit_prepared")

        # setup
        PSQL.run_sql_command("""
          DROP TABLE IF EXISTS mpp23395;
          """)

        # Scenario 1: FAULT during Create Table on master
        sql = '''
        CREATE TABLE mpp23395(a int);
        '''
        self.run_sequence(sql, 'dtm_broadcast_commit_prepared', 'fatal', 1)

        # Scenario 2: FAULT during Drop Table on master, COMMIT case
        sql = '''
        DROP TABLE mpp23395;
        '''
        self.run_sequence(sql, 'dtm_broadcast_commit_prepared', 'fatal', 1)

        (ok, out) = self.util.inject_fault(f='dtm_broadcast_commit_prepared',
                                           y='reset',
                                           seg_id=1)
        if not ok:
            raise Exception(
                "Failed to reset the fault dtm_broadcast_commit_prepared")

        # Scenario 3: FAULT during Create Table on segment, COMMIT case
        sql = '''
        SET debug_dtm_action_target = "protocol";
        SET debug_dtm_action_protocol = "commit_prepared";
        SET debug_dtm_action_segment = 0;
        SET debug_dtm_action = "fail_begin_command";
        CREATE TABLE mpp23395(a int);
        '''
        self.run_sequence(sql, 'twophase_transaction_commit_prepared', 'error',
                          2)

        # Scenario 4: FAULT during Drop Table on segment, COMMIT case
        sql = '''
        SET debug_dtm_action_target = "protocol";
        SET debug_dtm_action_protocol = "commit_prepared";
        SET debug_dtm_action_segment = 0;
        SET debug_dtm_action = "fail_begin_command";
        DROP TABLE mpp23395;
        '''
        self.run_sequence(sql, 'twophase_transaction_commit_prepared', 'error',
                          2)

        # Scenario 5: FAULT during Create Table on master, ABORT case
        (ok, out) = self.util.inject_fault(
            f='transaction_abort_after_distributed_prepared',
            y='error',
            seg_id=1)
        if not ok:
            raise Exception(
                "Failed to set the error fault for transaction_abort_after_distributed_prepared"
            )

        sql = '''
        CREATE TABLE mpp23395(a int);
        '''
        self.run_sequence(sql, 'dtm_broadcast_abort_prepared', 'fatal', 1)

        (ok, out) = self.util.inject_fault(
            f='transaction_abort_after_distributed_prepared',
            y='reset',
            seg_id=1)
        if not ok:
            raise Exception(
                "Failed to reset the fault transaction_abort_after_distributed_prepared"
            )

        PSQL.run_sql_command("""
        CREATE TABLE mpp23395(a int);
          """)

        # Scenario 6: FAULT during Drop Table on master, ABORT case
        (ok, out) = self.util.inject_fault(
            f='transaction_abort_after_distributed_prepared',
            y='error',
            seg_id=1)
        if not ok:
            raise Exception(
                "Failed to set the error fault for transaction_abort_after_distributed_prepared"
            )

        sql = '''
        DROP TABLE mpp23395;
        '''
        self.run_sequence(sql, 'dtm_broadcast_abort_prepared', 'fatal', 1)

        (ok, out) = self.util.inject_fault(
            f='transaction_abort_after_distributed_prepared',
            y='reset',
            seg_id=1)
        if not ok:
            raise Exception(
                "Failed to reset the fault transaction_abort_after_distributed_prepared"
            )

        PSQL.run_sql_command("""
        DROP TABLE mpp23395;
          """)

        dbstate = DbStateClass('run_validation')
        dbstate.check_catalog()