nova/nova/db/sqlalchemy/migrate_repo
Dan Smith 001f3a7bfe 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
2020-02-07 08:54:56 -08:00
..
versions Fix instance.hidden migration and querying 2020-02-07 08:54:56 -08:00
README [doc] Updated sqlalchemy URL in migrate readme 2017-06-20 14:09:41 +00:00
__init__.py Removed copyright from empty files 2014-02-27 14:27:54 +02:00
manage.py Remove vi modelines 2014-02-03 14:19:44 +00:00
migrate.cfg Keep pre-commit inline with hacking and fix whitespace 2019-12-12 14:56:39 +00:00

README

This is a database migration repository.

More information at
https://sqlalchemy-migrate.readthedocs.io/en/latest/