Comment 5 for bug 1862205

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

Reviewed: https://review.opendev.org/706331
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=001f3a7bfe6b2c8af135daff8e154a708792070e
Submitter: Zuul
Branch: master

commit 001f3a7bfe6b2c8af135daff8e154a708792070e
Author: Dan Smith <email address hidden>
Date: Thu Feb 6 09:21:38 2020 -0800

    Fix instance.hidden migration and querying

    It was discovered that default= on a Column definition in a schema migration
    will attempt to update the table with the provided value, instead of just
    translating on read, which is often the assumption. The Instance.hidden=False
    change introduced in Train[1] used such a default on the new column, which caused
    at least one real-world deployment to time out rewriting the instances table
    due to size. Apparently SQLAlchemy-migrate also does not consider such a timeout
    to be a failure and proceeds on. The end result is that some existing instances
    in the database have hidden=NULL values, and the DB model layer does not convert
    those to hidden=False when we read/query them, causing those instances to be
    excluded from the API list view.

    This change alters the 399 schema migration to remove the default=False
    specification. This does not actually change the schema, but /will/ prevent
    users who have not yet upgraded to Train from rewriting the table.

    This change also makes the instance_get_all_by_filters() code handle hidden
    specially, including false and NULL in a query for non-hidden instances.

    A future change should add a developer trap test to ensure that future migrations
    do not add default= values to new columns to avoid this situation in the future.

    [1] Iaffb27bd8c562ba120047c04bb62619c0864f594

    Change-Id: Iace3f653b42c20887b40ee0105c8e9a4edeff1f7
    Closes-Bug: #1862205