nova/nova
melanie witt 68f80d2013 Use subqueryload() instead of joinedload() for (system_)metadata
Currently, when we "get" a single instance from the database and we
load metadata and system_metadata, we do so using a joinedload() which
does JOINs with the respective tables. Because of the one-to-many
relationship between an instance and (system_)metadata records, doing
the database query this way can result in a large number of additional
rows being returned unnecessarily and cause a large data transfer.

This is similar to the problem addressed by change
I0610fb16ccce2ee95c318589c8abcc30613a3fe9 which added separate queries
for (system_)metadata when we "get" multiple instances. We don't,
however, reuse the same code for this change because
_instances_fill_metadata converts the instance database object to a
dict, and some callers of _instance_get_by_uuid need to be able to
access an instance database object attached to the session (example:
instance_update_and_get_original).

By using subqueryload() [1], we can perform the additional queries for
(system_)metadata to solve the problem with a similar approach.

Closes-Bug: #1799298

[1] https://docs.sqlalchemy.org/en/13/orm/loading_relationships.html#subquery-eager-loading

Change-Id: I5c071f70f669966e9807b38e99077c1cae5b4606
(cherry picked from commit e728fe668a)
(cherry picked from commit 63d2e62c3a)
(cherry picked from commit e7a45e0335)
(cherry picked from commit 4350074029)
(cherry picked from commit ad7e4fb8f4)
2021-03-29 15:07:52 +00:00
..
api Merge "Block rebuild when NUMA topology changed" into stable/rocky 2020-08-18 02:28:16 +00:00
cells Add instance action record for snapshot instances 2017-12-11 17:46:38 +08:00
cmd Add --instance option to heal_allocations 2019-12-13 15:05:22 -05:00
common
compute Merge "post live migration: don't call Neutron needlessly" into stable/rocky 2020-10-15 00:06:44 +00:00
conductor Avoid circular reference during serialization 2020-02-26 12:24:18 +00:00
conf Change default num_retries for glance to 3 2021-01-18 02:06:25 +00:00
console Mask the token used to allow access to consoles 2020-01-26 16:00:05 +01:00
consoleauth Mask the token used to allow access to consoles 2020-01-26 16:00:05 +01:00
db Use subqueryload() instead of joinedload() for (system_)metadata 2021-03-29 15:07:52 +00:00
hacking Use nova.db.api directly 2018-07-10 14:56:27 +00:00
image Share snapshot image membership with instance owner 2019-04-30 21:13:46 +09:00
ipv6
keymgr
locale Imported Translations from Zanata 2019-01-06 07:42:59 +00:00
network Add config option for neutron client retries 2020-04-24 15:09:16 +00:00
notifications Remove noisy DEBUG log 2018-08-24 11:19:14 +02:00
objects compute: Use source_bdms to reset attachment_ids during LM rollback 2020-09-14 10:20:11 +01:00
pci PCI: do not force remove allocated devices 2019-02-05 23:29:36 +00:00
policies Remove support for /os-floating-ip-dns REST API 2018-07-18 22:23:45 -04:00
privsep Make supports_direct_io work on 4096b sector size 2018-11-21 14:14:22 +00:00
scheduler FUP for in-place numa rebuild 2020-07-09 14:06:22 +01:00
servicegroup Fix service list for disabled compute using MC driver 2018-09-14 02:25:10 +00:00
tests Use subqueryload() instead of joinedload() for (system_)metadata 2021-03-29 15:07:52 +00:00
virt Merge "libvirt: Do not reference VIR_ERR_DEVICE_MISSING when libvirt is < v4.1.0" into stable/rocky 2020-09-24 20:01:05 +00:00
vnc
volume Add retry to cinder API calls related to volume detach 2020-05-04 09:37:22 -04:00
__init__.py
availability_zones.py AZ list performance optimization: avoid double service list DB fetch 2019-04-30 13:17:04 +00:00
baserpc.py
block_device.py Add uuid column to BlockDeviceMapping 2017-12-17 14:28:35 +00:00
cache_utils.py
config.py Configure placement DB context manager for nova-manage/status 2018-09-06 10:47:55 -04:00
context.py Reset the cell cache for database access in Service 2020-04-16 20:56:39 +00:00
crypto.py Convert certificate generation to processutils. 2018-05-02 19:18:41 +10:00
debugger.py
exception.py Removed the host FQDN from the exception message 2020-09-03 00:30:14 +00:00
exception_wrapper.py Add full traceback to ExceptionPayload in versioned notifications 2018-06-19 16:46:46 +08:00
filters.py
hooks.py
i18n.py correct referenced url in comments 2018-01-18 09:16:37 +08:00
loadables.py
manager.py conf: Remove 'db_driver' config opt 2018-03-16 17:23:16 +00:00
policy.py
profiler.py
quota.py Merge "Avoid joins in _server_group_count_members_by_user" 2018-08-07 23:16:06 +00:00
rc_fields.py Nix unused raise_if_custom_resource_class_pre_v1_1 2018-06-18 19:52:45 +00:00
rpc.py Use oslo.messaging per-call monitoring 2018-06-11 14:44:10 -07:00
safe_utils.py
service.py Reset the cell cache for database access in Service 2020-04-16 20:56:39 +00:00
service_auth.py Fix NoneType error when [service_user] is misconfigured 2017-11-28 12:22:30 -06:00
test.py Enhance service restart in functional env 2020-03-13 18:03:04 +01:00
utils.py Harden placement init under wsgi 2018-11-12 11:30:32 +00:00
version.py
weights.py
wsgi.py Refactor WSGI apps and utils to limit imports 2018-03-06 22:05:12 +00:00