Allow archiving deleted rows to shadow tables, for performance.
Implements bp db-archiving Add versions of all tables with "shadow_" prepended to their names. These shadow tables do not have indexes. Adds API function archive_deleted_rows, which moves some deleted rows from production tables to the corresponding shadow tables. (It only does a few rows, to avoid blocking the process or hitting the database too hard. So it needs to be called regularly.) Also adds a db archive_deleted_rows command to nova-manage. Uses Boris Pavlovic's code for copying columns from existing tables to new tables. Change-Id: I7c8f2fb8794b6f9cd2531e54a1a9635010f8c97e
This commit is contained in:
@@ -771,6 +771,17 @@ class DbCommands(object):
|
||||
"""Print the current database version."""
|
||||
print migration.db_version()
|
||||
|
||||
@args('--max_rows', dest='max_rows', metavar='<number>',
|
||||
help='Maximum number of deleted rows to archive')
|
||||
def archive_deleted_rows(self, max_rows=None):
|
||||
"""Move up to max_rows deleted rows from production tables to shadow
|
||||
tables.
|
||||
"""
|
||||
if max_rows is not None:
|
||||
max_rows = int(max_rows)
|
||||
admin_context = context.get_admin_context()
|
||||
db.archive_deleted_rows(admin_context, max_rows)
|
||||
|
||||
|
||||
class InstanceTypeCommands(object):
|
||||
"""Class for managing instance types / flavors."""
|
||||
|
||||
Reference in New Issue
Block a user