Merge "Update --max-rows parameter description for archive_deleted_rows"
This commit is contained in:
@@ -60,15 +60,17 @@ Nova Database
|
||||
|
||||
``nova-manage db archive_deleted_rows [--max_rows <number>] [--verbose] [--until-complete] [--purge]``
|
||||
Move deleted rows from production tables to shadow tables. Note that the
|
||||
corresponding rows in the ``instance_mappings`` and ``request_specs`` tables of the
|
||||
API database are purged when instance records are archived and thus,
|
||||
``CONF.api_database.connection`` is required in the config file. Specifying
|
||||
``--verbose`` will print the results of the archive operation for any tables that
|
||||
were changed. Specifying ``--until-complete`` will make the command run
|
||||
continuously until all deleted rows are archived. Use the ``--max_rows`` option,
|
||||
which defaults to 1000, as a batch size for each iteration. Specifying ``--purge``
|
||||
will cause a `full` DB purge to be completed after archival. If a date range
|
||||
is desired for the purge, then run ``nova-manage db purge --before
|
||||
corresponding rows in the ``instance_mappings``, ``request_specs`` and
|
||||
``instance_group_member`` tables of the API database are purged when
|
||||
instance records are archived and thus, ``CONF.api_database.connection`` is
|
||||
required in the config file. Specifying ``--verbose`` will print the results
|
||||
of the archive operation for any tables that were changed. Specifying
|
||||
``--until-complete`` will make the command run continuously until all
|
||||
deleted rows are archived. Use the ``--max_rows`` option, which defaults to
|
||||
1000, as a batch size for each iteration (note that the purged API database
|
||||
table records are not included in this batch size). Specifying ``--purge``
|
||||
will cause a `full` DB purge to be completed after archival. If a date
|
||||
range is desired for the purge, then run ``nova-manage db purge --before
|
||||
<date>`` manually after archiving is complete.
|
||||
|
||||
``nova-manage db purge [--all] [--before <date>] [--verbose] [--all-cells]``
|
||||
|
||||
+5
-2
@@ -497,7 +497,10 @@ Error: %s""") % six.text_type(e))
|
||||
print(migration.db_version())
|
||||
|
||||
@args('--max_rows', type=int, metavar='<number>', dest='max_rows',
|
||||
help='Maximum number of deleted rows to archive. Defaults to 1000.')
|
||||
help='Maximum number of deleted rows to archive. Defaults to 1000. '
|
||||
'Note that this number does not include the corresponding '
|
||||
'rows, if any, that are removed from the API database for '
|
||||
'deleted instances.')
|
||||
@args('--verbose', action='store_true', dest='verbose', default=False,
|
||||
help='Print how many rows were archived per table.')
|
||||
@args('--until-complete', action='store_true', dest='until_complete',
|
||||
@@ -528,7 +531,7 @@ Error: %s""") % six.text_type(e))
|
||||
try:
|
||||
# NOTE(tssurya): This check has been added to validate if the API
|
||||
# DB is reachable or not as this is essential for purging the
|
||||
# instance_mappings and request_specs of the deleted instances.
|
||||
# related API database records of the deleted instances.
|
||||
objects.CellMappingList.get_all(ctxt)
|
||||
except db_exc.CantStartEngineError:
|
||||
print(_('Failed to connect to API DB so aborting this archival '
|
||||
|
||||
@@ -5546,10 +5546,10 @@ def _archive_deleted_rows_for_table(tablename, max_rows):
|
||||
from_select(columns, sql.select([table], column.in_(records)))
|
||||
delete = table.delete().where(column.in_(records))
|
||||
# NOTE(tssurya): In order to facilitate the deletion of records from
|
||||
# instance_mappings and request_specs tables in the nova_api DB, the
|
||||
# rows of deleted instances from the instances table are stored prior
|
||||
# to their deletion. Basically the uuids of the archived instances
|
||||
# are queried and returned.
|
||||
# instance_mappings, request_specs and instance_group_member tables in
|
||||
# the nova_api DB, the rows of deleted instances from the instances
|
||||
# table are stored prior to their deletion. Basically the uuids of the
|
||||
# archived instances are queried and returned.
|
||||
if tablename == "instances":
|
||||
query_select = sql.select([table.c.uuid], table.c.id.in_(records))
|
||||
rows = conn.execute(query_select).fetchall()
|
||||
|
||||
Reference in New Issue
Block a user