Comment 8 for bug 1632247

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/409943
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=176c5c8a65efbde01020bc69a97bb7d05720589e
Submitter: Jenkins
Branch: master

commit 176c5c8a65efbde01020bc69a97bb7d05720589e
Author: Jay Pipes <email address hidden>
Date: Mon Dec 12 16:39:23 2016 -0500

    Only return latest instance fault for instances

    This patch addresses slowness that can occur when doing a list servers
    API operation when there are many thousands of records in the
    instance_faults table.

    Previously, in the Instance.fill_faults() method, we were getting all
    instance fault records for a set of instances having one of a set of
    supplied instance UUIDs and then iterating over those faults and
    returning a dict of instance UUID to the first fault returned (which
    happened to be the latest fault because of ordering the SQL query by
    created_at).

    This patch adds a new InstanceFaultList.get_latest_by_instance_uuids()
    method that does some SQL-fu to only return the latest fault records for
    each instance being inspected.

    Closes-Bug: #1632247

    Co-Authored-By: Roman Podoliaka <email address hidden>
    Change-Id: I8f2227b3969791ebb2d04d74a316b9d97a4b1571