From 961d615ce63002d99cd31d03c8c97228d9e453d3 Mon Sep 17 00:00:00 2001 From: David Ripton Date: Thu, 13 Dec 2012 16:10:57 -0500 Subject: 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 --- bin/nova-manage | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bin') diff --git a/bin/nova-manage b/bin/nova-manage index 6e8aa8a9c..d927de072 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -771,6 +771,17 @@ class DbCommands(object): """Print the current database version.""" print migration.db_version() + @args('--max_rows', dest='max_rows', metavar='', + 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.""" -- cgit