nova/nova/tests
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
..
functional compute: Don't delete the original attachment during pre LM rollback 2020-09-14 10:20:11 +01:00
live_migration/hooks [stable-only] gate: Pin CEPH_RELEASE to nautilus in LM hook 2021-03-12 16:15:06 +00:00
unit Use subqueryload() instead of joinedload() for (system_)metadata 2021-03-29 15:07:52 +00:00
__init__.py
fixtures.py Robustify attachment tracking in CinderFixtureNewAttachFlow 2020-09-14 10:20:11 +01:00
json_ref.py Transform instance.exists notification 2018-06-05 12:51:30 +00:00
uuidsentinel.py