(self, t1, t2, src_db, dst_db)
Actual comparison.
Actual comparison.
Actual comparison .
def process_sync(self, t1, t2, src_db, dst_db):
        """Actual comparison."""

        apply_db = None

        if self.options.apply:
            apply_db = self.get_database('db', cache='applydb', autocommit=1)
            self.apply_curs = apply_db.cursor()
            self.apply_curs.execute("set session_replication_role = 'replica'")

        src_tbl = t1.dest_table
        dst_tbl = t2.dest_table

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

        self.log.info('Checking %s', dst_tbl)

        self.common_fields = []
        self.fq_common_fields = []
        self.pkey_list = []
        self.load_common_columns(src_tbl, dst_tbl, src_curs, dst_curs)

        dump_src = dst_tbl + ".src"
        dump_dst = dst_tbl + ".dst"
        dump_src_sorted = dump_src + ".sorted"
        dump_dst_sorted = dump_dst + ".sorted"

        dst_where = t2.plugin.get_copy_condition(src_curs, dst_curs)
        src_where = dst_where

        self.log.info("Dumping src table: %s", src_tbl)
        self.dump_table(src_tbl, src_curs, dump_src, src_where)
        src_db.commit()
        self.log.info("Dumping dst table: %s", dst_tbl)
        self.dump_table(dst_tbl, dst_curs, dump_dst, dst_where)
        dst_db.commit()

        self.log.info("Sorting src table: %s", dump_src)
        self.do_sort(dump_src, dump_src_sorted)
        self.log.info("Sorting dst table: %s", dump_dst)
        self.do_sort(dump_dst, dump_dst_sorted)

        self.dump_compare(dst_tbl, dump_src_sorted, dump_dst_sorted)

        os.unlink(dump_src)
        os.unlink(dump_dst)
        os.unlink(dump_src_sorted)
        os.unlink(dump_dst_sorted)
def process_sync ( self , t1 , t2 , src_db , dst_db ) : apply_db = None if self . options . apply : apply_db = self . get_database ( 'db' , cache = 'applydb' , autocommit = 1 ) self . apply_curs = apply_db . cursor ( ) self . apply_curs . execute ( "set session_replication_role = 'replica'" ) src_tbl = t1 . dest_table dst_tbl = t2 . dest_table src_curs = src_db . cursor ( ) dst_curs = dst_db . cursor ( ) self . log . info ( 'Checking %s' , dst_tbl ) self . common_fields = [ ] self . fq_common_fields = [ ] self . pkey_list = [ ] self . load_common_columns ( src_tbl , dst_tbl , src_curs , dst_curs ) dump_src = dst_tbl + ".src" dump_dst = dst_tbl + ".dst" dump_src_sorted = dump_src + ".sorted" dump_dst_sorted = dump_dst + ".sorted" dst_where = t2 . plugin . get_copy_condition ( src_curs , dst_curs ) src_where = dst_where self . log . info ( "Dumping src table: %s" , src_tbl ) self . dump_table ( src_tbl , src_curs , dump_src , src_where ) src_db . commit ( ) self . log . info ( "Dumping dst table: %s" , dst_tbl ) self . dump_table ( dst_tbl , dst_curs , dump_dst , dst_where ) dst_db . commit ( ) self . log . info ( "Sorting src table: %s" , dump_src ) self . do_sort ( dump_src , dump_src_sorted ) self . log . info ( "Sorting dst table: %s" , dump_dst ) self . do_sort ( dump_dst , dump_dst_sorted ) self . dump_compare ( dst_tbl , dump_src_sorted , dump_dst_sorted ) os . unlink ( dump_src ) os . unlink ( dump_dst ) os . unlink ( dump_src_sorted ) os . unlink ( dump_dst_sorted )