commit 74e66fe8d4353be95868a68d21d882020cb40f4b
Author: Matt Riedemann <email address hidden>
Date: Thu May 23 11:14:55 2019 -0400
Avoid unnecessary joins in InstanceGroup.get_hosts
The InstanceList.get_by_filters query is joining on
info_cache, security_groups, metadata and system_metadata
because of how instance_get_all_by_filters_sort in the DB API
works if columns_to_join (expected_attrs) is None. The get_hosts
method only cares about the instance.host value of its members
so those joins are unnecessarily expensive.
This change simply passes expected_attrs=[] to get_by_filters
to avoid the joins. A follow up change can further optimize this
code by adding a new query method to just get the host values
for a list of instance uuids, so a TODO is left in place for that.
Note that a new query method would need to be remotable and thus
not something we can backport.
Change-Id: I53d4b38d12404a1641f667c537404effa837a83d
Partial-Bug: #1830234
(cherry picked from commit 15ccf2ddfbf857186fc05f77a7881243c6311062)
Reviewed: https:/ /review. opendev. org/664271 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=74e66fe8d43 53be95868a68d21 d882020cb40f4b
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit 74e66fe8d4353be 95868a68d21d882 020cb40f4b
Author: Matt Riedemann <email address hidden>
Date: Thu May 23 11:14:55 2019 -0400
Avoid unnecessary joins in InstanceGroup. get_hosts
The InstanceList. get_by_ filters query is joining on get_all_ by_filters_ sort in the DB API
info_cache, security_groups, metadata and system_metadata
because of how instance_
works if columns_to_join (expected_attrs) is None. The get_hosts
method only cares about the instance.host value of its members
so those joins are unnecessarily expensive.
This change simply passes expected_attrs=[] to get_by_filters
to avoid the joins. A follow up change can further optimize this
code by adding a new query method to just get the host values
for a list of instance uuids, so a TODO is left in place for that.
Note that a new query method would need to be remotable and thus
not something we can backport.
Change-Id: I53d4b38d12404a 1641f667c537404 effa837a83d 86fc05f77a78812 43c6311062)
Partial-Bug: #1830234
(cherry picked from commit 15ccf2ddfbf8571