Merge "Log DBReferenceError in archive_deleted_rows_for_table"

This commit is contained in:
Jenkins 2015-10-08 11:29:49 +00:00 committed by Gerrit Code Review
commit 2a75118a09

View File

@ -6017,12 +6017,13 @@ def archive_deleted_rows_for_table(tablename, max_rows):
with conn.begin():
conn.execute(insert)
result_delete = conn.execute(delete_statement)
except db_exc.DBReferenceError:
except db_exc.DBReferenceError as ex:
# A foreign key constraint keeps us from deleting some of
# these rows until we clean up a dependent table. Just
# skip this table for now; we'll come back to it later.
msg = _("IntegrityError detected when archiving table %s") % tablename
LOG.warn(msg)
LOG.warn(_LW("IntegrityError detected when archiving table "
"%(tablename)s: %(error)s"),
{'tablename': tablename, 'error': six.text_type(ex)})
return rows_archived
rows_archived = result_delete.rowcount