in core/lib/payload/copy.py [0:0]
def cleanup_with_force(self):
"""
Loop through all the tables we will touch during OSC, and clean them
up if force_cleanup is specified
"""
log.info(
"--force-cleanup specified, cleaning up things that may left "
"behind by last run"
)
cleanup_payload = CleanupPayload(charset=self.charset, sudo=self.sudo)
# cleanup outfiles for include_id and exclude_id
for filepath in (self.outfile_exclude_id, self.outfile_include_id):
cleanup_payload.add_file_entry(filepath)
# cleanup outfiles for detailed checksum
for suffix in ["old", "new"]:
cleanup_payload.add_file_entry("{}.{}".format(self.outfile, suffix))
# cleanup outfiles for table dump
file_prefixes = [
self.outfile,
"{}.old".format(self.outfile),
"{}.new".format(self.outfile),
]
for file_prefix in file_prefixes:
log.debug("globbing {}".format(file_prefix))
for outfile in glob.glob("{}.[0-9]*".format(file_prefix)):
cleanup_payload.add_file_entry(outfile)
for trigger in (
self.delete_trigger_name,
self.update_trigger_name,
self.insert_trigger_name,
):
cleanup_payload.add_drop_trigger_entry(self._current_db, trigger)
for tbl in (
self.new_table_name,
self.delta_table_name,
self.renamed_table_name,
):
partitions = self.fetch_partitions(tbl)
cleanup_payload.add_drop_table_entry(self._current_db, tbl, partitions)
cleanup_payload.mysql_user = self.mysql_user
cleanup_payload.mysql_pass = self.mysql_pass
cleanup_payload.socket = self.socket
cleanup_payload.get_conn_func = self.get_conn_func
cleanup_payload.cleanup(self._current_db)
cleanup_payload.close_conn()