Add --sleep option for archive_deleted_rows --until-complete

Currently, when 'nova-manage db archive_deleted_rows' is run with
the --until-complete option, the process will archive rows in batches
in a tight loop, which can cause problems in busy environments where
the aggressive archiving interferes with other requests trying to write
to the database.

This adds an option for users to specify an amount of time in seconds
to sleep between batches of rows while archiving with --until-complete,
allowing the process to be throttled.

Closes-Bug: #1912579

Change-Id: I638b2fa78b81919373e607458e6f68a7983a79aa
This commit is contained in:
melanie witt
2021-01-21 04:14:51 +00:00
committed by Balazs Gibizer
parent 75f719e022
commit fc77ce191f
4 changed files with 49 additions and 11 deletions
+8 -2
View File
@@ -227,6 +227,7 @@ db archive_deleted_rows
nova-manage db archive_deleted_rows [--max_rows <rows>] [--verbose]
[--until-complete] [--before <date>] [--purge] [--all-cells] [--task-log]
[--sleep]
Move deleted rows from production tables to shadow tables. Note that the
corresponding rows in the ``instance_mappings``, ``request_specs`` and
@@ -240,7 +241,7 @@ stopping at 0, or use the :option:`--until-complete` option.
.. versionchanged:: 24.0.0 (Xena)
Added :option:`--task-log` option.
Added :option:`--task-log`, :option:`--sleep` options.
.. rubric:: Options
@@ -295,7 +296,12 @@ stopping at 0, or use the :option:`--until-complete` option.
record data via the `/os-instance_usage_audit_log`__ API (example:
Telemetry).
.. __: https://docs.openstack.org/api-ref/compute/#server-usage-audit-log-os-instance-usage-audit-log
.. __: https://docs.openstack.org/api-ref/compute/#server-usage-audit-log-os-instance-usage-audit-log
.. option:: --sleep
The amount of time in seconds to sleep between batches when
:option:`--until-complete` is used. Defaults to 0.
.. rubric:: Return codes