(self, src_db, dst_db, where, pfx = 'repair', apply_fixes = False)
Actual comparison.
Actual comparison.
Actual comparison .
def do_repair(self, src_db, dst_db, where, pfx = 'repair', apply_fixes = False):
        """Actual comparison."""

        self.reset()

        src_curs = src_db.cursor()
        dst_curs = dst_db.cursor()

        self.apply_fixes = apply_fixes
        if apply_fixes:
            self.apply_cursor = dst_curs

        self.log.info('Checking %s' % self.table_name)

        copy_tbl = self.gen_copy_tbl(src_curs, dst_curs, where)

        dump_src = "%s.%s.src" % (pfx, self.table_name)
        dump_dst = "%s.%s.dst" % (pfx, self.table_name)
        fix = "%s.%s.fix" % (pfx, self.table_name)

        self.log.info("Dumping src table: %s" % self.table_name)
        self.dump_table(copy_tbl, src_curs, dump_src)
        src_db.commit()
        self.log.info("Dumping dst table: %s" % self.table_name)
        self.dump_table(copy_tbl, dst_curs, dump_dst)
        dst_db.commit()

        self.log.info("Sorting src table: %s" % self.table_name)
        self.do_sort(dump_src, dump_src + '.sorted')

        self.log.info("Sorting dst table: %s" % self.table_name)
        self.do_sort(dump_dst, dump_dst + '.sorted')

        self.dump_compare(dump_src + ".sorted", dump_dst + ".sorted", fix)

        os.unlink(dump_src)
        os.unlink(dump_dst)
        os.unlink(dump_src + ".sorted")
        os.unlink(dump_dst + ".sorted")

        if apply_fixes:
            dst_db.commit()
def do_repair ( self , src_db , dst_db , where , pfx = 'repair' , apply_fixes = False ) : self . reset ( ) src_curs = src_db . cursor ( ) dst_curs = dst_db . cursor ( ) self . apply_fixes = apply_fixes if apply_fixes : self . apply_cursor = dst_curs self . log . info ( 'Checking %s' % self . table_name ) copy_tbl = self . gen_copy_tbl ( src_curs , dst_curs , where ) dump_src = "%s.%s.src" % ( pfx , self . table_name ) dump_dst = "%s.%s.dst" % ( pfx , self . table_name ) fix = "%s.%s.fix" % ( pfx , self . table_name ) self . log . info ( "Dumping src table: %s" % self . table_name ) self . dump_table ( copy_tbl , src_curs , dump_src ) src_db . commit ( ) self . log . info ( "Dumping dst table: %s" % self . table_name ) self . dump_table ( copy_tbl , dst_curs , dump_dst ) dst_db . commit ( ) self . log . info ( "Sorting src table: %s" % self . table_name ) self . do_sort ( dump_src , dump_src + '.sorted' ) self . log . info ( "Sorting dst table: %s" % self . table_name ) self . do_sort ( dump_dst , dump_dst + '.sorted' ) self . dump_compare ( dump_src + ".sorted" , dump_dst + ".sorted" , fix ) os . unlink ( dump_src ) os . unlink ( dump_dst ) os . unlink ( dump_src + ".sorted" ) os . unlink ( dump_dst + ".sorted" ) if apply_fixes : dst_db . commit ( )