(self, ev, dst_curs)
handle one truncate event
handle one truncate event
handle one truncate event
def handle_truncate_event(self, ev, dst_curs):
        """handle one truncate event"""
        t = self.get_table_by_name(ev.extra1)
        if not t or not t.interesting(ev, self.cur_tick, self.copy_thread, self.copy_table_name):
            self.stat_increase('ignored_events')
            return

        fqname = skytools.quote_fqident(t.dest_table)

        try:
            p = self.used_plugins[ev.extra1]
        except KeyError:
            p = t.get_plugin()
            self.used_plugins[ev.extra1] = p

        if p.conf.get('ignore_truncate'):
            self.log.info("ignoring truncate for %s", fqname)
            return

        #
        # Always use CASCADE, because without it the
        # operation cannot work with FKeys, on both
        # slave and master.
        #
        sql = "TRUNCATE %s CASCADE;" % fqname

        self.flush_sql(dst_curs)
        dst_curs.execute(sql)
def handle_truncate_event ( self , ev , dst_curs ) : t = self . get_table_by_name ( ev . extra1 ) if not t or not t . interesting ( ev , self . cur_tick , self . copy_thread , self . copy_table_name ) : self . stat_increase ( 'ignored_events' ) return fqname = skytools . quote_fqident ( t . dest_table ) try : p = self . used_plugins [ ev . extra1 ] except KeyError : p = t . get_plugin ( ) self . used_plugins [ ev . extra1 ] = p if p . conf . get ( 'ignore_truncate' ) : self . log . info ( "ignoring truncate for %s" , fqname ) return # # Always use CASCADE, because without it the # operation cannot work with FKeys, on both # slave and master. # sql = "TRUNCATE %s CASCADE;" % fqname self . flush_sql ( dst_curs ) dst_curs . execute ( sql )